diff --git a/CMakeLists.txt b/CMakeLists.txt index 312095f08..c47168357 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,96 +15,104 @@ PROJECT(EQEmu) #Default build type is set to RelWithDebInfo for generators that honor that like makefiles IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) + SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) ENDIF(NOT CMAKE_BUILD_TYPE) #Add our various windows definitions IF(MSVC OR MINGW) - ADD_DEFINITIONS(-D_WINDOWS) - IF(CMAKE_CL_64) - ADD_DEFINITIONS(-DWIN64) - ELSE(CMAKE_CL_64) - ADD_DEFINITIONS(-DWIN32) - ENDIF(CMAKE_CL_64) + ADD_DEFINITIONS(-D_WINDOWS) + IF(CMAKE_CL_64) + ADD_DEFINITIONS(-DWIN64) + ELSE(CMAKE_CL_64) + ADD_DEFINITIONS(-DWIN32) + ENDIF(CMAKE_CL_64) ENDIF(MSVC OR MINGW) IF(MSVC) - #Set our default locations for zlib/mysql based on x86/x64 - IF(CMAKE_CL_64) - SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64") - SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64") - ELSE(CMAKE_CL_64) - SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86") - SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86") - ENDIF(CMAKE_CL_64) - - #disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere - OPTION(EQEMU_DISABLE_CRT_SECURE_WARNINGS "Disable Secure CRT Warnings" ON) - IF(EQEMU_DISABLE_CRT_SECURE_WARNINGS) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) - ENDIF(EQEMU_DISABLE_CRT_SECURE_WARNINGS) - - #fast FP if you'd like it - OPTION(EQEMU_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON) - IF(EQEMU_FAST_FLOATINGPOINT) + #Set our default locations for zlib/mysql based on x86/x64 + IF(CMAKE_CL_64) + SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64") + SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64") + ELSE(CMAKE_CL_64) + SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86") + SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86") + ENDIF(CMAKE_CL_64) + + #disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere + OPTION(EQEMU_DISABLE_CRT_SECURE_WARNINGS "Disable Secure CRT Warnings" ON) + IF(EQEMU_DISABLE_CRT_SECURE_WARNINGS) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) + ENDIF(EQEMU_DISABLE_CRT_SECURE_WARNINGS) + + #fast FP if you'd like it + OPTION(EQEMU_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON) + IF(EQEMU_FAST_FLOATINGPOINT) ADD_DEFINITIONS(/fp:fast) ENDIF(EQEMU_FAST_FLOATINGPOINT) - - #crash logging currently only works on windows x86/x64 - OPTION(EQEMU_ENABLE_CRASH_LOGGING "Enable crash logging" ON) - IF(EQEMU_ENABLE_CRASH_LOGGING) - ADD_DEFINITIONS(-DCRASH_LOGGING) - ENDIF(EQEMU_ENABLE_CRASH_LOGGING) - - #Disable safe SEH or not? - OPTION(EQEMU_DISABLE_SAFESEH "Disable Safe SEH (Needed for Strawberry Perl)" OFF) - IF(EQEMU_DISABLE_SAFESEH) - SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO") - SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO") - SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SAFESEH:NO") - SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO") - SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /SAFESEH:NO") - SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO") - SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /SAFESEH:NO") - SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO") - SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /SAFESEH:NO") - SET(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO") - SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO") - SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO") - ENDIF(EQEMU_DISABLE_SAFESEH) - - #We want to compile /MT not /MD so we change that - FOREACH(flag_var CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) - IF(${flag_var} MATCHES "/MD") - STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - ENDIF(${flag_var} MATCHES "/MD") - ENDFOREACH(flag_var) + + #crash logging currently only works on windows x86/x64 + OPTION(EQEMU_ENABLE_CRASH_LOGGING "Enable crash logging" ON) + IF(EQEMU_ENABLE_CRASH_LOGGING) + ADD_DEFINITIONS(-DCRASH_LOGGING) + ENDIF(EQEMU_ENABLE_CRASH_LOGGING) + + #Disable safe SEH or not? + OPTION(EQEMU_DISABLE_SAFESEH "Disable Safe SEH (Needed for Strawberry Perl)" OFF) + IF(EQEMU_DISABLE_SAFESEH) + SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO") + SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO") + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SAFESEH:NO") + SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO") + SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /SAFESEH:NO") + SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO") + SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /SAFESEH:NO") + SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO") + SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /SAFESEH:NO") + SET(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO") + SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO") + SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO") + ENDIF(EQEMU_DISABLE_SAFESEH) + + #We want to compile /MT not /MD so we change that + FOREACH(flag_var CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) + IF(${flag_var} MATCHES "/MD") + STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + ENDIF(${flag_var} MATCHES "/MD") + ENDFOREACH(flag_var) ELSE(MSVC) - #Normally set by perl but we don't use the perl flags anymore so we set it. - ADD_DEFINITIONS(-DHAS_UNION_SEMUN) + #Normally set by perl but we don't use the perl flags anymore so we set it. + ADD_DEFINITIONS(-DHAS_UNION_SEMUN) ENDIF(MSVC) +#FreeBSD support +IF(UNIX) + IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + ADD_DEFINITIONS(-DFREEBSD) + SET(FREEBSD TRUE) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") +ENDIF(UNIX) + #use stdint.h types if they exist for this platform (we have to guess otherwise) CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) IF(HAVE_STDINT_H) - ADD_DEFINITIONS(-DEQEMU_USE_STDINT) + ADD_DEFINITIONS(-DEQEMU_USE_STDINT) ENDIF(HAVE_STDINT_H) -#debug level, 5 is default. Most people wont ever change this but it's there if you want to +#debug level, 5 is default. Most people wont ever change this but it's there if you want to SET(EQEMU_DEBUG_LEVEL 5 CACHE STRING "EQEmu debug level: - 0 - Quiet mode Errors to file Status and Normal ignored - 1 - Status and Normal to console, Errors to logfile - 2 - Status, Normal, and Error to console and logfile - 3 - Light debug release errors and status - 4 - Moderate debug release errors and status - 5 - Maximum debug release errors and status - 10 - More errors than you ever wanted to see" + 0 - Quiet mode Errors to file Status and Normal ignored + 1 - Status and Normal to console, Errors to logfile + 2 - Status, Normal, and Error to console and logfile + 3 - Light debug release errors and status + 4 - Moderate debug release errors and status + 5 - Maximum debug release errors and status + 10 - More errors than you ever wanted to see" ) #Bots are a compile time option so on/off OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF) IF(EQEMU_ENABLE_BOTS) - ADD_DEFINITIONS(-DBOTS) + ADD_DEFINITIONS(-DBOTS) ENDIF(EQEMU_ENABLE_BOTS) #What to build @@ -116,22 +124,22 @@ OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON) #C++11 stuff IF(NOT MSVC) - ADD_DEFINITIONS(-std=c++0x) - #Rvalue-Move - todo: auto set this based on gcc version - OPTION(EQEMU_ENABLE_RVALUE_MOVE "Enable EQEmu RValue References (Enable if GCC 4.3 or higher)" OFF) + ADD_DEFINITIONS(-std=c++0x) + #Rvalue-Move - todo: auto set this based on gcc version + OPTION(EQEMU_ENABLE_RVALUE_MOVE "Enable EQEmu RValue References (Enable if GCC 4.3 or higher)" OFF) ELSE(NOT MSVC) - #Rvalue-Move - todo: auto set this based on msvc version - OPTION(EQEMU_ENABLE_RVALUE_MOVE "Enable EQEmu RValue References (Enable if Visual Studio 2010 or higher)" OFF) + #Rvalue-Move - todo: auto set this based on msvc version + OPTION(EQEMU_ENABLE_RVALUE_MOVE "Enable EQEmu RValue References (Enable if Visual Studio 2010 or higher)" OFF) ENDIF(NOT MSVC) IF(EQEMU_ENABLE_RVALUE_MOVE) - ADD_DEFINITIONS(-DEQEMU_RVALUE_MOVE) + ADD_DEFINITIONS(-DEQEMU_RVALUE_MOVE) ENDIF(EQEMU_ENABLE_RVALUE_MOVE) #Various definitions IF(EQEMU_BUILD_PERL) - ADD_DEFINITIONS(-DEMBPERL) - ADD_DEFINITIONS(-DEMBPERL_PLUGIN) + ADD_DEFINITIONS(-DEMBPERL) + ADD_DEFINITIONS(-DEMBPERL_PLUGIN) ENDIF(EQEMU_BUILD_PERL) ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL}) ADD_DEFINITIONS(-DINVERSEXY) @@ -142,30 +150,30 @@ ADD_DEFINITIONS(-DMAP_DIR="./Maps") FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(MySQL REQUIRED) IF(EQEMU_BUILD_PERL) - FIND_PACKAGE(PerlLibs REQUIRED) - INCLUDE_DIRECTORIES("${PERL_INCLUDE_PATH}") + FIND_PACKAGE(PerlLibs REQUIRED) + INCLUDE_DIRECTORIES("${PERL_INCLUDE_PATH}") ENDIF(EQEMU_BUILD_PERL) INCLUDE_DIRECTORIES("${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}") IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) - ADD_SUBDIRECTORY(common) + ADD_SUBDIRECTORY(common) ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) IF(EQEMU_BUILD_SERVER) - ADD_SUBDIRECTORY(shared_memory) - ADD_SUBDIRECTORY(world) - ADD_SUBDIRECTORY(zone) - ADD_SUBDIRECTORY(ucs) - ADD_SUBDIRECTORY(queryserv) - ADD_SUBDIRECTORY(eqlaunch) + ADD_SUBDIRECTORY(shared_memory) + ADD_SUBDIRECTORY(world) + ADD_SUBDIRECTORY(zone) + ADD_SUBDIRECTORY(ucs) + ADD_SUBDIRECTORY(queryserv) + ADD_SUBDIRECTORY(eqlaunch) ENDIF(EQEMU_BUILD_SERVER) IF(EQEMU_BUILD_LOGIN) - ADD_SUBDIRECTORY(loginserver) + ADD_SUBDIRECTORY(loginserver) ENDIF(EQEMU_BUILD_LOGIN) IF(EQEMU_BUILD_AZONE) - ADD_SUBDIRECTORY(utils) + ADD_SUBDIRECTORY(utils) ENDIF(EQEMU_BUILD_AZONE) IF(EQEMU_BUILD_TESTS) - ADD_SUBDIRECTORY(tests) + ADD_SUBDIRECTORY(tests) ENDIF(EQEMU_BUILD_TESTS) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index b4b65900c..14d08b695 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -4,65 +4,65 @@ # # Find the native MySQL includes and library # -# MySQL_INCLUDE_DIR - where to find mysql.h, etc. -# MySQL_LIBRARIES - List of libraries when using MySQL. -# MySQL_FOUND - True if MySQL found. -# The following can be used as a hint as to where to search: -# MYSQL_ROOT +# MySQL_INCLUDE_DIR - where to find mysql.h, etc. +# MySQL_LIBRARIES - List of libraries when using MySQL. +# MySQL_FOUND - True if MySQL found. +# The following can be used as a hint as to where to search: +# MYSQL_ROOT IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES) - # Already in cache, be silent - SET(MySQL_FIND_QUIETLY TRUE) + # Already in cache, be silent + SET(MySQL_FIND_QUIETLY TRUE) ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES) # Include dir IF(MYSQL_ROOT) - FIND_PATH(MySQL_INCLUDE_DIR - NAMES mysql.h - PATHS ${MYSQL_ROOT}/include - PATH_SUFFIXES mysql - ) + FIND_PATH(MySQL_INCLUDE_DIR + NAMES mysql.h + PATHS ${MYSQL_ROOT}/include + PATH_SUFFIXES mysql + ) ELSE(MYSQL_ROOT) - FIND_PATH(MySQL_INCLUDE_DIR - NAMES mysql.h - PATH_SUFFIXES mysql - ) + FIND_PATH(MySQL_INCLUDE_DIR + NAMES mysql.h + PATH_SUFFIXES mysql + ) ENDIF(MYSQL_ROOT) # Library SET(MySQL_NAMES mysqlclient_r mysqlclient) IF(MYSQL_ROOT) - FIND_LIBRARY(MySQL_LIBRARY_DEBUG - NAMES ${MySQL_NAMES} - PATHS ${MYSQL_ROOT}/lib/debug /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 - PATH_SUFFIXES mysql - ) - - 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 - ) + FIND_LIBRARY(MySQL_LIBRARY_DEBUG + NAMES ${MySQL_NAMES} + PATHS ${MYSQL_ROOT}/lib/debug /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 + PATH_SUFFIXES mysql + ) + + 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_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 - ) + 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_DEBUG AND MySQL_LIBRARY_RELEASE) - SET(MySQL_FOUND TRUE) - SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} ) + SET(MySQL_FOUND TRUE) + 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 ) + SET(MySQL_FOUND FALSE) + SET( MySQL_LIBRARIES ) ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE) @@ -72,14 +72,13 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MySQL DEFAULT_MSG MySQL_LIBRARY_DEBUG MySQL_LIBRARY_RELEASE MySQL_INCLUDE_DIR) IF(MySQL_FOUND) - SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} ) + SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} ) ELSE(MySQL_FOUND) - SET( MySQL_LIBRARIES ) + SET( MySQL_LIBRARIES ) ENDIF(MySQL_FOUND) MARK_AS_ADVANCED( - MySQL_LIBRARY_DEBUG - MySQL_LIBRARY_RELEASE - MySQL_INCLUDE_DIR - ) - \ No newline at end of file + MySQL_LIBRARY_DEBUG + MySQL_LIBRARY_RELEASE + MySQL_INCLUDE_DIR + ) diff --git a/common/BasePacket.cpp b/common/BasePacket.cpp index 28d88659a..12d48ee3b 100644 --- a/common/BasePacket.cpp +++ b/common/BasePacket.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" #include "BasePacket.h" @@ -34,7 +34,7 @@ BasePacket::BasePacket(const unsigned char *buf, uint32 len) pBuffer= new unsigned char[len]; if (buf) { memcpy(this->pBuffer,buf,len); - } else { + } else { memset(this->pBuffer,0,len); } } @@ -108,7 +108,7 @@ void BasePacket::ReadString(char *str, uint32 Offset, uint32 MaxLength) const while((j < size) && (i < MaxLength) && (str[i - 1] != 0)); str[i - 1] = '\0'; -} +} void DumpPacketHex(const BasePacket* app) { @@ -124,24 +124,3 @@ void DumpPacketBin(const BasePacket* app) { DumpPacketBin(app->pBuffer, app->size); } - - - - - - - - - - - - - - - - - - - - - diff --git a/common/BasePacket.h b/common/BasePacket.h index 56a36c2ef..4952e29d2 100644 --- a/common/BasePacket.h +++ b/common/BasePacket.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 BASEPACKET_H_ #define BASEPACKET_H_ @@ -50,7 +50,7 @@ public: void setSrcInfo(uint32 sip, uint16 sport) { src_ip=sip; src_port=sport; } void setDstInfo(uint32 dip, uint16 dport) { dst_ip=dip; dst_port=dport; } void setTimeInfo(uint32 ts_sec, uint32 ts_usec) { timestamp.tv_sec=ts_sec; timestamp.tv_usec=ts_usec; } - void copyInfo(const BasePacket *p) { src_ip=p->src_ip; src_port=p->src_port; dst_ip=p->dst_ip; dst_port=p->dst_port; timestamp.tv_sec=p->timestamp.tv_sec; timestamp.tv_usec=p->timestamp.tv_usec; } + void copyInfo(const BasePacket *p) { src_ip=p->src_ip; src_port=p->src_port; dst_ip=p->dst_ip; dst_port=p->dst_port; timestamp.tv_sec=p->timestamp.tv_sec; timestamp.tv_usec=p->timestamp.tv_usec; } inline bool operator<(const BasePacket &rhs) { return (timestamp.tv_sec < rhs.timestamp.tv_sec || (timestamp.tv_sec==rhs.timestamp.tv_sec && timestamp.tv_usec < rhs.timestamp.tv_usec)); @@ -71,7 +71,7 @@ public: uint32 ReadUInt32(uint32 Offset) const { uint32 value = *(uint32 *)(pBuffer + Offset); return value; } void ReadString(char *str) { uint32 len = static_cast(strlen((char *)(pBuffer + _rpos))) + 1; memcpy(str, pBuffer + _rpos, len); _rpos += len; } void ReadString(char *str, uint32 Offset, uint32 MaxLength) const; - + uint32 GetWritePosition() { return _wpos; } uint32 GetReadPosition() { return _rpos; } void SetWritePosition(uint32 Newwpos) { _wpos = Newwpos; } @@ -89,5 +89,3 @@ extern void DumpPacketBin(const BasePacket* app); #endif /*BASEPACKET_H_*/ - - diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 2cb7a8a70..49ab43f20 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1,312 +1,312 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(common_sources - BasePacket.cpp - classes.cpp - Condition.cpp - crash.cpp - CRC16.cpp - crc32.cpp - database.cpp - dbasync.cpp - dbcore.cpp - DBMemLeak.cpp - debug.cpp - emu_opcodes.cpp - EmuTCPConnection.cpp - EmuTCPServer.cpp - EQDB.cpp - EQDBRes.cpp - eqemu_exception.cpp - EQEmuConfig.cpp - EQEMuError.cpp - EQPacket.cpp - EQStream.cpp - EQStreamFactory.cpp - EQStreamIdent.cpp - EQStreamProxy.cpp - eqtime.cpp - extprofile.cpp + BasePacket.cpp + classes.cpp + Condition.cpp + crash.cpp + CRC16.cpp + crc32.cpp + database.cpp + dbasync.cpp + dbcore.cpp + DBMemLeak.cpp + debug.cpp + emu_opcodes.cpp + EmuTCPConnection.cpp + EmuTCPServer.cpp + EQDB.cpp + EQDBRes.cpp + eqemu_exception.cpp + EQEmuConfig.cpp + EQEMuError.cpp + EQPacket.cpp + EQStream.cpp + EQStreamFactory.cpp + EQStreamIdent.cpp + EQStreamProxy.cpp + eqtime.cpp + extprofile.cpp faction.cpp - guild_base.cpp - guilds.cpp - ipc_mutex.cpp - Item.cpp - logsys.cpp - logsys_eqemu.cpp - md5.cpp - memory_mapped_file.cpp - misc.cpp - MiscFunctions.cpp - moremath.cpp - Mutex.cpp - opcode_map.cpp - opcodemgr.cpp - packet_dump.cpp - packet_dump_file.cpp - packet_functions.cpp - perl_EQDB.cpp - perl_EQDBRes.cpp - ProcLauncher.cpp - ptimer.cpp - races.cpp - rdtsc.cpp - rulesys.cpp - serverinfo.cpp - shareddb.cpp - spdat.cpp - StructStrategy.cpp - TCPConnection.cpp - TCPServer.cpp - timeoutmgr.cpp - timer.cpp - unix.cpp - worldconn.cpp - XMLParser.cpp - platform.cpp - patches/Client62.cpp - patches/patches.cpp - patches/SoD.cpp - patches/SoF.cpp - patches/RoF.cpp - patches/Titanium.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 + guild_base.cpp + guilds.cpp + ipc_mutex.cpp + Item.cpp + logsys.cpp + logsys_eqemu.cpp + md5.cpp + memory_mapped_file.cpp + misc.cpp + MiscFunctions.cpp + moremath.cpp + Mutex.cpp + opcode_map.cpp + opcodemgr.cpp + packet_dump.cpp + packet_dump_file.cpp + packet_functions.cpp + perl_EQDB.cpp + perl_EQDBRes.cpp + ProcLauncher.cpp + ptimer.cpp + races.cpp + rdtsc.cpp + rulesys.cpp + serverinfo.cpp + shareddb.cpp + spdat.cpp + StructStrategy.cpp + TCPConnection.cpp + TCPServer.cpp + timeoutmgr.cpp + timer.cpp + unix.cpp + worldconn.cpp + XMLParser.cpp + platform.cpp + patches/Client62.cpp + patches/patches.cpp + patches/SoD.cpp + patches/SoF.cpp + patches/RoF.cpp + patches/Titanium.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 ) SET(common_headers - BasePacket.h - bodytypes.h - breakdowns.h - classes.h - common_profile.h - Condition.h - crash.h - CRC16.h - crc32.h - database.h - dbasync.h - dbcore.h - DBMemLeak.h - debug.h - deity.h - emu_opcodes.h - emu_oplist.h - EmuTCPConnection.h - EmuTCPServer.h - eq_constants.h - eq_packet_structs.h - EQDB.h - EQDBRes.h - eqemu_exception.h - EQEmuConfig.h - EQEmuConfig_elements.h - EQEMuError.h - EQPacket.h - EQStream.h - EQStreamFactory.h - EQStreamIdent.h - EQStreamIntf.h - EQStreamLocator.h - EQStreamProxy.h - EQStreamType.h - eqtime.h - errmsg.h - extprofile.h + BasePacket.h + bodytypes.h + breakdowns.h + classes.h + common_profile.h + Condition.h + crash.h + CRC16.h + crc32.h + database.h + dbasync.h + dbcore.h + DBMemLeak.h + debug.h + deity.h + emu_opcodes.h + emu_oplist.h + EmuTCPConnection.h + EmuTCPServer.h + eq_constants.h + eq_packet_structs.h + EQDB.h + EQDBRes.h + eqemu_exception.h + EQEmuConfig.h + EQEmuConfig_elements.h + EQEMuError.h + EQPacket.h + EQStream.h + EQStreamFactory.h + EQStreamIdent.h + EQStreamIntf.h + EQStreamLocator.h + EQStreamProxy.h + EQStreamType.h + eqtime.h + errmsg.h + extprofile.h faction.h - features.h - fixed_memory_hash_set.h - fixed_memory_variable_hash_set.h - guild_base.h - guilds.h - ipc_mutex.h - Item.h - item_fieldlist.h - item_struct.h - languages.h - linked_list.h - logsys.h - logtypes.h - loottable.h - mail_oplist.h - md5.h - memory_mapped_file.h - misc.h - MiscFunctions.h - moremath.h - Mutex.h - op_codes.h - opcode_dispatch.h - opcodemgr.h - packet_dump.h - packet_dump_file.h - packet_functions.h - ProcLauncher.h - profiler.h - ptimer.h - queue.h - races.h - rdtsc.h - rulesys.h - ruletypes.h - seperator.h - serverinfo.h - servertalk.h - shareddb.h - skills.h - spdat.h - StructStrategy.h - TCPBasicServer.h - TCPConnection.h - TCPServer.h - timeoutmgr.h - timer.h - types.h - unix.h - useperl.h - version.h - worldconn.h - XMLParser.h - ZoneNumbers.h - platform.h - patches/Client62.h - patches/Client62_itemfields.h - patches/Client62_ops.h - patches/Client62_structs.h - patches/patches.h - patches/SoD.h - patches/SoD_itemfields.h - patches/SoD_ops.h - patches/SoD_structs.h - patches/SoF.h - patches/SoF_itemfields.h - patches/SoF_opcode_list.h - patches/SoF_ops.h - patches/SoF_structs.h - patches/SSDeclare.h - patches/SSDefine.h - patches/SSRegister.h - patches/RoF.h - patches/RoF_itemfields.h - patches/RoF_ops.h - patches/RoF_structs.h - patches/Titanium.h - patches/Titanium_itemfields.h - patches/Titanium_ops.h - patches/Titanium_structs.h - patches/Underfoot.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 + features.h + fixed_memory_hash_set.h + fixed_memory_variable_hash_set.h + guild_base.h + guilds.h + ipc_mutex.h + Item.h + item_fieldlist.h + item_struct.h + languages.h + linked_list.h + logsys.h + logtypes.h + loottable.h + mail_oplist.h + md5.h + memory_mapped_file.h + misc.h + MiscFunctions.h + moremath.h + Mutex.h + op_codes.h + opcode_dispatch.h + opcodemgr.h + packet_dump.h + packet_dump_file.h + packet_functions.h + ProcLauncher.h + profiler.h + ptimer.h + queue.h + races.h + rdtsc.h + rulesys.h + ruletypes.h + seperator.h + serverinfo.h + servertalk.h + shareddb.h + skills.h + spdat.h + StructStrategy.h + TCPBasicServer.h + TCPConnection.h + TCPServer.h + timeoutmgr.h + timer.h + types.h + unix.h + useperl.h + version.h + worldconn.h + XMLParser.h + ZoneNumbers.h + platform.h + patches/Client62.h + patches/Client62_itemfields.h + patches/Client62_ops.h + patches/Client62_structs.h + patches/patches.h + patches/SoD.h + patches/SoD_itemfields.h + patches/SoD_ops.h + patches/SoD_structs.h + patches/SoF.h + patches/SoF_itemfields.h + patches/SoF_opcode_list.h + patches/SoF_ops.h + patches/SoF_structs.h + patches/SSDeclare.h + patches/SSDefine.h + patches/SSRegister.h + patches/RoF.h + patches/RoF_itemfields.h + patches/RoF_ops.h + patches/RoF_structs.h + patches/Titanium.h + patches/Titanium_itemfields.h + patches/Titanium_ops.h + patches/Titanium_structs.h + patches/Underfoot.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 ) SOURCE_GROUP(Patches FILES - patches/Client62.h - patches/Client62_itemfields.h - patches/Client62_ops.h - patches/Client62_structs.h - patches/patches.h - patches/SoD.h - patches/SoD_itemfields.h - patches/SoD_ops.h - patches/SoD_structs.h - patches/SoF.h - patches/SoF_itemfields.h - patches/SoF_opcode_list.h - patches/SoF_ops.h - patches/SoF_structs.h - patches/SSDeclare.h - patches/SSDefine.h - patches/SSRegister.h - patches/RoF.h - patches/RoF_itemfields.h - patches/RoF_ops.h - patches/RoF_structs.h - patches/Titanium.h - patches/Titanium_itemfields.h - patches/Titanium_ops.h - patches/Titanium_structs.h - patches/Underfoot.h - patches/Underfoot_itemfields.h - patches/Underfoot_ops.h - patches/Underfoot_structs.h - patches/Client62.cpp - patches/patches.cpp - patches/SoD.cpp - patches/SoF.cpp - patches/RoF.cpp - patches/Titanium.cpp - patches/Underfoot.cpp + patches/Client62.h + patches/Client62_itemfields.h + patches/Client62_ops.h + patches/Client62_structs.h + patches/patches.h + patches/SoD.h + patches/SoD_itemfields.h + patches/SoD_ops.h + patches/SoD_structs.h + patches/SoF.h + patches/SoF_itemfields.h + patches/SoF_opcode_list.h + patches/SoF_ops.h + patches/SoF_structs.h + patches/SSDeclare.h + patches/SSDefine.h + patches/SSRegister.h + patches/RoF.h + patches/RoF_itemfields.h + patches/RoF_ops.h + patches/RoF_structs.h + patches/Titanium.h + patches/Titanium_itemfields.h + patches/Titanium_ops.h + patches/Titanium_structs.h + patches/Underfoot.h + patches/Underfoot_itemfields.h + patches/Underfoot_ops.h + patches/Underfoot_structs.h + patches/Client62.cpp + patches/patches.cpp + patches/SoD.cpp + patches/SoF.cpp + patches/RoF.cpp + patches/Titanium.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 + 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 - StackWalker/StackWalker.h - StackWalker/StackWalker.cpp + StackWalker/StackWalker.h + StackWalker/StackWalker.cpp ) SOURCE_GROUP(TinyXML FILES - tinyxml/tinystr.h - tinyxml/tinyxml.h - tinyxml/tinystr.cpp - tinyxml/tinyxml.cpp - tinyxml/tinyxmlerror.cpp - tinyxml/tinyxmlparser.cpp + tinyxml/tinystr.h + tinyxml/tinyxml.h + tinyxml/tinystr.cpp + tinyxml/tinyxml.cpp + tinyxml/tinyxmlerror.cpp + tinyxml/tinyxmlparser.cpp ) INCLUDE_DIRECTORIES(Patches SocketLib StackWalker TinyXML) @@ -315,8 +315,8 @@ ADD_LIBRARY(Common ${common_sources} ${common_headers}) IF(UNIX) - ADD_DEFINITIONS(-fPIC) - SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0) + ADD_DEFINITIONS(-fPIC) + SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0) ENDIF(UNIX) SET(LIBRARY_OUTPUT_PATH ../Bin) diff --git a/common/CRC16.cpp b/common/CRC16.cpp index d5a8942d5..9e79dc470 100644 --- a/common/CRC16.cpp +++ b/common/CRC16.cpp @@ -1,14 +1,15 @@ #include "crc32.h" -uint16 CRC16(const unsigned char *buf, int size, int key) +uint16 CRC16(const unsigned char *buf, int size, int key) { - // This is computed as the lowest 16 bits of an Ethernet CRC32 checksum - // where the key is prepended to the data in little endian order. - uint8 keyBuf[] = {(uint8)((key >> 0) & 0xff), - (uint8)((key >> 8) & 0xff), - (uint8)((key >> 16) & 0xff), - (uint8)((key >> 24) & 0xff)}; - uint32 crc = CRC32::Update(keyBuf, sizeof(uint32)); - crc = CRC32::Update(buf, size, crc); - return CRC32::Finish(crc) & 0xffff; + // This is computed as the lowest 16 bits of an Ethernet CRC32 checksum + // where the key is prepended to the data in little endian order. + uint8 keyBuf[] = {(uint8)((key >> 0) & 0xff), + (uint8)((key >> 8) & 0xff), + (uint8)((key >> 16) & 0xff), + (uint8)((key >> 24) & 0xff)}; + uint32 crc = CRC32::Update(keyBuf, sizeof(uint32)); + crc = CRC32::Update(buf, size, crc); + return CRC32::Finish(crc) & 0xffff; } + diff --git a/common/Condition.cpp b/common/Condition.cpp index 27a2015fa..bb4dba96e 100644 --- a/common/Condition.cpp +++ b/common/Condition.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" @@ -29,16 +29,16 @@ #ifdef _WINDOWS -Condition::Condition() +Condition::Condition() { - m_events[SignalEvent] = CreateEvent (nullptr, // security - FALSE, // is auto-reset event? - FALSE, // is signaled initially? - nullptr); // name - m_events[BroadcastEvent] = CreateEvent (nullptr, // security - TRUE, // is auto-reset event? - FALSE, // is signaled initially? - nullptr); // name + m_events[SignalEvent] = CreateEvent (nullptr, // security + FALSE, // is auto-reset event? + FALSE, // is signaled initially? + nullptr); // name + m_events[BroadcastEvent] = CreateEvent (nullptr, // security + TRUE, // is auto-reset event? + FALSE, // is signaled initially? + nullptr); // name m_waiters = 0; InitializeCriticalSection(&CSMutex); } @@ -69,28 +69,28 @@ void Condition::SignalAll() void Condition::Wait() { EnterCriticalSection(&CSMutex); - + m_waiters++; - - + + LeaveCriticalSection(&CSMutex); int result = WaitForMultipleObjects (_eventCount, m_events, FALSE, INFINITE); EnterCriticalSection(&CSMutex); - + m_waiters--; - + //see if we are the last person waiting on the condition, and there was a broadcast //if so, we need to reset the broadcast event. if(m_waiters == 0 && result == (WAIT_OBJECT_0+BroadcastEvent)) ResetEvent(m_events[BroadcastEvent]); - + LeaveCriticalSection(&CSMutex); } #else //!WIN32 -Condition::Condition() +Condition::Condition() { pthread_cond_init(&cond,nullptr); pthread_mutex_init(&mutex,nullptr); diff --git a/common/Condition.h b/common/Condition.h index 139f41530..bfbffe760 100644 --- a/common/Condition.h +++ b/common/Condition.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 __CONDITION_H #define __CONDITION_H diff --git a/common/EQDB.cpp b/common/EQDB.cpp index b1f0166cd..124f2e817 100644 --- a/common/EQDB.cpp +++ b/common/EQDB.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" #include "EQDB.h" @@ -64,15 +64,12 @@ EQDBRes * EQDB::query(Const_char *q) { Const_char *EQDB::escape_string(Const_char *from) { int len = strlen(from); char *res = new char[len*2+1]; - + mysql_real_escape_string(mysql_ref,res,from,len); - + res[len*2] = '\0'; m_escapeBuffer = res; delete[] res; return(m_escapeBuffer.c_str()); } - - - diff --git a/common/EQDB.h b/common/EQDB.h index 5bac35073..5da63fdc3 100644 --- a/common/EQDB.h +++ b/common/EQDB.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 EQDB_H_ #define EQDB_H_ @@ -32,10 +32,10 @@ public: static EQDB *Singleton() { return(&s_EQDB); } static void SetMySQL(MYSQL *m) { s_EQDB.mysql_ref=m; } - + //BEGIN PERL EXPORT //NOTE: you must have a space after the * of a return value - + unsigned int field_count(); unsigned long affected_rows(); unsigned long insert_id(); diff --git a/common/EQDBRes.cpp b/common/EQDBRes.cpp index d33b46bf2..57db0b381 100644 --- a/common/EQDBRes.cpp +++ b/common/EQDBRes.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" #include "EQDBRes.h" @@ -23,7 +23,7 @@ vector EQDBRes::fetch_row_array() { vector array; if(res == nullptr) return(array); - + int count=mysql_num_fields(res); MYSQL_ROW row=mysql_fetch_row(res); for (int i=0;i EQDBRes::fetch_row_hash() { map rowhash; if(res == nullptr) return(rowhash); - + MYSQL_FIELD *fields; MYSQL_ROW row; unsigned long num_fields,i; @@ -49,3 +49,4 @@ map EQDBRes::fetch_row_hash() { return rowhash; } + diff --git a/common/EQDBRes.h b/common/EQDBRes.h index dd1a3a1ca..5af684da4 100644 --- a/common/EQDBRes.h +++ b/common/EQDBRes.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 EQDBRes_H_ #define EQDBRes_H_ @@ -30,7 +30,7 @@ class EQDBRes { public: EQDBRes(MYSQL_RES *r) { res=r; } ~EQDBRes() { finish(); } - + //BEGIN PERL EXPORT unsigned long num_rows() { return (res) ? mysql_num_rows(res) : 0; } unsigned long num_fields() { return (res) ? mysql_num_fields(res) : 0; } diff --git a/common/EQEMuError.cpp b/common/EQEMuError.cpp index 353c5a342..6dc5f9e96 100644 --- a/common/EQEMuError.cpp +++ b/common/EQEMuError.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 @@ -71,7 +71,7 @@ void AddEQEMuError(eEQEMuError iError, bool iExitNow) { } iterator.Advance(); } - + char* tmp = new char[6]; tmp[0] = 1; tmp[5] = 0; diff --git a/common/EQEMuError.h b/common/EQEMuError.h index 8ecb53aa6..ffc5d69ed 100644 --- a/common/EQEMuError.h +++ b/common/EQEMuError.h @@ -1,26 +1,26 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 EQEMuError_H #define EQEMuError_H #include "../common/types.h" -enum eEQEMuError { EQEMuError_NoError, +enum eEQEMuError { EQEMuError_NoError, EQEMuError_Mysql_1405, EQEMuError_Mysql_2003, EQEMuError_Mysql_2005, diff --git a/common/EQEmuConfig.cpp b/common/EQEmuConfig.cpp index 30d31606c..8bc7b0a46 100644 --- a/common/EQEmuConfig.cpp +++ b/common/EQEmuConfig.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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/debug.h" #include "EQEmuConfig.h" @@ -63,7 +63,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele) { text=ParseTextBlock(sub_ele,"port",true); if (text) LoginPort=atoi(text); - + text=ParseTextBlock(sub_ele,"account",true); if (text) LoginAccount=text; @@ -97,7 +97,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele) { } } while(sub_ele); } - + // Check for locked sub_ele = ele->FirstChildElement("locked"); if (sub_ele != nullptr) @@ -140,7 +140,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele) { text = sub_ele->Attribute("enabled"); if (text && !strcasecmp(text,"true")) WorldHTTPEnabled=true; - + } } @@ -155,7 +155,7 @@ void EQEmuConfig::do_chatserver(TiXmlElement *ele) { if (text) ChatPort=atoi(text); } - + void EQEmuConfig::do_mailserver(TiXmlElement *ele) { const char *text; @@ -167,7 +167,7 @@ void EQEmuConfig::do_mailserver(TiXmlElement *ele) { if (text) MailPort=atoi(text); } - + void EQEmuConfig::do_database(TiXmlElement *ele) { const char *text; @@ -192,7 +192,7 @@ void EQEmuConfig::do_database(TiXmlElement *ele) { DatabaseDB=text; } - + void EQEmuConfig::do_qsdatabase(TiXmlElement *ele) { const char *text; @@ -446,27 +446,3 @@ void EQEmuConfig::Dump() const // cout << "DynamicCount = " << DynamicCount << endl; } - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/EQEmuConfig.h b/common/EQEmuConfig.h index 36b0056df..b4417a2dd 100644 --- a/common/EQEmuConfig.h +++ b/common/EQEmuConfig.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 __EQEmuConfig_H #define __EQEmuConfig_H @@ -52,11 +52,11 @@ public: uint16 WorldHTTPPort; string WorldHTTPMimeFile; string SharedKey; - + // From string ChatHost; uint16 ChatPort; - + // From string MailHost; uint16 MailPort; @@ -85,7 +85,7 @@ public: string MapDir; string QuestDir; string PluginDir; - + // From string LogPrefix; string LogSuffix; @@ -103,7 +103,7 @@ public: // uint16 DynamicCount; // map StaticZones; - + protected: static EQEmuConfig *_config; @@ -168,7 +168,7 @@ protected: MapDir="Maps"; QuestDir="quests"; PluginDir="plugins"; - + // Launcher LogPrefix = "logs/zone-"; LogSuffix = ".log"; @@ -181,22 +181,22 @@ protected: #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() {} @@ -204,7 +204,7 @@ public: // Produce a const singleton static const EQEmuConfig *get() { - if (_config == nullptr) + if (_config == nullptr) LoadConfig(); return(_config); } diff --git a/common/EQNetwork.cpp b/common/EQNetwork.cpp index 1dfa9ddb2..8cdb200fe 100644 --- a/common/EQNetwork.cpp +++ b/common/EQNetwork.cpp @@ -1,21 +1,21 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 */ -/* +/* * EQStream classes, by Quagmire */ @@ -60,18 +60,18 @@ using namespace std; #define LOG_RAW_PACKETS_IN 0 //#define PRIORITYTEST -template // LO_BYTE -type LO_BYTE (type a) {return (a&=0xff);} -template // HI_BYTE -type HI_BYTE (type a) {return (a&=0xff00);} -template // LO_WORD -type LO_WORD (type a) {return (a&=0xffff);} -template // HI_WORD -type HI_WORD (type a) {return (a&=0xffff0000);} -template // HI_LOSWAPshort -type HI_LOSWAPshort (type a) {return (LO_BYTE(a)<<8) | (HI_BYTE(a)>>8);} -template // HI_LOSWAPlong -type HI_LOSWAPlong (type x) {return (LO_WORD(a)<<16) | (HIWORD(a)>>16);} +template // LO_BYTE +type LO_BYTE (type a) {return (a&=0xff);} +template // HI_BYTE +type HI_BYTE (type a) {return (a&=0xff00);} +template // LO_WORD +type LO_WORD (type a) {return (a&=0xffff);} +template // HI_WORD +type HI_WORD (type a) {return (a&=0xffff0000);} +template // HI_LOSWAPshort +type HI_LOSWAPshort (type a) {return (LO_BYTE(a)<<8) | (HI_BYTE(a)>>8);} +template // HI_LOSWAPlong +type HI_LOSWAPlong (type x) {return (LO_WORD(a)<<16) | (HIWORD(a)>>16);} EQStreamServer::EQStreamServer(uint16 iPort) { RunLoop = false; @@ -125,8 +125,8 @@ bool EQStreamServer::Open(uint16 iPort) { unsigned long nonblocking = 1; #endif - /* Setup internet address information. - This is used with the bind() call */ + /* Setup internet address information. + This is used with the bind() call */ memset((char *) &address, 0, sizeof(address)); address.sin_family = AF_INET; address.sin_port = htons(pPort); @@ -206,14 +206,14 @@ void EQStreamServer::Process() { return; } - uchar buffer[1518]; - - int status; - struct sockaddr_in from; - unsigned int fromlen; + uchar buffer[1518]; - from.sin_family = AF_INET; - fromlen = sizeof(from); + int status; + struct sockaddr_in from; + unsigned int fromlen; + + from.sin_family = AF_INET; + fromlen = sizeof(from); while (1) { #ifdef WIN32 @@ -240,13 +240,13 @@ void EQStreamServer::Process() { connection_list.erase(tmp); continue; } - EQStream* eqs_data = connection->second; - if (eqs_data->IsFree() && (!eqs_data->CheckNetActive())) { + EQStream* eqs_data = connection->second; + if (eqs_data->IsFree() && (!eqs_data->CheckNetActive())) { map ::iterator tmp=connection; connection++; safe_delete(eqs_data); connection_list.erase(tmp); - } + } else if(!eqs_data->RunLoop) { eqs_data->Process(sock); connection++; @@ -285,13 +285,13 @@ void EQStreamServer::RecvData(uchar* data, uint32 size, uint32 irIP, uint16 irPo tmp->RecvData(data, size); return; } - else if(tmp != NULL && tmp->GetrPort() != irPort) + else if(tmp != NULL && tmp->GetrPort() != irPort) { printf("Conflicting IPs & Ports: IP %i and Port %i is conflicting with IP %i and Port %i\n",irIP,irPort,tmp->GetrIP(),tmp->GetrPort()); return; } - if (data[1]==0x01) { + if (data[1]==0x01) { cout << "New EQStream Connection." << endl; EQStream* tmp = new EQStream(irIP, irPort); tmp->RecvData(data, size); diff --git a/common/EQNetwork.h b/common/EQNetwork.h index 71e288ab7..f7df21276 100644 --- a/common/EQNetwork.h +++ b/common/EQNetwork.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 EQNETWORK_H #define EQNETWORK_H diff --git a/common/EQPacket.cpp b/common/EQPacket.cpp index 9df2912fd..4d106f619 100644 --- a/common/EQPacket.cpp +++ b/common/EQPacket.cpp @@ -1,19 +1,19 @@ -/* +/* Copyright (C) 2005 Michael S. Finger - 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 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 + 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. + 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 + 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 "debug.h" #include @@ -35,15 +35,15 @@ using namespace std; EQPacket::EQPacket(EmuOpcode op, const unsigned char *buf, uint32 len) -: BasePacket(buf, len), - emu_opcode(op) +: BasePacket(buf, len), + emu_opcode(op) { } void EQPacket::build_raw_header_dump(char *buffer, uint16 seq) const { BasePacket::build_raw_header_dump(buffer, seq); buffer += strlen(buffer); - + buffer += sprintf(buffer, "[EmuOpCode 0x%04x Size=%u]\n", emu_opcode, size); } @@ -68,7 +68,7 @@ void EQPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const } if (seq != 0xffff) fprintf(to, "[Seq=%u] ",seq); - + fprintf(to, "[EmuOpCode 0x%04x Size=%lu]\n",emu_opcode,(unsigned long)size); } @@ -76,7 +76,7 @@ void EQProtocolPacket::build_raw_header_dump(char *buffer, uint16 seq) const { BasePacket::build_raw_header_dump(buffer, seq); buffer += strlen(buffer); - + buffer += sprintf(buffer, "[ProtoOpCode 0x%04x Size=%u]\n",opcode,size); } @@ -102,7 +102,7 @@ void EQProtocolPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const } if (seq != 0xffff) fprintf(to, "[Seq=%u] ",seq); - + fprintf(to, "[ProtoOpCode 0x%04x Size=%lu]\n",opcode,(unsigned long)size); } @@ -110,7 +110,7 @@ void EQApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) const { BasePacket::build_raw_header_dump(buffer, seq); buffer += strlen(buffer); - + #ifdef STATIC_OPCODE buffer += sprintf(buffer, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size); #else @@ -144,7 +144,7 @@ void EQApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const } if (seq != 0xffff) fprintf(to, "[Seq=%u] ",seq); - + #ifdef STATIC_OPCODE fprintf(to, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size); #else @@ -156,7 +156,7 @@ void EQRawApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) con { BasePacket::build_raw_header_dump(buffer, seq); buffer += strlen(buffer); - + #ifdef STATIC_OPCODE buffer += sprintf(buffer, "[OpCode 0x%04x (0x%04x) Size=%u]\n", emu_opcode, opcode,size); #else @@ -190,7 +190,7 @@ void EQRawApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const } if (seq != 0xffff) fprintf(to, "[Seq=%u] ",seq); - + #ifdef STATIC_OPCODE fprintf(to, "[OpCode 0x%04x (0x%04x) Size=%u]\n", emu_opcode, opcode,size); #else @@ -200,7 +200,7 @@ void EQRawApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const uint32 EQProtocolPacket::serialize(unsigned char *dest) const { - if (opcode>0xff) { + if (opcode>0xff) { *(uint16 *)dest=opcode; } else { *(dest)=0; @@ -235,8 +235,8 @@ uint32 EQApplicationPacket::serialize(uint16 opcode, unsigned char *dest) const } /*EQProtocolPacket::EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len) -: BasePacket(buf, len), - opcode(op) +: BasePacket(buf, len), + opcode(op) { uint32 offset; @@ -364,7 +364,7 @@ uint32 flag_offset=0; } else flag_offset=1; - if (length>2 && buffer[flag_offset]==0x5a) { + if (length>2 && buffer[flag_offset]==0x5a) { newlen=InflatePacket(buffer+flag_offset+1,length-(flag_offset+1)-2,newbuf+flag_offset,newbufsize-flag_offset)+2; newbuf[newlen++]=buffer[length-2]; newbuf[newlen++]=buffer[length-1]; @@ -409,7 +409,7 @@ void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey buffer+=2; size-=2; - int i; + int i; for (i = 0 ; i+4 <= size ; i+=4) { int pt = (*(int*)&buffer[i])^(Key); @@ -421,7 +421,7 @@ void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey { test[i]=buffer[i]^KC; } - memcpy(buffer,test,size); + memcpy(buffer,test,size); free(test); } } @@ -445,7 +445,7 @@ void EQProtocolPacket::ChatEncode(unsigned char *buffer, int size, int EncodeKey { test[i]=buffer[i]^KC; } - memcpy(buffer,test,size); + memcpy(buffer,test,size); free(test); } } @@ -461,43 +461,43 @@ EQRawApplicationPacket *EQProtocolPacket::MakeAppPacket() const { } EQRawApplicationPacket::EQRawApplicationPacket(uint16 opcode, const unsigned char *buf, const uint32 len) -: EQApplicationPacket(OP_Unknown, buf, len), - opcode(opcode) +: EQApplicationPacket(OP_Unknown, buf, len), + opcode(opcode) { } EQRawApplicationPacket::EQRawApplicationPacket(const unsigned char *buf, const uint32 len) : EQApplicationPacket(OP_Unknown, buf+sizeof(uint16), len-sizeof(uint16)) { - if(GetExecutablePlatform() != ExePlatformUCS) { - opcode = *((const uint16 *) buf); - if(opcode == 0x0000) - { - if(len >= 3) - { - opcode = *((const uint16 *) (buf + 1)); - const unsigned char *packet_start = (buf + 3); - const int32 packet_length = len - 3; - safe_delete_array(pBuffer); - if(len >= 0) - { - size = packet_length; - pBuffer = new unsigned char[size]; - memcpy(pBuffer, packet_start, size); - } - else - { - size = 0; - } - } - else - { - safe_delete_array(pBuffer); - size = 0; - } - } - } else { - opcode = *((const uint8 *) buf); - } + if(GetExecutablePlatform() != ExePlatformUCS) { + opcode = *((const uint16 *) buf); + if(opcode == 0x0000) + { + if(len >= 3) + { + opcode = *((const uint16 *) (buf + 1)); + const unsigned char *packet_start = (buf + 3); + const int32 packet_length = len - 3; + safe_delete_array(pBuffer); + if(len >= 0) + { + size = packet_length; + pBuffer = new unsigned char[size]; + memcpy(pBuffer, packet_start, size); + } + else + { + size = 0; + } + } + else + { + safe_delete_array(pBuffer); + size = 0; + } + } + } else { + opcode = *((const uint8 *) buf); + } } void DumpPacket(const EQApplicationPacket* app, bool iShowInfo) { diff --git a/common/EQPacket.h b/common/EQPacket.h index f8d4f11fb..3925f5c71 100644 --- a/common/EQPacket.h +++ b/common/EQPacket.h @@ -1,19 +1,19 @@ -/* +/* Copyright (C) 2005 Michael S. Finger - 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 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 + 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. + 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 + 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 _EQPACKET_H #define _EQPACKET_H @@ -39,9 +39,9 @@ class EQPacket : public BasePacket { friend class EQStream; public: virtual ~EQPacket() {} - + uint32 Size() const { return size+2; } - + virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const; virtual void build_header_dump(char *buffer) const; virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const; @@ -50,7 +50,7 @@ public: void SetOpcode(EmuOpcode op) { emu_opcode = op; } const EmuOpcode GetOpcode() const { return(emu_opcode); } // const char *GetOpcodeName() const; - + protected: //this is just a cache so we dont look it up several times on Get() //and it is mutable so we can store the cached copy even on a const object @@ -68,32 +68,32 @@ 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; } + 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; EQProtocolPacket *Copy() { return new EQProtocolPacket(opcode,pBuffer,size); } EQRawApplicationPacket *MakeAppPacket() const; - + bool acked; - + virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const; virtual void build_header_dump(char *buffer) const; virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const; virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const; - + protected: - + static bool ValidateCRC(const unsigned char *buffer, int length, uint32 Key); static uint32 Decompress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize); static uint32 Compress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize); static void ChatDecode(unsigned char *buffer, int size, int DecodeKey); static void ChatEncode(unsigned char *buffer, int size, int EncodeKey); - + uint16 GetRawOpcode() const { return(opcode); } - + uint32 Size() const { return size+2; } - + //the actual raw EQ opcode uint16 opcode; }; @@ -102,25 +102,25 @@ class EQApplicationPacket : public EQPacket { // friend class EQProtocolPacket; friend class EQStream; public: - EQApplicationPacket() : EQPacket(OP_Unknown,nullptr,0) - { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } - EQApplicationPacket(const EmuOpcode op) : EQPacket(op,nullptr,0) - { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } - EQApplicationPacket(const EmuOpcode op, const uint32 len) : EQPacket(op,nullptr,len) - { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } - EQApplicationPacket(const EmuOpcode op, const unsigned char *buf, const uint32 len) : EQPacket(op,buf,len) - { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } + EQApplicationPacket() : EQPacket(OP_Unknown,nullptr,0) + { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } + EQApplicationPacket(const EmuOpcode op) : EQPacket(op,nullptr,0) + { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } + EQApplicationPacket(const EmuOpcode op, const uint32 len) : EQPacket(op,nullptr,len) + { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } + EQApplicationPacket(const EmuOpcode op, const unsigned char *buf, const uint32 len) : EQPacket(op,buf,len) + { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } bool combine(const EQApplicationPacket *rhs); uint32 serialize (uint16 opcode, unsigned char *dest) const; uint32 Size() const { return size+app_opcode_size; } - + virtual EQApplicationPacket *Copy() const; - + virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const; virtual void build_header_dump(char *buffer) const; virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const; virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const; - + protected: uint8 app_opcode_size; @@ -135,17 +135,17 @@ class EQRawApplicationPacket : public EQApplicationPacket { public: EQRawApplicationPacket(uint16 opcode, const unsigned char *buf, const uint32 len); uint16 GetRawOpcode() const { return(opcode); } - + virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const; virtual void build_header_dump(char *buffer) const; virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const; virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const; protected: - + //the actual raw EQ opcode uint16 opcode; - + EQRawApplicationPacket(const unsigned char *buf, const uint32 len); }; diff --git a/common/EQStream.cpp b/common/EQStream.cpp index c9397f43e..2b8b2488c 100644 --- a/common/EQStream.cpp +++ b/common/EQStream.cpp @@ -1,19 +1,19 @@ -/* +/* Copyright (C) 2005 Michael S. Finger - 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 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 + 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. + 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 + 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 "debug.h" #include @@ -106,11 +106,11 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf EQProtocolPacket *EQStream::MakeProtocolPacket(const unsigned char *buf, uint32 len) { uint16 proto_opcode = ntohs(*(const uint16 *)buf); - + //advance over opcode. buf += 2; len -= 2; - + return(new EQProtocolPacket(proto_opcode, buf, len)); } @@ -121,7 +121,7 @@ uint32 processed=0,subpacket_length=0; return; // Raw Application packet if (p->opcode > 0xff) { - p->opcode = htons(p->opcode); //byte order is backwards in the protocol packet + p->opcode = htons(p->opcode); //byte order is backwards in the protocol packet EQRawApplicationPacket *ap=MakeApplicationPacket(p); if (ap) InboundQueuePush(ap); @@ -149,7 +149,7 @@ uint32 processed=0,subpacket_length=0; } } break; - + case OP_AppCombined: { processed=0; while(processedsize) { @@ -171,7 +171,7 @@ uint32 processed=0,subpacket_length=0; } } break; - + case OP_Packet: { if(!p->pBuffer || (p->Size() < 4)) { @@ -192,7 +192,7 @@ uint32 processed=0,subpacket_length=0; } else if (check == SeqPast) { _log(NET__DEBUG, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); - SendOutOfOrderAck(seq); //we already got this packet but it was out of order + SendOutOfOrderAck(seq); //we already got this packet but it was out of order } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); @@ -221,7 +221,7 @@ uint32 processed=0,subpacket_length=0; } } break; - + case OP_Fragment: { if(!p->pBuffer || (p->Size() < 4)) { @@ -317,10 +317,10 @@ uint32 processed=0,subpacket_length=0; #ifndef COLLECTOR if (GetState()==ESTABLISHED) { _log(NET__ERROR, _L "Received OP_SessionRequest in ESTABLISHED state (%d)" __L, GetState()); - + /*RemoveData(); - init(); - State=UNESTABLISHED;*/ + init(); + State=UNESTABLISHED;*/ _SendDisconnect(); SetState(CLOSED); break; @@ -360,7 +360,7 @@ uint32 processed=0,subpacket_length=0; encoded=(Response->Format&FLAG_ENCODED); _log(NET__NET_TRACE, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); - + // Kinda kludgy, but trie for now if (StreamType==UnknownStream) { if (compressed) { @@ -406,7 +406,7 @@ uint32 processed=0,subpacket_length=0; #ifndef COLLECTOR uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); MOutboundQueue.lock(); - + if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { _log(NET__ERROR, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } @@ -418,7 +418,7 @@ if(NextSequencedSend > SequencedQueue.size()) { _log(NET__NET_TRACE, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, seq, SequencedBase, SequencedBase+NextSequencedSend); #ifdef RETRANSMITS - if (!RuleB(EQStream, RetransmitAckedPackets)) { + if (!RuleB(EQStream, RetransmitAckedPackets)) { #endif uint16 sqsize = SequencedQueue.size(); uint16 index = seq - SequencedBase; @@ -431,7 +431,7 @@ if(NextSequencedSend > SequencedQueue.size()) { } #ifdef RETRANSMITS } - if (RuleR(EQStream, RetransmitTimeoutMult)) { // only choose new behavior if multiplier is set + if (RuleR(EQStream, RetransmitTimeoutMult)) { // only choose new behavior if multiplier is set retransmittimer = Timer::GetCurrentTime(); } #endif @@ -457,9 +457,9 @@ if(NextSequencedSend > SequencedQueue.size()) { } #ifndef COLLECTOR SessionStats *Stats=(SessionStats *)p->pBuffer; - _log(NET__NET_TRACE, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, - (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), - (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), + _log(NET__NET_TRACE, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, + (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), + (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), (unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta)); uint64 x=Stats->packets_received; Stats->packets_received=Stats->packets_sent; @@ -502,7 +502,7 @@ void EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req) { if(p == nullptr) return; - + EQApplicationPacket *newp = p->Copy(); if (newp != nullptr) @@ -513,18 +513,18 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) { EQApplicationPacket *pack=*p; *p = nullptr; //clear caller's pointer.. effectively takes ownership - + if(pack == nullptr) return; - + if(OpMgr == nullptr || *OpMgr == nullptr) { _log(NET__DEBUG, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); delete pack; return; } - + uint16 opcode = (*OpMgr)->EmuToEQ(pack->emu_opcode); - + //make sure this packet is compatible with this stream /* if(StreamType == UnknownStream || StreamType == ChatOrMailStream) { _log(NET__DEBUG, _L "Stream type undetermined (%s), packet ignored" __L, StreamTypeString(StreamType)); @@ -534,9 +534,9 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) _log(NET__ERROR, _L "Trying to queue a packet of type %s into a stream of type %s, dropping it." __L, StreamTypeString(pack->GetPacketType()), StreamTypeString(StreamType)); return; }*/ - + _log(NET__APP_TRACE, "Queueing %sacked packet with opcode 0x%x (%s) and length %d", ack_req?"":"non-", opcode, OpcodeManager::EmuToName(pack->emu_opcode), pack->size); - + if (!ack_req) { NonSequencedPush(new EQProtocolPacket(opcode, pack->pBuffer, pack->size)); delete pack; @@ -556,15 +556,15 @@ uint32 length; unsigned char *tmpbuff=new unsigned char[p->size+3]; length=p->serialize(opcode, tmpbuff); - + EQProtocolPacket *out=new EQProtocolPacket(OP_Fragment,nullptr,MaxLen-4); *(uint32 *)(out->pBuffer+2)=htonl(p->Size()); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); _log(NET__FRAGMENT, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); SequencedPush(out); - - + + while (used::iterator sitr; sitr = SequencedQueue.begin(); if (sitr!=SequencedQueue.end()) sitr += NextSequencedSend; - + // Loop until both are empty or MaxSends is reached - while(!SeqEmpty || !NonSeqEmpty) { + while(!SeqEmpty || !NonSeqEmpty) { // See if there are more non-sequenced packets left if (!NonSequencedQueue.empty()) { @@ -703,7 +703,7 @@ deque::iterator sitr; ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; - + if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair _log(NET__RATES, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); @@ -721,7 +721,7 @@ deque::iterator sitr; } if (sitr!=SequencedQueue.end()) { -//_log(NET__NET_COMBINE, _L "Send Seq with %d seq packets starting at seq %d, next send %d, and %d non-seq packets." __L, +//_log(NET__NET_COMBINE, _L "Send Seq with %d seq packets starting at seq %d, next send %d, and %d non-seq packets." __L, // SequencedQueue.size(), SequencedBase, NextSequencedSend, NonSequencedQueue.size()); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { _log(NET__ERROR, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); @@ -802,7 +802,7 @@ if(NextSequencedSend > SequencedQueue.size()) { delete p; ReadyToSend.pop(); } - + //see if we need to send our disconnect and finish our close if(SeqEmpty && NonSeqEmpty) { //no more data to send @@ -825,7 +825,7 @@ sockaddr_in address; address.sin_port=remote_port; #ifdef NOWAY uint32 ip=address.sin_addr.s_addr; - cout << "Sending to: " + cout << "Sending to: " << (int)*(unsigned char *)&ip << "." << (int)*((unsigned char *)&ip+1) << "." << (int)*((unsigned char *)&ip+2) @@ -886,7 +886,7 @@ char temp[15]; ntohs(from->sin_port)); //cout << timestamp() << "Data from: " << temp << " OpCode 0x" << hex << setw(2) << setfill('0') << (int)p->opcode << dec << endl; //dump_message(p->pBuffer,p->size,timestamp()); - + } return p; }*/ @@ -904,12 +904,12 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses if (encoded) Response->Format|=FLAG_ENCODED; Response->Key=htonl(Key); - + out->size=sizeof(SessionResponse); - + _log(NET__NET_TRACE, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no"); - + NonSequencedPush(out); } @@ -920,9 +920,9 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess memset(Request,0,sizeof(SessionRequest)); Request->Session=htonl(time(nullptr)); Request->MaxLength=htonl(512); - + _log(NET__NET_TRACE, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); - + NonSequencedPush(out); } @@ -930,11 +930,11 @@ void EQStream::_SendDisconnect() { if(GetState() == CLOSED) return; - + EQProtocolPacket *out=new EQProtocolPacket(OP_SessionDisconnect,nullptr,sizeof(uint32)); *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); - + _log(NET__NET_TRACE, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); } @@ -956,7 +956,7 @@ EQRawApplicationPacket *p=nullptr; InboundQueue.erase(itr); } MInboundQueue.unlock(); - + //resolve the opcode if we can. if(p) { if(OpMgr != nullptr && *OpMgr != nullptr) { @@ -969,7 +969,7 @@ EQRawApplicationPacket *p=nullptr; p->SetOpcode(emu_op); } } - + return p; } @@ -984,7 +984,7 @@ EQRawApplicationPacket *p=nullptr; InboundQueue.erase(itr); } MInboundQueue.unlock(); - + //resolve the opcode if we can. if(p) { if(OpMgr != nullptr && *OpMgr != nullptr) { @@ -1018,9 +1018,9 @@ EQRawApplicationPacket *p=nullptr; void EQStream::InboundQueueClear() { EQApplicationPacket *p=nullptr; - + _log(NET__APP_TRACE, _L "Clearing inbound queue" __L); - + MInboundQueue.lock(); if (!InboundQueue.empty()) { vector::iterator itr; @@ -1036,11 +1036,11 @@ EQApplicationPacket *p=nullptr; bool EQStream::HasOutgoingData() { bool flag; - + //once closed, we have nothing more to say if(CheckClosed()) return(false); - + MOutboundQueue.lock(); flag=(!NonSequencedQueue.empty()); if (!flag) { @@ -1063,7 +1063,7 @@ void EQStream::OutboundQueueClear() EQProtocolPacket *p=nullptr; _log(NET__APP_TRACE, _L "Clearing outbound queue" __L); - + MOutboundQueue.lock(); while(!NonSequencedQueue.empty()) { delete NonSequencedQueue.front(); @@ -1078,7 +1078,7 @@ EQProtocolPacket *p=nullptr; SequencedQueue.clear(); } MOutboundQueue.unlock(); - + /*if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { _log(NET__ERROR, _L "Out-bound Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } @@ -1093,7 +1093,7 @@ void EQStream::PacketQueueClear() EQProtocolPacket *p=nullptr; _log(NET__APP_TRACE, _L "Clearing future packet queue" __L); - + if(!PacketQueue.empty()) { map::iterator itr; for(itr=PacketQueue.begin();itr!=PacketQueue.end();itr++) { @@ -1150,7 +1150,7 @@ long EQStream::GetLastAckSent() void EQStream::AckPackets(uint16 seq) { deque::iterator itr, tmp; - + MOutboundQueue.lock(); //do a bit of sanity checking. if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { @@ -1159,7 +1159,7 @@ if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { if(NextSequencedSend > SequencedQueue.size()) { _log(NET__ERROR, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } - + SeqOrder ord = CompareSequence(SequencedBase, seq); if(ord == SeqInOrder) { //they are not acking anything new... @@ -1197,7 +1197,7 @@ if(NextSequencedSend > SequencedQueue.size()) { _log(NET__ERROR, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } - + MOutboundQueue.unlock(); } @@ -1222,7 +1222,7 @@ void EQStream::ProcessQueue() if(PacketQueue.empty()) { return; } - + EQProtocolPacket *qp=nullptr; while((qp=RemoveQueue(NextInSeq))!=nullptr) { _log(NET__DEBUG, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); @@ -1308,7 +1308,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq) if (expected_seq==seq) { // Curent return SeqInOrder; - } else if ((seq > expected_seq && (uint32)seq < ((uint32)expected_seq + EQStream::MaxWindowSize)) || seq < (expected_seq - EQStream::MaxWindowSize)) { + } else if ((seq > expected_seq && (uint32)seq < ((uint32)expected_seq + EQStream::MaxWindowSize)) || seq < (expected_seq - EQStream::MaxWindowSize)) { // Future return SeqFuture; } else { @@ -1326,9 +1326,9 @@ void EQStream::SetState(EQStreamState state) { void EQStream::CheckTimeout(uint32 now, uint32 timeout) { - + bool outgoing_data = HasOutgoingData(); //up here to avoid recursive locking - + EQStreamState orig_state = GetState(); if (orig_state == CLOSING && !outgoing_data) { _log(NET__NET_TRACE, _L "Out of data in closing state, disconnecting." __L); @@ -1410,7 +1410,7 @@ void EQStream::Close() { EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { EQRawApplicationPacket *p = nullptr; MatchState res = MatchNotReady; - + MInboundQueue.lock(); if (!InboundQueue.empty()) { //this is already getting hackish... @@ -1444,10 +1444,7 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { } } MInboundQueue.unlock(); - + return(res); } - - - diff --git a/common/EQStream.h b/common/EQStream.h index 2c6bf6c7b..09bd604eb 100644 --- a/common/EQStream.h +++ b/common/EQStream.h @@ -55,10 +55,10 @@ struct SessionStats { /*030*/ uint64 packets_received; /*038*/ }; - + #pragma pack() -class OpcodeManager; +class OpcodeManager; //extern OpcodeManager *EQNetworkOpcodeManager; //class EQStreamFactory; @@ -73,7 +73,7 @@ class EQStream : public EQStreamInterface { SeqInOrder, SeqFuture } SeqOrder; - + uint32 remote_ip; uint16 remote_port; uint8 buffer[8192]; @@ -89,7 +89,7 @@ class EQStream : public EQStreamInterface { uint32 Session, Key; uint16 NextInSeq; - uint32 MaxLen; + uint32 MaxLen; uint16 MaxSends; uint8 active_users; //how many things are actively using this @@ -119,10 +119,10 @@ class EQStream : public EQStreamInterface { uint16 SequencedBase; //the sequence number of SequencedQueue[0] long NextSequencedSend; //index into SequencedQueue Mutex MOutboundQueue; - + //a buffer we use for compression/decompression unsigned char _tempBuffer[2048]; - + // Packets waiting to be processed vector InboundQueue; map PacketQueue; //not mutex protected, only accessed by caller of Process() @@ -136,18 +136,18 @@ class EQStream : public EQStreamInterface { int32 RateThreshold; int32 DecayRate; - + OpcodeManager **OpMgr; - + // EQStreamFactory *const Factory; EQRawApplicationPacket *MakeApplicationPacket(EQProtocolPacket *p); EQRawApplicationPacket *MakeApplicationPacket(const unsigned char *buf, uint32 len); EQProtocolPacket *MakeProtocolPacket(const unsigned char *buf, uint32 len); void SendPacket(uint16 opcode, EQApplicationPacket *p); - + void SetState(EQStreamState state); - + void SendSessionResponse(); void SendSessionRequest(); void SendAck(uint16 seq); @@ -157,7 +157,7 @@ class EQStream : public EQStreamInterface { void NonSequencedPush(EQProtocolPacket *p); void SequencedPush(EQProtocolPacket *p); void WritePacket(int fd,EQProtocolPacket *p); - + uint32 GetKey() { return Key; } void SetKey(uint32 k) { Key=k; } @@ -167,21 +167,21 @@ class EQStream : public EQStreamInterface { // virtual void DispatchPacket(EQApplicationPacket *p) { p->DumpRaw(); } - bool Stale(uint32 now, uint32 timeout=30) { return (LastPacket && (now-LastPacket) > timeout); } + bool Stale(uint32 now, uint32 timeout=30) { return (LastPacket && (now-LastPacket) > timeout); } void InboundQueuePush(EQRawApplicationPacket *p); EQRawApplicationPacket *PeekPacket(); //for collector. EQRawApplicationPacket *PopRawPacket(); //for collector. - + void InboundQueueClear(); void OutboundQueueClear(); void PacketQueueClear(); - + void ProcessQueue(); EQProtocolPacket *RemoveQueue(uint16 seq); - + void _SendDisconnect(); - + 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(); } @@ -201,21 +201,21 @@ class EQStream : public EQStreamInterface { virtual void RemoveData() { InboundQueueClear(); OutboundQueueClear(); PacketQueueClear(); /*if (CombinedAppPacket) delete CombinedAppPacket;*/ } virtual bool CheckState(EQStreamState state) { return GetState() == state; } virtual std::string Describe() const { return("Direct EQStream"); } - + void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; } - + void CheckTimeout(uint32 now, uint32 timeout=30); bool HasOutgoingData(); void Process(const unsigned char *data, const uint32 length); void SetLastPacketTime(uint32 t) {LastPacket=t;} void Write(int eq_fd); - + // inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; } inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); } - + inline EQStreamState GetState() { EQStreamState s; MState.lock(); s=State; MState.unlock(); return s; } - + // static EQProtocolPacket *Read(int eq_fd, sockaddr_in *from); static SeqOrder CompareSequence(uint16 expected_seq , uint16 seq); @@ -259,14 +259,14 @@ class EQStream : public EQStreamInterface { return 0; return bytes_recv / (Timer::GetTimeSeconds() - create_time); } - + //used for dynamic stream identification class Signature { public: //this object could get more complicated if needed... - uint16 ignore_eq_opcode; //0=dont ignore + uint16 ignore_eq_opcode; //0=dont ignore uint16 first_eq_opcode; - uint32 first_length; //0=dont check length + uint32 first_length; //0=dont check length }; typedef enum { MatchNotReady, @@ -274,8 +274,8 @@ class EQStream : public EQStreamInterface { MatchFailed } MatchState; MatchState CheckSignature(const Signature *sig); - + }; - #endif + diff --git a/common/EQStreamFactory.cpp b/common/EQStreamFactory.cpp index 56b1f9da7..c5e37b690 100644 --- a/common/EQStreamFactory.cpp +++ b/common/EQStreamFactory.cpp @@ -24,28 +24,28 @@ using namespace std; ThreadReturnType EQStreamFactoryReaderLoop(void *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); } 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 @@ -55,8 +55,8 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) THREAD_RETURN(nullptr); } -EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout) - : Timeoutable(5000), stream_timeout(timeout) +EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout) + : Timeoutable(5000), stream_timeout(timeout) { StreamType=type; Port=port; @@ -81,7 +81,7 @@ struct sockaddr_in address; #ifndef WIN32 pthread_t t1,t2; #endif - /* Setup internet address information. + /* Setup internet address information. This is used with the bind() call */ memset((char *) &address, 0, sizeof(address)); address.sin_family = AF_INET; @@ -172,10 +172,10 @@ timeval sleep_time; continue; } else if (num==0) continue; - + if(sock == -1) break; //somebody closed us while we were sleeping. - + if (FD_ISSET(sock,&readset)) { #ifdef _WINDOWS if ((length=recvfrom(sock,(char*)buffer,sizeof(buffer),0,(struct sockaddr*)&from,(int *)&socklen)) < 2) @@ -208,7 +208,7 @@ timeval sleep_time; else curstream->PutInUse(); MStreams.unlock(); //the in use flag prevents the stream from being deleted while we are using it. - + if(curstream) { curstream->AddBytesRecv(length); curstream->Process(buffer,length); @@ -225,17 +225,17 @@ void EQStreamFactory::CheckTimeout() { //lock streams the entire time were checking timeouts, it should be fast. MStreams.lock(); - + unsigned long now=Timer::GetCurrentTime(); map::iterator stream_itr; - + for(stream_itr=Streams.begin();stream_itr!=Streams.end();) { EQStream *s = stream_itr->second; - + s->CheckTimeout(now, stream_timeout); - + EQStreamState state = s->GetState(); - + //not part of the else so we check it right away on state change if (state==CLOSED) { if (s->IsInUse()) { @@ -267,7 +267,7 @@ bool decay=false; uint32 stream_count; Timer DecayTimer(20); - + WriterRunning=true; DecayTimer.Enable(); while(sock!=-1) { @@ -278,12 +278,12 @@ Timer DecayTimer(20); if (!WriterRunning) break; MWriterRunning.unlock(); - + havework = false; wants_write.clear(); decay=DecayTimer.Check(); - + //copy streams into a seperate list so we dont have to keep //MStreams locked while we are writting MStreams.lock(); @@ -291,13 +291,13 @@ Timer DecayTimer(20); // 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: %s", stream_itr->first.c_str()); continue; } - + if (stream_itr->second->HasOutgoingData()) { havework=true; stream_itr->second->PutInUse(); @@ -305,7 +305,7 @@ Timer DecayTimer(20); } } MStreams.unlock(); - + //do the actual writes cur = wants_write.begin(); end = wants_write.end(); @@ -313,7 +313,6 @@ Timer DecayTimer(20); (*cur)->Write(sock); (*cur)->ReleaseFromUse(); } - Sleep(10); @@ -328,20 +327,3 @@ Timer DecayTimer(20); } } - - - - - - - - - - - - - - - - - diff --git a/common/EQStreamFactory.h b/common/EQStreamFactory.h index 316a175b0..66911bc3f 100644 --- a/common/EQStreamFactory.h +++ b/common/EQStreamFactory.h @@ -23,7 +23,7 @@ class EQStreamFactory : private Timeoutable { Condition WriterWork; EQStreamType StreamType; - + queue NewStreams; Mutex MNewStreams; @@ -34,7 +34,7 @@ class EQStreamFactory : private Timeoutable { Timer *DecayTimer; - uint32 stream_timeout; + uint32 stream_timeout; public: EQStreamFactory(EQStreamType type, uint32 timeout = 135000) : Timeoutable(5000), stream_timeout(timeout) { ReaderRunning=false; WriterRunning=false; StreamType=type; sock=-1; } diff --git a/common/EQStreamIdent.cpp b/common/EQStreamIdent.cpp index 2cc5385e9..7d5fa2449 100644 --- a/common/EQStreamIdent.cpp +++ b/common/EQStreamIdent.cpp @@ -1,4 +1,3 @@ - #include "debug.h" #include "EQStreamIdent.h" #include "EQStreamProxy.h" @@ -39,12 +38,12 @@ void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const cha void EQStreamIdentifier::Process() { vector::iterator cur; vector::iterator curp, endp; - + //foreach pending stream. cur = m_streams.begin(); while(cur != m_streams.end()) { Record *r = *cur; - + //first see if this stream has expired if(r->expire.Check(false)) { //this stream has failed to match any pattern in our timeframe. @@ -54,7 +53,7 @@ void EQStreamIdentifier::Process() { 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) @@ -87,18 +86,18 @@ void EQStreamIdentifier::Process() { cur = m_streams.erase(cur); continue; } - + //not expired, check against all patch signatures - + bool found_one = false; //"we found a matching patch for this stream" bool all_ready = true; //"all signatures were ready to check the stream" - + //foreach possbile patch... curp = m_patches.begin(); endp = m_patches.end(); for(; !found_one && curp != endp; curp++) { Patch *p = *curp; - + //ask the stream to see if it matches the supplied signature EQStream::MatchState res = r->stream->CheckSignature(&p->signature); switch(res) { @@ -109,13 +108,13 @@ void EQStreamIdentifier::Process() { break; case EQStream::MatchSuccessful: { //yay, a match. - + _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); m_identified.push(s); - + found_one = true; break; } @@ -125,14 +124,14 @@ void EQStreamIdentifier::Process() { break; } } - + //if we checked all patches and did not find a match. if(all_ready && !found_one) { //the stream cannot be identified. _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. @@ -156,44 +155,10 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() { m_identified.pop(); return(res); } - + EQStreamIdentifier::Record::Record(EQStream *s) -: stream(s), - expire(STREAM_IDENT_WAIT_MS) +: stream(s), + expire(STREAM_IDENT_WAIT_MS) { } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/EQStreamIdent.h b/common/EQStreamIdent.h index 361c6237f..855838c86 100644 --- a/common/EQStreamIdent.h +++ b/common/EQStreamIdent.h @@ -15,27 +15,27 @@ class StructStrategy; class EQStreamIdentifier { public: ~EQStreamIdentifier(); - + //registration interface. void RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs); - + //main processing interface void Process(); void AddStream(EQStream *& eqs); EQStreamInterface *PopIdentified(); - + protected: - + //registered patches.. class Patch { public: std::string name; - EQStream::Signature signature; + EQStream::Signature signature; OpcodeManager ** opcodes; const StructStrategy *structs; }; std::vector m_patches; //we own these objects. - + //pending streams.. class Record { public: diff --git a/common/EQStreamIntf.h b/common/EQStreamIntf.h index e3e3ac092..9373f2262 100644 --- a/common/EQStreamIntf.h +++ b/common/EQStreamIntf.h @@ -19,7 +19,7 @@ class EQApplicationPacket; class EQStreamInterface { public: virtual ~EQStreamInterface() {} - + 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; diff --git a/common/EQStreamLocator.h b/common/EQStreamLocator.h index 27d17aeb3..7e41aa12b 100644 --- a/common/EQStreamLocator.h +++ b/common/EQStreamLocator.h @@ -1,19 +1,19 @@ -/* +/* Copyright (C) 2005 EQEmulator Team - 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 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 + 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. + 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 + 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 _EQSTREAM_LOCATOR_H #define _EQSTREAM_LOCATOR_H @@ -66,7 +66,7 @@ if(res) else printf(": False\n");*/ - + if(l.src_ip != r.src_ip) return(l.src_ip < r.src_ip); if(l.dst_ip != r.dst_ip) @@ -74,7 +74,7 @@ else if(l.src_port != r.src_port) return(l.src_port < r.src_port); return(l.dst_port < r.dst_port); - + /* //so, this turned out uglier than I had hoped if(l.src_ip < r.src_ip) return(true); @@ -105,35 +105,35 @@ class EQStreamLocator { protected: typedef typename map::iterator iterator; public: - + void Clear() { streams.clear(); } - + void AddStream(const EQStreamInfo &i, T *o) { //do we care to check if it exists? - + //add this stream, and its inverse streams[i] = o; EQStreamInfo inv; i.invert(inv); streams[inv] = o; } - + //deletes this stream, and its inverse void RemoveStream(const EQStreamInfo &i) { iterator res; res = streams.find(i); if(res != streams.end()) streams.erase(res); - + EQStreamInfo inv; i.invert(inv); res = streams.find(inv); if(res != streams.end()) streams.erase(res); } - + //removes every occurance of this stream from the list void RemoveStream(T *it) { iterator cur, end; @@ -142,14 +142,14 @@ public: for(; cur != end; cur++) { if(cur->second == it) { streams.erase(cur); - //lazy recursive delete for now, since we have to redo + //lazy recursive delete for now, since we have to redo //our iterators anyways RemoveStream(it); return; } } } - + T *GetStream(const EQStreamInfo &i) { iterator res; res = streams.find(i); @@ -160,16 +160,14 @@ public: return(nullptr); return(res->second); } - + //allow people to iterate over the const struct // typedef map::const_iterator iterator; // inline iterator begin() const { return(streams.begin()); } // inline iterator end() const { return(streams.end()); } - + protected: map streams; }; - - #endif diff --git a/common/EQStreamProxy.cpp b/common/EQStreamProxy.cpp index 1268b378d..90ea6ffce 100644 --- a/common/EQStreamProxy.cpp +++ b/common/EQStreamProxy.cpp @@ -6,9 +6,9 @@ EQStreamProxy::EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes) -: m_stream(stream), - m_structs(structs), - m_opcodes(opcodes) +: m_stream(stream), + m_structs(structs), + m_opcodes(opcodes) { stream = nullptr; //take the stream. m_stream->SetOpcodeManager(m_opcodes); @@ -30,7 +30,7 @@ const EQClientVersion EQStreamProxy::ClientVersion() const void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) { if(p == nullptr) return; - + EQApplicationPacket *newp = p->Copy(); FastQueuePacket(&newp, ack_req); } @@ -45,7 +45,7 @@ EQApplicationPacket *EQStreamProxy::PopPacket() { EQApplicationPacket *pack = m_stream->PopPacket(); if(pack == nullptr) return(nullptr); - + //pass this packet through the struct strategy. m_structs->Decode(pack); return(pack); diff --git a/common/EQStreamProxy.h b/common/EQStreamProxy.h index d2266ab9c..cecdf9f38 100644 --- a/common/EQStreamProxy.h +++ b/common/EQStreamProxy.h @@ -15,7 +15,7 @@ public: //takes ownership of the stream. EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes); virtual ~EQStreamProxy(); - + //EQStreamInterface: virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req=true); virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true); @@ -28,28 +28,19 @@ public: virtual bool CheckState(EQStreamState state); virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + virtual const uint32 GetBytesSent() const; virtual const uint32 GetBytesRecieved() const; virtual const uint32 GetBytesSentPerSecond() const; virtual const uint32 GetBytesRecvPerSecond() const; protected: - EQStream *const m_stream; //we own this stream 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. + OpcodeManager **const m_opcodes; //we do not own this object. }; - - - - - - - - #endif /*EQSTREAMPROXY_H_*/ - diff --git a/common/EmuTCPConnection.cpp b/common/EmuTCPConnection.cpp index a4108b0bb..b3f044363 100644 --- a/common/EmuTCPConnection.cpp +++ b/common/EmuTCPConnection.cpp @@ -1,47 +1,27 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 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 + 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. + 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 + 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. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ +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" @@ -71,9 +51,9 @@ using namespace std; //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) +: TCPConnection(ID, in_socket, irIP, irPort), + keepalive_timer(SERVER_TIMEOUT), + timeout_timer(SERVER_TIMEOUT * 2) { id = 0; Server = nullptr; @@ -92,14 +72,14 @@ EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_s 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) +: TCPConnection(), + keepalive_timer(SERVER_TIMEOUT), + timeout_timer(SERVER_TIMEOUT * 2) { Server = iRelayServer; if (Server) @@ -119,9 +99,9 @@ EmuTCPConnection::EmuTCPConnection(bool iOldFormat, EmuTCPServer* iRelayServer, //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) +: TCPConnection(ID, 0, irIP, irPort), + keepalive_timer(SERVER_TIMEOUT), + timeout_timer(SERVER_TIMEOUT * 2) { Server = iServer; RelayLink = iRelayLink; @@ -141,7 +121,6 @@ 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) { @@ -246,7 +225,7 @@ bool EmuTCPConnection::SendPacket(EmuTCPNetPacket_Struct* tnps) { return false; if (GetMode() != modePacket) return false; - + LockMutex lock(&MState); eTCPMode tmp = GetMode(); if (tmp == modeTransition) { @@ -391,13 +370,13 @@ bool EmuTCPConnection::LineOutQueuePush(char* line) { } } - + return(TCPConnection::LineOutQueuePush(line)); } void EmuTCPConnection::Disconnect(bool iSendRelayDisconnect) { TCPConnection::Disconnect(); - + if (RelayLink) { RelayLink->RemoveRelay(this, iSendRelayDisconnect); RelayLink = 0; @@ -407,7 +386,7 @@ void EmuTCPConnection::Disconnect(bool iSendRelayDisconnect) { bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) { if(!TCPConnection::ConnectIP(irIP, irPort, errbuf)) return(false); - + MSendQueue.lock(); #ifdef MINILOGIN TCPMode = modePacket; @@ -453,27 +432,26 @@ bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) { } #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; @@ -810,7 +788,7 @@ 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()) { @@ -820,9 +798,9 @@ bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) { #if TCPN_DEBUG >= 5 cout << "Sending TCP keepalive packet. (timeout=" << timeout_timer.GetRemainingTime() << " remaining)" << endl; #endif - } - - return(true); + } + + return(true); } bool EmuTCPConnection::RecvData(char* errbuf) { @@ -832,24 +810,13 @@ bool EmuTCPConnection::RecvData(char* errbuf) { 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); } - - - - - - - - - - - diff --git a/common/EmuTCPConnection.h b/common/EmuTCPConnection.h index 8d567154d..ff7dd8995 100644 --- a/common/EmuTCPConnection.h +++ b/common/EmuTCPConnection.h @@ -31,67 +31,67 @@ 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); } - + 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 InModeQueue; - + //output queue... MyQueue OutQueue; Mutex MOutQueueLock; diff --git a/common/EmuTCPServer.cpp b/common/EmuTCPServer.cpp index 362e462af..3549abacd 100644 --- a/common/EmuTCPServer.cpp +++ b/common/EmuTCPServer.cpp @@ -1,14 +1,10 @@ - - - - #include "debug.h" #include "EmuTCPServer.h" #include "EmuTCPConnection.h" EmuTCPServer::EmuTCPServer(uint16 iPort, bool iOldFormat) -: TCPServer(iPort), - pOldFormat(iOldFormat) +: TCPServer(iPort), + pOldFormat(iOldFormat) { } @@ -83,14 +79,3 @@ EmuTCPConnection *EmuTCPServer::FindConnection(uint32 iID) { return(nullptr); } - - - - - - - - - - - diff --git a/common/Item.cpp b/common/Item.cpp index 023f341e9..0a05d8bff 100644 --- a/common/Item.cpp +++ b/common/Item.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + 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 - the Free Software Foundation; version 2 of the License. + 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 + 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. + 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 + 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 @@ -42,7 +42,7 @@ int32 NextItemInstSerialNumber = 1; static inline int32 GetNextItemInstSerialNumber() { - // The Bazaar relies on each item a client has up for Trade having a unique + // The Bazaar relies on each item a client has up for Trade having a unique // identifier. This 'SerialNumber' is sent in Serialized item packets and // is used in Bazaar packets to identify the item a player is buying or inspecting. // @@ -103,8 +103,8 @@ ItemInstQueue::~ItemInstQueue() { Inventory::~Inventory() { map::iterator cur,end; - - + + cur = m_worn.begin(); end = m_worn.end(); for(; cur != end; cur++) { @@ -112,7 +112,7 @@ Inventory::~Inventory() { safe_delete(tmp); } m_worn.clear(); - + cur = m_inv.begin(); end = m_inv.end(); for(; cur != end; cur++) { @@ -120,7 +120,7 @@ Inventory::~Inventory() { safe_delete(tmp); } m_inv.clear(); - + cur = m_bank.begin(); end = m_bank.end(); for(; cur != end; cur++) { @@ -128,7 +128,7 @@ Inventory::~Inventory() { safe_delete(tmp); } m_bank.clear(); - + cur = m_shbank.begin(); end = m_shbank.end(); for(; cur != end; cur++) { @@ -136,7 +136,7 @@ Inventory::~Inventory() { safe_delete(tmp); } m_shbank.clear(); - + cur = m_trade.begin(); end = m_trade.end(); for(; cur != end; cur++) { @@ -163,21 +163,21 @@ ItemInst::ItemInst(const ItemInst& copy) for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); it++) { ItemInst* inst_old = it->second; ItemInst* inst_new = nullptr; - + if (inst_old) { inst_new = inst_old->Clone(); } - + if (inst_new != nullptr) { m_contents[it->first] = inst_new; } } - std::map::const_iterator iter; - for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); iter++) { - m_custom_data[iter->first] = iter->second; - } + std::map::const_iterator iter; + for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); iter++) { + m_custom_data[iter->first] = iter->second; + } m_SerialNumber = copy.m_SerialNumber; - m_custom_data = copy.m_custom_data; + m_custom_data = copy.m_custom_data; } // Clean up container contents @@ -200,11 +200,11 @@ bool ItemInst::IsType(ItemClass item_class) const { // Check usage type if ((m_use_type == ItemUseWorldContainer) && (item_class == ItemClassContainer)) - + return true; if (!m_item) return false; - + return (m_item->ItemClass == item_class); } @@ -229,14 +229,14 @@ bool ItemInst::IsEquipable(int16 slot_id) const { if (!m_item) return false; - + if(slot_id == 9999) { slot_id = 22; uint32 slot_mask = (1 << slot_id); if (slot_mask & m_item->Slots) return true; } - + if (slot_id < 22) { uint32 slot_mask = (1 << slot_id); if (slot_mask & m_item->Slots) @@ -316,12 +316,12 @@ bool ItemInst::IsAmmo() const { if(!m_item) return false; if((m_item->ItemType == ItemTypeArrow) || - (m_item->ItemType == ItemTypeThrowing) || - (m_item->ItemType == ItemTypeThrowingv2)) - return true; + (m_item->ItemType == ItemTypeThrowing) || + (m_item->ItemType == ItemTypeThrowingv2)) + return true; return false; - + } // Retrieve augment inside item @@ -329,7 +329,7 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const { if (m_item->ItemClass == ItemClassCommon) return GetItem(slot); - + return nullptr; } @@ -376,7 +376,7 @@ ItemInst* ItemInst::GetItem(uint8 index) const ItemInst* inst = it->second; return inst; } - + return nullptr; } @@ -384,8 +384,8 @@ void ItemInst::PutItem(uint8 index, const ItemInst& inst) { // Clean up item already in slot (if exists) DeleteItem(index); - - + + // Delegate to internal method _PutItem(index, inst.Clone()); } @@ -423,7 +423,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) const Item_Struct* item = inst->GetItem(); del = cur; cur++; - + switch(is_nodrop) { case byFlagSet: if (item->NoDrop == 0) { @@ -440,7 +440,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) default: break; } - + switch(is_norent) { case byFlagSet: if (item->NoRent == 0) { @@ -470,7 +470,7 @@ ItemInst* ItemInst::PopItem(uint8 index) m_contents.erase(index); return inst; } - + // Return pointer that needs to be deleted (or otherwise managed) return nullptr; } @@ -492,7 +492,7 @@ ItemInst* ItemInstQueue::pop() { if (m_list.size() == 0) return nullptr; - + ItemInst* inst = m_list.front(); m_list.pop_front(); return inst; @@ -509,13 +509,13 @@ ItemInst* Inventory::GetItem(int16 slot_id) const { _CP(Inventory_GetItem); ItemInst* result = nullptr; - + // Cursor if (slot_id == SLOT_CURSOR) { // Cursor slot result = m_cursor.peek_front(); } - + // Non bag slots else if (slot_id>=3000 && slot_id<=3007) { // Trade slots @@ -537,7 +537,7 @@ ItemInst* Inventory::GetItem(int16 slot_id) const // Equippable slots (on body) result = _GetItem(m_worn, slot_id); } - + // Inner bag slots else if (slot_id>=3031 && slot_id<=3110) { // Trade bag slots @@ -574,69 +574,69 @@ ItemInst* Inventory::GetItem(int16 slot_id) const result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } - + return result; } std::string ItemInst::GetCustomDataString() const { - std::string ret_val; - map::const_iterator iter = m_custom_data.begin(); - while(iter != m_custom_data.end()) { - if(ret_val.length() > 0) { - ret_val += "^"; - } - ret_val += iter->first; - ret_val += "^"; - ret_val += iter->second; - iter++; + std::string ret_val; + map::const_iterator iter = m_custom_data.begin(); + while(iter != m_custom_data.end()) { + if(ret_val.length() > 0) { + ret_val += "^"; + } + ret_val += iter->first; + ret_val += "^"; + ret_val += iter->second; + iter++; - if(ret_val.length() > 0) { - ret_val += "^"; - } - } - return ret_val; + if(ret_val.length() > 0) { + ret_val += "^"; + } + } + return ret_val; } void ItemInst::SetCustomData(std::string identifier, std::string value) { - DeleteCustomData(identifier); - m_custom_data[identifier] = value; + DeleteCustomData(identifier); + m_custom_data[identifier] = value; } void ItemInst::SetCustomData(std::string identifier, int value) { - DeleteCustomData(identifier); - std::stringstream ss; - ss << value; - m_custom_data[identifier] = ss.str(); + DeleteCustomData(identifier); + std::stringstream ss; + ss << value; + m_custom_data[identifier] = ss.str(); } void ItemInst::SetCustomData(std::string identifier, float value) { - DeleteCustomData(identifier); - std::stringstream ss; - ss << value; - m_custom_data[identifier] = ss.str(); + DeleteCustomData(identifier); + std::stringstream ss; + ss << value; + m_custom_data[identifier] = ss.str(); } void ItemInst::SetCustomData(std::string identifier, bool value) { - DeleteCustomData(identifier); - std::stringstream ss; - ss << value; - m_custom_data[identifier] = ss.str(); + DeleteCustomData(identifier); + std::stringstream ss; + ss << value; + m_custom_data[identifier] = ss.str(); } void ItemInst::DeleteCustomData(std::string identifier) { - map::iterator iter = m_custom_data.find(identifier); - if(iter != m_custom_data.end()) { - m_custom_data.erase(iter); - } + map::iterator iter = m_custom_data.find(identifier); + if(iter != m_custom_data.end()) { + m_custom_data.erase(iter); + } } std::string ItemInst::GetCustomData(std::string identifier) { - map::const_iterator iter = m_custom_data.find(identifier); - if(iter != m_custom_data.end()) { - return iter->second; - } + map::const_iterator iter = m_custom_data.find(identifier); + if(iter != m_custom_data.end()) { + return iter->second; + } - return ""; + return ""; } // Retrieve item at specified position within bag @@ -656,13 +656,13 @@ int16 Inventory::PutItem(int16 slot_id, const ItemInst& inst) { // Clean up item already in slot (if exists) DeleteItem(slot_id); - + if (!inst) { // User is effectively deleting the item // in the slot, why hold a null ptr in map<>? return slot_id; } - + // Delegate to internal method return _PutItem(slot_id, inst.Clone()); } @@ -693,48 +693,48 @@ int16 Inventory::HasItem(uint32 item_id, uint8 quantity, uint8 where) { _CP(Inventory_HasItem); int16 slot_id = SLOT_INVALID; - + //Altered by Father Nitwit to support a specification of //where to search, with a default value to maintain compatibility - + // Check each inventory bucket if(where & invWhereWorn) { slot_id = _HasItem(m_worn, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWherePersonal) { slot_id = _HasItem(m_inv, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereBank) { slot_id = _HasItem(m_bank, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereSharedBank) { slot_id = _HasItem(m_shbank, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereTrading) { slot_id = _HasItem(m_trade, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereCursor) { // Check cursor queue slot_id = _HasItem(m_cursor, item_id, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + return slot_id; } @@ -743,90 +743,90 @@ int16 Inventory::HasItem(uint32 item_id, uint8 quantity, uint8 where) int16 Inventory::HasItemByUse(uint8 use, uint8 quantity, uint8 where) { int16 slot_id = SLOT_INVALID; - + // Check each inventory bucket if(where & invWhereWorn) { slot_id = _HasItemByUse(m_worn, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWherePersonal) { slot_id = _HasItemByUse(m_inv, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereBank) { slot_id = _HasItemByUse(m_bank, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereSharedBank) { slot_id = _HasItemByUse(m_shbank, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereTrading) { slot_id = _HasItemByUse(m_trade, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereCursor) { // Check cursor queue slot_id = _HasItemByUse(m_cursor, use, quantity); if (slot_id != SLOT_INVALID) return slot_id; } - + return slot_id; } -int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where) +int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where) { int16 slot_id = SLOT_INVALID; - + // Check each inventory bucket if(where & invWhereWorn) { slot_id = _HasItemByLoreGroup(m_worn, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWherePersonal) { slot_id = _HasItemByLoreGroup(m_inv, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereBank) { slot_id = _HasItemByLoreGroup(m_bank, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereSharedBank) { slot_id = _HasItemByLoreGroup(m_shbank, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereTrading) { slot_id = _HasItemByLoreGroup(m_trade, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + if(where & invWhereCursor) { // Check cursor queue slot_id = _HasItemByLoreGroup(m_cursor, loregroup); if (slot_id != SLOT_INVALID) return slot_id; } - + return slot_id; } @@ -835,13 +835,13 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { if(ItemToTry->Stackable) { for(int16 i = 22; i <= 29; i++) { - + ItemInst* InvItem = GetItem(i); if(InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); - + if(Quantity <= ChargeSlotsLeft) return true; @@ -857,10 +857,10 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { InvItem = GetItem(BaseSlotID + BagSlot); if(InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && - (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { + (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); - + if(Quantity <= ChargeSlotsLeft) return true; @@ -930,7 +930,7 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) { // Pop item out of inventory map (or queue) ItemInst* item_to_delete = PopItem(slot_id); - + // Determine if object should be fully deleted, or // just a quantity of charges of the item can be deleted if (item_to_delete && (quantity > 0)) { @@ -940,30 +940,30 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) // If there are no charges left on the item, if(item_to_delete->GetCharges() <= 0) { // If the item is stackable (e.g arrows), or - // the item is not stackable, and is not a charged item, or is expendable, delete it + // the item is not stackable, and is not a charged item, or is expendable, delete it if(item_to_delete->IsStackable() || - (!item_to_delete->IsStackable() && - ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable()))) { + (!item_to_delete->IsStackable() && + ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable()))) { // Item can now be destroyed safe_delete(item_to_delete); return true; } } - // Charges still exist, or it is a charged item that is not expendable. Put back into inventory + // Charges still exist, or it is a charged item that is not expendable. Put back into inventory _PutItem(slot_id, item_to_delete); return false; } - + safe_delete(item_to_delete); return true; - + } // Checks All items in a bag for No Drop bool Inventory::CheckNoDrop(int16 slot_id) { - ItemInst* inst = GetItem(slot_id); + ItemInst* inst = GetItem(slot_id); if (!inst) return false; if (!inst->GetItem()->NoDrop) return true; if (inst->GetItem()->ItemClass == 1) { @@ -980,7 +980,7 @@ bool Inventory::CheckNoDrop(int16 slot_id) { ItemInst* Inventory::PopItem(int16 slot_id) { ItemInst* p = nullptr; - + if (slot_id==SLOT_CURSOR) { // Cursor p = m_cursor.pop(); } @@ -1011,7 +1011,7 @@ ItemInst* Inventory::PopItem(int16 slot_id) p = baginst->PopItem(Inventory::CalcBagIdx(slot_id)); } } - + // Return pointer that needs to be deleted (or otherwise managed) return p; } @@ -1026,12 +1026,12 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo // Found available slot in personal inventory return i; } - + if (!for_bag) { for (int16 i=22; i<=29; i++) { const ItemInst* inst = GetItem(i); - if (inst && inst->IsType(ItemClassContainer) - && inst->GetItem()->BagSize >= min_size) + if (inst && inst->IsType(ItemClassContainer) + && inst->GetItem()->BagSize >= min_size) { if(inst->GetItem()->BagType == bagTypeQuiver && inst->GetItem()->ItemType != ItemTypeArrow) { @@ -1050,12 +1050,12 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo } } } - + if (try_cursor) // Always room on cursor (it's a queue) // (we may wish to cap this in the future) return SLOT_CURSOR; - + // No available slots return SLOT_INVALID; } @@ -1064,7 +1064,7 @@ void Inventory::dumpInventory() { iter_inst it; iter_contents itb; ItemInst* inst = nullptr; - + // Check item: After failed checks, check bag contents (if bag) printf("Worn items:\n"); for (it=m_worn.begin(); it!=m_worn.end(); it++) { @@ -1072,9 +1072,9 @@ void Inventory::dumpInventory() { it->first; if(!inst || !inst->GetItem()) continue; - + printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { for (itb=inst->_begin(); itb!=inst->_end(); itb++) { @@ -1086,16 +1086,16 @@ void Inventory::dumpInventory() { } } } - + printf("Inventory items:\n"); for (it=m_inv.begin(); it!=m_inv.end(); it++) { inst = it->second; it->first; if(!inst || !inst->GetItem()) continue; - + printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { for (itb=inst->_begin(); itb!=inst->_end(); itb++) { @@ -1104,57 +1104,57 @@ void Inventory::dumpInventory() { continue; printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges()); - + } } } - + printf("Bank items:\n"); for (it=m_bank.begin(); it!=m_bank.end(); it++) { inst = it->second; it->first; if(!inst || !inst->GetItem()) continue; - + printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if(!baginst || !baginst->GetItem()) continue; printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges()); - + } } } - + printf("Shared Bank items:\n"); for (it=m_shbank.begin(); it!=m_shbank.end(); it++) { inst = it->second; it->first; if(!inst || !inst->GetItem()) continue; - + printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if(!baginst || !baginst->GetItem()) continue; printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges()); - + } } } - + printf("\n"); fflush(stdout); } @@ -1166,7 +1166,7 @@ ItemInst* Inventory::_GetItem(const map& bucket, int16 slot_id if (it != bucket.end()) { return it->second; } - + // Not found! return nullptr; } @@ -1181,9 +1181,9 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) PopItem(slot_id); return slot_id; } - + int16 result = SLOT_INVALID; - + if (slot_id==SLOT_CURSOR) { // Cursor // Replace current item on cursor, if exists m_cursor.pop(); // no memory delete, clients of this function know what they are doing @@ -1218,12 +1218,12 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) result = slot_id; } } - + if (result == SLOT_INVALID) { LogFile->write(EQEMuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i)", slot_id); safe_delete(inst); // Slot not found, clean up } - + return result; } @@ -1234,7 +1234,7 @@ int16 Inventory::_HasItem(map& bucket, uint32 item_id, uint8 q iter_contents itb; ItemInst* inst = nullptr; uint8 quantity_found = 0; - + // Check item: After failed checks, check bag contents (if bag) for (it=bucket.begin(); it!=bucket.end(); it++) { inst = it->second; @@ -1244,15 +1244,15 @@ int16 Inventory::_HasItem(map& bucket, uint32 item_id, uint8 q if (quantity_found >= quantity) return it->first; } - + for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { - if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) return SLOT_AUGMENT; // Only one augment per slot. } } // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if (baginst->GetID() == item_id) { @@ -1261,13 +1261,13 @@ int16 Inventory::_HasItem(map& bucket, uint32 item_id, uint8 q return Inventory::CalcSlotId(it->first, itb->first); } for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { - if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) return SLOT_AUGMENT; // Only one augment per slot. } } } } - + // Not found return SLOT_INVALID; } @@ -1278,7 +1278,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) iter_queue it; iter_contents itb; uint8 quantity_found = 0; - + // Read-only iteration of queue for (it=iqueue.begin(); it!=iqueue.end(); it++) { ItemInst* inst = *it; @@ -1290,13 +1290,13 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) return SLOT_CURSOR; } for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { - if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) return SLOT_AUGMENT; // Only one augment per slot. } } // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if (baginst->GetID() == item_id) { @@ -1305,14 +1305,14 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) return Inventory::CalcSlotId(SLOT_CURSOR, itb->first); } for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { - if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) return SLOT_AUGMENT; // Only one augment per slot. } } } } - + // Not found return SLOT_INVALID; } @@ -1324,7 +1324,7 @@ int16 Inventory::_HasItemByUse(map& bucket, uint8 use, uint8 q iter_contents itb; ItemInst* inst = nullptr; uint8 quantity_found = 0; - + // Check item: After failed checks, check bag contents (if bag) for (it=bucket.begin(); it!=bucket.end(); it++) { inst = it->second; @@ -1333,10 +1333,10 @@ int16 Inventory::_HasItemByUse(map& bucket, uint8 use, uint8 q if (quantity_found >= quantity) return it->first; } - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->ItemType == use) { @@ -1347,7 +1347,7 @@ int16 Inventory::_HasItemByUse(map& bucket, uint8 use, uint8 q } } } - + // Not found return SLOT_INVALID; } @@ -1358,7 +1358,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) iter_queue it; iter_contents itb; uint8 quantity_found = 0; - + // Read-only iteration of queue for (it=iqueue.begin(); it!=iqueue.end(); it++) { ItemInst* inst = *it; @@ -1367,10 +1367,10 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) if (quantity_found >= quantity) return SLOT_CURSOR; } - + // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->ItemType == use) { @@ -1381,24 +1381,24 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) } } } - + // Not found return SLOT_INVALID; } -int16 Inventory::_HasItemByLoreGroup(map& bucket, uint32 loregroup) +int16 Inventory::_HasItemByLoreGroup(map& bucket, uint32 loregroup) { iter_inst it; iter_contents itb; ItemInst* inst = nullptr; - + // Check item: After failed checks, check bag contents (if bag) for (it=bucket.begin(); it!=bucket.end(); it++) { inst = it->second; if (inst) { - if (inst->GetItem()->LoreGroup == loregroup) + if (inst->GetItem()->LoreGroup == loregroup) return it->first; - + ItemInst* Aug; for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { Aug = inst->GetAugment(i); @@ -1408,12 +1408,12 @@ int16 Inventory::_HasItemByLoreGroup(map& bucket, uint32 loreg } // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; - if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) + if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(it->first, itb->first); - + ItemInst* Aug2; for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { Aug2 = baginst->GetAugment(i); @@ -1423,7 +1423,7 @@ int16 Inventory::_HasItemByLoreGroup(map& bucket, uint32 loreg } } } - + // Not found return SLOT_INVALID; } @@ -1433,15 +1433,15 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) { iter_queue it; iter_contents itb; - + // Read-only iteration of queue for (it=iqueue.begin(); it!=iqueue.end(); it++) { ItemInst* inst = *it; if (inst) { - if (inst->GetItem()->LoreGroup == loregroup) + if (inst->GetItem()->LoreGroup == loregroup) return SLOT_CURSOR; - + ItemInst* Aug; for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { Aug = inst->GetAugment(i); @@ -1451,13 +1451,13 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) } // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - + for (itb=inst->_begin(); itb!=inst->_end(); itb++) { ItemInst* baginst = itb->second; - if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) + if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(SLOT_CURSOR, itb->first); - - + + ItemInst* Aug2; for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) { Aug2 = baginst->GetAugment(i); @@ -1468,7 +1468,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) } } } - + // Not found return SLOT_INVALID; } @@ -1513,7 +1513,7 @@ bool ItemInst::IsNoneEmptyContainer() for(int i = 0; i < m_item->BagSlots; ++i) if(GetItem(i)) return true; - + return false; } @@ -1522,7 +1522,7 @@ bool ItemInst::IsAugmented() for(int i = 0; i < MAX_AUGMENT_SLOTS; ++i) if (GetAugmentItemID(i)) return true; - + return false; } @@ -1532,9 +1532,9 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) if (!Inventory::SupportsContainers(bagslot_id)) { return SLOT_INVALID; } - + int16 slot_id = SLOT_INVALID; - + if (bagslot_id==SLOT_CURSOR || bagslot_id==8000) // Cursor slot_id = IDX_CURSOR_BAG + bagidx; else if (bagslot_id>=22 && bagslot_id<=29) // Inventory slots @@ -1545,7 +1545,7 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) slot_id = IDX_SHBANK_BAG + (bagslot_id-2500)*MAX_ITEMS_PER_BAG + bagidx; else if (bagslot_id>=3000 && bagslot_id<=3007) // Trade window slots slot_id = IDX_TRADE_BAG + (bagslot_id-3000)*MAX_ITEMS_PER_BAG + bagidx; - + return slot_id; } @@ -1553,7 +1553,7 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) int16 Inventory::CalcSlotId(int16 slot_id) { int16 parent_slot_id = SLOT_INVALID; - + if (slot_id>=251 && slot_id<=330) parent_slot_id = IDX_INV + (slot_id-251) / MAX_ITEMS_PER_BAG; else if (slot_id>=331 && slot_id<=340) @@ -1566,14 +1566,14 @@ int16 Inventory::CalcSlotId(int16 slot_id) parent_slot_id = IDX_SHBANK + (slot_id-2531) / MAX_ITEMS_PER_BAG; else if (slot_id>=3100 && slot_id<=3179) parent_slot_id = IDX_TRADE + (slot_id-3100) / MAX_ITEMS_PER_BAG; - + return parent_slot_id; } uint8 Inventory::CalcBagIdx(int16 slot_id) { uint8 index = 0; - + if (slot_id>=251 && slot_id<=330) index = (slot_id-251) % MAX_ITEMS_PER_BAG; else if (slot_id>=331 && slot_id<=340) @@ -1588,7 +1588,7 @@ uint8 Inventory::CalcBagIdx(int16 slot_id) index = (slot_id-3100) % MAX_ITEMS_PER_BAG; else if (slot_id>=4000 && slot_id<=4009) index = (slot_id-4000) % MAX_ITEMS_PER_BAG; - + return index; } @@ -1691,19 +1691,19 @@ EvoItemInst::EvoItemInst(const EvoItemInst ©) { for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); it++) { ItemInst* inst_old = it->second; ItemInst* inst_new = nullptr; - + if (inst_old) { inst_new = inst_old->Clone(); } - + if (inst_new != nullptr) { m_contents[it->first] = inst_new; } } - std::map::const_iterator iter; - for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); iter++) { - m_custom_data[iter->first] = iter->second; - } + std::map::const_iterator iter; + for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); iter++) { + m_custom_data[iter->first] = iter->second; + } m_SerialNumber = copy.m_SerialNumber; m_exp = copy.m_exp; m_evolveLvl = copy.m_evolveLvl; @@ -1717,7 +1717,7 @@ EvoItemInst::EvoItemInst(const EvoItemInst ©) { EvoItemInst::EvoItemInst(const ItemInst &basecopy) { EvoItemInst* copy = (EvoItemInst*)&basecopy; - + m_use_type=copy->m_use_type; m_item=copy->m_item; m_charges=copy->m_charges; @@ -1732,20 +1732,20 @@ EvoItemInst::EvoItemInst(const ItemInst &basecopy) { for (it=copy->m_contents.begin(); it!=copy->m_contents.end(); it++) { ItemInst* inst_old = it->second; ItemInst* inst_new = nullptr; - + if (inst_old) { inst_new = inst_old->Clone(); } - + if (inst_new != nullptr) { m_contents[it->first] = inst_new; } } - std::map::const_iterator iter; - for (iter = copy->m_custom_data.begin(); iter != copy->m_custom_data.end(); iter++) { - m_custom_data[iter->first] = iter->second; - } + std::map::const_iterator iter; + for (iter = copy->m_custom_data.begin(); iter != copy->m_custom_data.end(); iter++) { + m_custom_data[iter->first] = iter->second; + } m_SerialNumber = copy->m_SerialNumber; m_exp = 0; m_evolveLvl = 0; @@ -1775,7 +1775,7 @@ EvoItemInst::EvoItemInst(const Item_Struct* item, int16 charges) { } EvoItemInst::~EvoItemInst() { - safe_delete(m_scaledItem); + safe_delete(m_scaledItem); } EvoItemInst* EvoItemInst::Clone() const { @@ -1812,7 +1812,7 @@ void EvoItemInst::Initialize(SharedDatabase *db) { void EvoItemInst::ScaleItem() { // free memory from any previously scaled item data safe_delete(m_scaledItem); - + m_scaledItem = new Item_Struct(*m_item); float Mult = (float)(GetExp())/10000; // scaling is determined by exp, with 10,000 being full stats @@ -1829,7 +1829,7 @@ void EvoItemInst::ScaleItem() { m_scaledItem->DR = (int8)((float)m_item->DR*Mult); m_scaledItem->CR = (int8)((float)m_item->CR*Mult); m_scaledItem->FR = (int8)((float)m_item->FR*Mult); - + m_scaledItem->HP = (int32)((float)m_item->HP*Mult); m_scaledItem->Mana = (int32)((float)m_item->Mana*Mult); m_scaledItem->AC = (int32)((float)m_item->AC*Mult); @@ -1862,8 +1862,8 @@ void EvoItemInst::ScaleItem() { m_scaledItem->EnduranceRegen = (uint32)((float)m_item->EnduranceRegen*Mult); m_scaledItem->Haste = (uint32)((float)m_item->Haste*Mult); m_scaledItem->DamageShield = (uint32)((float)m_item->DamageShield*Mult); - - + + m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself. } @@ -1874,14 +1874,14 @@ bool EvoItemInst::EvolveOnAllKills() const { int8 EvoItemInst::GetMaxEvolveLvl() const { if(m_evolveInfo) return m_evolveInfo->MaxLvl; - else + else return 0; } uint32 EvoItemInst::GetKillsNeeded(uint8 currentlevel) { uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero. - if (m_evolveInfo) - if (currentlevel != m_evolveInfo->MaxLvl) + if (m_evolveInfo) + if (currentlevel != m_evolveInfo->MaxLvl) kills = m_evolveInfo->LvlKills[currentlevel-1]; if (kills == 0) @@ -1913,7 +1913,7 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const { bool IsRace = false; bool IsClass = false; - + uint32 Classes_ = Classes; uint32 Races_ = Races; @@ -1924,9 +1924,9 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const { if (Classes_ % 2 == 1) { - if (CurrentClass == Class_) + if (CurrentClass == Class_) { - IsClass = true; + IsClass = true; break; } } @@ -1939,11 +1939,11 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const { if (Races_ % 2 == 1) { - if (CurrentRace == Race_) + if (CurrentRace == Race_) { - IsRace = true; + IsRace = true; break; - } + } } Races_ >>= 1; } diff --git a/common/Item.h b/common/Item.h index 4b765221d..c5d43f25e 100644 --- a/common/Item.h +++ b/common/Item.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + 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 - the Free Software Foundation; version 2 of the License. + 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 + 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. + 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 + 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 */ // @merth notes: @@ -86,7 +86,7 @@ typedef enum { //FatherNitwit: location bits for searching specific //places with HasItem() and HasItemByUse() enum { - invWhereWorn = 0x01, + invWhereWorn = 0x01, invWherePersonal = 0x02, //in the character's inventory invWhereBank = 0x04, invWhereSharedBank = 0x08, @@ -105,23 +105,23 @@ public: ///////////////////////// // Public Methods ///////////////////////// - + inline iter_queue begin() { return m_list.begin(); } inline iter_queue end() { return m_list.end(); } - + void push(ItemInst* inst); void push_front(ItemInst* inst); ItemInst* pop(); ItemInst* peek_front() const; - inline int size() { return static_cast(m_list.size()); } - + inline int size() { return static_cast(m_list.size()); } + protected: ///////////////////////// // Protected Members ///////////////////////// - + list m_list; - + }; // ######################################## @@ -134,9 +134,9 @@ public: /////////////////////////////// // Public Methods /////////////////////////////// - + virtual ~Inventory(); - + // Retrieve a writeable item at specified slot ItemInst* GetItem(int16 slot_id) const; ItemInst* GetItem(int16 slot_id, uint8 bagidx) const; @@ -144,16 +144,16 @@ public: inline iter_queue cursor_begin() { return m_cursor.begin(); } inline iter_queue cursor_end() { return m_cursor.end(); } inline bool CursorEmpty() { return (m_cursor.size() == 0); } - + // Retrieve a read-only item from inventory inline const ItemInst* operator[](int16 slot_id) const { return GetItem(slot_id); } - + // Add item to inventory int16 PutItem(int16 slot_id, const ItemInst& inst); // Add item to cursor queue int16 PushCursor(const ItemInst& inst); - + // Swap items in inventory bool SwapItem(int16 slot_a, int16 slot_b); @@ -162,17 +162,17 @@ public: // Checks All items in a bag for No Drop bool CheckNoDrop(int16 slot_id); - + // Remove item from inventory (and take control of memory) ItemInst* PopItem(int16 slot_id); - + // Check whether item exists in inventory // where argument specifies OR'd list of invWhere constants to look int16 HasItem(uint32 item_id, uint8 quantity=0, uint8 where=0xFF); // Check whether there is space for the specified number of the specified item. bool HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity); - + // Check whether item exists in inventory // where argument specifies OR'd list of invWhere constants to look int16 HasItemByUse(uint8 use, uint8 quantity=0, uint8 where=0xFF); @@ -180,10 +180,10 @@ public: // Check whether item exists in inventory // where argument specifies OR'd list of invWhere constants to look int16 HasItemByLoreGroup(uint32 loregroup, uint8 where=0xFF); - + // Locate an available inventory slot int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false); - + // Calculate slot_id for an item within a bag static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag @@ -195,25 +195,25 @@ public: // Test whether a given slot can support a container item static bool SupportsContainers(int16 slot_id); - + void dumpInventory(); void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value); - std::string GetCustomItemData(int16 slot_id, std::string identifier); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value); + std::string GetCustomItemData(int16 slot_id, std::string identifier); protected: /////////////////////////////// // Protected Methods /////////////////////////////// - + // Retrieves item within an inventory bucket ItemInst* _GetItem(const map& bucket, int16 slot_id) const; - + // Private "put" item into bucket, without regard for what is currently in bucket int16 _PutItem(int16 slot_id, ItemInst* inst); - + // Checks an inventory bucket for a particular item int16 _HasItem(map& bucket, uint32 item_id, uint8 quantity); int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity); @@ -221,8 +221,8 @@ protected: int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity); int16 _HasItemByLoreGroup(map& bucket, uint32 loregroup); int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup); - - + + // Player inventory map m_worn; // Items worn by character map m_inv; // Items in character personal inventory @@ -245,12 +245,12 @@ public: ///////////////////////// // Methods ///////////////////////// - + // Constructors/Destructor ItemInst(const Item_Struct* item = nullptr, int16 charges = 0); - + ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0); - + ItemInst(ItemUseType use_type) { m_use_type = use_type; m_item = nullptr; @@ -262,19 +262,19 @@ public: } ItemInst(const ItemInst& copy); - + virtual ~ItemInst(); - + // Query item type virtual bool IsType(ItemClass item_class) const; - + // Can item be stacked? virtual bool IsStackable() const; // Can item be equipped by/at? virtual bool IsEquipable(uint16 race, uint16 class_) const; virtual bool IsEquipable(int16 slot_id) const; - + // // Augements // @@ -322,13 +322,13 @@ public: const uint32 GetItemScriptID() const { return m_item->ScriptFileID; } virtual const Item_Struct* GetItem() const { return m_item; } void SetItem(const Item_Struct* item) { m_item = item; } - + int16 GetCharges() const { return m_charges; } void SetCharges(int16 charges) { m_charges = charges; } - + uint32 GetPrice() const { return m_price; } void SetPrice(uint32 price) { m_price = price; } - + void SetColor(uint32 color) { m_color = color; } uint32 GetColor() const { return m_color; } @@ -339,7 +339,7 @@ public: void SetMerchantCount(int32 count) { m_merchantcount = count; } int16 GetCurrentSlot() const { return m_currentslot; } - void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; } + void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; } @@ -348,24 +348,24 @@ public: bool IsInstNoDrop() const { return m_instnodrop; } void SetInstNoDrop(bool flag) { m_instnodrop=flag; } - std::string GetCustomDataString() const; - void SetCustomData(std::string identifier, std::string value); - void SetCustomData(std::string identifier, int value); - void SetCustomData(std::string identifier, float value); - void SetCustomData(std::string identifier, bool value); - std::string GetCustomData(std::string identifier); - void DeleteCustomData(std::string identifier); + std::string GetCustomDataString() const; + void SetCustomData(std::string identifier, std::string value); + void SetCustomData(std::string identifier, int value); + void SetCustomData(std::string identifier, float value); + void SetCustomData(std::string identifier, bool value); + std::string GetCustomData(std::string identifier); + void DeleteCustomData(std::string identifier); // Allows treatment of this object as though it were a pointer to m_item operator bool() const { return (m_item != nullptr); } - + // Compare inner Item_Struct of two ItemInst objects bool operator==(const ItemInst& right) const { return (this->m_item == right.m_item); } bool operator!=(const ItemInst& right) const { return (this->m_item != right.m_item); } - + // Clone current item virtual ItemInst* Clone() const; - + bool IsSlotAllowed(int16 slot_id) const; virtual bool IsScaling() const { return false; } @@ -379,14 +379,14 @@ protected: ////////////////////////// // Protected Members ////////////////////////// - iter_contents _begin() { return m_contents.begin(); } - iter_contents _end() { return m_contents.end(); } + iter_contents _begin() { return m_contents.begin(); } + iter_contents _end() { return m_contents.end(); } friend class Inventory; - - + + void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; } - + ItemUseType m_use_type; // Usage type for item const Item_Struct* m_item; // Ptr to item data int16 m_charges; // # of charges for chargeable items @@ -394,13 +394,13 @@ protected: uint32 m_color; uint32 m_merchantslot; int16 m_currentslot; - bool m_instnodrop; + bool m_instnodrop; int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar. // // Items inside of this item (augs or contents); map m_contents; // Zero-based index: min=0, max=9 - map m_custom_data; + map m_custom_data; }; class EvoItemInst: public ItemInst { @@ -410,7 +410,7 @@ public: EvoItemInst(const ItemInst& copy); EvoItemInst(const Item_Struct* item = nullptr, int16 charges = 0); ~EvoItemInst(); - + // accessors... a lot of these are for evolving items (not complete yet) bool IsScaling() const { return (m_evolveLvl == -1); } bool IsEvolving() const { return (m_evolveLvl >= 1); } @@ -420,16 +420,16 @@ public: bool IsActivated() { return m_activated; } void SetActivated(bool activated) { m_activated = activated; } int8 GetEvolveLvl() const { return m_evolveLvl; } - + EvoItemInst* Clone() const; const Item_Struct* GetItem() const; const Item_Struct* GetUnscaledItem() const; void Initialize(SharedDatabase *db = nullptr); void ScaleItem(); - bool EvolveOnAllKills() const; + bool EvolveOnAllKills() const; int8 GetMaxEvolveLvl() const; uint32 GetKillsNeeded(uint8 currentlevel); - + private: uint32 m_exp; @@ -447,7 +447,7 @@ public: uint32 FirstItem; uint8 MaxLvl; bool AllKills; - + EvolveInfo(); EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32 L3, uint32 L4, uint32 L5, uint32 L6, uint32 L7, uint32 L8, uint32 L9, uint32 L10); ~EvolveInfo(); diff --git a/common/MaxSkill.cpp b/common/MaxSkill.cpp index 5558827c2..d24ffbc91 100644 --- a/common/MaxSkill.cpp +++ b/common/MaxSkill.cpp @@ -3,7 +3,7 @@ #include "../zone/skills.h" uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level); -/* TODO: +/* TODO: Load MaxSkillTable function into ram as a really big matrix: MaxSkillTable[skillid][race][eqclass][level] @@ -31,43 +31,43 @@ uint8 MaxSkill(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { "must put one point in at GM", etc */ -uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { - uint16 r_value = 0; - - switch (skillid) { - /////////////// - // Melee Weapon/ Hand to Hand - /////////////// - case _1H_BLUNT: - case _2H_BLUNT: - case PIERCING: - case HAND_TO_HAND: - case _1H_SLASHING: - case _2H_SLASHING:{ - switch (eqclass) { - // Pure melee classes - case WARRIOR: case WARRIORGM: { - r_value = 5 + (level*5); - if ( level < 51 && r_value > 200) - r_value = 200; - if ( level > 51 && r_value > 250 ) - r_value = 250; +uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { + uint16 r_value = 0; + + switch (skillid) { + /////////////// + // Melee Weapon/ Hand to Hand + /////////////// + case _1H_BLUNT: + case _2H_BLUNT: + case PIERCING: + case HAND_TO_HAND: + case _1H_SLASHING: + case _2H_SLASHING:{ + switch (eqclass) { + // Pure melee classes + case WARRIOR: case WARRIORGM: { + r_value = 5 + (level*5); + if ( level < 51 && r_value > 200) + r_value = 200; + if ( level > 51 && r_value > 250 ) + r_value = 250; switch (skillid) { case PIERCING: { - if ( r_value > 240 ) - r_value = 240; - break; - } + if ( r_value > 240 ) + r_value = 240; + break; + } case HAND_TO_HAND: { - if ( r_value > 100 ) - r_value = 100; - break; - } + if ( r_value > 100 ) + r_value = 100; + break; + } default: - break; + break; } - break; - } + break; + } case MONK: case MONKGM: { r_value = 5 + (level*5); if ( level < 51 && r_value > 240) @@ -80,24 +80,24 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { if ( r_value > 225 && level < 51 ) r_value = 225; break; - } - case PIERCING: - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } + } + case PIERCING: + case _1H_SLASHING: + case _2H_SLASHING:{ + r_value = 0; + break; + } default: break; } - break; - } + break; + } case ROGUE: case ROGUEGM: { r_value = 5 + (level*5); if ( level > 50 ) { - if ( r_value > 250 ) - r_value = 250; - } + if ( r_value > 250 ) + r_value = 250; + } else if ( level < 51 ) { if ( r_value > 200 && skillid != PIERCING ) r_value = 200; @@ -108,226 +108,226 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { break; } default: - break; - } - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } + break; + } + } + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 100 ) + r_value = 100; + break; + } default: break; - } - break; - } + } + break; + } ////////////////////////////////////////////////////////////// - // Melee Weapon/ Hand to Hand - // Priest classes + // Melee Weapon/ Hand to Hand + // Priest classes ////////////////////////////////////////////////////////////// - case CLERIC: case CLERICGM:{ - r_value = 4 + (level*4); - if ( r_value > 175 ){ - r_value = 175; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; - break; - } + case CLERIC: case CLERICGM:{ + r_value = 4 + (level*4); + if ( r_value > 175 ){ + r_value = 175; + } + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 75 ) + r_value = 75; + break; + } case PIERCING: case _1H_SLASHING: case _2H_SLASHING: { - r_value = 0; - break; - } + r_value = 0; + break; + } default: break; - } - break; - } - case DRUID: case DRUIDGM:{ - r_value = 4 + (level*4); - if ( r_value > 175 ){ - r_value = 175; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; - } - case PIERCING: - case _2H_SLASHING:{ - r_value = 0; - break; - } + } + break; + } + case DRUID: case DRUIDGM:{ + r_value = 4 + (level*4); + if ( r_value > 175 ){ + r_value = 175; + } + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 75 ) + r_value = 75; + } + case PIERCING: + case _2H_SLASHING:{ + r_value = 0; + break; + } default: break; - } - break; - } - case SHAMAN: case SHAMANGM:{ - r_value = 4 + (level*4); - if ( r_value > 200 ){ - r_value = 200; - } + } + break; + } + case SHAMAN: case SHAMANGM:{ + r_value = 4 + (level*4); + if ( r_value > 200 ){ + r_value = 200; + } switch (skillid) { case HAND_TO_HAND: { - if ( r_value > 75 ) - r_value = 75; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } + if ( r_value > 75 ) + r_value = 75; + } + case _1H_SLASHING: + case _2H_SLASHING:{ + r_value = 0; + break; + } default: break; - } - break; + } + break; } - /////////////////////////////////////////////////////////// - // Melee Weapon/ Hand to Hand - // Hybrids + /////////////////////////////////////////////////////////// + // Melee Weapon/ Hand to Hand + // Hybrids ////////////////////////////////////////////////////////// - case RANGER: case RANGERGM:{ - r_value = 5 + (level*5); + case RANGER: case RANGERGM:{ + r_value = 5 + (level*5); if ( level > 50 ) { - if ( r_value > 250 ) - r_value = 250; - - switch (skillid) { + if ( r_value > 250 ) + r_value = 250; + + switch (skillid) { case PIERCING: { - if ( r_value > 240 ) - r_value = 240; - break; + if ( r_value > 240 ) + r_value = 240; + break; } default: break; - } - } + } + } else if ( level < 51 ) { - if ( r_value > 200 ) - r_value = 200; - } + if ( r_value > 200 ) + r_value = 200; + } switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } - default: + case HAND_TO_HAND:{ + if ( r_value > 100 ) + r_value = 100; break; - } - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - r_value = 5 + (level*5); - if ( level > 50 ){ - if ( r_value > 225 ) - r_value = 225; - } - if ( level < 51 ){ - if ( r_value > 200 ) - r_value = 200; - } - - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; } default: - break; + break; } - break; - } + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + r_value = 5 + (level*5); + if ( level > 50 ){ + if ( r_value > 225 ) + r_value = 225; + } + if ( level < 51 ){ + if ( r_value > 200 ) + r_value = 200; + } + + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 100 ) + r_value = 100; + break; + } + default: + break; + } + break; + } case BARD: case BARDGM: { r_value = 5 + (level*5); if ( level > 51 && r_value > 225 ) r_value = 225; if ( level < 51 && r_value > 200 ) - r_value = 200; - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } - case _2H_BLUNT: - case _2H_SLASHING:{ - r_value = 0; + r_value = 200; + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 100 ) + r_value = 100; + break; + } + case _2H_BLUNT: + case _2H_SLASHING:{ + r_value = 0; - } + } default: break; } - break; + break; } - - case BEASTLORD: case BEASTLORDGM:{ - r_value = 4 + (level*4); - if ( level > 51 ){ - if ( r_value > 225 && skillid != HAND_TO_HAND ) - r_value = 225; - } - if ( r_value > 250 ) - r_value = 250; - if ( level < 51 && r_value > 200 ) - r_value = 200; - - switch (skillid) { - case HAND_TO_HAND:{ - r_value = 5 + (level*5); - if ( level < 51 ) - r_value = 200; - if ( r_value > 250 ) - r_value = 250; - break; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } - default: - break; - } - break; - } + case BEASTLORD: case BEASTLORDGM:{ + r_value = 4 + (level*4); + if ( level > 51 ){ + if ( r_value > 225 && skillid != HAND_TO_HAND ) + r_value = 225; + } + if ( r_value > 250 ) + r_value = 250; + if ( level < 51 && r_value > 200 ) + r_value = 200; - // Melee Weapon/ Hand to Hand - // Pure casters - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - r_value = 3 + (level*3); - if ( r_value > 110 ) - r_value = 110; - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; + switch (skillid) { + case HAND_TO_HAND:{ + r_value = 5 + (level*5); + if ( level < 51 ) + r_value = 200; + + if ( r_value > 250 ) + r_value = 250; break; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } + } + case _1H_SLASHING: + case _2H_SLASHING:{ + r_value = 0; + break; + } default: break; } - } + break; + } + + // Melee Weapon/ Hand to Hand + // Pure casters + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM:{ + r_value = 3 + (level*3); + if ( r_value > 110 ) + r_value = 110; + switch (skillid) { + case HAND_TO_HAND:{ + if ( r_value > 75 ) + r_value = 75; + break; + } + case _1H_SLASHING: + case _2H_SLASHING:{ + r_value = 0; + break; + } + default: + break; + } + } default: { r_value = 0; break; @@ -337,95 +337,95 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { } // end case weapon skills -///////////////////////////////////////////////////////////// -// Combat non weapon -///////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////// +// Combat non weapon +///////////////////////////////////////////////////////////// -// Attack +// Attack case OFFENSE: { switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM: - case ROGUE: case ROGUEGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case MONK: case MONKGM:{ - // 230 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 230) - r_value = 230; - } - if (r_value > 252) - r_value = 252; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 200 200 4*level+4 - r_value = ((level*4) + 4); - if (r_value > 200) - r_value = 200; - break; + // Melee + case WARRIOR: case WARRIORGM: + case ROGUE: case ROGUEGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; + break; } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM:{ - // 200 225 5*level+5 + case MONK: case MONKGM:{ + // 230 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 230) + r_value = 230; + } + if (r_value > 252) + r_value = 252; + break; + } + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM:{ + // 200 200 4*level+4 + r_value = ((level*4) + 4); + if (r_value > 200) + r_value = 200; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM:{ + // 200 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 252) + r_value = 252; + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: + case BARD: case BARDGM:{ + // 200 225 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 225) - r_value = 225; - break; - } - case RANGER: case RANGERGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 140 140 level*4 - r_value = (level*4); - if (r_value > 140) - r_value = 140; - break; - } + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 225) + r_value = 225; + break; + } + case RANGER: case RANGERGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; + break; + } + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM:{ + // 140 140 level*4 + r_value = (level*4); + if (r_value > 140) + r_value = 140; + break; + } default: { r_value = 0; break; @@ -433,221 +433,220 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { } // end switch (eqclass) break; } // end case OFFENSE - case THROWING: { - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM:{ - // 220 250 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 220) - r_value = 220; - } - if (r_value > 250) - r_value = 250; - break; - } - case WARRIOR: case WARRIORGM: - case MONK: case MONKGM:{ - // 113 200 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 113) - r_value = 113; - } - if (r_value > 200) - r_value = 200; - break; + case THROWING: { + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM:{ + // 220 250 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 220) + r_value = 220; + } + if (r_value > 250) + r_value = 250; + break; } - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: - case RANGER: case RANGERGM:{ - // 113 - r_value = ((level*5) + 5); - if ( r_value > 113 ) - r_value = 113; - break; - } - // Pure + case WARRIOR: case WARRIORGM: + case MONK: case MONKGM:{ + // 113 200 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 113) + r_value = 113; + } + if (r_value > 200) + r_value = 200; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case BARD: case BARDGM: + case RANGER: case RANGERGM:{ + // 113 + r_value = ((level*5) + 5); + if ( r_value > 113 ) + r_value = 113; + break; + } + // Pure case NECROMANCER: case NECROMANCERGM: case WIZARD: case WIZARDGM: case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 75 - r_value = ((level*3) + 3); - if ( r_value > 75 ) - r_value = 75; - break; + case ENCHANTER: case ENCHANTERGM:{ + // 75 + r_value = ((level*3) + 3); + if ( r_value > 75 ) + r_value = 75; + break; } - // No skill classes - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: + // No skill classes + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: default: { - r_value = 0; + r_value = 0; break; } } // end switch (eqclass) - break; + break; } // end case THROWING: case ARCHERY: { - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM: - case WARRIOR: case WARRIORGM:{ - // 200 240 - r_value = ((level*5) + 5); - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 240) - r_value = 240; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 75 75 - r_value = ((level*5) + 5); - if ( r_value > 75 ) - r_value = 75; - break; - } - case RANGER: case RANGERGM:{ - // 240 240 - r_value = ((level*5) + 5); - if ( r_value > 240 ) - r_value = 240; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM: + case WARRIOR: case WARRIORGM:{ + // 200 240 + r_value = ((level*5) + 5); + if ( level < 51 && r_value > 200) + r_value = 200; + if (r_value > 240) + r_value = 240; + break; + } + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 75 75 + r_value = ((level*5) + 5); + if ( r_value > 75 ) + r_value = 75; + break; + } + case RANGER: case RANGERGM:{ + // 240 240 + r_value = ((level*5) + 5); + if ( r_value > 240 ) + r_value = 240; + break; + } + // Pure + // No skill classes + // Melee + case MONK: case MONKGM: + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case BARD: case BARDGM: default: { - r_value = 0; + r_value = 0; break; } } // end switch (eqclass) break; } // end case ARCHERY: - case DOUBLE_ATTACK: { - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM:{ - // 16 200 240 - r_value = ((level*5) + 5); - if ( level < 16 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 240) - r_value = 240; - break; - } - case WARRIOR: case WARRIORGM:{ - // 15 205 245 - r_value = ((level*5) + 5); - if ( level < 15 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 245) - r_value = 245; - break; - } - case MONK: case MONKGM:{ - // 15 210 250 - r_value = ((level*5) + 5); - if ( level < 15 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 250) - r_value = 250; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 20 200 235 - r_value = ((level*5) + 5); - if ( level < 20 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 235) - r_value = 235; - break; - } - case RANGER: case RANGERGM:{ - // 20 200 245 - r_value = ((level*5) + 5); - if ( level < 20 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 245) - r_value = 245; - break; - } - // Pure - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: + case DOUBLE_ATTACK: { + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM:{ + // 16 200 240 + r_value = ((level*5) + 5); + if ( level < 16 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 240) + r_value = 240; + break; + } + case WARRIOR: case WARRIORGM:{ + // 15 205 245 + r_value = ((level*5) + 5); + if ( level < 15 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 245) + r_value = 245; + break; + } + case MONK: case MONKGM:{ + // 15 210 250 + r_value = ((level*5) + 5); + if ( level < 15 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 250) + r_value = 250; + break; + } + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 20 200 235 + r_value = ((level*5) + 5); + if ( level < 20 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 235) + r_value = 235; + break; + } + case RANGER: case RANGERGM:{ + // 20 200 245 + r_value = ((level*5) + 5); + if ( level < 20 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 245) + r_value = 245; + break; + } + // Pure + // No skill classes + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case BARD: case BARDGM: default: { r_value = 0; break; } } // end switch (eqclass) - break; + break; } // end case DOUBLE_ATTACK: case DUEL_WIELD: { - switch (eqclass) { - // Melee + switch (eqclass) { + // Melee case MONK: case MONKGM:{ // 1 252 252 - r_value = level*7; // This can't be right can it? - break -; + r_value = level*7; // This can't be right can it? + break; } - case WARRIOR: case WARRIORGM: + case WARRIOR: case WARRIORGM: case ROGUE: case ROGUEGM: { // 15 210 245 r_value = ((level*5) + 5); @@ -661,7 +660,7 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { r_value = 245; break; } - // Hybrid + // Hybrid case BEASTLORD: case BEASTLORDGM: // 17 210 245 case RANGER: case RANGERGM:{ @@ -686,25 +685,25 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { r_value = 210; break; } - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: + // No skill classes + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: default: { - r_value = 0; - break; + r_value = 0; + break; } - }// end Class switch + }// end Class switch break; } // end case DUEL_WIELD: case KICK: { @@ -721,519 +720,519 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { r_value = 210; break; } - case MONK: case MONKGM:{ - // 1 200 250 + case MONK: case MONKGM:{ + // 1 200 250 r_value = ((level*5) + 5); if ( level < 51 ) { if (r_value > 200) r_value = 200; } - if (r_value > 250) + if (r_value > 250) r_value = 250; break; - } - // Hybrid - case RANGER: case RANGERGM:{ - // 5 149 205 - r_value = ((level*5) + 5); - if ( level < 5 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 149) - r_value = 149; - } - if (r_value > 205) - r_value = 205; - break; - } - case BEASTLORD: case BEASTLORDGM:{ - // 5 180 230 - r_value = ((level*5) + 5); - if ( level < 5 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 180) - r_value = 180; - } - if (r_value > 230) - r_value = 230; - break; - } - // Pure - // No skill classes - case ROGUE: case ROGUEGM: - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM: + } + // Hybrid + case RANGER: case RANGERGM:{ + // 5 149 205 + r_value = ((level*5) + 5); + if ( level < 5 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 149) + r_value = 149; + } + if (r_value > 205) + r_value = 205; + break; + } + case BEASTLORD: case BEASTLORDGM:{ + // 5 180 230 + r_value = ((level*5) + 5); + if ( level < 5 ) + r_value = 0; + if ( level < 51 ) { + if (r_value > 180) + r_value = 180; + } + if (r_value > 230) + r_value = 230; + break; + } + // Pure + // No skill classes + case ROGUE: case ROGUEGM: + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: + case BARD: case BARDGM: default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch(eqclass) break; } // end case KICK: - /////////// - // FIXME Where is slam? + /////////// + // FIXME Where is slam? // Quagmire: Slam = bash w/ race check - case BASH:{ - r_value = ((level*5)+5); - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 6 220 240 - if (level < 6) - r_value = 0; - if (level < 51 && r_value > 220) - r_value = 220; - if (r_value > 240) - r_value = 240; - break; - } - // Priest - case CLERIC: case CLERICGM:{ - // 25 180 200 - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 180) - r_value = 180; - if (r_value > 200) - r_value = 200; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 6 175 200 - if (level < 6) - r_value = 0; - if (level < 51 && r_value > 175) - r_value = 175; - if (r_value > 200) - r_value = 200; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - case ROGUE: case ROGUEGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case RANGER: case RANGERGM: - case BARD: case BARDGM:{ - switch (race) { - case BARBARIAN: - case TROLL: - case OGRE:{ - r_value = 50; - break; - } + case BASH:{ + r_value = ((level*5)+5); + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 6 220 240 + if (level < 6) + r_value = 0; + if (level < 51 && r_value > 220) + r_value = 220; + if (r_value > 240) + r_value = 240; + break; + } + // Priest + case CLERIC: case CLERICGM:{ + // 25 180 200 + if (level < 25) + r_value = 0; + if (level < 51 && r_value > 180) + r_value = 180; + if (r_value > 200) + r_value = 200; + break; + } + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 6 175 200 + if (level < 6) + r_value = 0; + if (level < 51 && r_value > 175) + r_value = 175; + if (r_value > 200) + r_value = 200; + break; + } + // Pure + // No skill classes + // Melee + case MONK: case MONKGM: + case ROGUE: case ROGUEGM: + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case RANGER: case RANGERGM: + case BARD: case BARDGM:{ + switch (race) { + case BARBARIAN: + case TROLL: + case OGRE:{ + r_value = 50; + break; + } default: { break; } } // end switch (race) r_value = 0; - break; + break; } - } + } break; } // end case BASH: - ///////////////////////////////////// - ///////////////////////////////////// - // Defensive skills - case DEFENSE:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case ROGUE: case ROGUEGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case MONK: case MONKGM:{ - // 230 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 230) - r_value = 230; - } - if (r_value > 252) - r_value = 252; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 200 200 4*level+4 - r_value = ((level*4) + 4); - if (r_value > 200) - r_value = 200; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case BARD: case BARDGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case RANGER: case RANGERGM:{ - // 200 200 5*level+5 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 145 145 level*4 - r_value = (level*4); - if (r_value > 140) - r_value = 140; + ///////////////////////////////////// + ///////////////////////////////////// + // Defensive skills + case DEFENSE:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; break; - } + } + case ROGUE: case ROGUEGM:{ + // 200 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 252) + r_value = 252; + break; + } + case MONK: case MONKGM:{ + // 230 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 230) + r_value = 230; + } + if (r_value > 252) + r_value = 252; + break; + } + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM:{ + // 200 200 4*level+4 + r_value = ((level*4) + 4); + if (r_value > 200) + r_value = 200; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 210 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 210) + r_value = 210; + } + if (r_value > 252) + r_value = 252; + break; + } + case BARD: case BARDGM:{ + // 200 252 5*level+5 + r_value = ((level*5) + 5); + if ( level < 51 ) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 252) + r_value = 252; + break; + } + case RANGER: case RANGERGM:{ + // 200 200 5*level+5 + r_value = ((level*5) + 5); + if (r_value > 200) + r_value = 200; + break; + } + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM:{ + // 145 145 level*4 + r_value = (level*4); + if (r_value > 140) + r_value = 140; + break; + } default: { break; } } // end switch(eqclass) - break; + break; } // end case DEFENSE: - case PARRY:{ - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM:{ - // 12 200 230 - r_value = ((level*5) + 5); - if ( level < 12 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - case WARRIOR: case WARRIORGM:{ - // 10 200 230 - r_value = ((level*5) + 5); - if ( level < 10 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - // Hybrid - case BARD: case BARDGM:{ - // 53 0 75 - r_value = ((level*5) + 5); - if ( level < 53 ) - r_value = 0; - if (r_value > 75) - r_value = 75; + case PARRY:{ + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM:{ + // 12 200 230 + r_value = ((level*5) + 5); + if ( level < 12 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 230) + r_value = 230; break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 17 175 205 - r_value = ((level*5) + 5); - if ( level < 17 ) - r_value = 0; - if (r_value > 175 && level < 51 ) - r_value = 175; - if (r_value > 205) - r_value = 205; - break; - } - case RANGER: case RANGERGM:{ - // 18 185 220 - r_value = ((level*5) + 5); - if ( level < 18 ) - r_value = 0; - if (r_value > 185 && level < 51 ) - r_value = 185; - if (r_value > 220) - r_value = 220; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: + } + case WARRIOR: case WARRIORGM:{ + // 10 200 230 + r_value = ((level*5) + 5); + if ( level < 10 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 230) + r_value = 230; + break; + } + // Hybrid + case BARD: case BARDGM:{ + // 53 0 75 + r_value = ((level*5) + 5); + if ( level < 53 ) + r_value = 0; + if (r_value > 75) + r_value = 75; + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 17 175 205 + r_value = ((level*5) + 5); + if ( level < 17 ) + r_value = 0; + if (r_value > 175 && level < 51 ) + r_value = 175; + if (r_value > 205) + r_value = 205; + break; + } + case RANGER: case RANGERGM:{ + // 18 185 220 + r_value = ((level*5) + 5); + if ( level < 18 ) + r_value = 0; + if (r_value > 185 && level < 51 ) + r_value = 185; + if (r_value > 220) + r_value = 220; + break; + } + // Pure + // No skill classes + // Melee + case MONK: case MONKGM: + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch (eqclass) - break; + break; } // end case PARRY: - case RIPOSTE:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 25 200 225 - r_value = ((level*5) + 5); - if ( level < 25 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case ROGUE: case ROGUEGM:{ - // 30 200 225 - r_value = ((level*5) + 5); - if ( level < 30 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case MONK: case MONKGM:{ - // 35 200 225 - r_value = ((level*5) + 5); - if ( level < 35 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 40 150 185 - r_value = ((level*5) + 5); - if ( level < 40 ) - r_value = 0; - if (r_value > 150 && level < 51 ) - r_value = 150; - if (r_value > 185) - r_value = 185; - break; - } - case BARD: case BARDGM:{ - // 58 75 75 - r_value = ((level*5) + 5); - if ( level < 58 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 30 175 200 - r_value = ((level*5) + 5); - if ( level < 30 ) - r_value = 0; - if (r_value > 175 && level < 51 ) - r_value = 175; - if (r_value > 200) - r_value = 200; - break; - } - case RANGER: case RANGERGM:{ - // 35 150 150 - r_value = ((level*5) + 5); - if ( level < 35 ) - r_value = 0; - if (r_value > 150) - r_value = 150; - break; - } - // Pure - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid + case RIPOSTE:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 25 200 225 + r_value = ((level*5) + 5); + if ( level < 25 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case ROGUE: case ROGUEGM:{ + // 30 200 225 + r_value = ((level*5) + 5); + if ( level < 30 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case MONK: case MONKGM:{ + // 35 200 225 + r_value = ((level*5) + 5); + if ( level < 35 ) + r_value = 0; + if (r_value > 200 && level < 51 ) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM:{ + // 40 150 185 + r_value = ((level*5) + 5); + if ( level < 40 ) + r_value = 0; + if (r_value > 150 && level < 51 ) + r_value = 150; + if (r_value > 185) + r_value = 185; + break; + } + case BARD: case BARDGM:{ + // 58 75 75 + r_value = ((level*5) + 5); + if ( level < 58 ) + r_value = 0; + if (r_value > 75) + r_value = 75; + break; + } + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 30 175 200 + r_value = ((level*5) + 5); + if ( level < 30 ) + r_value = 0; + if (r_value > 175 && level < 51 ) + r_value = 175; + if (r_value > 200) + r_value = 200; + break; + } + case RANGER: case RANGERGM:{ + // 35 150 150 + r_value = ((level*5) + 5); + if ( level < 35 ) + r_value = 0; + if (r_value > 150) + r_value = 150; + break; + } + // Pure + // No skill classes + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch (eqclass) - break; + break; } // end case RIPOSTE: - case DODGE:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 6 140 175 - r_value = ((level*5) + 5); - if ( level < 6 ) - r_value = 0; - if (r_value > 140 && level < 51 ) - r_value = 140; - if (r_value > 175) - r_value = 175; - break; - } - case ROGUE: case ROGUEGM:{ - // 4 150 210 - r_value = ((level*5) + 5); - if ( level < 4 ) - r_value = 0; - if (r_value > 150 && level < 51 ) - r_value = 150; - if (r_value > 210) - r_value = 210; - break; - } - case MONK: case MONKGM:{ - // 1 200 230 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 15 75 75 4*level+4 - r_value = ((level*4) + 4); - if ( level < 15 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM:{ - // 10 125 155 5*level+5 - r_value = ((level*5) + 5); - if ( level < 10 ) - r_value = 0; - if (r_value > 125 && level < 51 ) - r_value = 125; - if (r_value > 155) - r_value = 155; - break; - } - - case RANGER: case RANGERGM:{ - // 8 137 170 5*level+5 - r_value = ((level*5) + 5); - if ( level < 8 ) - r_value = 0; - if (r_value > 137 && level < 51 ) - r_value = 137; - if (r_value > 170) - r_value = 170; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 22 75 75 3*level+3 - r_value = ((level*3) + 3); - if ( level < 22 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; + case DODGE:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 6 140 175 + r_value = ((level*5) + 5); + if ( level < 6 ) + r_value = 0; + if (r_value > 140 && level < 51 ) + r_value = 140; + if (r_value > 175) + r_value = 175; + break; } - // No skill classes - // Melee - // Priest - // Pure - // Hybrid + case ROGUE: case ROGUEGM:{ + // 4 150 210 + r_value = ((level*5) + 5); + if ( level < 4 ) + r_value = 0; + if (r_value > 150 && level < 51 ) + r_value = 150; + if (r_value > 210) + r_value = 210; + break; + } + case MONK: case MONKGM:{ + // 1 200 230 + r_value = ((level*5) + 5); + if (r_value > 200) + r_value = 200; + if (r_value > 230) + r_value = 230; + break; + } + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM:{ + // 15 75 75 4*level+4 + r_value = ((level*4) + 4); + if ( level < 15 ) + r_value = 0; + if (r_value > 75) + r_value = 75; + break; + } + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: + case BARD: case BARDGM:{ + // 10 125 155 5*level+5 + r_value = ((level*5) + 5); + if ( level < 10 ) + r_value = 0; + if (r_value > 125 && level < 51 ) + r_value = 125; + if (r_value > 155) + r_value = 155; + break; + } + + case RANGER: case RANGERGM:{ + // 8 137 170 5*level+5 + r_value = ((level*5) + 5); + if ( level < 8 ) + r_value = 0; + if (r_value > 137 && level < 51 ) + r_value = 137; + if (r_value > 170) + r_value = 170; + break; + } + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM:{ + // 22 75 75 3*level+3 + r_value = ((level*3) + 3); + if ( level < 22 ) + r_value = 0; + if (r_value > 75) + r_value = 75; + break; + } + // No skill classes + // Melee + // Priest + // Pure + // Hybrid default: { r_value = 0; break; @@ -1241,661 +1240,661 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { } // end switch (eqclass) break; } // end case DODGE: - // Other - case TAUNT:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 1 200 200 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - break; - } - // Priest - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 1 180 180 - r_value = ((level*5) + 5); - if (r_value > 180) - r_value = 180; - break; - } - case RANGER: case RANGERGM:{ - // 1 150 150 - r_value = ((level*5) + 5); - if (r_value > 150) - r_value = 150; - break; - } - // Pure - // No skill classes - // Melee - case ROGUE: case ROGUEGM: - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: + // Other + case TAUNT:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 1 200 200 + r_value = ((level*5) + 5); + if (r_value > 200) + r_value = 200; + break; + } + // Priest + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 1 180 180 + r_value = ((level*5) + 5); + if (r_value > 180) + r_value = 180; + break; + } + case RANGER: case RANGERGM:{ + // 1 150 150 + r_value = ((level*5) + 5); + if (r_value > 150) + r_value = 150; + break; + } + // Pure + // No skill classes + // Melee + case ROGUE: case ROGUEGM: + case MONK: case MONKGM: + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BEASTLORD: case BEASTLORDGM: + case BARD: case BARDGM: default: { r_value = 0; - break; + break; } } // end swtich (eqclass) break; } // end case TAUNT: - case DISARM:{ - switch (eqclass) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 35 200 200 - r_value = ((level*5) + 5); - if (level < 35) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case ROGUE: case ROGUEGM: - case MONK: case MONKGM:{ - // 27 200 200 - r_value = ((level*5) + 5); - if (level < 27) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - // Priest - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 40 70 70 - r_value = ((level*5) + 5); - if (level < 40) - r_value = 0; - if (r_value > 70) - r_value = 70; - break; - } - case RANGER: case RANGERGM:{ - // 35 55 55 - r_value = ((level*5) + 5); - if (level < 35) - r_value = 0; - if (r_value > 55) - r_value = 55; - break; - } + case DISARM:{ + switch (eqclass) { + // Melee + case WARRIOR: case WARRIORGM:{ + // 35 200 200 + r_value = ((level*5) + 5); + if (level < 35) + r_value = 0; + if (r_value > 200) + r_value = 200; + break; + } + case ROGUE: case ROGUEGM: + case MONK: case MONKGM:{ + // 27 200 200 + r_value = ((level*5) + 5); + if (level < 27) + r_value = 0; + if (r_value > 200) + r_value = 200; + break; + } + // Priest + // Hybrid + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 40 70 70 + r_value = ((level*5) + 5); + if (level < 40) + r_value = 0; + if (r_value > 70) + r_value = 70; + break; + } + case RANGER: case RANGERGM:{ + // 35 55 55 + r_value = ((level*5) + 5); + if (level < 35) + r_value = 0; + if (r_value > 55) + r_value = 55; + break; + } // Pure - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BARD: case BARDGM: - case BEASTLORD: case BEASTLORDGM: + // No skill classes + // Melee + // Priest + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM: + case CLERIC: case CLERICGM: + // Pure + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM: + case MAGICIAN: case MAGICIANGM: + case ENCHANTER: case ENCHANTERGM: + // Hybrid + case BARD: case BARDGM: + case BEASTLORD: case BEASTLORDGM: default: { r_value = 0; - break; - } + break; + } } // end switch (eqclass) break; } // end case DISARM: - /////////////////////////////////////////// - /////////////////////////////////////////// - // Spell Skills - case MEDITATE: - case ABJURE: + /////////////////////////////////////////// + /////////////////////////////////////////// + // Spell Skills + case MEDITATE: + case ABJURE: - case ALTERATION: - case CHANNELING: - case CONJURATION: - case DIVINATION: + case ALTERATION: + case CHANNELING: + case CONJURATION: + case DIVINATION: - case EVOCATION:{ - r_value = ((level*5) + 5); - switch(eqclass){ - // Hybrid - case RANGER: case RANGERGM:{ - // 9 235 235 - // Channel 9 200 215 - // Med 12 185 235 - if (level < 9) - r_value = 0; - if (level < 12 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 215) - r_value = 215; + case EVOCATION:{ + r_value = ((level*5) + 5); + switch(eqclass){ + // Hybrid + case RANGER: case RANGERGM:{ + // 9 235 235 + // Channel 9 200 215 + // Med 12 185 235 + if (level < 9) + r_value = 0; + if (level < 12 && skillid == MEDITATE) + r_value = 0; + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) + r_value = 200; + if (r_value > 215) + r_value = 215; } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 235) - r_value = 235; - } - break; - } - case BEASTLORD: case BEASTLORDGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 9 235 235 - // Channel 9 200 220 - // Med 12 185 235 - if (level < 9) - r_value = 0; - if (level < 12 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 235) - r_value = 235; - } - break; - } - // Priest - case CLERIC: case CLERICGM: - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM:{ - // 1 235 235 - // Channel 4 200 220 - // Med 8 235 252 - if (level < 4 && skillid == CHANNELING) - r_value = 0; - if (level < 8 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 235) - r_value = 235; - if (r_value > 252) - r_value = 252; - } - break; - } - // Int caster - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - // 1 235 235 - // Channel 1 200 220 - // Med 4 235 252 - if (level < 4 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 235) - r_value = 235; - if (r_value > 252) - r_value = 252; - } - break; + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 185) + r_value = 185; + if (r_value > 235) + r_value = 235; + } + break; + } + case BEASTLORD: case BEASTLORDGM: + case PALADIN: case PALADINGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ + // 9 235 235 + // Channel 9 200 220 + // Med 12 185 235 + if (level < 9) + r_value = 0; + if (level < 12 && skillid == MEDITATE) + r_value = 0; + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 185) + r_value = 185; + if (r_value > 220) + r_value = 220; + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 185) + r_value = 185; + if (r_value > 235) + r_value = 235; + } + break; + } + // Priest + case CLERIC: case CLERICGM: + case DRUID: case DRUIDGM: + case SHAMAN: case SHAMANGM:{ + // 1 235 235 + // Channel 4 200 220 + // Med 8 235 252 + if (level < 4 && skillid == CHANNELING) + r_value = 0; + if (level < 8 && skillid == MEDITATE) + r_value = 0; + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) + r_value = 200; + if (r_value > 220) + r_value = 220; + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 235) + r_value = 235; + if (r_value > 252) + r_value = 252; + } + break; + } + // Int caster + case ENCHANTER: case ENCHANTERGM: + case MAGICIAN: case MAGICIANGM: + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM:{ + // 1 235 235 + // Channel 1 200 220 + // Med 4 235 252 + if (level < 4 && skillid == MEDITATE) + r_value = 0; + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) + r_value = 200; + if (r_value > 220) + r_value = 220; + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 235) + r_value = 235; + if (r_value > 252) + r_value = 252; + } + break; + } + case BARD: case BARDGM:{ + r_value = 0; + if (level > 9 && skillid == MEDITATE) + r_value = 1; + break; } - case BARD: case BARDGM:{ - r_value = 0; - if (level > 9 && skillid == MEDITATE) - r_value = 1; - break; - } default: { - // Unknown class - r_value = 0; - break; + // Unknown class + r_value = 0; + break; } - }// Class Switch + }// Class Switch break; } // end spell skills - case SPECIALIZE_ABJURE: - case SPECIALIZE_ALTERATION: - case SPECIALIZE_CONJURATION: - case SPECIALIZE_DIVINATION: - case SPECIALIZE_EVOCATION: - case RESEARCH:{ - r_value = ((level*5) + 5); - switch(eqclass){ - // Int caster - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - // Res 16 200 200 - if (level < 16 && skillid == RESEARCH) - r_value = 0; - if (r_value > 0 && skillid == RESEARCH) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 235) - r_value = 235; - // FIXME Only let one SPEC go above what ever limit theres supposed to be - break; - } - default:{ - r_value = 0; - break; - } - }// Class Switch + case SPECIALIZE_ABJURE: + case SPECIALIZE_ALTERATION: + case SPECIALIZE_CONJURATION: + case SPECIALIZE_DIVINATION: + case SPECIALIZE_EVOCATION: + case RESEARCH:{ + r_value = ((level*5) + 5); + switch(eqclass){ + // Int caster + case ENCHANTER: case ENCHANTERGM: + case MAGICIAN: case MAGICIANGM: + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM:{ + // Res 16 200 200 + if (level < 16 && skillid == RESEARCH) + r_value = 0; + if (r_value > 0 && skillid == RESEARCH) { + if (r_value > 200) + r_value = 200; + } + if (r_value > 235) + r_value = 235; + // FIXME Only let one SPEC go above what ever limit theres supposed to be + break; + } + default:{ + r_value = 0; + break; + } + }// Class Switch break; } // end specilize & research skills - case BRASS_INSTRUMENTS: - case SINGING: - case STRINGED_INSTRUMENTS: - case WIND_INSTRUMENTS: - case PERCUSSION_INSTRUMENTS:{ - switch(eqclass){ - case BARD: case BARDGM:{ - r_value = ((level*5) + 5); - if (level < 5 && skillid == PERCUSSION_INSTRUMENTS){ - r_value = 0; - } - if (level < 8 && skillid == STRINGED_INSTRUMENTS){ - r_value = 0; - } - if (level < 11 && skillid == BRASS_INSTRUMENTS){ - r_value = 0; - } - if (level < 14 && skillid == WIND_INSTRUMENTS){ - r_value = 0; - } - if (r_value > 235) - r_value = 235; - break; - } - default: { - r_value = 0; + case BRASS_INSTRUMENTS: + case SINGING: + case STRINGED_INSTRUMENTS: + case WIND_INSTRUMENTS: + case PERCUSSION_INSTRUMENTS:{ + switch(eqclass){ + case BARD: case BARDGM:{ + r_value = ((level*5) + 5); + if (level < 5 && skillid == PERCUSSION_INSTRUMENTS){ + r_value = 0; + } + if (level < 8 && skillid == STRINGED_INSTRUMENTS){ + r_value = 0; + } + if (level < 11 && skillid == BRASS_INSTRUMENTS){ + r_value = 0; + } + if (level < 14 && skillid == WIND_INSTRUMENTS){ + r_value = 0; + } + if (r_value > 235) + r_value = 235; + break; } - break; - }// Class Switch + default: { + r_value = 0; + } + break; + }// Class Switch break; } // bard song skills - /////////////////////////////////////////// - /////////////////////////////////////////// - // Class skills - // Rogue - case APPLY_POISON: - case MAKE_POISON: - case PICK_POCKETS: - case BACKSTAB:{ - switch (eqclass) { - // Melee - case ROGUE: case ROGUEGM: { - r_value = ((level*5) + 5); - switch (skillid){ - case APPLY_POISON:{ - // 18 200 200 - if (level < 18) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case MAKE_POISON:{ - // 20 200 250 - if (level < 20) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 250) - r_value = 250; - break; - } - case PICK_POCKETS:{ - // 7 200 210 - if (level < 7) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 210) - r_value = 210; - break; - } - case BACKSTAB:{ - // 10 200 225 - if (level < 10) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } + /////////////////////////////////////////// + /////////////////////////////////////////// + // Class skills + // Rogue + case APPLY_POISON: + case MAKE_POISON: + case PICK_POCKETS: + case BACKSTAB:{ + switch (eqclass) { + // Melee + case ROGUE: case ROGUEGM: { + r_value = ((level*5) + 5); + switch (skillid){ + case APPLY_POISON:{ + // 18 200 200 + if (level < 18) + r_value = 0; + if (r_value > 200) + r_value = 200; + break; + } + case MAKE_POISON:{ + // 20 200 250 + if (level < 20) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 250) + r_value = 250; + break; + } + case PICK_POCKETS:{ + // 7 200 210 + if (level < 7) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 210) + r_value = 210; + break; + } + case BACKSTAB:{ + // 10 200 225 + if (level < 10) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch (skillid) - break; + break; } // end case ROGUE: case ROGUEGM: default: { - r_value = 0; - break; + r_value = 0; + break; } - }// Class Switch + }// Class Switch break; } // end rogue skills - // Monk - case FEIGN_DEATH: - case MEND: - case DRAGON_PUNCH: - case EAGLE_STRIKE: - case FLYING_KICK: - case ROUND_KICK: - case TIGER_CLAW: - case BLOCKSKILL:{ - switch(eqclass){ - case MONK: case MONKGM:{ - r_value = ((level*5) + 5); - switch (skillid){ - case MEND:{ - // 1 200 200 - if (r_value > 200) - r_value = 200; - break; - } - case ROUND_KICK:{ - // 5 200 225 - if (level < 5) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case TIGER_CLAW:{ - // 10 200 225 - if (level < 10) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case BLOCKSKILL:{ - // 12 200 230 - if (level < 12) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - case FEIGN_DEATH:{ - // 17 200 200 - if (level < 17) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case EAGLE_STRIKE:{ - // 20 200 225 - if (level < 20) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case DRAGON_PUNCH:{ - // 25 200 225 - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case FLYING_KICK:{ - // 30 200 225 - if (level < 30) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } + // Monk + case FEIGN_DEATH: + case MEND: + case DRAGON_PUNCH: + case EAGLE_STRIKE: + case FLYING_KICK: + case ROUND_KICK: + case TIGER_CLAW: + case BLOCKSKILL:{ + switch(eqclass){ + case MONK: case MONKGM:{ + r_value = ((level*5) + 5); + switch (skillid){ + case MEND:{ + // 1 200 200 + if (r_value > 200) + r_value = 200; + break; + } + case ROUND_KICK:{ + // 5 200 225 + if (level < 5) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case TIGER_CLAW:{ + // 10 200 225 + if (level < 10) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case BLOCKSKILL:{ + // 12 200 230 + if (level < 12) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 230) + r_value = 230; + break; + } + case FEIGN_DEATH:{ + // 17 200 200 + if (level < 17) + r_value = 0; + if (r_value > 200) + r_value = 200; + break; + } + case EAGLE_STRIKE:{ + // 20 200 225 + if (level < 20) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case DRAGON_PUNCH:{ + // 25 200 225 + if (level < 25) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } + case FLYING_KICK:{ + // 30 200 225 + if (level < 30) + r_value = 0; + if (level < 51 && r_value > 200) + r_value = 200; + if (r_value > 225) + r_value = 225; + break; + } default: { - r_value = 0; - break; + r_value = 0; + break; } } // end switch (skillid) - break; + break; } // end case MONK: case MONKGM: default: { - r_value = 0; - break; + r_value = 0; + break; } }// Class Switch break; } // end monk skills - // Shaman - case ALCHEMY:{ - switch(eqclass){ - case SHAMAN: case SHAMANGM:{ - // 25 130 180 - r_value = ((level*5) + 5); - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 130) - r_value = 130; - if (r_value > 180) - r_value = 180; - break; - } - default: { - r_value = 0; + // Shaman + case ALCHEMY:{ + switch(eqclass){ + case SHAMAN: case SHAMANGM:{ + // 25 130 180 + r_value = ((level*5) + 5); + if (level < 25) + r_value = 0; + if (level < 51 && r_value > 130) + r_value = 130; + if (r_value > 180) + r_value = 180; break; } - }// Class Switch + default: { + r_value = 0; + break; + } + }// Class Switch break; } // end case ALCHEMY: - /////////////////////////////////////////// - ////////////////////////////////////////// - // Shared skill - // Shared Rogue - case HIDE: - case SNEAK:{ - switch(eqclass){ - // True class - case ROGUE: case ROGUEGM:{ - break; - } - // Hybrids - case MONK: case MONKGM: - case RANGER: case RANGERGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM:{ - break; - } - default: { - r_value = 0; - break; + /////////////////////////////////////////// + ////////////////////////////////////////// + // Shared skill + // Shared Rogue + case HIDE: + case SNEAK:{ + switch(eqclass){ + // True class + case ROGUE: case ROGUEGM:{ + break; } - }// Class Switch + // Hybrids + case MONK: case MONKGM: + case RANGER: case RANGERGM: + case SHADOWKNIGHT: case SHADOWKNIGHTGM: + case BARD: case BARDGM:{ + break; + } + default: { + r_value = 0; + break; + } + }// Class Switch } // end sneak/hide - case SENSE_TRAPS: - case PICK_LOCK: - case DISARM_TRAPS:{ - switch(eqclass){ - // True class - case ROGUE: case ROGUEGM:{ - break; - } - // Hybrids - case BARD: case BARDGM:{ - break; - } - default: { - r_value = 0; - break; + case SENSE_TRAPS: + case PICK_LOCK: + case DISARM_TRAPS:{ + switch(eqclass){ + // True class + case ROGUE: case ROGUEGM:{ + break; } - }// Class Switch + // Hybrids + case BARD: case BARDGM:{ + break; + } + default: { + r_value = 0; + break; + } + }// Class Switch break; } // end case SENSE_TRAPS/PICK_LOCK/DISARM_TRAPS - case SAFE_FALL: - case INTIMIDATION:{ - switch(eqclass){ - // Melee - case MONK: case MONKGM: - case ROGUE: case ROGUEGM:{ - break; - } - default: { - r_value = 0; - break; + case SAFE_FALL: + case INTIMIDATION:{ + switch(eqclass){ + // Melee + case MONK: case MONKGM: + case ROGUE: case ROGUEGM:{ + break; } - }// Class Switch + default: { + r_value = 0; + break; + } + }// Class Switch break; } // end SAFE_FALL/INTIMIDATION - // Druid/Ranger/Bard - case FORAGE:{ - switch(eqclass) { - case DRUID: case DRUIDGM: - case RANGER: case RANGERGM:{ - if (r_value > 200) - r_value = 200; - break; - } + // Druid/Ranger/Bard + case FORAGE:{ + switch(eqclass) { + case DRUID: case DRUIDGM: + case RANGER: case RANGERGM:{ + if (r_value > 200) + r_value = 200; + break; + } case BARD: case BARDGM: { - r_value = 55; - break; + r_value = 55; + break; } default: { - r_value = 00; - break; + r_value = 00; + break; } } // end switch (eqclass) - break; + break; } // end case FORAGE: - case TRACKING:{ - switch(eqclass){ - case RANGER: case RANGERGM: - case BARD: case BARDGM: + case TRACKING:{ + switch(eqclass){ + case RANGER: case RANGERGM: + case BARD: case BARDGM: case DRUID: case DRUIDGM: { } default: { - r_value = 0; + r_value = 0; break; } - }// Class Switch + }// Class Switch } // end case TRACKING - /////////////////////////////////////////// - /////////////////////////////////////////// - // Tradeskills - case BAKING: - case TAILORING: - case BLACKSMITHING: - case FLETCHING: - case BREWING: - case JEWELRY_MAKING: - case POTTERY: - case FISHING:{ - // Check for Any Trade above 200, check for X (aa skill) Trades above 200 - r_value = 200; - break; - } + /////////////////////////////////////////// + /////////////////////////////////////////// + // Tradeskills + case BAKING: + case TAILORING: + case BLACKSMITHING: + case FLETCHING: + case BREWING: + case JEWELRY_MAKING: + case POTTERY: + case FISHING:{ + // Check for Any Trade above 200, check for X (aa skill) Trades above 200 + r_value = 200; + break; + } /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// - // Gnome + // Gnome /////////////////////////////////////////////////////////////////// - case TINKERING:{ - if ( race == GNOME && level > 24 ) { - r_value = ((level*5)+5); - break; - } - r_value = 0; - break; + case TINKERING:{ + if ( race == GNOME && level > 24 ) { + r_value = ((level*5)+5); + break; + } + r_value = 0; + break; } // end case TINKERING: - ///////////////////////////////////////// - // Common - ///////////////////////////////////////// - case BIND_WOUND:{ - r_value = 5 + (level*5); - if (level > 50){ - // Check for aa and class - } - if (r_value > 200) - r_value = 200; - switch (eqclass) { - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - if ( r_value > 100 ) - r_value = 100; - } + ///////////////////////////////////////// + // Common + ///////////////////////////////////////// + case BIND_WOUND:{ + r_value = 5 + (level*5); + if (level > 50){ + // Check for aa and class + } + if (r_value > 200) + r_value = 200; + switch (eqclass) { + case ENCHANTER: case ENCHANTERGM: + case MAGICIAN: case MAGICIANGM: + case NECROMANCER: case NECROMANCERGM: + case WIZARD: case WIZARDGM:{ + if ( r_value > 100 ) + r_value = 100; + } default: { - break; + break; } } // end switch (eqclass) - break; + break; } // end case BIND_WOUND: - case SENSE_HEADING: - case SWIMMING: - case ALCOHOL_TOLERANCE: - case BEGGING:{ - r_value = 5 + (level*5); - if (r_value > 200) - r_value = 200; - break; - } - //case BERSERKING: - default: { - // Unknown skill we should like print something to a log/debug here - r_value = 0; - break; - } + case SENSE_HEADING: + case SWIMMING: + case ALCOHOL_TOLERANCE: + case BEGGING:{ + r_value = 5 + (level*5); + if (r_value > 200) + r_value = 200; + break; + } + //case BERSERKING: + default: { + // Unknown skill we should like print something to a log/debug here + r_value = 0; + break; + } } // end switch (skillid) - // NO skill may go over 252 +// NO skill may go over 252 if (r_value > 252) r_value = 252; - return r_value; -} + return r_value; +} diff --git a/common/MiscFunctions.cpp b/common/MiscFunctions.cpp index f6cd00e63..94a03dba0 100644 --- a/common/MiscFunctions.cpp +++ b/common/MiscFunctions.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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/debug.h" #include "MiscFunctions.h" @@ -42,7 +42,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #else #include #include @@ -50,9 +50,9 @@ using namespace std; #include #include #ifdef FREEBSD //Timothy Whitman - January 7, 2003 - #include - #include - #endif + #include + #include +#endif #include #include #include @@ -83,8 +83,8 @@ void CoutTimestamp(bool ms) { time(&rawtime); gmt_t = gmtime(&rawtime); - struct timeval read_time; - gettimeofday(&read_time,0); + struct timeval read_time; + gettimeofday(&read_time,0); cout << (gmt_t->tm_year + 1900) << "/" << setw(2) << setfill('0') << (gmt_t->tm_mon + 1) << "/" << setw(2) << setfill('0') << gmt_t->tm_mday << " " << setw(2) << setfill('0') << gmt_t->tm_hour << ":" << setw(2) << setfill('0') << gmt_t->tm_min << ":" << setw(2) << setfill('0') << gmt_t->tm_sec; if (ms) @@ -121,50 +121,50 @@ bool strn0cpyt(char* dest, const char* source, uint32 size) { } const char *MakeUpperString(const char *source) { - static char str[128]; - if (!source) - return nullptr; - MakeUpperString(source, str); - return str; + static char str[128]; + if (!source) + return nullptr; + MakeUpperString(source, str); + return str; } void MakeUpperString(const char *source, char *target) { - if (!source || !target) { + if (!source || !target) { *target=0; - return; - } - while (*source) - { - *target = toupper(*source); - target++;source++; - } - *target = 0; + return; + } + while (*source) + { + *target = toupper(*source); + target++;source++; + } + *target = 0; } const char *MakeLowerString(const char *source) { - static char str[128]; - if (!source) - return nullptr; - MakeLowerString(source, str); - return str; + static char str[128]; + if (!source) + return nullptr; + MakeLowerString(source, str); + return str; } void MakeLowerString(const char *source, char *target) { - if (!source || !target) { + if (!source || !target) { *target=0; - return; - } - while (*source) - { - *target = tolower(*source); - target++;source++; - } - *target = 0; + return; + } + while (*source) + { + *target = tolower(*source); + target++;source++; + } + *target = 0; } int MakeAnyLenString(char** ret, const char* format, ...) { int buf_len = 128; - int chars = -1; + int chars = -1; va_list argptr, tmpargptr; va_start(argptr, format); while (chars == -1 || chars >= buf_len) { @@ -186,7 +186,7 @@ uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const cha *bufsize = 256; if (*ret == 0) *strlen = 0; - int chars = -1; + int chars = -1; char* oldret = 0; va_list argptr, tmpargptr; va_start(argptr, format); @@ -314,7 +314,7 @@ uint32 ResolveIP(const char* hostname, char* errbuf) { snprintf(errbuf, ERRBUF_SIZE, "ResolveIP(): hostname == 0"); return 0; } - struct sockaddr_in server_sin; + struct sockaddr_in server_sin; #ifdef _WINDOWS PHOSTENT phostent = nullptr; #else @@ -383,7 +383,7 @@ const char * itoa(int num, char* a,int b) { } #endif -/* +/* * generate a random integer in the range low-high this * should be used instead of the rand()%limit method */ @@ -394,7 +394,7 @@ int MakeRandomInt(int low, int high) return(low); //return (rand()%(high-low+1) + (low)); - if(!WELLRNG_init) { + if(!WELLRNG_init) { WELLRNG_init = true; oneseed( rnd_hash( time(nullptr), clock() ) ); WELLRNG19937 = case_1; @@ -412,7 +412,7 @@ double MakeRandomFloat(double low, double high) return(low); //return (rand() / (double)RAND_MAX * (high - low) + low); - if(!WELLRNG_init) { + if(!WELLRNG_init) { WELLRNG_init = true; oneseed( rnd_hash( time(nullptr), clock() ) ); WELLRNG19937 = case_1; @@ -422,41 +422,41 @@ double MakeRandomFloat(double low, double high) uint32 rnd_hash( time_t t, clock_t c ) { - // Get a uint32 from t and c - // Better than uint32(x) in case x is floating point in [0,1] - // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk) - - static uint32 differ = 0; // guarantee time-based seeds will change - - uint32 h1 = 0; - unsigned char *p = (unsigned char *) &t; - for( size_t i = 0; i < sizeof(t); ++i ) - { - h1 *= 255 + 2U; - h1 += p[i]; - } - uint32 h2 = 0; - p = (unsigned char *) &c; - for( size_t j = 0; j < sizeof(c); ++j ) - { - h2 *= 255 + 2U; - h2 += p[j]; - } - return ( h1 + differ++ ) ^ h2; + // Get a uint32 from t and c + // Better than uint32(x) in case x is floating point in [0,1] + // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk) + + static uint32 differ = 0; // guarantee time-based seeds will change + + uint32 h1 = 0; + unsigned char *p = (unsigned char *) &t; + for( size_t i = 0; i < sizeof(t); ++i ) + { + h1 *= 255 + 2U; + h1 += p[i]; + } + uint32 h2 = 0; + p = (unsigned char *) &c; + for( size_t j = 0; j < sizeof(c); ++j ) + { + h2 *= 255 + 2U; + h2 += p[j]; + } + return ( h1 + differ++ ) ^ h2; } void oneseed( const uint32 seed ) { - // Initialize generator state with seed - // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. - // In previous versions, most significant bits (MSBs) of the seed affect - // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. - register int j = 0; - STATE[j] = seed & 0xffffffffUL; + // Initialize generator state with seed + // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. + // In previous versions, most significant bits (MSBs) of the seed affect + // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. + register int j = 0; + STATE[j] = seed & 0xffffffffUL; for (j = 1; j < R; j++) - { - STATE[j] = ( 1812433253UL * ( STATE[j-1] ^ (STATE[j-1] >> 30) ) + j ) & 0xffffffffUL; - } + { + STATE[j] = ( 1812433253UL * ( STATE[j-1] ^ (STATE[j-1] >> 30) ) + j ) & 0xffffffffUL; + } } // WELL RNG code @@ -472,79 +472,79 @@ void oneseed( const uint32 seed ) /* ***************************************************************************** */ unsigned int case_1 (void){ - // state_i == 0 - z0 = (VRm1Under & MASKL) | (VRm2Under & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); - newV1 = z1 ^ z2; - newV0Under = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i = R - 1; - WELLRNG19937 = case_3; - return (STATE[state_i] ^ (newVM2Over & BITMASK)); + // state_i == 0 + z0 = (VRm1Under & MASKL) | (VRm2Under & MASKU); + z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); + z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); + newV1 = z1 ^ z2; + newV0Under = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); + state_i = R - 1; + WELLRNG19937 = case_3; + return (STATE[state_i] ^ (newVM2Over & BITMASK)); } static unsigned int case_2 (void){ - // state_i == 1 - z0 = (VRm1 & MASKL) | (VRm2Under & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i = 0; - WELLRNG19937 = case_1; - return (STATE[state_i] ^ (newVM2 & BITMASK)); + // state_i == 1 + z0 = (VRm1 & MASKL) | (VRm2Under & MASKU); + z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); + z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); + newV1 = z1 ^ z2; + newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); + state_i = 0; + WELLRNG19937 = case_1; + return (STATE[state_i] ^ (newVM2 & BITMASK)); } static unsigned int case_3 (void){ - // state_i+M1 >= R - z0 = (VRm1 & MASKL) | (VRm2 & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1Over); - z2 = MAT3POS (9, VM2Over) ^ MAT0POS (1, VM3Over); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i--; - if (state_i + M1 < R) - WELLRNG19937 = case_5; - return (STATE[state_i] ^ (newVM2Over & BITMASK)); + // state_i+M1 >= R + z0 = (VRm1 & MASKL) | (VRm2 & MASKU); + z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1Over); + z2 = MAT3POS (9, VM2Over) ^ MAT0POS (1, VM3Over); + newV1 = z1 ^ z2; + newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); + state_i--; + if (state_i + M1 < R) + WELLRNG19937 = case_5; + return (STATE[state_i] ^ (newVM2Over & BITMASK)); } static unsigned int case_4 (void){ - // state_i+M3 >= R - z0 = (VRm1 & MASKL) | (VRm2 & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3Over); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i--; - if (state_i + M3 < R) - WELLRNG19937 = case_6; - return (STATE[state_i] ^ (newVM2 & BITMASK)); + // state_i+M3 >= R + z0 = (VRm1 & MASKL) | (VRm2 & MASKU); + z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); + z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3Over); + newV1 = z1 ^ z2; + newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); + state_i--; + if (state_i + M3 < R) + WELLRNG19937 = case_6; + return (STATE[state_i] ^ (newVM2 & BITMASK)); } static unsigned int case_5 (void){ - // state_i+M2 >= R - z0 = (VRm1 & MASKL) | (VRm2 & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2Over) ^ MAT0POS (1, VM3Over); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i--; - if (state_i + M2 < R) - WELLRNG19937 = case_4; - return (STATE[state_i] ^ (newVM2Over & BITMASK)); + // state_i+M2 >= R + z0 = (VRm1 & MASKL) | (VRm2 & MASKU); + z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); + z2 = MAT3POS (9, VM2Over) ^ MAT0POS (1, VM3Over); + newV1 = z1 ^ z2; + newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); + state_i--; + if (state_i + M2 < R) + WELLRNG19937 = case_4; + return (STATE[state_i] ^ (newVM2Over & BITMASK)); } static unsigned int case_6 (void){ - // 2 <= state_i <= (R - M3 - 1) - z0 = (VRm1 & MASKL) | (VRm2 & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i--; - if (state_i == 1) - WELLRNG19937 = case_2; - return (STATE[state_i] ^ (newVM2 & BITMASK)); + // 2 <= state_i <= (R - M3 - 1) + z0 = (VRm1 & MASKL) | (VRm2 & MASKU); + z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); + z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); + newV1 = z1 ^ z2; + newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); + state_i--; + if (state_i == 1) + WELLRNG19937 = case_2; + return (STATE[state_i] ^ (newVM2 & BITMASK)); } // end WELL RNG code @@ -553,10 +553,10 @@ static unsigned int case_6 (void){ char *CleanMobName(const char *in, char *out) { unsigned i, j; - + for(i = j = 0; i < strlen(in); i++) { - // convert _ to space.. any other conversions like this? I *think* this + // convert _ to space.. any other conversions like this? I *think* this // is the only non alpha char that's not stripped but converted. if(in[i] == '_') { @@ -632,7 +632,7 @@ void RemoveApostrophes(std::string &s) { for(unsigned int i = 0; i < s.length(); ++i) if(s[i] == '\'') - s[i] = '_'; + s[i] = '_'; } char *RemoveApostrophes(const char *s) @@ -643,7 +643,7 @@ char *RemoveApostrophes(const char *s) for(unsigned int i = 0 ; i < strlen(NewString); ++i) if(NewString[i] == '\'') - NewString[i] = '_'; + NewString[i] = '_'; return NewString; } diff --git a/common/MiscFunctions.h b/common/MiscFunctions.h index 2ed8a8954..d25a57dab 100644 --- a/common/MiscFunctions.h +++ b/common/MiscFunctions.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 MISCFUNCTIONS_H #define MISCFUNCTIONS_H @@ -32,8 +32,8 @@ // These are helper macros for dealing with packets of variable length, typically those that contain // variable length strings where it is not convenient to use a fixed length struct. // -#define VARSTRUCT_DECODE_TYPE(Type, Buffer) *(Type *)Buffer; Buffer += sizeof(Type); -#define VARSTRUCT_DECODE_STRING(String, Buffer) strcpy(String, Buffer); Buffer += strlen(String)+1; +#define VARSTRUCT_DECODE_TYPE(Type, Buffer) *(Type *)Buffer; Buffer += sizeof(Type); +#define VARSTRUCT_DECODE_STRING(String, Buffer) strcpy(String, Buffer); Buffer += strlen(String)+1; #define VARSTRUCT_ENCODE_STRING(Buffer, String) { sprintf(Buffer, String); Buffer += strlen(String) + 1; } #define VARSTRUCT_ENCODE_INTSTRING(Buffer, Number) { sprintf(Buffer, "%i", Number); Buffer += strlen(Buffer) + 1; } #define VARSTRUCT_ENCODE_TYPE(Type, Buffer, Value) { *(Type *)Buffer = Value; Buffer += sizeof(Type); } @@ -63,41 +63,41 @@ #define MAT1(v) v #define MAT3POS(t,v) (v>>t) -#define V0 STATE[state_i] -#define VM1Over STATE[state_i+M1-R] -#define VM1 STATE[state_i+M1] -#define VM2Over STATE[state_i+M2-R] -#define VM2 STATE[state_i+M2] -#define VM3Over STATE[state_i+M3-R] -#define VM3 STATE[state_i+M3] -#define VRm1 STATE[state_i-1] -#define VRm1Under STATE[state_i+R-1] -#define VRm2 STATE[state_i-2] -#define VRm2Under STATE[state_i+R-2] +#define V0 STATE[state_i] +#define VM1Over STATE[state_i+M1-R] +#define VM1 STATE[state_i+M1] +#define VM2Over STATE[state_i+M2-R] +#define VM2 STATE[state_i+M2] +#define VM3Over STATE[state_i+M3-R] +#define VM3 STATE[state_i+M3] +#define VRm1 STATE[state_i-1] +#define VRm1Under STATE[state_i+R-1] +#define VRm2 STATE[state_i-2] +#define VRm2Under STATE[state_i+R-2] -#define newV0 STATE[state_i-1] -#define newV0Under STATE[state_i-1+R] -#define newV1 STATE[state_i] -#define newVRm1 STATE[state_i-2] -#define newVRm1Under STATE[state_i-2+R] +#define newV0 STATE[state_i-1] +#define newV0Under STATE[state_i-1+R] +#define newV1 STATE[state_i] +#define newVRm1 STATE[state_i-2] +#define newVRm1Under STATE[state_i-2+R] -#define newVM2Over STATE[state_i+M2-R+1] -#define newVM2 STATE[state_i+M2+1] +#define newVM2Over STATE[state_i+M2-R+1] +#define newVM2 STATE[state_i+M2+1] #define BITMASK 0x41180000 ////////////////////////////////////////////////////////////////////// // -// MakeUpperString -// i : source - allocated null-terminated string -// return: pointer to static buffer with the target string +// MakeUpperString +// i: source - allocated null-terminated string +// return: pointer to static buffer with the target string const char *MakeUpperString(const char *source); const char *MakeLowerString(const char *source); ////////////////////////////////////////////////////////////////////// // -// MakeUpperString -// i : source - allocated null-terminated string -// io: target - allocated buffer, at least of size strlen(source)+1 +// MakeUpperString +// i : source - allocated null-terminated string +// io: target - allocated buffer, at least of size strlen(source)+1 void MakeUpperString(const char *source, char *target); void MakeLowerString(const char *source, char *target); diff --git a/common/Mutex.cpp b/common/Mutex.cpp index a866c5530..0b5e156ec 100644 --- a/common/Mutex.cpp +++ b/common/Mutex.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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/debug.h" #include "../common/Mutex.h" @@ -23,7 +23,7 @@ using namespace std; #define DEBUG_MUTEX_CLASS 0 #if DEBUG_MUTEX_CLASS >= 1 - + #endif #ifdef _WINDOWS @@ -74,7 +74,7 @@ Mutex::Mutex() { #else pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); -#if defined(__CYGWIN__) || defined(__APPLE__) +#if defined(__CYGWIN__) || defined(__APPLE__) || defined(FREEBSD) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); #else pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); diff --git a/common/Mutex.h b/common/Mutex.h index 32c29ece8..b1a71c331 100644 --- a/common/Mutex.h +++ b/common/Mutex.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 MYMUTEX_H #define MYMUTEX_H diff --git a/common/ProcLauncher.cpp b/common/ProcLauncher.cpp index de317886f..18413b260 100644 --- a/common/ProcLauncher.cpp +++ b/common/ProcLauncher.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" #include "ProcLauncher.h" @@ -71,7 +71,7 @@ void ProcLauncher::Process() { //GetLastError(); TerminateProcess(cur->second->proc_info.hProcess, 1); } - + //if we get here, the current process died. tmp = cur; tmp++; @@ -85,7 +85,7 @@ void ProcLauncher::Process() { ProcRef died = waitpid(-1, &status, WNOHANG); if(died == -1) { //error waiting... shouldent really happen... - + } else if(died == 0) { //nothing pending... break; @@ -102,14 +102,14 @@ void ProcLauncher::Process() { } } #endif //!WIN32 - + } void ProcLauncher::ProcessTerminated(std::map::iterator &it) { - + if(it->second->handler != nullptr) it->second->handler->OnTerminate(it->first, it->second); - + #ifdef _WINDOWS CloseHandle(it->second->proc_info.hProcess); #else //!WIN32 @@ -125,18 +125,18 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { #ifdef _WINDOWS STARTUPINFO siStartInfo; - BOOL bFuncRetn = FALSE; - - // Set up members of the PROCESS_INFORMATION structure. - + BOOL bFuncRetn = FALSE; + + // Set up members of the PROCESS_INFORMATION structure. + ZeroMemory( &it->proc_info, sizeof(PROCESS_INFORMATION) ); - - // Set up members of the STARTUPINFO structure. - + + // Set up members of the STARTUPINFO structure. + ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) ); - siStartInfo.cb = sizeof(STARTUPINFO); + siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.dwFlags = 0; - + //handle output redirection. HANDLE logOut = nullptr; BOOL inherit_handles = FALSE; @@ -144,9 +144,9 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { inherit_handles = TRUE; // Set up our log file to redirect output into. SECURITY_ATTRIBUTES saAttr; - saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); - saAttr.bInheritHandle = TRUE; //we want this handle to be inherited by the child. - saAttr.lpSecurityDescriptor = nullptr; + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + saAttr.bInheritHandle = TRUE; //we want this handle to be inherited by the child. + saAttr.lpSecurityDescriptor = nullptr; logOut = CreateFile( it->logFile.c_str(), //lpFileName FILE_WRITE_DATA, //dwDesiredAccess @@ -155,7 +155,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { CREATE_ALWAYS, //dwCreationDisposition FILE_FLAG_NO_BUFFERING, //dwFlagsAndAttributes nullptr ); //hTemplateFile - + //configure the startup info to redirect output appropriately. siStartInfo.hStdError = logOut; siStartInfo.hStdOutput = logOut; @@ -164,9 +164,9 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { } siStartInfo.dwFlags |= CREATE_NEW_CONSOLE; - - // Create the child process. - + + // Create the child process. + //glue together all the nice command line arguments string args(it->program); vector::iterator cur, end; @@ -176,39 +176,39 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { args += " "; args += *cur; } - - bFuncRetn = CreateProcess(it->program.c_str(), - const_cast(args.c_str()), // command line - nullptr, // process security attributes - nullptr, // primary thread security attributes - inherit_handles, // handles are not inherited - 0, // creation flags (CREATE_NEW_PROCESS_GROUP maybe) - nullptr, // use parent's environment - nullptr, // use parent's current directory - &siStartInfo, // STARTUPINFO pointer - &it->proc_info); // receives PROCESS_INFORMATION - + + bFuncRetn = CreateProcess(it->program.c_str(), + const_cast(args.c_str()), // command line + nullptr, // process security attributes + nullptr, // primary thread security attributes + inherit_handles, // handles are not inherited + 0, // creation flags (CREATE_NEW_PROCESS_GROUP maybe) + nullptr, // use parent's environment + nullptr, // use parent's current directory + &siStartInfo, // STARTUPINFO pointer + &it->proc_info); // receives PROCESS_INFORMATION + if (bFuncRetn == 0) { safe_delete(it); //GetLastError() return(ProcError); } - - + + //keep process handle open to get exit code CloseHandle(it->proc_info.hThread); //we dont need their thread handle if(logOut != nullptr) CloseHandle(logOut); //we dont want their output handle either. - + ProcRef res = it->proc_info.dwProcessId; - + //record this entry.. m_running[res] = it; - + return(res); - + #else //!WIN32 - + //build argv char **argv = new char *[it->args.size()+2]; unsigned int r; @@ -217,7 +217,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { argv[r] = const_cast(it->args[r-1].c_str()); } argv[r] = nullptr; - + ProcRef res = fork(); //cant use vfork since we are opening the log file. if(res == -1) { //error forking... errno @@ -225,10 +225,10 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { safe_delete_array(argv); return(ProcError); } - + if(res == 0) { //child... exec this bitch - + //handle output redirection if requested. if(it->logFile.length() > 0) { //we will put their output directly into a file. @@ -252,20 +252,20 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { write(outfd, err, strlen(err)); } close(STDIN_FILENO); - + close(outfd); //dont need this one, we have two more copies... } } - + //call it... execv(argv[0], argv); _exit(1); } safe_delete_array(argv); - + //record this entry.. m_running[res] = it; - + return(res); #endif //!WIN32 } @@ -277,10 +277,10 @@ bool ProcLauncher::Terminate(const ProcRef &proc, bool graceful) { std::map::iterator res = m_running.find(proc); if(res == m_running.end()) return(false); - + //we do not remove it from the list until we have been notified //that they have been terminated. - + #ifdef _WINDOWS if(!TerminateProcess(res->second->proc_info.hProcess, 0)) { return(false); @@ -311,7 +311,7 @@ void ProcLauncher::TerminateAll(bool final) { //kill each process and remove it from the list std::map running(m_running); m_running.clear(); - + std::map::iterator cur, end; cur = running.begin(); end = running.end(); @@ -352,17 +352,3 @@ ProcLauncher::Spec &ProcLauncher::Spec::operator=(const Spec &other) { return(*this); } - - - - - - - - - - - - - - diff --git a/common/ProcLauncher.h b/common/ProcLauncher.h index 1c851de4f..64133481e 100644 --- a/common/ProcLauncher.h +++ b/common/ProcLauncher.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 PROCLAUNCHER_H_ #define PROCLAUNCHER_H_ @@ -32,7 +32,7 @@ public: //Singleton method static ProcLauncher *get() { return(&s_launcher); } static void ProcessInThisThread(); - + #ifdef WIN32 typedef DWORD ProcRef; static const ProcRef ProcError; @@ -47,7 +47,7 @@ public: Spec(); Spec(const Spec &other); Spec &operator=(const Spec &other); - + std::string program; std::vector args; //std::map environment; @@ -64,30 +64,23 @@ public: virtual ~EventHandler() {} virtual void OnTerminate(const ProcRef &ref, const Spec *spec) = 0; }; - - /* - * The main launch method, call to start a new background process. - */ + + /* The main launch method, call to start a new background process. */ ProcRef Launch(Spec *&to_launch); //takes ownership of the pointer - - /* - * The terminate method - */ + + /* The terminate method */ bool Terminate(const ProcRef &proc, bool graceful = true); void TerminateAll(bool final = true); - - /* - * The main processing method. Call regularly to check for terminated - * background processes. - */ + + /* The main processing method. Call regularly to check for terminated background processes. */ void Process(); protected: -// std::vector m_specs; + //std::vector m_specs; std::map m_running; //we own the pointers in this map - + void ProcessTerminated(std::map::iterator &it); - + private: static ProcLauncher s_launcher; #ifndef WIN32 @@ -96,29 +89,5 @@ private: #endif }; - - - - - - - - #endif /*PROCLAUNCHER_H_*/ - - - - - - - - - - - - - - - - diff --git a/common/StructStrategy.cpp b/common/StructStrategy.cpp index 7b71180e3..61b060259 100644 --- a/common/StructStrategy.cpp +++ b/common/StructStrategy.cpp @@ -28,13 +28,13 @@ void StructStrategy::Decode(EQApplicationPacket *p) const { proc(p); } - + void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bool ack_req) { EQApplicationPacket *p = *in_p; *in_p = nullptr; - + _log(NET__STRUCTS, "Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); - + delete p; } @@ -56,13 +56,13 @@ void StructStrategy::PassDecoder(EQApplicationPacket *p) { //effectively a singleton, but I decided to do it this way for no apparent reason. namespace StructStrategyFactory { - + static map strategies; - + void RegisterPatch(EmuOpcode first_opcode, const StructStrategy *structs) { strategies[first_opcode] = structs; } - + const StructStrategy *FindPatch(EmuOpcode first_opcode) { map::const_iterator res; res = strategies.find(first_opcode); @@ -70,7 +70,7 @@ namespace StructStrategyFactory { return(nullptr); return(res->second); } - + }; diff --git a/common/StructStrategy.h b/common/StructStrategy.h index b504db6a5..224c1e31d 100644 --- a/common/StructStrategy.h +++ b/common/StructStrategy.h @@ -14,18 +14,18 @@ public: typedef void (*Encoder)(EQApplicationPacket **p, EQStream *dest, bool ack_req); //the decoder may only edit the supplied packet, producing a single packet for eqemu to consume. typedef void (*Decoder)(EQApplicationPacket *p); - + StructStrategy(); virtual ~StructStrategy() {} - + //this method takes an eqemu struct, and enqueues the produced structs into the stream. void Encode(EQApplicationPacket **p, EQStream *dest, bool ack_req) const; //this method takes an EQ wire struct, and converts it into an eqemu struct void Decode(EQApplicationPacket *p) const; - + virtual std::string Describe() const = 0; virtual const EQClientVersion ClientVersion() const = 0; - + protected: //some common coders: //Print an error saying unknown struct/opcode and drop it @@ -34,7 +34,7 @@ protected: //pass the packet through without modification (emu == EQ) (default) static void PassEncoder(EQApplicationPacket **p, EQStream *dest, bool ack_req); static void PassDecoder(EQApplicationPacket *p); - + Encoder encoders[_maxEmuOpcode]; Decoder decoders[_maxEmuOpcode]; }; @@ -42,7 +42,7 @@ protected: //effectively a singleton, but I decided to do it this way for no apparent reason. namespace StructStrategyFactory { void RegisterPatch(EmuOpcode first_opcode, const StructStrategy *structs); - + //does NOT return ownership of the strategy. const StructStrategy *FindPatch(EmuOpcode first_opcode); }; diff --git a/common/TCPConnection.cpp b/common/TCPConnection.cpp index c4a4f79b3..2c4867efd 100644 --- a/common/TCPConnection.cpp +++ b/common/TCPConnection.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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/debug.h" @@ -47,11 +47,11 @@ InitWinsock winsock; //client version TCPConnection::TCPConnection() -: ConnectionType(Outgoing), - connection_socket(0), - id(0), - rIP(0), - rPort(0) +: ConnectionType(Outgoing), + connection_socket(0), + id(0), + rIP(0), + rPort(0) { pState = TCPS_Ready; pFree = false; @@ -69,11 +69,11 @@ TCPConnection::TCPConnection() //server version TCPConnection::TCPConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort) -: ConnectionType(Incomming), - connection_socket(in_socket), - id(ID), - rIP(irIP), - rPort(irPort) +: ConnectionType(Incomming), + connection_socket(in_socket), + id(ID), + rIP(irIP), + rPort(irPort) { pState = TCPS_Connected; pFree = false; @@ -438,8 +438,8 @@ bool TCPConnection::ConnectIP(uint32 in_ip, uint16 in_port, char* errbuf) { } connection_socket = INVALID_SOCKET; - struct sockaddr_in server_sin; -// struct in_addr in; + struct sockaddr_in server_sin; + //struct in_addr in; if ((connection_socket = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET || connection_socket == 0) { #ifdef _WINDOWS @@ -490,7 +490,7 @@ bool TCPConnection::ConnectIP(uint32 in_ip, uint16 in_port, char* errbuf) { SetEcho(false); ClearBuffers(); - + rIP = in_ip; rPort = in_port; SetState(TCPS_Connected); @@ -504,7 +504,7 @@ void TCPConnection::ClearBuffers() { LockMutex lock4(&MState); safe_delete_array(recvbuf); safe_delete_array(sendbuf); - + char* line = 0; while ((line = LineOutQueue.pop())) safe_delete_array(line); @@ -520,7 +520,7 @@ bool TCPConnection::CheckNetActive() { return false; } -/* This is always called from an IO thread. Either the server socket's thread, or a +/* This is always called from an IO thread. Either the server socket's thread, or a * special thread we create when we make an outbound connection. */ bool TCPConnection::Process() { char errbuf[TCPConnection_ErrorBufferSize]; @@ -535,18 +535,18 @@ bool TCPConnection::Process() { } } return(true); - + case TCPS_Connected: // only receive data in the connected state, no others... if (!RecvData(errbuf)) { - struct in_addr in; + struct in_addr in; in.s_addr = GetrIP(); //cout << inet_ntoa(in) << ":" << GetrPort() << ": " << errbuf << endl; return false; } /* we break to do the send */ break; - + case TCPS_Disconnecting: { //waiting for any sending data to go out... MSendQueue.lock(); @@ -562,7 +562,7 @@ bool TCPConnection::Process() { MSendQueue.unlock(); } /* Fallthrough */ - + case TCPS_Disconnected: FinishDisconnect(); MRunLoop.lock(); @@ -570,27 +570,27 @@ bool TCPConnection::Process() { MRunLoop.unlock(); // SetState(TCPS_Ready); //reset the state in case they want to use it again... return(false); - + case TCPS_Closing: //I dont understand this state... - + case TCPS_Error: MRunLoop.lock(); pRunLoop = false; MRunLoop.unlock(); return(false); } - + /* we get here in connected or disconnecting with more data to send */ - + bool sent_something = false; if (!SendData(sent_something, errbuf)) { - struct in_addr in; + struct in_addr in; in.s_addr = GetrIP(); cout << inet_ntoa(in) << ":" << GetrPort() << ": " << errbuf << endl; return false; } - + return true; } @@ -621,9 +621,9 @@ bool TCPConnection::RecvData(char* errbuf) { } } - status = recv(connection_socket, (char *) &recvbuf[recvbuf_used], (recvbuf_size - recvbuf_used), 0); + status = recv(connection_socket, (char *) &recvbuf[recvbuf_used], (recvbuf_size - recvbuf_used), 0); - if (status >= 1) { + if (status >= 1) { #if TCPN_LOG_RAW_DATA_IN >= 1 struct in_addr in; in.s_addr = GetrIP(); @@ -642,7 +642,7 @@ bool TCPConnection::RecvData(char* errbuf) { recvbuf_used += status; if (!ProcessReceivedData(errbuf)) return false; - } + } else if (status == SOCKET_ERROR) { #ifdef _WINDOWS if (!(WSAGetLastError() == WSAEWOULDBLOCK)) { @@ -770,15 +770,15 @@ bool TCPConnection::ProcessReceivedData(char* errbuf) { i = -1; m_previousLineEnd = true; } - - + + if(line != nullptr) { bool finish_proc = false; finish_proc = LineOutQueuePush(line); if(finish_proc) return(true); //break early as requested by LineOutQueuePush } - + break; } case 8: // backspace @@ -877,13 +877,13 @@ bool TCPConnection::SendData(bool &sent_something, char* errbuf) { snprintf(errbuf, TCPConnection_ErrorBufferSize, "TCPConnection::SendData(): send(): Errorcode: %s", strerror(errno)); #endif } - + //if we get an error while disconnecting, just jump to disconnected MState.lock(); if(pState == TCPS_Disconnecting) pState = TCPS_Disconnected; MState.unlock(); - + return false; } } @@ -908,7 +908,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { if (!tcpc->ConnectReady()) { _CP(TCPConnectionLoop); if (!tcpc->Process()) { - //the processing loop has detecting an error.. + //the processing loop has detecting an error.. //we want to drop the link immediately, so we clear buffers too. tcpc->ClearBuffers(); tcpc->Disconnect(); @@ -927,11 +927,11 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { Sleep(10); //nothing to do. } tcpc->MLoopRunning.unlock(); - + #ifndef WIN32 _log(COMMON__THREADS, "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif - + THREAD_RETURN(nullptr); } @@ -943,7 +943,3 @@ bool TCPConnection::RunLoop() { return ret; } - - - - diff --git a/common/TCPConnection.h b/common/TCPConnection.h index d2f942c5e..7473db1c6 100644 --- a/common/TCPConnection.h +++ b/common/TCPConnection.h @@ -1,25 +1,25 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 TCP_CONNECTION_H #define TCP_CONNECTION_H /* - Parent classes for interserver TCP Communication. - -Quagmire + Parent classes for interserver TCP Communication. + -Quagmire */ #ifdef _WINDOWS @@ -28,7 +28,7 @@ #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #include #else @@ -75,15 +75,15 @@ protected: TCPS_Closing = 250, TCPS_Error = 255 } State_t; - + public: //socket created by a server (incoming) TCPConnection(uint32 ID, SOCKET iSock, uint32 irIP, uint16 irPort); //socket created to connect to a server (outgoing) TCPConnection(); // for outgoing connections - + virtual ~TCPConnection(); - + // Functions for outgoing connections bool Connect(const char* irAddress, uint16 irPort, char* errbuf = 0); virtual bool ConnectIP(uint32 irIP, uint16 irPort, char* errbuf = 0); @@ -92,7 +92,7 @@ public: virtual void Disconnect(); bool Send(const uchar* data, int32 size); - + char* PopLine(); //returns ownership of allocated byte array inline uint32 GetrIP() const { return rIP; } inline uint16 GetrPort() const { return rPort; } @@ -106,7 +106,7 @@ public: bool GetEcho(); void SetEcho(bool iValue); bool GetSockName(char *host, uint16 *port); - + //should only be used by TCPServer: bool CheckNetActive(); inline bool IsFree() const { return pFree; } @@ -129,10 +129,10 @@ protected: virtual bool ProcessReceivedData(char* errbuf = 0); virtual bool SendData(bool &sent_something, char* errbuf = 0); virtual bool RecvData(char* errbuf = 0); - + virtual void ClearBuffers(); - + bool m_previousLineEnd; eConnectionType ConnectionType; @@ -144,22 +144,22 @@ protected: uint32 rIP; uint16 rPort; // host byte order bool pFree; - + mutable Mutex MState; State_t pState; - + //text based line out queue. Mutex MLineOutQueue; virtual bool LineOutQueuePush(char* line); //this is really kinda a hack for the transition to packet mode. Returns true to stop processing the output. MyQueue LineOutQueue; - + uchar* recvbuf; int32 recvbuf_size; int32 recvbuf_used; - + int32 recvbuf_echo; volatile bool pEcho; - + Mutex MSendQueue; uchar* sendbuf; int32 sendbuf_size; @@ -169,7 +169,7 @@ protected: void ServerSendQueuePushEnd(const uchar* data, int32 size); void ServerSendQueuePushEnd(uchar** data, int32 size); void ServerSendQueuePushFront(uchar* data, int32 size); - + private: void FinishDisconnect(); }; @@ -177,5 +177,3 @@ private: #endif - - diff --git a/common/TCPServer.cpp b/common/TCPServer.cpp index 175dc0b3b..415587b81 100644 --- a/common/TCPServer.cpp +++ b/common/TCPServer.cpp @@ -1,5 +1,3 @@ - - #include "debug.h" #include "TCPServer.h" #include @@ -18,12 +16,8 @@ #define SOCKET_ERROR -1 #endif - #define SERVER_LOOP_GRANULARITY 3 //# of ms between checking our socket/queues - - - BaseTCPServer::BaseTCPServer(uint16 in_port) { NextID = 1; pPort = in_port; @@ -70,11 +64,11 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { THREAD_RETURN(nullptr); } BaseTCPServer* tcps = (BaseTCPServer*) tmp; - + #ifndef WIN32 _log(COMMON__THREADS, "Starting TCPServerLoop with thread ID %d", pthread_self()); #endif - + tcps->MLoopRunning.lock(); while (tcps->RunLoop()) { _CP(BaseTCPServerLoop); @@ -82,11 +76,11 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { tcps->Process(); } tcps->MLoopRunning.unlock(); - + #ifndef WIN32 _log(COMMON__THREADS, "Ending TCPServerLoop with thread ID %d", pthread_self()); #endif - + THREAD_RETURN(nullptr); } @@ -95,14 +89,14 @@ void BaseTCPServer::Process() { } void BaseTCPServer::ListenNewConnections() { - SOCKET tmpsock; - struct sockaddr_in from; - struct in_addr in; - unsigned int fromlen; - unsigned short port; - - from.sin_family = AF_INET; - fromlen = sizeof(from); + SOCKET tmpsock; + struct sockaddr_in from; + struct in_addr in; + unsigned int fromlen; + unsigned short port; + + from.sin_family = AF_INET; + fromlen = sizeof(from); LockMutex lock(&MSock); if (!sock) return; @@ -124,7 +118,7 @@ void BaseTCPServer::ListenNewConnections() { setsockopt(tmpsock, SOL_SOCKET, SO_RCVBUF, (char*) &bufsize, sizeof(bufsize)); port = from.sin_port; in.s_addr = from.sin_addr.s_addr; - + // New TCP connection, this must consume the socket. CreateNewConnection(GetNextID(), tmpsock, in.s_addr, ntohs(from.sin_port)); } @@ -151,7 +145,7 @@ bool BaseTCPServer::Open(uint16 in_port, char* errbuf) { #endif int reuse_addr = 1; -// Setup internet address information. +// Setup internet address information. // This is used with the bind() call memset((char *) &address, 0, sizeof(address)); address.sin_family = AF_INET; @@ -211,7 +205,7 @@ bool BaseTCPServer::Open(uint16 in_port, char* errbuf) { void BaseTCPServer::Close() { StopLoopAndWait(); - + LockMutex lock(&MSock); if (sock) { #ifdef _WINDOWS @@ -230,4 +224,3 @@ bool BaseTCPServer::IsOpen() { return ret; } - diff --git a/common/TCPServer.h b/common/TCPServer.h index 2a5b95ad3..2ed2e24de 100644 --- a/common/TCPServer.h +++ b/common/TCPServer.h @@ -22,17 +22,17 @@ public: protected: static ThreadReturnType TCPServerLoop(void* tmp); - + //factory method: virtual void CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort) = 0; - - + + virtual void Process(); bool RunLoop(); Mutex MLoopRunning; - + void StopLoopAndWait(); - + void ListenNewConnections(); uint32 NextID; @@ -55,10 +55,10 @@ public: TCPServer(uint16 iPort = 0) : BaseTCPServer(iPort) { } - + virtual ~TCPServer() { StopLoopAndWait(); - + //im not sure what the right thing to do here is... //we are freeing a connection which somebody likely has a pointer to.. //but, we really shouldent ever get called anyhow.. @@ -69,7 +69,7 @@ public: delete *cur; } } - + T * NewQueuePop() { T * ret = nullptr; MNewQueue.lock(); @@ -80,11 +80,11 @@ public: MNewQueue.unlock(); return ret; } - + protected: virtual void Process() { BaseTCPServer::Process(); - + vitr cur; cur = m_list.begin(); while(cur != m_list.end()) { @@ -102,18 +102,18 @@ protected: } } } - + void AddConnection(T *con) { m_list.push_back(con); MNewQueue.lock(); m_NewQueue.push(con); MNewQueue.unlock(); } - + //queue of new connections, for the app to pull from Mutex MNewQueue; std::queue m_NewQueue; - + vstore m_list; }; diff --git a/common/XMLParser.cpp b/common/XMLParser.cpp index 481dbf81f..44626f82f 100644 --- a/common/XMLParser.cpp +++ b/common/XMLParser.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" #include "XMLParser.h" @@ -29,7 +29,7 @@ bool XMLParser::ParseFile(const char *file, const char *root_ele) { printf("Unable to load '%s': %s\n", file, doc.ErrorDesc()); return(false); } - + TiXmlElement *root = doc.FirstChildElement( root_ele ); if(root == nullptr) { printf("Unable to find root '%s' in %s\n",root_ele, file); @@ -37,7 +37,7 @@ bool XMLParser::ParseFile(const char *file, const char *root_ele) { } ParseOkay=true; - + TiXmlNode *main_element = nullptr; while( (main_element = root->IterateChildren( main_element )) ) { if(main_element->Type() != TiXmlNode::ELEMENT) @@ -47,25 +47,25 @@ bool XMLParser::ParseFile(const char *file, const char *root_ele) { handler=Handlers.find(ele->Value()); if (handler!=Handlers.end() && handler->second) { ElementHandler h=handler->second; - + /* - * - * This is kinda a sketchy operation here, since all of these - * element handler methods will be functions in child classes. - * This essentially causes us to do an un-checkable (and hence - * un-handle-properly-able) cast down to the child class. This - * WILL BREAK if any children classes do multiple inheritance. - * - * - */ - + * + * This is kinda a sketchy operation here, since all of these + * element handler methods will be functions in child classes. + * This essentially causes us to do an un-checkable (and hence + * un-handle-properly-able) cast down to the child class. This + * WILL BREAK if any children classes do multiple inheritance. + * + * + */ + (this->*h)(ele); } else { //unhandled element.... do nothing for now } - + } - + return(ParseOkay); } diff --git a/common/XMLParser.h b/common/XMLParser.h index 37e1bb915..503b96e19 100644 --- a/common/XMLParser.h +++ b/common/XMLParser.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 XMLParser_H #define XMLParser_H @@ -29,18 +29,18 @@ using namespace std; /* - * See note in XMLParser::ParseFile() before inheriting this class. - */ +* See note in XMLParser::ParseFile() before inheriting this class. +*/ class XMLParser { public: typedef void (XMLParser::*ElementHandler)(TiXmlElement *ele); - + XMLParser(); virtual ~XMLParser() {} - + bool ParseFile(const char *file, const char *root_ele); bool ParseStatus() const { return ParseOkay; } - + protected: const char *ParseTextBlock(TiXmlNode *within, const char *name, bool optional = false); const char *GetText(TiXmlNode *within, bool optional = false); @@ -48,12 +48,9 @@ protected: map Handlers; bool ParseOkay; - + }; #endif - - - diff --git a/common/bodytypes.h b/common/bodytypes.h index f3e49a0b4..804506e7a 100644 --- a/common/bodytypes.h +++ b/common/bodytypes.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 BODYTYPES_H #define BODYTYPES_H @@ -25,7 +25,7 @@ typedef enum { BT_Giant = 4, BT_Construct = 5, BT_Extraplanar = 6, - BT_Magical = 7, //this name might be a bit off, + BT_Magical = 7, //this name might be a bit off, BT_SummonedUndead = 8, BT_RaidGiant = 9, // ... @@ -45,7 +45,7 @@ typedef enum { BT_Dragon = 26, BT_Summoned2 = 27, BT_Summoned3 = 28, - // 29 + //29 BT_VeliousDragon = 30, //might not be a tight set // ... BT_Dragon3 = 32, diff --git a/common/breakdowns.h b/common/breakdowns.h index dccf6e2f6..18dfb803f 100644 --- a/common/breakdowns.h +++ b/common/breakdowns.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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_ diff --git a/common/classes.cpp b/common/classes.cpp index a632c8889..a1a3bf05a 100644 --- a/common/classes.cpp +++ b/common/classes.cpp @@ -1,279 +1,279 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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/debug.h" #include "../common/classes.h" 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: + 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: + case CLERICGM: return "Cleric Guildmaster"; - case PALADINGM: + case PALADINGM: return "Paladin Guildmaster"; - case RANGERGM: + case RANGERGM: return "Ranger Guildmaster"; - case SHADOWKNIGHTGM: + case SHADOWKNIGHTGM: return "Shadowknight Guildmaster"; - case DRUIDGM: - return "Druid Guildmaster"; - case MONKGM: + case DRUIDGM: + return "Druid Guildmaster"; + case MONKGM: return "Monk Guildmaster"; - case BARDGM: + case BARDGM: return "Bard Guildmaster"; - case ROGUEGM: + case ROGUEGM: return "Rogue Guildmaster"; - case SHAMANGM: + case SHAMANGM: return "Shaman Guildmaster"; - case NECROMANCERGM: + case NECROMANCERGM: return "Necromancer Guildmaster"; - case WIZARDGM: + case WIZARDGM: return "Wizard Guildmaster"; - case MAGICIANGM: + case MAGICIANGM: return "Magician Guildmaster"; - case ENCHANTERGM: + case ENCHANTERGM: return "Enchanter Guildmaster"; - case BEASTLORDGM: + case BEASTLORDGM: return "Beastlord Guildmaster"; - case BERSERKERGM: + case BERSERKERGM: return "Berserker Guildmaster"; - case MERCHANT: + case MERCHANT: return "Merchant"; case ADVENTURERECRUITER: return "Adventure Recruiter"; @@ -285,7 +285,7 @@ const char* GetEQClassName(uint8 class_, uint8 level) { return "Tribute Master"; case GUILD_TRIBUTE_MASTER: return "Guild Tribute Master"; - default: + default: return "Unknown"; } } diff --git a/common/classes.h b/common/classes.h index a6072e1ba..b70609379 100644 --- a/common/classes.h +++ b/common/classes.h @@ -1,59 +1,59 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 CLASSES_CH #define CLASSES_CH #include "../common/types.h" #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 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 -#define RANGERGM 23 -#define SHADOWKNIGHTGM 24 -#define DRUIDGM 25 -#define MONKGM 26 -#define BARDGM 27 -#define ROGUEGM 28 -#define SHAMANGM 29 -#define NECROMANCERGM 30 -#define WIZARDGM 31 -#define MAGICIANGM 32 -#define ENCHANTERGM 33 +#define WARRIORGM 20 +#define CLERICGM 21 +#define PALADINGM 22 +#define RANGERGM 23 +#define SHADOWKNIGHTGM 24 +#define DRUIDGM 25 +#define MONKGM 26 +#define BARDGM 27 +#define ROGUEGM 28 +#define SHAMANGM 29 +#define NECROMANCERGM 30 +#define WIZARDGM 31 +#define MAGICIANGM 32 +#define ENCHANTERGM 33 #define BEASTLORDGM 34 #define BERSERKERGM 35 -#define BANKER 40 +#define BANKER 40 #define MERCHANT 41 #define DISCORD_MERCHANT 59 #define ADVENTURERECRUITER 60 diff --git a/common/common_profile.h b/common/common_profile.h index 034a59d63..3dba80cbc 100644 --- a/common/common_profile.h +++ b/common/common_profile.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2004 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 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 + 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. + 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 + 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_PROFILE_H #define COMMON_PROFILE_H @@ -45,41 +45,41 @@ public: Database_DBLoadItems, Database_GetWaypoints, Database_DBLoadNPCFactionLists, - + DBcore_RunQuery, - + DBAsync_ProcessWork, DBAsync_DispatchWork, DBAsyncLoop_loop, - + EQStreamServer_Process, - + EQStream_Process, - + EQStreamServerLoop, EQStreamInLoop, EQStreamOutLoop, TCPServerLoop, TCPConnectionLoop, - + Inventory_GetItem, Inventory_HasItem, - + BaseTCPServerLoop, MakeRandomInt, MakeRandomFloat, - + Mutex_lock, Timer_Check, - + WorldConnection_Process, - + MaxCommonProfilerId }; - + inline CommonProfiler() : GeneralProfiler(MaxCommonProfilerId) { } - + }; extern CommonProfiler _cp; diff --git a/common/crash.cpp b/common/crash.cpp index 44c05f50f..5ce1229a5 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -7,107 +7,107 @@ class EQEmuStackWalker : public StackWalker { public: - EQEmuStackWalker() : StackWalker() { } - EQEmuStackWalker(DWORD dwProcessId, HANDLE hProcess) : StackWalker(dwProcessId, hProcess) { } - virtual void OnOutput(LPCSTR szText) { - char buffer[4096]; - for(int i = 0; i < 4096; ++i) { - if(szText[i] == 0) { - buffer[i] = '\0'; - break; - } + EQEmuStackWalker() : StackWalker() { } + EQEmuStackWalker(DWORD dwProcessId, HANDLE hProcess) : StackWalker(dwProcessId, hProcess) { } + virtual void OnOutput(LPCSTR szText) { + char buffer[4096]; + for(int i = 0; i < 4096; ++i) { + if(szText[i] == 0) { + buffer[i] = '\0'; + break; + } - if(szText[i] == '\n' || szText[i] == '\r') { - buffer[i] = ' '; - } else { - buffer[i] = szText[i]; - } - } + if(szText[i] == '\n' || szText[i] == '\r') { + buffer[i] = ' '; + } else { + buffer[i] = szText[i]; + } + } - LogFile->write(EQEMuLog::Crash, buffer); - StackWalker::OnOutput(szText); - } + LogFile->write(EQEMuLog::Crash, buffer); + StackWalker::OnOutput(szText); + } }; LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) { - switch(ExceptionInfo->ExceptionRecord->ExceptionCode) - { - case EXCEPTION_ACCESS_VIOLATION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_ACCESS_VIOLATION"); - break; - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); - break; - case EXCEPTION_BREAKPOINT: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_BREAKPOINT"); - break; - case EXCEPTION_DATATYPE_MISALIGNMENT: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); - break; - case EXCEPTION_FLT_DENORMAL_OPERAND: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); - break; - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); - break; - case EXCEPTION_FLT_INEXACT_RESULT: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); - break; - case EXCEPTION_FLT_INVALID_OPERATION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); - break; - case EXCEPTION_FLT_OVERFLOW: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_OVERFLOW"); - break; - case EXCEPTION_FLT_STACK_CHECK: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_STACK_CHECK"); - break; - case EXCEPTION_FLT_UNDERFLOW: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_UNDERFLOW"); - break; - case EXCEPTION_ILLEGAL_INSTRUCTION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); - break; - case EXCEPTION_IN_PAGE_ERROR: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_IN_PAGE_ERROR"); - break; - case EXCEPTION_INT_DIVIDE_BY_ZERO: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); - break; - case EXCEPTION_INT_OVERFLOW: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_OVERFLOW"); - break; - case EXCEPTION_INVALID_DISPOSITION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_INVALID_DISPOSITION"); - break; - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); - break; - case EXCEPTION_PRIV_INSTRUCTION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION"); - break; - case EXCEPTION_SINGLE_STEP: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_SINGLE_STEP"); - break; - case EXCEPTION_STACK_OVERFLOW: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_STACK_OVERFLOW"); - break; - default: - LogFile->write(EQEMuLog::Crash, "Unknown Exception"); - break; - } - - if(EXCEPTION_STACK_OVERFLOW != ExceptionInfo->ExceptionRecord->ExceptionCode) - { - EQEmuStackWalker sw; sw.ShowCallstack(GetCurrentThread(), ExceptionInfo->ContextRecord); - } - - return EXCEPTION_EXECUTE_HANDLER; + switch(ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_ACCESS_VIOLATION"); + break; + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); + break; + case EXCEPTION_BREAKPOINT: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_BREAKPOINT"); + break; + case EXCEPTION_DATATYPE_MISALIGNMENT: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); + break; + case EXCEPTION_FLT_DENORMAL_OPERAND: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); + break; + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); + break; + case EXCEPTION_FLT_INEXACT_RESULT: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); + break; + case EXCEPTION_FLT_INVALID_OPERATION: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); + break; + case EXCEPTION_FLT_OVERFLOW: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_OVERFLOW"); + break; + case EXCEPTION_FLT_STACK_CHECK: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_STACK_CHECK"); + break; + case EXCEPTION_FLT_UNDERFLOW: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_UNDERFLOW"); + break; + case EXCEPTION_ILLEGAL_INSTRUCTION: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); + break; + case EXCEPTION_IN_PAGE_ERROR: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_IN_PAGE_ERROR"); + break; + case EXCEPTION_INT_DIVIDE_BY_ZERO: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); + break; + case EXCEPTION_INT_OVERFLOW: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_OVERFLOW"); + break; + case EXCEPTION_INVALID_DISPOSITION: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_INVALID_DISPOSITION"); + break; + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); + break; + case EXCEPTION_PRIV_INSTRUCTION: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION"); + break; + case EXCEPTION_SINGLE_STEP: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_SINGLE_STEP"); + break; + case EXCEPTION_STACK_OVERFLOW: + LogFile->write(EQEMuLog::Crash, "EXCEPTION_STACK_OVERFLOW"); + break; + default: + LogFile->write(EQEMuLog::Crash, "Unknown Exception"); + break; + } + + if(EXCEPTION_STACK_OVERFLOW != ExceptionInfo->ExceptionRecord->ExceptionCode) + { + EQEmuStackWalker sw; sw.ShowCallstack(GetCurrentThread(), ExceptionInfo->ContextRecord); + } + + return EXCEPTION_EXECUTE_HANDLER; } void set_exception_handler() { - SetUnhandledExceptionFilter(windows_exception_handler); + SetUnhandledExceptionFilter(windows_exception_handler); } #else // crash is off or an unhandled platform diff --git a/common/crc32.cpp b/common/crc32.cpp index d5dd48e78..0e9746a08 100644 --- a/common/crc32.cpp +++ b/common/crc32.cpp @@ -84,21 +84,21 @@ uint32 CRC32::GenerateNoFlip(const uint8* buf, uint32 bufsize) { void CRC32::SetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at) { unsigned long data; - unsigned long check = 0xffffffff; - + unsigned long check = 0xffffffff; + assert(in_length >= start_at && in_data); - - for(uint32 i=start_at; i> 8; - data = CRC32Table[data]; - check = check ^ data; - } - - memcpy(in_data, (char*)&check, 4); + + for(uint32 i=start_at; i> 8; + data = CRC32Table[data]; + check = check ^ data; + } + + memcpy(in_data, (char*)&check, 4); } uint32 CRC32::Update(const uint8* buf, uint32 bufsize, uint32 crc32var) { diff --git a/common/crc32.h b/common/crc32.h index 4abea79bd..3a391a564 100644 --- a/common/crc32.h +++ b/common/crc32.h @@ -8,12 +8,12 @@ public: static uint32 Generate(const uint8* buf, uint32 bufsize); static uint32 GenerateNoFlip(const uint8* buf, uint32 bufsize); // Same as Generate(), but without the ~ static void SetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at=4); - + // Multiple buffer CRC32 static uint32 Update(const uint8* buf, uint32 bufsize, uint32 crc32 = 0xFFFFFFFF); static inline uint32 Finish(uint32 crc32) { return ~crc32; } static inline void Finish(uint32* crc32) { *crc32 = ~(*crc32); } - + private: static inline void Calc(const uint8 byte, uint32& crc32); }; diff --git a/common/database.cpp b/common/database.cpp index 8960a58e0..4572533c4 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + 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 - the Free Software Foundation; version 2 of the License. + 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 + 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. + 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 + 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/debug.h" #include "../common/rulesys.h" @@ -56,7 +56,7 @@ server after the world server, or inbetween zones when that is finished /* Establish a connection to a mysql database with the supplied parameters - Added a very simple .ini file parser - Bounce + Added a very simple .ini file parser - Bounce Modify to use for win32 & linux - misanthropicfiend */ @@ -158,9 +158,9 @@ Zero will also be returned if there is a database error. */ uint32 Database::CheckLogin(const char* name, const char* password, int16* oStatus) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if(strlen(name) >= 50 || strlen(password) >= 50) return(0); @@ -202,53 +202,53 @@ uint32 Database::CheckLogin(const char* name, const char* password, int16* oStat } -//Lieka: Get Banned IP Address List - Only return false if the incoming connection's IP address is not present in the banned_ips table. +//Lieka: Get Banned IP Address List - Only return false if the incoming connection's IP address is not present in the banned_ips table. bool Database::CheckBannedIPs(const char* loginIP) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - //cout << "Checking against Banned IPs table."<< endl; //Lieka: Debugging - if (RunQuery(query, MakeAnyLenString(&query, "SELECT ip_address FROM Banned_IPs WHERE ip_address='%s'", loginIP), errbuf, &result)) { - safe_delete_array(query); - if (mysql_num_rows(result) != 0) - { - //cout << loginIP << " was present in the banned IPs table" << endl; //Lieka: Debugging - mysql_free_result(result); - return true; - } - else - { - //cout << loginIP << " was not present in the banned IPs table." << endl; //Lieka: Debugging - mysql_free_result(result); - return false; - } - mysql_free_result(result); - } - else - { - cerr << "Error in CheckBannedIPs query '" << query << "' " << errbuf << endl; - safe_delete_array(query); - return true; - } - return true; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; + MYSQL_RES *result; + //cout << "Checking against Banned IPs table."<< endl; //Lieka: Debugging + if (RunQuery(query, MakeAnyLenString(&query, "SELECT ip_address FROM Banned_IPs WHERE ip_address='%s'", loginIP), errbuf, &result)) { + safe_delete_array(query); + if (mysql_num_rows(result) != 0) + { + //cout << loginIP << " was present in the banned IPs table" << endl; //Lieka: Debugging + mysql_free_result(result); + return true; + } + else + { + //cout << loginIP << " was not present in the banned IPs table." << endl; //Lieka: Debugging + mysql_free_result(result); + return false; + } + mysql_free_result(result); + } + else + { + cerr << "Error in CheckBannedIPs query '" << query << "' " << errbuf << endl; + safe_delete_array(query); + return true; + } + return true; } bool Database::AddBannedIP(char* bannedIP, const char* notes) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; - if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into Banned_IPs SET ip_address='%s', notes='%s'", bannedIP, notes), errbuf)) { - cerr << "Error in ReserveName query '" << query << "' " << errbuf << endl; - safe_delete_array(query); - return false; - } - safe_delete_array(query); - return true; + if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into Banned_IPs SET ip_address='%s', notes='%s'", bannedIP, notes), errbuf)) { + cerr << "Error in ReserveName query '" << query << "' " << errbuf << endl; + safe_delete_array(query); + return false; + } + safe_delete_array(query); + return true; } //End Lieka Edit - + bool Database::CheckGMIPs(const char* ip_address, uint32 account_id) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; @@ -268,7 +268,7 @@ bool Database::AddBannedIP(char* bannedIP, const char* notes) safe_delete_array(query); return false; } - + return false; } @@ -287,12 +287,12 @@ bool Database::AddGMIP(char* ip_address, char* name) { void Database::LoginIP(uint32 AccountID, const char* LoginIP) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO account_ip SET accid=%i, ip='%s' ON DUPLICATE KEY UPDATE count=count+1, lastused=now()", AccountID, LoginIP), errbuf)) { - cerr << "Error in Log IP query '" << query << "' " << errbuf << endl; - } - safe_delete_array(query); + cerr << "Error in Log IP query '" << query << "' " << errbuf << endl; + } + safe_delete_array(query); } int16 Database::CheckStatus(uint32 account_id) @@ -303,7 +303,7 @@ int16 Database::CheckStatus(uint32 account_id) MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT `status`, UNIX_TIMESTAMP(`suspendeduntil`) as `suspendeduntil`, UNIX_TIMESTAMP() as `current`" - " FROM `account` WHERE `id` = %i", account_id), errbuf, &result)) + " FROM `account` WHERE `id` = %i", account_id), errbuf, &result)) { safe_delete_array(query); @@ -343,7 +343,7 @@ int16 Database::CheckStatus(uint32 account_id) uint32 Database::CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 querylen; uint32 last_insert_id; @@ -370,7 +370,7 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta bool Database::DeleteAccount(const char* name) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; cerr << "Account Attempting to be deleted:" << name << endl; @@ -391,7 +391,7 @@ bool Database::DeleteAccount(const char* name) { bool Database::SetLocalPassword(uint32 accid, const char* password) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET password=MD5('%s') where id=%i;", password, accid), errbuf)) { cerr << "Error in SetLocalPassword query '" << query << "' " << errbuf << endl; @@ -426,7 +426,7 @@ bool Database::SetAccountStatus(const char* name, int16 status) { bool Database::ReserveName(uint32 account_id, char* name) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into character_ SET account_id=%i, name='%s', profile=NULL", account_id, name), errbuf)) { cerr << "Error in ReserveName query '" << query << "' " << errbuf << endl; @@ -651,34 +651,34 @@ bool Database::DeleteCharacter(char *name) } #if DEBUG >= 5 - printf(" keyring"); + printf(" keyring"); #endif - RunQuery(query, MakeAnyLenString(&query, "DELETE FROM keyring WHERE char_id='%d'", charid), errbuf, nullptr, &affected_rows); - if(query) - { - safe_delete_array(query); - query = nullptr; - } + RunQuery(query, MakeAnyLenString(&query, "DELETE FROM keyring WHERE char_id='%d'", charid), errbuf, nullptr, &affected_rows); + if(query) + { + safe_delete_array(query); + query = nullptr; + } #if DEBUG >= 5 - printf(" factions"); + printf(" factions"); #endif - RunQuery(query, MakeAnyLenString(&query, "DELETE FROM faction_values WHERE char_id='%d'", charid), errbuf, nullptr, &affected_rows); - if(query) - { - safe_delete_array(query); - query = nullptr; - } + RunQuery(query, MakeAnyLenString(&query, "DELETE FROM faction_values WHERE char_id='%d'", charid), errbuf, nullptr, &affected_rows); + if(query) + { + safe_delete_array(query); + query = nullptr; + } #if DEBUG >= 5 - printf(" instances"); + printf(" instances"); #endif - RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE charid='%d'", charid), errbuf, nullptr, &affected_rows); - if(query) - { - safe_delete_array(query); - query = nullptr; - } + RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE charid='%d'", charid), errbuf, nullptr, &affected_rows); + if(query) + { + safe_delete_array(query); + query = nullptr; + } #if DEBUG >= 5 printf(" _character"); @@ -696,14 +696,14 @@ bool Database::DeleteCharacter(char *name) } #if DEBUG >= 5 - printf(" alternate currency"); + printf(" alternate currency"); #endif - RunQuery(query, MakeAnyLenString(&query, "DELETE FROM character_alt_currency WHERE char_id='%d'", charid), errbuf, nullptr, &affected_rows); - if(query) - { - safe_delete_array(query); - query = nullptr; - } + RunQuery(query, MakeAnyLenString(&query, "DELETE FROM character_alt_currency WHERE char_id='%d'", charid), errbuf, nullptr, &affected_rows); + if(query) + { + safe_delete_array(query); + query = nullptr; + } #if DEBUG >= 5 printf("\n"); @@ -744,7 +744,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven errbuf, &result )) { - safe_delete_array(charidquery); + safe_delete_array(charidquery); LogFile->write(EQEMuLog::Error, "Error in char store id query: %s: %s", charidquery, errbuf); return(false); } @@ -816,15 +816,15 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven RunQuery(invquery, strlen(invquery), errbuf, 0, &affected_rows); if(!affected_rows) { - LogFile->write(EQEMuLog::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery, errbuf); + LogFile->write(EQEMuLog::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery, errbuf); } #if EQDEBUG >= 9 else { - LogFile->write(EQEMuLog::Debug, "StoreCharacter inventory succeeded. Query '%s' %s", invquery, errbuf); + LogFile->write(EQEMuLog::Debug, "StoreCharacter inventory succeeded. Query '%s' %s", invquery, errbuf); } #endif - safe_delete_array(invquery); + safe_delete_array(invquery); } if(i==30){ //end of standard inventory/cursor, jump to internals of bags/cursor @@ -859,9 +859,9 @@ Zero will also be returned if there is a database error. */ uint32 Database::GetAccountIDByChar(const char* charname, uint32* oCharID) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT account_id, id FROM character_ WHERE name='%s'", charname), errbuf, &result)) { safe_delete_array(query); @@ -887,9 +887,9 @@ uint32 Database::GetAccountIDByChar(const char* charname, uint32* oCharID) { // Retrieve account_id for a given char_id uint32 Database::GetAccountIDByChar(uint32 char_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char* query = 0; + MYSQL_RES *result; + MYSQL_ROW row; uint32 ret = 0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT account_id FROM character_ WHERE id=%i", char_id), errbuf, &result)) { @@ -909,9 +909,9 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { uint32 Database::GetAccountIDByName(const char* accname, int16* status, uint32* lsid) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; for (unsigned int i=0; i 0) { if (!varcache_array) { @@ -1099,7 +1099,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ bool Database::SetVariable(const char* varname_in, const char* varvalue_in) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; char *varname,*varvalue; @@ -1140,8 +1140,8 @@ bool Database::SetVariable(const char* varname_in, const char* varvalue_in) { uint32 Database::GetMiniLoginAccount(char* ip){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; MYSQL_ROW row; uint32 retid = 0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM account WHERE minilogin_ip='%s'", ip), errbuf, &result)) { @@ -1161,11 +1161,11 @@ uint32 Database::GetMiniLoginAccount(char* ip){ // Pyro: Get zone starting points from DB bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe_x, float* safe_y, float* safe_z, int16* minstatus, uint8* minlevel, char *flag_needed) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; // int buf_len = 256; - // int chars = -1; - MYSQL_RES *result; - MYSQL_ROW row; + // int chars = -1; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT safe_x, safe_y, safe_z, min_status, min_level, " @@ -1208,9 +1208,9 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe bool Database::GetZoneLongName(const char* short_name, char** long_name, char* file_name, float* safe_x, float* safe_y, float* safe_z, uint32* graveyard_id, uint32* maxclients) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT long_name, file_name, safe_x, safe_y, safe_z, graveyard_id, maxclients FROM zone WHERE short_name='%s' AND version=0", short_name), errbuf, &result)) { @@ -1252,10 +1252,10 @@ bool Database::GetZoneLongName(const char* short_name, char** long_name, char* f } uint32 Database::GetZoneGraveyardID(uint32 zone_id, uint32 version) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - uint32 GraveyardID = 0; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + uint32 GraveyardID = 0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT graveyard_id FROM zone WHERE zoneidnumber='%u' AND (version=%i OR version=0) ORDER BY version DESC", zone_id, version), errbuf, &result)) { @@ -1277,9 +1277,9 @@ uint32 Database::GetZoneGraveyardID(uint32 zone_id, uint32 version) { bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid, float* graveyard_x, float* graveyard_y, float* graveyard_z, float* graveyard_heading) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT zone_id, x, y, z, heading FROM graveyard WHERE id=%i", graveyard_id), errbuf, &result)) { @@ -1313,9 +1313,9 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon bool Database::LoadZoneNames() { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; query = new char[256]; strcpy(query, "SELECT MAX(zoneidnumber) FROM zone"); @@ -1379,17 +1379,17 @@ const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) { else return 0; } - + if (zoneID <= max_zonename) { - if (zonename_array[zoneID]) - return zonename_array[zoneID]; - else { - if (ErrorUnknown) - return "UNKNOWN"; - else - return 0; - } - } + if (zonename_array[zoneID]) + return zonename_array[zoneID]; + else { + if (ErrorUnknown) + return "UNKNOWN"; + else + return 0; + } + } else { if (ErrorUnknown) return "UNKNOWN"; @@ -1401,14 +1401,14 @@ const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) { uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; MYSQL_ROW row; int peqzone = 0; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version), errbuf, &result)) + if (RunQuery(query, MakeAnyLenString(&query, "SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version), errbuf, &result)) { - if (mysql_num_rows(result) > 0) + if (mysql_num_rows(result) > 0) { row = mysql_fetch_row(result); peqzone = atoi(row[0]); @@ -1425,7 +1425,7 @@ uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){ return peqzone; } -bool Database::CheckNameFilter(const char* name, bool surname) +bool Database::CheckNameFilter(const char* name, bool surname) { std::string str_name = name; char errbuf[MYSQL_ERRMSG_SIZE]; @@ -1512,7 +1512,7 @@ bool Database::CheckNameFilter(const char* name, bool surname) bool Database::AddToNameFilter(const char* name) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO name_filter (name) values ('%s')", name), errbuf, 0, &affected_rows)) { @@ -1532,9 +1532,9 @@ bool Database::AddToNameFilter(const char* name) { uint32 Database::GetAccountIDFromLSID(uint32 iLSID, char* oAccountName, int16* oStatus) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, name, status FROM account WHERE lsaccount_id=%i", iLSID), errbuf, &result)) { @@ -1567,9 +1567,9 @@ uint32 Database::GetAccountIDFromLSID(uint32 iLSID, char* oAccountName, int16* o void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT name, status FROM account WHERE id=%i", id), errbuf, &result)) { @@ -1589,7 +1589,7 @@ void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) { void Database::ClearMerchantTemp(){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "delete from merchantlist_temp"), errbuf)) { cerr << "Error in ClearMerchantTemp query '" << query << "' " << errbuf << endl; @@ -1599,7 +1599,7 @@ void Database::ClearMerchantTemp(){ bool Database::UpdateName(const char* oldname, const char* newname) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; cout << "Renaming " << oldname << " to " << newname << "..." << endl; @@ -1622,7 +1622,7 @@ bool Database::CheckUsedName(const char* name) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - MYSQL_RES *result; + MYSQL_RES *result; //if (strlen(name) > 15) // return false; if (!RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM character_ where name='%s'", name), errbuf, &result)) { @@ -1634,7 +1634,7 @@ bool Database::CheckUsedName(const char* name) safe_delete_array(query); uint32 tmp = mysql_num_rows(result); mysql_free_result(result); - if (tmp > 0) // There is a Name! No change (Return False) + if (tmp > 0) // There is a Name! No change (Return False) return false; else // Everything is okay, so we go and do this. return true; @@ -1749,15 +1749,15 @@ uint8 Database::CopyCharacter(const char* oldname, const char* newname, uint32 a char* end=query2; end += sprintf(end, "INSERT INTO character_ SET zonename=\'%s\', x = %f, y = %f, z = %f, profile=\'", GetZoneName(pp->zone_id), pp->x, pp->y, pp->z); - end += DoEscapeString(end, (char*) pp, sizeof(PlayerProfile_Struct)); + end += DoEscapeString(end, (char*) pp, sizeof(PlayerProfile_Struct)); end += sprintf(end,"\', extprofile=\'"); end += DoEscapeString(end, (char*) ext, sizeof(ExtendedProfile_Struct)); - end += sprintf(end, "\', account_id=%d, name='%s'", acctid, newname); + end += sprintf(end, "\', account_id=%d, name='%s'", acctid, newname); if (!RunQuery(query2, (uint32) (end - query2), errbuf, 0, &affected_rows)) { - cerr << "Error in CopyCharacter query '" << query << "' " << errbuf << endl; + cerr << "Error in CopyCharacter query '" << query << "' " << errbuf << endl; return 0; - } + } // @merth: Need to copy inventory as well (and shared bank?) if (affected_rows == 0) { @@ -1884,9 +1884,9 @@ uint8 Database::GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZoneID, uint32* oInstanceID, float* oX, float* oY, float* oZ) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, account_id, zonename, instanceid, x, y, z FROM character_ WHERE name='%s'", iName), errbuf, &result)) { safe_delete_array(query); @@ -1919,7 +1919,7 @@ uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZo bool Database::UpdateLiveChar(char* charname,uint32 lsaccount_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET charname='%s' WHERE id=%i;",charname, lsaccount_id), errbuf)) { cerr << "Error in UpdateLiveChar query '" << query << "' " << errbuf << endl; safe_delete_array(query); @@ -1932,9 +1932,9 @@ bool Database::UpdateLiveChar(char* charname,uint32 lsaccount_id) { bool Database::GetLiveChar(uint32 account_id, char* cname) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT charname FROM account WHERE id=%i", account_id), errbuf, &result)) { safe_delete_array(query); if (mysql_num_rows(result) == 1) { @@ -2015,9 +2015,9 @@ void Database::AddReport(std::string who, std::string against, std::string lines safe_delete_array(escape_str); } -void Database::SetGroupID(const char* name,uint32 id, uint32 charid, uint32 ismerc){ +void Database::SetGroupID(const char* name,uint32 id, uint32 charid, uint32 ismerc){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if(id == 0){ //removing you from table if (!RunQuery(query, MakeAnyLenString(&query, "delete from group_id where charid=%i and name='%s' and ismerc=%i",charid, name, ismerc), errbuf)) LogFile->write(EQEMuLog::Error, "Error deleting character from group id: %s", errbuf); @@ -2032,8 +2032,8 @@ void Database::SetGroupID(const char* name,uint32 id, uint32 charid, uint32 ism void Database::ClearGroup(uint32 gid) { ClearGroupLeader(gid); char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - if(gid == 0) { //clear all groups + char *query = 0; + if(gid == 0) { //clear all groups //if (!RunQuery(query, MakeAnyLenString(&query, "update group_id set groupid=0 where groupid!=0"), errbuf)) if (!RunQuery(query, MakeAnyLenString(&query, "delete from group_id"), errbuf)) printf("Unable to clear groups: %s\n",errbuf); @@ -2047,8 +2047,8 @@ void Database::ClearGroup(uint32 gid) { uint32 Database::GetGroupID(const char* name){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; MYSQL_ROW row; uint32 groupid=0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT groupid from group_id where name='%s'", name), errbuf, &result)) { @@ -2069,8 +2069,8 @@ uint32 Database::GetGroupID(const char* name){ char* Database::GetGroupLeaderForLogin(const char* name,char* leaderbuf){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; MYSQL_ROW row; PlayerProfile_Struct pp; if (RunQuery(query, MakeAnyLenString(&query, "SELECT profile from character_ where name='%s'", name), errbuf, &result)) { @@ -2091,7 +2091,7 @@ char* Database::GetGroupLeaderForLogin(const char* name,char* leaderbuf){ void Database::SetGroupLeaderName(uint32 gid, const char* name) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "Replace into group_leaders set gid=%lu, leadername='%s'",(unsigned long)gid,name), errbuf)) printf("Unable to set group leader: %s\n",errbuf); @@ -2106,7 +2106,7 @@ char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* mainta MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT leadername, maintank, assist, puller, marknpc, leadershipaa FROM group_leaders WHERE gid=%lu",(unsigned long)gid), - errbuf, &result)) { + errbuf, &result)) { safe_delete_array(query); @@ -2160,8 +2160,8 @@ char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* mainta void Database::ClearGroupLeader(uint32 gid){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - if(gid == 0) { //clear all group leaders + char *query = 0; + if(gid == 0) { //clear all group leaders if (!RunQuery(query, MakeAnyLenString(&query, "DELETE from group_leaders"), errbuf)) printf("Unable to clear group leaders: %s\n",errbuf); } else { //clear a specific group leader @@ -2176,7 +2176,7 @@ bool FetchRowMap(MYSQL_RES *result, map &rowmap) MYSQL_FIELD *fields; MYSQL_ROW row; unsigned long num_fields,i; -bool retval=false; +bool retval=false; rowmap.clear(); if (result && (num_fields=mysql_num_fields(result)) && (row = mysql_fetch_row(result))!=nullptr && (fields = mysql_fetch_fields(result))!=nullptr) { retval=true; @@ -2227,8 +2227,8 @@ void Database::SetAgreementFlag(uint32 acctid) void Database::ClearRaid(uint32 rid) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - if(rid == 0) { //clear all raids + char *query = 0; + if(rid == 0) { //clear all raids if (!RunQuery(query, MakeAnyLenString(&query, "delete from raid_members"), errbuf)) printf("Unable to clear raids: %s\n",errbuf); } else { //clear a specific group @@ -2240,8 +2240,8 @@ void Database::ClearRaid(uint32 rid) { void Database::ClearRaidDetails(uint32 rid) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - if(rid == 0) { //clear all raids + char *query = 0; + if(rid == 0) { //clear all raids if (!RunQuery(query, MakeAnyLenString(&query, "delete from raid_details"), errbuf)) printf("Unable to clear raid details: %s\n",errbuf); } else { //clear a specific group @@ -2253,11 +2253,11 @@ void Database::ClearRaidDetails(uint32 rid) { uint32 Database::GetRaidID(const char* name){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; MYSQL_ROW row; uint32 raidid=0; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT raidid from raid_members where name='%s'", name), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT raidid from raid_members where name='%s'", name), errbuf, &result)) { if((row = mysql_fetch_row(result))) { @@ -2279,11 +2279,11 @@ const char *Database::GetRaidLeaderName(uint32 rid) static char name[128]; char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; MYSQL_ROW row; - - if (RunQuery(query, MakeAnyLenString(&query, "SELECT name FROM raid_members WHERE raidid=%u AND israidleader=1", + + if (RunQuery(query, MakeAnyLenString(&query, "SELECT name FROM raid_members WHERE raidid=%u AND israidleader=1", rid), errbuf, &result)) { if((row = mysql_fetch_row(result)) != nullptr) { @@ -2326,11 +2326,11 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id) char *query = 0; MYSQL_RES *result; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM instance_lockout where id=%u AND zone=%u", + if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM instance_lockout where id=%u AND zone=%u", instance_id, zone_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { mysql_free_result(result); return true; @@ -2341,7 +2341,7 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id) return false; } } - else + else { safe_delete_array(query); return false; @@ -2356,17 +2356,17 @@ bool Database::CharacterInInstanceGroup(uint16 instance_id, uint32 char_id) MYSQL_RES *result; bool lockout_instance_player = false; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM instance_lockout_player where id=%u AND charid=%u", + if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM instance_lockout_player where id=%u AND charid=%u", instance_id, char_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) == 1) + if (mysql_num_rows(result) == 1) { lockout_instance_player = true; } mysql_free_result(result); } - else + else { safe_delete_array(query); } @@ -2402,11 +2402,11 @@ bool Database::CheckInstanceExpired(uint16 instance_id) int32 start_time = 0; int32 duration = 0; uint32 never_expires = 0; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", + if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); start_time = atoi(row[0]); @@ -2420,7 +2420,7 @@ bool Database::CheckInstanceExpired(uint16 instance_id) } mysql_free_result(result); } - else + else { safe_delete_array(query); return true; @@ -2448,16 +2448,16 @@ uint32 Database::ZoneIDFromInstanceID(uint16 instance_id) MYSQL_ROW row; uint32 ret; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT zone FROM instance_lockout where id=%u", instance_id), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT zone FROM instance_lockout where id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2465,7 +2465,7 @@ uint32 Database::ZoneIDFromInstanceID(uint16 instance_id) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2481,16 +2481,16 @@ uint32 Database::VersionFromInstanceID(uint16 instance_id) MYSQL_ROW row; uint32 ret; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_lockout where id=%u", instance_id), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_lockout where id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2498,7 +2498,7 @@ uint32 Database::VersionFromInstanceID(uint16 instance_id) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2516,11 +2516,11 @@ uint32 Database::GetTimeRemainingInstance(uint16 instance_id, bool &is_perma) uint32 duration = 0; uint32 never_expires = 0; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", + if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); start_time = atoi(row[0]); @@ -2535,7 +2535,7 @@ uint32 Database::GetTimeRemainingInstance(uint16 instance_id, bool &is_perma) } mysql_free_result(result); } - else + else { safe_delete_array(query); is_perma = false; @@ -2567,7 +2567,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) if (RunQuery(query, MakeAnyLenString(&query, "SELECT COUNT(*) FROM instance_lockout"), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); int count = atoi(row[0]); @@ -2584,7 +2584,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) } mysql_free_result(result); } - else + else { safe_delete_array(query); instance_id = 0; @@ -2597,7 +2597,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM instance_lockout where id >= %i ORDER BY id", count), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { while((row = mysql_fetch_row(result))) { @@ -2624,7 +2624,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) mysql_free_result(result); } } - else + else { safe_delete_array(query); } @@ -2638,13 +2638,13 @@ bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - if(RunQuery(query, MakeAnyLenString(&query, "INSERT INTO instance_lockout (id, zone, version, start_time, duration)" + if(RunQuery(query, MakeAnyLenString(&query, "INSERT INTO instance_lockout (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), errbuf)) { safe_delete_array(query); return true; } - else + else { safe_delete_array(query); return false; @@ -2663,7 +2663,7 @@ void Database::PurgeExpiredInstances() "(start_time+duration) <= UNIX_TIMESTAMP() and never_expires = 0"), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) > 0) + if (mysql_num_rows(result) > 0) { row = mysql_fetch_row(result); while(row != nullptr) @@ -2675,7 +2675,7 @@ void Database::PurgeExpiredInstances() } mysql_free_result(result); } - else + else { safe_delete_array(query); } @@ -2692,7 +2692,7 @@ bool Database::AddClientToInstance(uint16 instance_id, uint32 char_id) safe_delete_array(query); return true; } - else + else { safe_delete_array(query); return false; @@ -2704,13 +2704,13 @@ bool Database::RemoveClientFromInstance(uint16 instance_id, uint32 char_id) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - if(RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE id=%lu AND charid=%lu", + if(RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE id=%lu AND charid=%lu", (unsigned long)instance_id, (unsigned long)char_id), errbuf)) { safe_delete_array(query); return true; } - else + else { safe_delete_array(query); return false; @@ -2722,13 +2722,13 @@ bool Database::RemoveClientsFromInstance(uint16 instance_id) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - if(RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE id=%lu", + if(RunQuery(query, MakeAnyLenString(&query, "DELETE FROM instance_lockout_player WHERE id=%lu", (unsigned long)instance_id), errbuf)) { safe_delete_array(query); return true; } - else + else { safe_delete_array(query); return false; @@ -2741,11 +2741,11 @@ bool Database::CheckInstanceExists(uint16 instance_id) char *query = 0; MYSQL_RES *result; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM instance_lockout where id=%u", instance_id), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM instance_lockout where id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { mysql_free_result(result); return true; @@ -2753,7 +2753,7 @@ bool Database::CheckInstanceExists(uint16 instance_id) mysql_free_result(result); return false; } - else + else { safe_delete_array(query); return false; @@ -2767,7 +2767,7 @@ void Database::BuryCorpsesInInstance(uint16 instance_id) char *query = 0; MYSQL_RES *result; - if(RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried=1, instanceid=0 WHERE instanceid=%u", + if(RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried=1, instanceid=0 WHERE instanceid=%u", instance_id), errbuf, &result)) { mysql_free_result(result); @@ -2786,16 +2786,16 @@ uint16 Database::GetInstanceVersion(uint16 instance_id) MYSQL_ROW row; uint32 ret; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_lockout where id=%u", instance_id), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT version FROM instance_lockout where id=%u", instance_id), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2803,7 +2803,7 @@ uint16 Database::GetInstanceVersion(uint16 instance_id) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2824,12 +2824,12 @@ uint16 Database::GetInstanceID(const char* zone, uint32 charid, int16 version) "instance_lockout_player.charid=%u LIMIT 1;", GetZoneID(zone), version, charid, charid), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2837,7 +2837,7 @@ uint16 Database::GetInstanceID(const char* zone, uint32 charid, int16 version) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2861,12 +2861,12 @@ uint16 Database::GetInstanceID(uint32 zone, uint32 charid, int16 version) "instance_lockout_player.charid=%u LIMIT 1;", zone, version, charid), errbuf, &result)) { safe_delete_array(query); - if (mysql_num_rows(result) != 0) + if (mysql_num_rows(result) != 0) { row = mysql_fetch_row(result); ret = atoi(row[0]); mysql_free_result(result); - return ret; + return ret; } else { @@ -2874,7 +2874,7 @@ uint16 Database::GetInstanceID(uint32 zone, uint32 charid, int16 version) return 0; } } - else + else { safe_delete_array(query); return 0; @@ -2891,7 +2891,7 @@ void Database::AssignGroupToInstance(uint32 gid, uint32 instance_id) uint32 zone_id = ZoneIDFromInstanceID(instance_id); uint16 version = VersionFromInstanceID(instance_id); - if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM group_id WHERE groupid=%u", gid), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM group_id WHERE groupid=%u", gid), errbuf, &result)) { safe_delete_array(query); @@ -2905,7 +2905,7 @@ void Database::AssignGroupToInstance(uint32 gid, uint32 instance_id) } mysql_free_result(result); } - else + else { safe_delete_array(query); } @@ -2920,7 +2920,7 @@ void Database::AssignRaidToInstance(uint32 rid, uint32 instance_id) uint32 zone_id = ZoneIDFromInstanceID(instance_id); uint16 version = VersionFromInstanceID(instance_id); - if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM raid_members WHERE raidid=%u", rid), + if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM raid_members WHERE raidid=%u", rid), errbuf, &result)) { safe_delete_array(query); @@ -2934,7 +2934,7 @@ void Database::AssignRaidToInstance(uint32 rid, uint32 instance_id) } mysql_free_result(result); } - else + else { safe_delete_array(query); } @@ -3012,7 +3012,7 @@ bool Database::GlobalInstance(uint16 instance_id) return false; } } - else + else { safe_delete_array(query); return false; @@ -3125,8 +3125,8 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win) } } -bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, - uint32 &tak_w, uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l) +bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, + uint32 &tak_w, uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; @@ -3134,7 +3134,7 @@ bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, u MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, " - "`guk_losses`, `mir_losses`, `mmc_losses`, `ruj_losses`, `tak_losses` FROM `adventure_stats` WHERE player_id=%u", + "`guk_losses`, `mir_losses`, `mmc_losses`, `ruj_losses`, `tak_losses` FROM `adventure_stats` WHERE player_id=%u", char_id), errbuf, &result)) { safe_delete_array(query); @@ -3154,7 +3154,7 @@ bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, u mysql_free_result(result); return true; } - else + else { safe_delete_array(query); return false; @@ -3175,7 +3175,7 @@ uint32 Database::GetGuildDBIDByCharID(uint32 char_id) { mysql_free_result(result); } else { - cerr << "Error in GetAccountIDByChar query '" << query << "' " << errbuf << endl; + cerr << "Error in GetAccountIDByChar query '" << query << "' " << errbuf << endl; } safe_delete_array(query); return retVal; diff --git a/common/database.h b/common/database.h index f494484e0..753e90d7f 100644 --- a/common/database.h +++ b/common/database.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + 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 - the Free Software Foundation; version 2 of the License. + 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 + 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. + 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 + 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_DATABASE_H #define EQEMU_DATABASE_H @@ -76,10 +76,10 @@ EventLogDetails_Struct eld[255]; }; -// Added By Hogie +// Added By Hogie // INSERT into variables (varname,value) values('decaytime [minlevel] [maxlevel]','[number of seconds]'); // IE: decaytime 1 54 = Levels 1 through 54 -// decaytime 55 100 = Levels 55 through 100 +// decaytime 55 100 = Levels 55 through 100 // It will always put the LAST time for the level (I think) from the Database struct npcDecayTimes_Struct { uint16 minlvl; @@ -106,10 +106,10 @@ public: 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); ~Database(); - + /* - * General Character Related Stuff - */ + * General Character Related Stuff + */ 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); @@ -124,8 +124,8 @@ public: uint8 CopyCharacter(const char* oldname, const char* newname, uint32 acctid); /* - * General Information Getting Queries - */ + * 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); @@ -136,15 +136,15 @@ public: 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 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 Stuff - */ + * 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); @@ -172,68 +172,68 @@ public: bool GlobalInstance(uint16 instance_id); /* - * Adventure related. - */ + * Adventure related. + */ void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win); - bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w, + bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w, uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l); /* - * 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 SetAccountStatus(const char* name, int16 status); + bool SetAccountStatus(const char* name, int16 status); bool SetLocalPassword(uint32 accid, const char* password); uint32 GetAccountIDFromLSID(uint32 iLSID, char* oAccountName = 0, int16* oStatus = 0); bool UpdateLiveChar(char* charname,uint32 lsaccount_id); bool GetLiveChar(uint32 account_id, char* cname); uint8 GetAgreementFlag(uint32 acctid); void SetAgreementFlag(uint32 acctid); - + /* - * Groups - */ + * Groups + */ uint32 GetGroupID(const char* name); 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, - GroupLeadershipAA_Struct* GLAA = nullptr); + GroupLeadershipAA_Struct* GLAA = nullptr); void ClearGroupLeader(uint32 gid = 0); /* - * Raids - */ + * Raids + */ void ClearRaid(uint32 rid = 0); void ClearRaidDetails(uint32 rid = 0); uint32 GetRaidID(const char* name); const char *GetRaidLeaderName(uint32 rid); /* - * Database Varaibles - */ + * Database Varaibles + */ 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(MYSQL_RES* result); - + /* - * General Queries - */ + * General Queries + */ bool LoadZoneNames(); 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 GetPEQZone(uint32 zoneID, uint32 version); 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); @@ -243,22 +243,22 @@ public: bool LoadPTimers(uint32 charid, PTimerList &into); void ClearPTimers(uint32 charid); void ClearMerchantTemp(); - void SetLFP(uint32 CharID, bool LFP); + 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 SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon); void AddReport(std::string who, std::string against, std::string lines); - + protected: void HandleMysqlError(uint32 errnum); - + private: void DBInitVars(); - + uint32 max_zonename; char** zonename_array; - + Mutex Mvarcache; uint32 varcache_max; VarCache_Struct** varcache_array; diff --git a/common/dbasync.cpp b/common/dbasync.cpp index 31e956180..ba13ab2f6 100644 --- a/common/dbasync.cpp +++ b/common/dbasync.cpp @@ -41,11 +41,11 @@ void AsyncLoadVariables(DBAsync *dba, Database *db) { //which will get signaled when somebody puts something on the queue ThreadReturnType DBAsyncLoop(void* tmp) { DBAsync* dba = (DBAsync*) tmp; - + #ifndef WIN32 _log(COMMON__THREADS, "Starting DBAsyncLoop with thread ID %d", pthread_self()); #endif - + dba->MLoopRunning.lock(); while (dba->RunLoop()) { //wait before working so we check the loop condition @@ -60,11 +60,11 @@ ThreadReturnType DBAsyncLoop(void* tmp) { // Sleep(ASYNC_LOOP_GRANULARITY); } dba->MLoopRunning.unlock(); - + #ifndef WIN32 _log(COMMON__THREADS, "Ending DBAsyncLoop with thread ID %d", pthread_self()); #endif - + THREAD_RETURN(nullptr); } @@ -92,14 +92,14 @@ bool DBAsync::StopThread() { ret = pRunLoop; pRunLoop = false; MRunLoop.unlock(); - + //signal the condition so we exit the loop if were waiting CInList.Signal(); - + //this effectively waits for the processing thread to finish MLoopRunning.lock(); MLoopRunning.unlock(); - + return ret; } @@ -120,10 +120,10 @@ uint32 DBAsync::AddWork(DBAsyncWork** iWork, uint32 iDelay) { #endif *iWork = 0; MInList.unlock(); - + //wake up the processing thread and tell it to get to work. CInList.Signal(); - + return ret; } @@ -268,7 +268,7 @@ void DBAsync::CheckTimeout() { MFQList.unlock(); } catch(...){ - + } } diff --git a/common/dbasync.h b/common/dbasync.h index d6db825df..f65f9cb58 100644 --- a/common/dbasync.h +++ b/common/dbasync.h @@ -31,10 +31,10 @@ protected: Condition CInList; bool RunLoop(); void Process(); - + private: virtual void CheckTimeout(); - + void ProcessWork(DBAsyncWork* iWork, bool iSleep = true); void DispatchWork(DBAsyncWork* iWork); inline uint32 GetNextID() { return pNextID++; } @@ -64,7 +64,7 @@ private: /* DB Work Complete Callback: - This will be called under the DBAsync thread! Never access any non-threadsafe + This will be called under the DBAsync thread! Never access any non-threadsafe data/functions/classes. (ie: zone, entitylist, client, etc are not threadsafe) Function prototype: return value: true if we should delete the data, false if we should keep it @@ -103,7 +103,7 @@ public: // Pops finished queries off the work DBAsyncQuery* PopAnswer(); uint32 QueryCount(); - + Database *GetDB() const { return(m_db); } bool CheckTimeout(uint32 iFQTimeout); diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 504843db0..7190f2224 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -38,7 +38,7 @@ DBcore::DBcore() { pDatabase = 0; pCompress = false; pSSL = false; - pStatus = Closed; + pStatus = Closed; } DBcore::~DBcore() { @@ -184,13 +184,13 @@ bool DBcore::Open(uint32* errnum, char* errbuf) { if (GetStatus() == Error) { mysql_close(&mysql); mysql_init(&mysql); // Initialize structure again - } + } if (!pHost) return false; /* Added CLIENT_FOUND_ROWS flag to the connect otherwise DB update calls would say 0 rows affected when the value already equalled - what the function was tring to set it to, therefore the function would think it failed + what the function was tring to set it to, therefore the function would think it failed */ uint32 flags = CLIENT_FOUND_ROWS; if (pCompress) diff --git a/common/dbcore.h b/common/dbcore.h index 2e2290f95..b43752c1f 100644 --- a/common/dbcore.h +++ b/common/dbcore.h @@ -26,7 +26,7 @@ public: uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen); void ping(); MYSQL* getMySQL(){ return &mysql; } - + protected: bool Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase, uint32 iPort, uint32* errnum = 0, char* errbuf = 0, bool iCompress = false, bool iSSL = false); private: diff --git a/common/dbmemshare.cpp b/common/dbmemshare.cpp index c8e917791..8447f6d0d 100644 --- a/common/dbmemshare.cpp +++ b/common/dbmemshare.cpp @@ -1,12 +1,10 @@ - - // Doors #ifdef SHAREMEM int32 Database::GetDoorsCount(uint32* oMaxID) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + 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)) { @@ -29,7 +27,7 @@ int32 Database::GetDoorsCount(uint32* oMaxID) { delete[] query; return -1; } - + return -1; } @@ -65,9 +63,9 @@ bool Database::LoadDoors() { 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; + 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)) diff --git a/common/debug.cpp b/common/debug.cpp index ebeed542f..947571626 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -12,7 +12,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #else #include #include @@ -75,34 +75,34 @@ EQEMuLog::~EQEMuLog() { 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"<= MaxLogID) { return false; - } + } bool dofile = false; if (pLogStatus[id] & 1) { dofile = open(id); @@ -138,13 +138,13 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) { 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 */ + time_t aclock; + struct tm *newtime; - if (dofile) + 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 @@ -162,7 +162,7 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) { va_copy(tmpargptr, argptr); p(id, fmt, tmpargptr ); } - if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) { fprintf(stderr, "[%s] ", LogNames[id]); vfprintf( stderr, fmt, argptr ); @@ -173,9 +173,9 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) { } } va_end(argptr); - if (dofile) + if (dofile) fprintf(fp[id], "\n"); - if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) { fprintf(stderr, "\n"); fflush(stderr); @@ -184,19 +184,19 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) { fflush(stdout); } } - if(dofile) - fflush(fp[id]); - return true; + 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); @@ -208,15 +208,15 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list 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 */ + time_t aclock; + struct tm *newtime; + + time( &aclock ); /* Get time in seconds */ + newtime = localtime( &aclock ); /* Convert time to struct */ va_list tmpargptr; - if (dofile) { + 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 @@ -224,13 +224,13 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list #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] & 2) { if (pLogStatus[id] & 8) { fprintf(stderr, "[%s] %s", LogNames[id], prefix); vfprintf( stderr, fmt, argptr ); @@ -241,26 +241,26 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list } } va_end(argptr); - if (dofile) + if (dofile) fprintf(fp[id], "\n"); - if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) fprintf(stderr, "\n"); else fprintf(stdout, "\n"); } - if(dofile) - fflush(fp[id]); - return true; + 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); @@ -271,13 +271,13 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { 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 */ + time_t aclock; + struct tm *newtime; - if (dofile) + 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 @@ -292,7 +292,7 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { msgCallbackBuf p = logCallbackBuf[id]; p(id, buf, size, count); } - if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) { fprintf(stderr, "[%s] ", LogNames[id]); fwrite(buf, size, count, stderr); @@ -303,9 +303,9 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { fprintf(stdout, "\n"); } } - if(dofile) - fflush(fp[id]); - return true; + if(dofile) + fflush(fp[id]); + return true; } bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) { @@ -315,23 +315,23 @@ bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) { va_copy(tmpargptr, argptr); vfprintf( fp[id], fmt, tmpargptr ); } - if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) vfprintf( stderr, fmt, argptr ); else vfprintf( stdout, fmt, argptr ); } va_end(argptr); - return true; + return true; }; bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) { if (!logFileValid) { #if EQDEBUG >= 10 - cerr << "Error: Dump() from null pointer"<= MaxLogID) { return; - } - logCallbackFmt[id] = proc; + } + logCallbackFmt[id] = proc; } void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) { @@ -397,8 +397,8 @@ void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) { return; if (id >= MaxLogID) { return; - } - logCallbackBuf[id] = proc; + } + logCallbackBuf[id] = proc; } void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) { @@ -406,8 +406,8 @@ void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) { return; if (id >= MaxLogID) { return; - } - logCallbackPva[id] = proc; + } + logCallbackPva[id] = proc; } void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) { @@ -437,5 +437,3 @@ void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) { } } - - diff --git a/common/debug.h b/common/debug.h index 62641f53a..3961598a6 100644 --- a/common/debug.h +++ b/common/debug.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 @@ -23,11 +23,11 @@ ////// 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 +// 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 +// 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 @@ -103,22 +103,22 @@ public: Debug, Quest, Commands, - Crash, + Crash, MaxLogID }; - + //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); @@ -137,7 +137,7 @@ private: 8 = use stderr instead (2 must be set) */ uint8 pLogStatus[MaxLogID]; - + msgCallbackFmt logCallbackFmt[MaxLogID]; msgCallbackBuf logCallbackBuf[MaxLogID]; msgCallbackPva logCallbackPva[MaxLogID]; diff --git a/common/deity.h b/common/deity.h index beff69134..f7a44f5a3 100644 --- a/common/deity.h +++ b/common/deity.h @@ -1,24 +1,24 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 DEITY_H #define DEITY_H -/* +/* ** Diety List */ #define DEITY_AGNOSTIC 396 //drop the high bit for 140 @@ -37,7 +37,7 @@ #define DEITY_TUNARE 215 //Guessed: -#define DEITY_BERTOX 201 +#define DEITY_BERTOX 201 #define DEITY_RODCET 212 #define DEITY_VEESHAN 216 diff --git a/common/emu_opcodes.cpp b/common/emu_opcodes.cpp index 6075e7d86..49da5e140 100644 --- a/common/emu_opcodes.cpp +++ b/common/emu_opcodes.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2005 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 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. + 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 04111-1307 USA + 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 04111-1307 USA */ #include "debug.h" @@ -21,13 +21,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA const char *OpcodeNames[_maxEmuOpcode+1] = { "OP_Unknown", - + //a preprocessor hack so we dont have to maintain two lists #define N(x) #x #include "emu_oplist.h" - #include "mail_oplist.h" + #include "mail_oplist.h" #undef N - + "" }; diff --git a/common/emu_opcodes.h b/common/emu_opcodes.h index 4899131d2..d7f1814da 100644 --- a/common/emu_opcodes.h +++ b/common/emu_opcodes.h @@ -1,5 +1,5 @@ -/* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator +Copyright (C) 2001-2005 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 @@ -9,11 +9,11 @@ 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. +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 04111-1307 USA +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA */ #ifndef EMU_OPCODES_H #define EMU_OPCODES_H @@ -49,5 +49,3 @@ extern const char *OpcodeNames[_maxEmuOpcode+1]; #endif - - diff --git a/common/emu_oplist.h b/common/emu_oplist.h index 4b7357efe..bd83a6f30 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -413,7 +413,7 @@ N(OP_PetBuffWindow), N(OP_RaidJoin), N(OP_Translocate), N(OP_Sacrifice), -N(OP_KeyRing), +N(OP_KeyRing), N(OP_PopupResponse), N(OP_DeleteCharge), N(OP_PotionBelt), diff --git a/common/eq_constants.h b/common/eq_constants.h index 039f80006..bc0c16857 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -1,22 +1,22 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + 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 - the Free Software Foundation; version 2 of the License. + 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 + 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. + 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 + 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_CONSTANTS_H -#define EQ_CONSTANTS_H +#define EQ_CONSTANTS_H #include "skills.h" @@ -53,49 +53,49 @@ enum ItemClass */ enum ItemTypes { - ItemType1HS = 0, - ItemType2HS = 1, - ItemTypePierce = 2, - ItemType1HB = 3, - ItemType2HB = 4, - ItemTypeBow = 5, + ItemType1HS = 0, + ItemType2HS = 1, + ItemTypePierce = 2, + ItemType1HB = 3, + ItemType2HB = 4, + ItemTypeBow = 5, //6 ItemTypeThrowing = 7, - ItemTypeShield = 8, + ItemTypeShield = 8, //9 - ItemTypeArmor = 10, - ItemTypeUnknon = 11, //A lot of random crap has this item use. + ItemTypeArmor = 10, + ItemTypeUnknon = 11, //A lot of random crap has this item use. ItemTypeLockPick = 12, ItemTypeFood = 14, - ItemTypeDrink = 15, - ItemTypeLightSource = 16, - ItemTypeStackable = 17, //Not all stackable items are this use... - ItemTypeBandage = 18, - ItemTypeThrowingv2 = 19, - ItemTypeSpell = 20, //spells and tomes - ItemTypePotion = 21, - ItemTypeWindInstr = 23, - ItemTypeStringInstr = 24, - ItemTypeBrassInstr = 25, - ItemTypeDrumInstr = 26, - ItemTypeArrow = 27, - ItemTypeJewlery = 29, - ItemTypeSkull = 30, + ItemTypeDrink = 15, + ItemTypeLightSource = 16, + ItemTypeStackable = 17, //Not all stackable items are this use... + ItemTypeBandage = 18, + ItemTypeThrowingv2 = 19, + ItemTypeSpell = 20, //spells and tomes + ItemTypePotion = 21, + ItemTypeWindInstr = 23, + ItemTypeStringInstr = 24, + ItemTypeBrassInstr = 25, + ItemTypeDrumInstr = 26, + ItemTypeArrow = 27, + ItemTypeJewlery = 29, + ItemTypeSkull = 30, ItemTypeTome = 31, ItemTypeNote = 32, - ItemTypeKey = 33, + ItemTypeKey = 33, ItemTypeCoin = 34, ItemType2HPierce = 35, - ItemTypeFishingPole = 36, - ItemTypeFishingBait = 37, - ItemTypeAlcohol = 38, - ItemTypeCompass = 40, - ItemTypePoison = 42, //might be wrong, but includes poisons - ItemTypeHand2Hand = 45, - ItemUseSinging = 50, + ItemTypeFishingPole = 36, + ItemTypeFishingBait = 37, + ItemTypeAlcohol = 38, + ItemTypeCompass = 40, + ItemTypePoison = 42, //might be wrong, but includes poisons + ItemTypeHand2Hand = 45, + ItemUseSinging = 50, ItemUseAllInstruments = 51, - ItemTypeCharm = 52, - ItemTypeAugment = 54, + ItemTypeCharm = 52, + ItemTypeAugment = 54, ItemTypeAugmentSolvent = 55, ItemTypeAugmentDistill = 56 }; @@ -170,7 +170,7 @@ typedef enum { _eaMaxAppearance } EmuAppearance; -/* +/* ** Diety List */ #define DEITY_UNKNOWN 0 @@ -190,11 +190,11 @@ typedef enum { #define DEITY_TUNARE 215 //Guessed: -#define DEITY_BERT 201 +#define DEITY_BERT 201 #define DEITY_RODCET 212 #define DEITY_VEESHAN 216 -// msg_type's for custom usercolors +// msg_type's for custom usercolors #define MT_Say 256 #define MT_Tell 257 #define MT_Group 258 @@ -284,84 +284,84 @@ typedef enum { //from showeq enum ChatColor { - CC_Default = 0, - CC_DarkGrey = 1, - CC_DarkGreen = 2, - CC_DarkBlue = 3, - CC_Purple = 5, - CC_LightGrey = 6, - CC_User_Say = 256, - CC_User_Tell = 257, - CC_User_Group = 258, - CC_User_Guild = 259, - CC_User_OOC = 260, - CC_User_Auction = 261, - CC_User_Shout = 262, - CC_User_Emote = 263, - CC_User_Spells = 264, - CC_User_YouHitOther = 265, - CC_User_OtherHitYou = 266, - CC_User_YouMissOther = 267, - CC_User_OtherMissYou = 268, - CC_User_Duels = 269, - CC_User_Skills = 270, - CC_User_Disciplines = 271, - CC_User_Default = 273, - CC_User_MerchantOffer = 275, - CC_User_MerchantExchange = 276, - CC_User_YourDeath = 277, - CC_User_OtherDeath = 278, - CC_User_OtherHitOther = 279, - CC_User_OtherMissOther = 280, - CC_User_Who = 281, - CC_User_Yell = 282, - CC_User_NonMelee = 283, - CC_User_SpellWornOff = 284, - CC_User_MoneySplit = 285, - CC_User_Loot = 286, - CC_User_Random = 287, - CC_User_OtherSpells = 288, - CC_User_SpellFailure = 289, - CC_User_ChatChannel = 290, - CC_User_Chat1 = 291, - CC_User_Chat2 = 292, - CC_User_Chat3 = 293, - CC_User_Chat4 = 294, - CC_User_Chat5 = 295, - CC_User_Chat6 = 296, - CC_User_Chat7 = 297, - CC_User_Chat8 = 298, - CC_User_Chat9 = 299, - CC_User_Chat10 = 300, - CC_User_MeleeCrit = 301, - CC_User_SpellCrit = 302, - CC_User_TooFarAway = 303, - CC_User_NPCRampage = 304, - CC_User_NPCFurry = 305, - CC_User_NPCEnrage = 306, - CC_User_EchoSay = 307, - CC_User_EchoTell = 308, - CC_User_EchoGroup = 309, - CC_User_EchoGuild = 310, - CC_User_EchoOOC = 311, - CC_User_EchoAuction = 312, - CC_User_EchoShout = 313, - CC_User_EchoEmote = 314, - CC_User_EchoChat1 = 315, - CC_User_EchoChat2 = 316, - CC_User_EchoChat3 = 317, - CC_User_EchoChat4 = 318, - CC_User_EchoChat5 = 319, - CC_User_EchoChat6 = 320, - CC_User_EchoChat7 = 321, - CC_User_EchoChat8 = 322, - CC_User_EchoChat9 = 323, - CC_User_EchoChat10 = 324, - CC_User_UnusedAtThisTime = 325, - CC_User_ItemTags = 326, - CC_User_RaidSay = 327, - CC_User_MyPet = 328, - CC_User_DamageShield = 329, + CC_Default = 0, + CC_DarkGrey = 1, + CC_DarkGreen = 2, + CC_DarkBlue = 3, + CC_Purple = 5, + CC_LightGrey = 6, + CC_User_Say = 256, + CC_User_Tell = 257, + CC_User_Group = 258, + CC_User_Guild = 259, + CC_User_OOC = 260, + CC_User_Auction = 261, + CC_User_Shout = 262, + CC_User_Emote = 263, + CC_User_Spells = 264, + CC_User_YouHitOther = 265, + CC_User_OtherHitYou = 266, + CC_User_YouMissOther = 267, + CC_User_OtherMissYou = 268, + CC_User_Duels = 269, + CC_User_Skills = 270, + CC_User_Disciplines = 271, + CC_User_Default = 273, + CC_User_MerchantOffer = 275, + CC_User_MerchantExchange = 276, + CC_User_YourDeath = 277, + CC_User_OtherDeath = 278, + CC_User_OtherHitOther = 279, + CC_User_OtherMissOther = 280, + CC_User_Who = 281, + CC_User_Yell = 282, + CC_User_NonMelee = 283, + CC_User_SpellWornOff = 284, + CC_User_MoneySplit = 285, + CC_User_Loot = 286, + CC_User_Random = 287, + CC_User_OtherSpells = 288, + CC_User_SpellFailure = 289, + CC_User_ChatChannel = 290, + CC_User_Chat1 = 291, + CC_User_Chat2 = 292, + CC_User_Chat3 = 293, + CC_User_Chat4 = 294, + CC_User_Chat5 = 295, + CC_User_Chat6 = 296, + CC_User_Chat7 = 297, + CC_User_Chat8 = 298, + CC_User_Chat9 = 299, + CC_User_Chat10 = 300, + CC_User_MeleeCrit = 301, + CC_User_SpellCrit = 302, + CC_User_TooFarAway = 303, + CC_User_NPCRampage = 304, + CC_User_NPCFurry = 305, + CC_User_NPCEnrage = 306, + CC_User_EchoSay = 307, + CC_User_EchoTell = 308, + CC_User_EchoGroup = 309, + CC_User_EchoGuild = 310, + CC_User_EchoOOC = 311, + CC_User_EchoAuction = 312, + CC_User_EchoShout = 313, + CC_User_EchoEmote = 314, + CC_User_EchoChat1 = 315, + CC_User_EchoChat2 = 316, + CC_User_EchoChat3 = 317, + CC_User_EchoChat4 = 318, + CC_User_EchoChat5 = 319, + CC_User_EchoChat6 = 320, + CC_User_EchoChat7 = 321, + CC_User_EchoChat8 = 322, + CC_User_EchoChat9 = 323, + CC_User_EchoChat10 = 324, + CC_User_UnusedAtThisTime = 325, + CC_User_ItemTags = 326, + CC_User_RaidSay = 327, + CC_User_MyPet = 328, + CC_User_DamageShield = 329, }; //ZoneChange_Struct->success values @@ -435,41 +435,41 @@ typedef enum { #define STAT_HASTE 19 #define STAT_DAMAGE_SHIELD 20 - /** - * Recast timer types. Used as an off set to charProfileStruct timers. - */ - enum RecastTypes - { - RecastTimer0 = 0, - RecastTimer1, - WeaponHealClickTimer, // 2 - MuramiteBaneNukeClickTimer, // 3 - RecastTimer4, - DispellClickTimer, // 5 (also click heal orbs?) - EpicTimer, // 6 - OoWBPClickTimer, // 7 - VishQuestClassItemTimer, // 8 - HealPotionTimer, // 9 - RecastTimer10, - RecastTimer11, - RecastTimer12, - RecastTimer13, - RecastTimer14, - RecastTimer15, - RecastTimer16, - RecastTimer17, - RecastTimer18, - ModRodTimer // 19 - }; - - enum GroupUpdateAction +/** +* Recast timer types. Used as an off set to charProfileStruct timers. +*/ +enum RecastTypes { - GUA_Joined = 0, - GUA_Left = 1, - GUA_LastLeft = 6, - GUA_FullGroupInfo = 7, - GUA_MakeLeader = 8, - GUA_Started = 9 + RecastTimer0 = 0, + RecastTimer1, + WeaponHealClickTimer, // 2 + MuramiteBaneNukeClickTimer, // 3 + RecastTimer4, + DispellClickTimer, // 5 (also click heal orbs?) + EpicTimer, // 6 + OoWBPClickTimer, // 7 + VishQuestClassItemTimer, // 8 + HealPotionTimer, // 9 + RecastTimer10, + RecastTimer11, + RecastTimer12, + RecastTimer13, + RecastTimer14, + RecastTimer15, + RecastTimer16, + RecastTimer17, + RecastTimer18, + ModRodTimer // 19 +}; + +enum GroupUpdateAction +{ + GUA_Joined = 0, + GUA_Left = 1, + GUA_LastLeft = 6, + GUA_FullGroupInfo = 7, + GUA_MakeLeader = 8, + GUA_Started = 9 }; //0x1c is something... @@ -479,81 +479,81 @@ static const uint8 DamageTypeUnknown = 0xFF; //indexed by 'SkillType' static const uint8 SkillDamageTypes[HIGHEST_SKILL+1] = { - /* _1H_BLUNT */ 0, - /* _1H_SLASHING */ 1, - /* _2H_BLUNT */ 0, - /* _2H_SLASHING */ 1, - /* ABJURE */ SpellDamageType, - /* ALTERATION */ SpellDamageType, - /* APPLY_POISON */ DamageTypeUnknown, - /* ARCHERY */ 7, - /* BACKSTAB */ 8, - /* BIND_WOUND */ DamageTypeUnknown, - /* BASH */ 10, - /* BLOCKSKILL */ DamageTypeUnknown, - /* BRASS_INSTRUMENTS */ SpellDamageType, - /* CHANNELING */ DamageTypeUnknown, - /* CONJURATION */ SpellDamageType, - /* DEFENSE */ DamageTypeUnknown, - /* DISARM */ DamageTypeUnknown, - /* DISARM_TRAPS */ DamageTypeUnknown, - /* DIVINATION */ SpellDamageType, - /* DODGE */ DamageTypeUnknown, - /* DOUBLE_ATTACK */ DamageTypeUnknown, - /* DRAGON_PUNCH */ 21, - /* DUAL_WIELD */ DamageTypeUnknown, - /* EAGLE_STRIKE */ 23, - /* EVOCATION */ SpellDamageType, - /* FEIGN_DEATH */ 4, - /* FLYING_KICK */ 30, - /* FORAGE */ DamageTypeUnknown, - /* HAND_TO_HAND */ 4, - /* HIDE */ DamageTypeUnknown, - /* KICK */ 30, - /* MEDITATE */ DamageTypeUnknown, - /* MEND */ DamageTypeUnknown, - /* OFFENSE */ DamageTypeUnknown, - /* PARRY */ DamageTypeUnknown, - /* PICK_LOCK */ DamageTypeUnknown, - /* PIERCING */ 36, - /* RIPOSTE */ DamageTypeUnknown, - /* ROUND_KICK */ 30, - /* SAFE_FALL */ DamageTypeUnknown, - /* SENSE_HEADING */ DamageTypeUnknown, - /* SINGING */ SpellDamageType, - /* SNEAK */ DamageTypeUnknown, - /* SPECIALIZE_ABJURE */ DamageTypeUnknown, - /* SPECIALIZE_ALTERATION */ DamageTypeUnknown, - /* SPECIALIZE_CONJURATION */ DamageTypeUnknown, - /* SPECIALIZE_DIVINATION */ DamageTypeUnknown, - /* SPECIALIZE_EVOCATION */ DamageTypeUnknown, - /* PICK_POCKETS */ DamageTypeUnknown, - /* STRINGED_INSTRUMENTS */ SpellDamageType, - /* SWIMMING */ DamageTypeUnknown, - /* THROWING */ 51, - /* TIGER_CLAW */ 23, - /* TRACKING */ DamageTypeUnknown, - /* WIND_INSTRUMENTS */ SpellDamageType, - /* FISHING */ DamageTypeUnknown, - /* MAKE_POISON */ DamageTypeUnknown, - /* TINKERING */ DamageTypeUnknown, - /* RESEARCH */ DamageTypeUnknown, - /* ALCHEMY */ DamageTypeUnknown, - /* BAKING */ DamageTypeUnknown, - /* TAILORING */ DamageTypeUnknown, - /* SENSE_TRAPS */ DamageTypeUnknown, - /* BLACKSMITHING */ DamageTypeUnknown, - /* FLETCHING */ DamageTypeUnknown, - /* BREWING */ DamageTypeUnknown, - /* ALCOHOL_TOLERANCE */ DamageTypeUnknown, - /* BEGGING */ DamageTypeUnknown, - /* JEWELRY_MAKING */ DamageTypeUnknown, - /* POTTERY */ DamageTypeUnknown, - /* PERCUSSION_INSTRUMENTS */ SpellDamageType, - /* INTIMIDATION */ DamageTypeUnknown, - /* BERSERKING */ DamageTypeUnknown, - /* TAUNT */ DamageTypeUnknown, - /* FRENZY */ 74 + /* _1H_BLUNT */ 0, + /* _1H_SLASHING */ 1, + /* _2H_BLUNT */ 0, + /* _2H_SLASHING */ 1, + /* ABJURE */ SpellDamageType, + /* ALTERATION */ SpellDamageType, + /* APPLY_POISON */ DamageTypeUnknown, + /* ARCHERY */ 7, + /* BACKSTAB */ 8, + /* BIND_WOUND */ DamageTypeUnknown, + /* BASH */ 10, + /* BLOCKSKILL */ DamageTypeUnknown, + /* BRASS_INSTRUMENTS */ SpellDamageType, + /* CHANNELING */ DamageTypeUnknown, + /* CONJURATION */ SpellDamageType, + /* DEFENSE */ DamageTypeUnknown, + /* DISARM */ DamageTypeUnknown, + /* DISARM_TRAPS */ DamageTypeUnknown, + /* DIVINATION */ SpellDamageType, + /* DODGE */ DamageTypeUnknown, + /* DOUBLE_ATTACK */ DamageTypeUnknown, + /* DRAGON_PUNCH */ 21, + /* DUAL_WIELD */ DamageTypeUnknown, + /* EAGLE_STRIKE */ 23, + /* EVOCATION */ SpellDamageType, + /* FEIGN_DEATH */ 4, + /* FLYING_KICK */ 30, + /* FORAGE */ DamageTypeUnknown, + /* HAND_TO_HAND */ 4, + /* HIDE */ DamageTypeUnknown, + /* KICK */ 30, + /* MEDITATE */ DamageTypeUnknown, + /* MEND */ DamageTypeUnknown, + /* OFFENSE */ DamageTypeUnknown, + /* PARRY */ DamageTypeUnknown, + /* PICK_LOCK */ DamageTypeUnknown, + /* PIERCING */ 36, + /* RIPOSTE */ DamageTypeUnknown, + /* ROUND_KICK */ 30, + /* SAFE_FALL */ DamageTypeUnknown, + /* SENSE_HEADING */ DamageTypeUnknown, + /* SINGING */ SpellDamageType, + /* SNEAK */ DamageTypeUnknown, + /* SPECIALIZE_ABJURE */ DamageTypeUnknown, + /* SPECIALIZE_ALTERATION */ DamageTypeUnknown, + /* SPECIALIZE_CONJURATION */ DamageTypeUnknown, + /* SPECIALIZE_DIVINATION */ DamageTypeUnknown, + /* SPECIALIZE_EVOCATION */ DamageTypeUnknown, + /* PICK_POCKETS */ DamageTypeUnknown, + /* STRINGED_INSTRUMENTS */ SpellDamageType, + /* SWIMMING */ DamageTypeUnknown, + /* THROWING */ 51, + /* TIGER_CLAW */ 23, + /* TRACKING */ DamageTypeUnknown, + /* WIND_INSTRUMENTS */ SpellDamageType, + /* FISHING */ DamageTypeUnknown, + /* MAKE_POISON */ DamageTypeUnknown, + /* TINKERING */ DamageTypeUnknown, + /* RESEARCH */ DamageTypeUnknown, + /* ALCHEMY */ DamageTypeUnknown, + /* BAKING */ DamageTypeUnknown, + /* TAILORING */ DamageTypeUnknown, + /* SENSE_TRAPS */ DamageTypeUnknown, + /* BLACKSMITHING */ DamageTypeUnknown, + /* FLETCHING */ DamageTypeUnknown, + /* BREWING */ DamageTypeUnknown, + /* ALCOHOL_TOLERANCE */ DamageTypeUnknown, + /* BEGGING */ DamageTypeUnknown, + /* JEWELRY_MAKING */ DamageTypeUnknown, + /* POTTERY */ DamageTypeUnknown, + /* PERCUSSION_INSTRUMENTS */ SpellDamageType, + /* INTIMIDATION */ DamageTypeUnknown, + /* BERSERKING */ DamageTypeUnknown, + /* TAUNT */ DamageTypeUnknown, + /* FRENZY */ 74 }; // Indexing positions into item material arrays @@ -593,7 +593,7 @@ enum InventorySlot //////////////////////// // Equip slots //////////////////////// - + SLOT_CHARM = 0, SLOT_EAR01 = 1, SLOT_HEAD = 2, @@ -616,38 +616,38 @@ enum InventorySlot SLOT_FEET = 19, SLOT_WAIST = 20, SLOT_AMMO = 21, - + //////////////////////// // All other slots //////////////////////// SLOT_PERSONAL_BEGIN = 22, SLOT_PERSONAL_END = 29, - + SLOT_CURSOR = 30, - + SLOT_CURSOR_END = (int16)0xFFFE, // Last item on cursor queue // Cursor bag slots are 331->340 (10 slots) - + // Personal Inventory Slots // Slots 1 through 8 are slots 22->29 // Inventory bag slots are 251->330 (10 slots per bag) - + // Tribute slots are 400-404? (upper bound unknown) // storing these in worn item's map - + // Bank slots // Bank slots 1 through 16 are slots 2000->2015 // Bank bag slots are 2031->2190 - + // Shared bank slots // Shared bank slots 1 through 2 are slots 2500->2501 // Shared bank bag slots are 2531->2550 - + // Trade session slots // Trade slots 1 through 8 are slots 3000->3007 // Trade bag slots are technically 0->79 when passed to client, // but in our code, we treat them as slots 3100->3179 - + // Slot used in OP_TradeSkillCombine for world tradeskill containers SLOT_TRADESKILL = 1000, SLOT_AUGMENT = 1001, diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 1be8eddc5..f72b4c721 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + 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 - the Free Software Foundation; version 2 of the License. + 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 + 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. + 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 + 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_PACKET_STRUCTS_H #define EQ_PACKET_STRUCTS_H @@ -154,7 +154,7 @@ struct CharacterSelect_Struct { /*0040*/ Color_Struct cs_colors[10][9]; // Characters Equipment Colors /*0400*/ uint8 beardcolor[10]; // Characters beard Color /*0410*/ uint8 hairstyle[10]; // Characters hair style -/*0420*/ uint32 equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be) +/*0420*/ uint32 equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be) /*0780*/ uint32 secondary[10]; // Characters secondary IDFile number /*0820*/ uint32 drakkin_heritage[10]; // added for SoF /*0860*/ uint32 drakkin_tattoo[10]; // added for SoF @@ -195,10 +195,10 @@ struct CharacterSelect_Struct { ** Generic Spawn Struct ** Length: 383 Octets ** Used in: -** spawnZoneStruct -** dbSpawnStruct -** petStruct -** newSpawnStruct +** spawnZoneStruct +** dbSpawnStruct +** petStruct +** newSpawnStruct */ /* showeq -> eqemu @@ -206,119 +206,119 @@ sed -e 's/_t//g' -e 's/seto_0xFF/set_to_0xFF/g' */ struct Spawn_Struct { /*0000*/ uint8 unknown0000; -/*0001*/ uint8 gm; // 0=no, 1=gm -/*0002*/ uint8 unknown0003; -/*0003*/ uint8 aaitle; // 0=none, 1=general, 2=archtype, 3=class -/*0004*/ uint8 unknown0004; -/*0005*/ uint8 anon; // 0=normal, 1=anon, 2=roleplay -/*0006*/ uint8 face; // Face id for players -/*0007*/ char name[64]; // Player's Name -/*0071*/ uint16 deity; // Player's Deity +/*0001*/ uint8 gm; // 0=no, 1=gm +/*0002*/ uint8 unknown0003; +/*0003*/ uint8 aaitle; // 0=none, 1=general, 2=archtype, 3=class +/*0004*/ uint8 unknown0004; +/*0005*/ uint8 anon; // 0=normal, 1=anon, 2=roleplay +/*0006*/ uint8 face; // Face id for players +/*0007*/ char name[64]; // Player's Name +/*0071*/ uint16 deity; // Player's Deity /*0073*/ uint16 unknown0073; -/*0075*/ float size; // Model size -/*0079*/ uint32 unknown0079; -/*0083*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse,a -/*0084*/ uint8 invis; // Invis (0=not, 1=invis) -/*0085*/ uint8 haircolor; // Hair color -/*0086*/ uint8 curHp; // Current hp %%% wrong -/*0087*/ uint8 max_hp; // (name prolly wrong)takes on the value 100 for players, 100 or 110 for NPCs and 120 for PC corpses... -/*0088*/ uint8 findable; // 0=can't be found, 1=can be found -/*0089*/ uint8 unknown0089[5]; -/*0094*/ signed deltaHeading:10;// change in heading - signed x:19; // x coord - signed padding0054:3; // ***Placeholder -/*0098*/ signed y:19; // y coord - signed animation:10; // animation - signed padding0058:3; // ***Placeholder -/*0102*/ signed z:19; // z coord - signed deltaY:13; // change in y -/*0106*/ signed deltaX:13; // change in x - unsigned heading:12; // heading - signed padding0066:7; // ***Placeholder -/*0110*/ signed deltaZ:13; // change in z - signed padding0070:19; // ***Placeholder -/*0114*/ uint8 eyecolor1; // Player's left eye color -/*0115*/ uint8 unknown0115[11]; // Was [24] -/*0126*/ uint8 StandState; // stand state for SoF+ 0x64 for normal animation -/*0127*/ uint32 drakkin_heritage; // Added for SoF -/*0131*/ uint32 drakkin_tattoo; // Added for SoF -/*0135*/ uint32 drakkin_details; // Added for SoF -/*0139*/ uint8 showhelm; // 0=no, 1=yes -/*0140*/ uint8 unknown0140[4]; -/*0144*/ uint8 is_npc; // 0=no, 1=yes -/*0145*/ uint8 hairstyle; // Hair style -/*0146*/ uint8 beard; // Beard style (not totally, sure but maybe!) -/*0147*/ uint8 unknown0147[4]; -/*0151*/ uint8 level; // Spawn Level -/*0152*/ uint8 unknown0259[4]; // ***Placeholder -/*0156*/ uint8 beardcolor; // Beard color -/*0157*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) -/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner -/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader -/*0194*/ uint8 unknown0194[3]; +/*0075*/ float size; // Model size +/*0079*/ uint32 unknown0079; +/*0083*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse,a +/*0084*/ uint8 invis; // Invis (0=not, 1=invis) +/*0085*/ uint8 haircolor; // Hair color +/*0086*/ uint8 curHp; // Current hp %%% wrong +/*0087*/ uint8 max_hp; // (name prolly wrong)takes on the value 100 for players, 100 or 110 for NPCs and 120 for PC corpses... +/*0088*/ uint8 findable; // 0=can't be found, 1=can be found +/*0089*/ uint8 unknown0089[5]; +/*0094*/ signed deltaHeading:10; // change in heading +/*????*/ signed x:19; // x coord +/*????*/ signed padding0054:3; // ***Placeholder +/*0098*/ signed y:19; // y coord +/*????*/ signed animation:10; // animation +/*????*/ signed padding0058:3; // ***Placeholder +/*0102*/ signed z:19; // z coord +/*????*/ signed deltaY:13; // change in y +/*0106*/ signed deltaX:13; // change in x +/*????*/ unsigned heading:12; // heading +/*????*/ signed padding0066:7; // ***Placeholder +/*0110*/ signed deltaZ:13; // change in z +/*????*/ signed padding0070:19; // ***Placeholder +/*0114*/ uint8 eyecolor1; // Player's left eye color +/*0115*/ uint8 unknown0115[11]; // Was [24] +/*0126*/ uint8 StandState; // stand state for SoF+ 0x64 for normal animation +/*0127*/ uint32 drakkin_heritage; // Added for SoF +/*0131*/ uint32 drakkin_tattoo; // Added for SoF +/*0135*/ uint32 drakkin_details; // Added for SoF +/*0139*/ uint8 showhelm; // 0=no, 1=yes +/*0140*/ uint8 unknown0140[4]; +/*0144*/ uint8 is_npc; // 0=no, 1=yes +/*0145*/ uint8 hairstyle; // Hair style +/*0146*/ uint8 beard; // Beard style (not totally, sure but maybe!) +/*0147*/ uint8 unknown0147[4]; +/*0151*/ uint8 level; // Spawn Level +/*0152*/ uint8 unknown0259[4]; // ***Placeholder +/*0156*/ uint8 beardcolor; // Beard color +/*0157*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) +/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner +/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader +/*0194*/ uint8 unknown0194[3]; /*0197*/ union - { - struct - { - /*0197*/ uint32 equip_helmet; // Equipment: Helmet Visual - /*0201*/ uint32 equip_chest; // Equipment: Chest Visual - /*0205*/ uint32 equip_arms; // Equipment: Arms Visual - /*0209*/ uint32 equip_bracers; // Equipment: Bracers Visual - /*0213*/ uint32 equip_hands; // Equipment: Hands Visual - /*0217*/ uint32 equip_legs; // Equipment: Legs Visual - /*0221*/ uint32 equip_feet; // Equipment: Feet Visual - /*0225*/ uint32 equip_primary; // Equipment: Primary Visual - /*0229*/ uint32 equip_secondary; // Equipment: Secondary Visual - } equip; - /*0197*/ uint32 equipment[MAX_MATERIALS]; // Array elements correspond to struct equipment above - }; -/*0233*/ float runspeed; // Speed when running -/*0036*/ uint8 afk; // 0=no, 1=afk -/*0238*/ uint32 guildID; // Current guild -/*0242*/ char title[32]; // Title -/*0274*/ uint8 unknown0274; -/*0275*/ uint8 set_to_0xFF[8]; // ***Placeholder (all ff) -/*0283*/ uint8 helm; // Helm texture -/*0284*/ uint32 race; // Spawn race -/*0288*/ uint32 unknown0288; -/*0292*/ char lastName[32]; // Player's Lastname -/*0324*/ float walkspeed; // Speed when walking -/*0328*/ uint8 unknown0328; -/*0329*/ uint8 is_pet; // 0=no, 1=yes -/*0330*/ uint8 light; // Spawn's lightsource %%% wrong -/*0331*/ uint8 class_; // Player's class -/*0332*/ uint8 eyecolor2; // Left eye color -/*0333*/ uint8 flymode; -/*0334*/ uint8 gender; // Gender (0=male, 1=female) -/*0335*/ uint8 bodytype; // Bodytype + { + struct + { + /*0197*/ uint32 equip_helmet; // Equipment: Helmet Visual + /*0201*/ uint32 equip_chest; // Equipment: Chest Visual + /*0205*/ uint32 equip_arms; // Equipment: Arms Visual + /*0209*/ uint32 equip_bracers; // Equipment: Bracers Visual + /*0213*/ uint32 equip_hands; // Equipment: Hands Visual + /*0217*/ uint32 equip_legs; // Equipment: Legs Visual + /*0221*/ uint32 equip_feet; // Equipment: Feet Visual + /*0225*/ uint32 equip_primary; // Equipment: Primary Visual + /*0229*/ uint32 equip_secondary; // Equipment: Secondary Visual + } equip; + /*0197*/ uint32 equipment[MAX_MATERIALS]; // Array elements correspond to struct equipment above + }; +/*0233*/ float runspeed; // Speed when running +/*0036*/ uint8 afk; // 0=no, 1=afk +/*0238*/ uint32 guildID; // Current guild +/*0242*/ char title[32]; // Title +/*0274*/ uint8 unknown0274; +/*0275*/ uint8 set_to_0xFF[8]; // ***Placeholder (all ff) +/*0283*/ uint8 helm; // Helm texture +/*0284*/ uint32 race; // Spawn race +/*0288*/ uint32 unknown0288; +/*0292*/ char lastName[32]; // Player's Lastname +/*0324*/ float walkspeed; // Speed when walking +/*0328*/ uint8 unknown0328; +/*0329*/ uint8 is_pet; // 0=no, 1=yes +/*0330*/ uint8 light; // Spawn's lightsource %%% wrong +/*0331*/ uint8 class_; // Player's class +/*0332*/ uint8 eyecolor2; // Left eye color +/*0333*/ uint8 flymode; +/*0334*/ uint8 gender; // Gender (0=male, 1=female) +/*0335*/ uint8 bodytype; // Bodytype /*0336*/ uint8 unknown0336[3]; union { -/*0339*/ uint8 equip_chest2; // Second place in packet for chest texture (usually 0xFF in live packets) - // Not sure why there are 2 of them, but it effects chest texture! -/*0339*/ uint8 mount_color; // drogmor: 0=white, 1=black, 2=green, 3=red - // horse: 0=brown, 1=white, 2=black, 3=tan +/*0339*/ uint8 equip_chest2; // Second place in packet for chest texture (usually 0xFF in live packets) + // Not sure why there are 2 of them, but it effects chest texture! +/*0339*/ uint8 mount_color; // drogmor: 0=white, 1=black, 2=green, 3=red + // horse: 0=brown, 1=white, 2=black, 3=tan }; -/*0340*/ uint32 spawnId; // Spawn Id +/*0340*/ uint32 spawnId; // Spawn Id /*0344*/ uint8 unknown0344[3]; /*0347*/ uint8 IsMercenary; /*0348*/ union - { - struct - { - /*0348*/ Color_Struct color_helmet; // Color of helmet item - /*0352*/ Color_Struct color_chest; // Color of chest item - /*0356*/ Color_Struct color_arms; // Color of arms item - /*0360*/ Color_Struct color_bracers; // Color of bracers item - /*0364*/ Color_Struct color_hands; // Color of hands item - /*0368*/ Color_Struct color_legs; // Color of legs item - /*0372*/ Color_Struct color_feet; // Color of feet item - /*0376*/ Color_Struct color_primary; // Color of primary item - /*0380*/ Color_Struct color_secondary; // Color of secondary item - } equipment_colors; - /*0348*/ Color_Struct colors[MAX_MATERIALS]; // Array elements correspond to struct equipment_colors above - }; -/*0384*/ uint8 lfg; // 0=off, 1=lfg on + { + struct + { + /*0348*/ Color_Struct color_helmet; // Color of helmet item + /*0352*/ Color_Struct color_chest; // Color of chest item + /*0356*/ Color_Struct color_arms; // Color of arms item + /*0360*/ Color_Struct color_bracers; // Color of bracers item + /*0364*/ Color_Struct color_hands; // Color of hands item + /*0368*/ Color_Struct color_legs; // Color of legs item + /*0372*/ Color_Struct color_feet; // Color of feet item + /*0376*/ Color_Struct color_primary; // Color of primary item + /*0380*/ Color_Struct color_secondary; // Color of secondary item + } equipment_colors; + /*0348*/ Color_Struct colors[MAX_MATERIALS]; // Array elements correspond to struct equipment_colors above + }; +/*0384*/ uint8 lfg; // 0=off, 1=lfg on /*0385*/ bool DestructibleObject; // Only used to flag as a destrible object @@ -398,7 +398,7 @@ struct NewZone_Struct { /*0686*/ uint16 zone_instance; /*0688*/ uint32 unknown688; /*0692*/ uint8 unknown692[8]; -/*0700*/ float fog_density; +/*0700*/ float fog_density; /*0704*/ uint32 SuspendBuffs; /*0704*/ }; @@ -409,9 +409,9 @@ struct NewZone_Struct { ** */ struct MemorizeSpell_Struct { -uint32 slot; // Spot in the spell book/memorized slot -uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) -uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming +uint32 slot; // Spot in the spell book/memorized slot +uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) +uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming uint32 unknown12; }; @@ -423,7 +423,7 @@ uint32 unknown12; struct Charm_Struct { /*00*/ uint32 owner_id; /*04*/ uint32 pet_id; -/*08*/ uint32 command; // 1: make pet, 0: release pet +/*08*/ uint32 command; // 1: make pet, 0: release pet /*12*/ }; @@ -445,7 +445,7 @@ struct DeleteSpell_Struct struct ManaChange_Struct { - uint32 new_mana; // New Mana AMount + uint32 new_mana; // New Mana AMount uint32 stamina; uint32 spell_id; uint32 unknown12; @@ -471,9 +471,9 @@ struct CastSpell_Struct { uint32 slot; uint32 spell_id; - uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast + uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint8 cs_unknown[4]; + uint8 cs_unknown[4]; }; struct SpellEffect_Struct @@ -500,9 +500,9 @@ struct SpellEffect_Struct */ struct SpawnAppearance_Struct { -/*0000*/ uint16 spawn_id; // ID of the spawn -/*0002*/ uint16 type; // Values associated with the type -/*0004*/ uint32 parameter; // Type of data sent +/*0000*/ uint16 spawn_id; // ID of the spawn +/*0002*/ uint16 type; // Values associated with the type +/*0004*/ uint32 parameter; // Type of data sent /*0008*/ }; @@ -516,7 +516,7 @@ struct SpellBuff_Struct /*003*/ uint8 effect; //not real /*004*/ uint32 spellid; /*008*/ uint32 duration; -/*012*/ uint32 counters; +/*012*/ uint32 counters; /*016*/ uint32 player_id; //'global' ID of the caster, for wearoff messages /*020*/ }; @@ -547,7 +547,7 @@ struct BuffRemoveRequest_Struct struct PetBuff_Struct { /*000*/ uint32 petid; /*004*/ uint32 spellid[BUFF_COUNT]; -/*104*/ uint32 unknown700; +/*104*/ uint32 unknown700; /*108*/ uint32 unknown701; /*112*/ uint32 unknown702; /*116*/ uint32 unknown703; @@ -606,8 +606,8 @@ struct GMTrainEnd_Struct struct GMSkillChange_Struct { /*000*/ uint16 npcid; -/*002*/ uint8 unknown1[2]; // something like PC_ID, but not really. stays the same thru the session though -/*002*/ uint16 skillbank; // 0 if normal skills, 1 if languages +/*002*/ uint8 unknown1[2]; // something like PC_ID, but not really. stays the same thru the session though +/*002*/ uint16 skillbank; // 0 if normal skills, 1 if languages /*002*/ uint8 unknown2[2]; /*008*/ uint16 skill_id; /*010*/ uint8 unknown3[2]; @@ -773,12 +773,12 @@ struct RaidLeadershipAA_Struct { * Size: 20 Octets */ struct BindStruct { - /*000*/ uint32 zoneId; - /*004*/ float x; - /*008*/ float y; - /*012*/ float z; - /*016*/ float heading; - /*020*/ + /*000*/ uint32 zoneId; + /*004*/ float x; + /*008*/ float y; + /*012*/ float z; + /*016*/ float heading; + /*020*/ }; struct SuspendedMinion_Struct @@ -810,49 +810,49 @@ static const uint32 MAX_RECAST_TYPES = 20; /* showeq -> eqemu sed -e 's/_t//g' -e 's/MAX_AA/MAX_PP_AA_ARRAY/g' \ - -e 's/MAX_SPELL_SLOTS/MAX_PP_MEMSPELL/g' \ - -e 's/MAX_KNOWN_SKILLS/MAX_PP_SKILL/g' \ - -e 's/MAXRIBUTES/MAX_PLAYER_TRIBUTES/g' \ - -e 's/MAX_BUFFS/BUFF_COUNT/g' \ - -e 's/MAX_KNOWN_LANGS/MAX_PP_LANGUAGE/g' \ - -e 's/MAX_RECASTYPES/MAX_RECAST_TYPES/g' \ - -e 's/spellBuff/SpellBuff_Struct/g' \ - -e 's/lastName/last_name/g' \ - -e 's/guildID/guildid/g' \ - -e 's/itemint/item_tint/g' \ - -e 's/MANA/mana/g' \ - -e 's/curHp/cur_hp/g' \ - -e 's/sSpellBook/spell_book/g' \ - -e 's/sMemSpells/mem_spells/g' \ - -e 's/uint32[ \t]*disciplines\[MAX_DISCIPLINES\]/Disciplines_Struct disciplines/g' \ - -e 's/aa_unspent/aapoints/g' \ - -e 's/aa_spent/aapoints_spent/g' \ - -e 's/InlineItem[ \t]*potionBelt\[MAX_POTIONS_IN_BELT\]/PotionBelt_Struct potionbelt/g' \ - -e 's/ldon_guk_points/ldon_points_guk/g' \ - -e 's/ldon_mir_points/ldon_points_mir/g' \ - -e 's/ldon_mmc_points/ldon_points_mmc/g' \ - -e 's/ldon_ruj_points/ldon_points_ruj/g' \ - -e 's/ldonak_points/ldon_points_tak/g' \ - -e 's/ldon_avail_points/ldon_points_available/g' \ - -e 's/tributeTime/tribute_time_remaining/g' \ - -e 's/careerTribute/career_tribute_points/g' \ - -e 's/currentTribute/tribute_points/g' \ - -e 's/tributeActive/tribute_active/g' \ - -e 's/TributeStruct/Tribute_Struct/g' \ - -e 's/expGroupLeadAA/group_leadership_exp/g' \ - -e 's/expRaidLeadAA/raid_leadership_exp/g' \ - -e 's/groupLeadAAUnspent/group_leadership_points/g' \ - -e 's/raidLeadAAUnspent/raid_leadership_points/g' \ - -e 's/uint32[ \t]*leadershipAAs\[MAX_LEAD_AA\]/LeadershipAA_Struct leader_abilities/g' \ - -e 's/BandolierStruct/Bandolier_Struct/g' \ - -e 's/MAX_BANDOLIERS/MAX_PLAYER_BANDOLIER/g' \ - -e 's/birthdayTime/birthday/g' \ - -e 's/lastSaveTime/lastlogin/g' \ - -e 's/zoneId/zone_id/g' \ - -e 's/hunger/hunger_level/g' \ - -e 's/thirst/thirst_level/g' \ - -e 's/guildstatus/guildrank/g' \ - -e 's/airRemaining/air_remaining/g' \ + -e 's/MAX_SPELL_SLOTS/MAX_PP_MEMSPELL/g' \ + -e 's/MAX_KNOWN_SKILLS/MAX_PP_SKILL/g' \ + -e 's/MAXRIBUTES/MAX_PLAYER_TRIBUTES/g' \ + -e 's/MAX_BUFFS/BUFF_COUNT/g' \ + -e 's/MAX_KNOWN_LANGS/MAX_PP_LANGUAGE/g' \ + -e 's/MAX_RECASTYPES/MAX_RECAST_TYPES/g' \ + -e 's/spellBuff/SpellBuff_Struct/g' \ + -e 's/lastName/last_name/g' \ + -e 's/guildID/guildid/g' \ + -e 's/itemint/item_tint/g' \ + -e 's/MANA/mana/g' \ + -e 's/curHp/cur_hp/g' \ + -e 's/sSpellBook/spell_book/g' \ + -e 's/sMemSpells/mem_spells/g' \ + -e 's/uint32[ \t]*disciplines\[MAX_DISCIPLINES\]/Disciplines_Struct disciplines/g' \ + -e 's/aa_unspent/aapoints/g' \ + -e 's/aa_spent/aapoints_spent/g' \ + -e 's/InlineItem[ \t]*potionBelt\[MAX_POTIONS_IN_BELT\]/PotionBelt_Struct potionbelt/g' \ + -e 's/ldon_guk_points/ldon_points_guk/g' \ + -e 's/ldon_mir_points/ldon_points_mir/g' \ + -e 's/ldon_mmc_points/ldon_points_mmc/g' \ + -e 's/ldon_ruj_points/ldon_points_ruj/g' \ + -e 's/ldonak_points/ldon_points_tak/g' \ + -e 's/ldon_avail_points/ldon_points_available/g' \ + -e 's/tributeTime/tribute_time_remaining/g' \ + -e 's/careerTribute/career_tribute_points/g' \ + -e 's/currentTribute/tribute_points/g' \ + -e 's/tributeActive/tribute_active/g' \ + -e 's/TributeStruct/Tribute_Struct/g' \ + -e 's/expGroupLeadAA/group_leadership_exp/g' \ + -e 's/expRaidLeadAA/raid_leadership_exp/g' \ + -e 's/groupLeadAAUnspent/group_leadership_points/g' \ + -e 's/raidLeadAAUnspent/raid_leadership_points/g' \ + -e 's/uint32[ \t]*leadershipAAs\[MAX_LEAD_AA\]/LeadershipAA_Struct leader_abilities/g' \ + -e 's/BandolierStruct/Bandolier_Struct/g' \ + -e 's/MAX_BANDOLIERS/MAX_PLAYER_BANDOLIER/g' \ + -e 's/birthdayTime/birthday/g' \ + -e 's/lastSaveTime/lastlogin/g' \ + -e 's/zoneId/zone_id/g' \ + -e 's/hunger/hunger_level/g' \ + -e 's/thirst/thirst_level/g' \ + -e 's/guildstatus/guildrank/g' \ + -e 's/airRemaining/air_remaining/g' \ */ struct PlayerProfile_Struct @@ -867,7 +867,7 @@ struct PlayerProfile_Struct /*0116*/ uint32 level; // Level of player (might be one byte) /*0120*/ BindStruct binds[5]; // Bind points (primary is first, home city is fifth) /*0220*/ uint32 deity; // deity -/*0224*/ uint32 guild_id; +/*0224*/ uint32 guild_id; /*0228*/ uint32 birthday; // characters bday /*0232*/ uint32 lastlogin; // last login or zone time /*0236*/ uint32 timePlayedMin; // in minutes @@ -966,7 +966,7 @@ struct PlayerProfile_Struct /*5504*/ uint16 zone_id; // Current zone of the player /*5506*/ uint16 zoneInstance; // Instance ID /*5508*/ SpellBuff_Struct buffs[BUFF_COUNT]; // Buffs currently on the player -/*6008*/ char groupMembers[6][64];// +/*6008*/ char groupMembers[6][64];// /*6392*/ char unknown6428[656]; /*7048*/ uint32 entityid; /*7052*/ uint32 leadAAActive; @@ -1073,8 +1073,8 @@ struct PetCommand_Struct { */ struct DeleteSpawn_Struct { -/*00*/ uint32 spawn_id; // Spawn ID to delete -/*04*/ uint8 Decay; // 0 = vanish immediately, 1 = 'Decay' sparklies for corpses. +/*00*/ uint32 spawn_id; // Spawn ID to delete +/*04*/ uint8 Decay; // 0 = vanish immediately, 1 = 'Decay' sparklies for corpses. }; /* @@ -1119,8 +1119,7 @@ struct SpecialMesg_Struct }; /* -** When somebody changes what they're wearing -** or give a pet a weapon (model changes) +** When somebody changes what they're wearing or give a pet a weapon (model changes) ** Length: 19 Bytes */ struct WearChange_Struct{ @@ -1136,7 +1135,7 @@ struct WearChange_Struct{ }; /* -** Type: Bind Wound Structure +** Type: Bind Wound Structure ** Length: 8 Bytes */ //Fixed for 7-14-04 patch @@ -1150,13 +1149,13 @@ struct BindWound_Struct /* -** Type: Zone Change Request (before hand) +** Type: Zone Change Request (before hand) ** Length: 88 bytes ** OpCode: a320 */ struct ZoneChange_Struct { -/*000*/ char char_name[64]; // Character Name +/*000*/ char char_name[64]; // Character Name /*064*/ uint16 zoneID; /*066*/ uint16 instanceID; /*068*/ float y; @@ -1213,13 +1212,13 @@ struct Action_Struct }; // solar: this is what prints the You have been struck. and the regular -// melee messages like You try to pierce, etc. It's basically the melee +// melee messages like You try to pierce, etc. It's basically the melee // and spell damage message struct CombatDamage_Struct { /* 00 */ uint16 target; /* 02 */ uint16 source; -/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells +/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells /* 05 */ uint16 spellid; /* 07 */ uint32 damage; /* 11 */ uint32 unknown11; @@ -1232,13 +1231,13 @@ struct CombatDamage_Struct ** Consider Struct */ struct Consider_Struct{ -/*000*/ uint32 playerid; // PlayerID -/*004*/ uint32 targetid; // TargetID -/*008*/ uint32 faction; // Faction -/*0012*/ uint32 level; // Level -/*016*/ int32 cur_hp; // Current Hitpoints -/*020*/ int32 max_hp; // Maximum Hitpoints -/*024*/ uint8 pvpcon; // Pvp con flag 0/1 +/*000*/ uint32 playerid; // PlayerID +/*004*/ uint32 targetid; // TargetID +/*008*/ uint32 faction; // Faction +/*0012*/ uint32 level; // Level +/*016*/ int32 cur_hp; // Current Hitpoints +/*020*/ int32 max_hp; // Maximum Hitpoints +/*024*/ uint8 pvpcon; // Pvp con flag 0/1 /*025*/ uint8 unknown3[3]; }; @@ -1254,7 +1253,7 @@ struct Death_Struct /*008*/ uint32 corpseid; // was corpseid /*012*/ uint32 bindzoneid; /*016*/ uint32 spell_id; -/*020*/ uint32 attack_skill; +/*020*/ uint32 attack_skill; /*024*/ uint32 damage; /*028*/ uint32 unknown028; }; @@ -1275,19 +1274,19 @@ struct BecomeCorpse_Struct { struct PlayerPositionUpdateServer_Struct { /*0000*/ uint16 spawn_id; -/*0002*/ int32 delta_heading:10, // change in heading - x_pos:19, // x coord - padding0002:3; // ***Placeholder -/*0006*/ int32 y_pos:19, // y coord - animation:10, // animation - padding0006:3; // ***Placeholder -/*0010*/ int32 z_pos:19, // z coord - delta_y:13; // change in y -/*0014*/ int32 delta_x:13, // change in x - heading:12, // heading - padding0014:7; // ***Placeholder -/*0018*/ int32 delta_z:13, // change in z - padding0018:19; // ***Placeholder +/*0002*/ int32 delta_heading:10, // change in heading + x_pos:19, // x coord + padding0002:3; // ***Placeholder +/*0006*/ int32 y_pos:19, // y coord + animation:10, // animation + padding0006:3; // ***Placeholder +/*0010*/ int32 z_pos:19, // z coord + delta_y:13; // change in y +/*0014*/ int32 delta_x:13, // change in x + heading:12, // heading + padding0014:7; // ***Placeholder +/*0018*/ int32 delta_z:13, // change in z + padding0018:19; // ***Placeholder /*0022*/ }; @@ -1301,28 +1300,27 @@ struct PlayerPositionUpdateClient_Struct { /*0000*/ uint16 spawn_id; /*0022*/ uint16 sequence; //increments one each packet -/*0004*/ float y_pos; // y coord -/*0008*/ float delta_z; // Change in z -/*0016*/ float delta_x; // Change in x -/*0012*/ float delta_y; // Change in y -/*0020*/ int32 animation:10, // animation - delta_heading:10, // change in heading - padding0020:12; // ***Placeholder (mostly 1) -/*0024*/ float x_pos; // x coord -/*0028*/ float z_pos; // z coord -/*0034*/ uint16 heading:12, // Directional heading - padding0004:4; // ***Placeholder -/*0032*/ uint8 unknown0006[2]; // ***Placeholder +/*0004*/ float y_pos; // y coord +/*0008*/ float delta_z; // Change in z +/*0016*/ float delta_x; // Change in x +/*0012*/ float delta_y; // Change in y +/*0020*/ int32 animation:10, // animation + delta_heading:10, // change in heading + padding0020:12; // ***Placeholder (mostly 1) +/*0024*/ float x_pos; // x coord +/*0028*/ float z_pos; // z coord +/*0034*/ uint16 heading:12, // Directional heading + padding0004:4; // ***Placeholder +/*0032*/ uint8 unknown0006[2]; // ***Placeholder /*0036*/ }; struct SpawnPositionUpdate_Struct { -/*0000*/ uint16 spawn_id; -/*0002*/ uint64 y_pos:19, z_pos:19, x_pos:19, padding002:7; -/*0010*/ unsigned heading:12; - signed padding010:4; -/*0012*/ +/*0000*/ uint16 spawn_id; +/*0002*/ uint64 y_pos:19, z_pos:19, x_pos:19, padding002:7; +/*0010*/ unsigned heading:12; +/*0012*/ signed padding010:4; }; /* @@ -1388,8 +1386,8 @@ struct MobHealth ** OpCode: 5721 */ struct Stamina_Struct { -/*00*/ uint32 food; // (low more hungry 127-0) -/*02*/ uint32 water; // (low more thirsty 127-0) +/*00*/ uint32 food; // (low more hungry 127-0) +/*02*/ uint32 water; // (low more thirsty 127-0) }; /* @@ -1398,9 +1396,9 @@ struct Stamina_Struct { */ struct LevelUpdate_Struct { -/*00*/ uint32 level; // New level -/*04*/ uint32 level_old; // Old level -/*08*/ uint32 exp; // Current Experience +/*00*/ uint32 level; // New level +/*04*/ uint32 level_old; // Old level +/*08*/ uint32 exp; // Current Experience }; /* @@ -1410,8 +1408,8 @@ struct LevelUpdate_Struct */ struct ExpUpdate_Struct { -/*0000*/ uint32 exp; // Current experience ratio from 0 to 330 -/*0004*/ uint32 aaxp; // @BP ?? +/*0000*/ uint32 exp; // Current experience ratio from 0 to 330 +/*0004*/ uint32 aaxp; // @BP ?? }; /* @@ -1449,9 +1447,9 @@ struct Consume_Struct { /*0000*/ uint32 slot; /*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click -/*0008*/ uint8 c_unknown1[4]; -/*0012*/ uint8 type; // 0x01=Food 0x02=Water -/*0013*/ uint8 unknown13[3]; +/*0008*/ uint8 c_unknown1[4]; +/*0012*/ uint8 type; // 0x01=Food 0x02=Water +/*0013*/ uint8 unknown13[3]; }; struct DeleteItem_Struct { @@ -1470,11 +1468,11 @@ struct MoveItem_Struct // // from_slot/to_slot // -1 - destroy -// 0 - cursor -// 1 - inventory -// 2 - bank -// 3 - trade -// 4 - shared bank +// 0 - cursor +// 1 - inventory +// 2 - bank +// 3 - trade +// 4 - shared bank // // cointype // 0 - copeer @@ -1489,11 +1487,11 @@ static const uint32 COINTYPE_CP = 0; struct MoveCoin_Struct { - int32 from_slot; - int32 to_slot; - uint32 cointype1; - uint32 cointype2; - int32 amount; + int32 from_slot; + int32 to_slot; + uint32 cointype1; + uint32 cointype2; + int32 amount; }; struct TradeCoin_Struct{ uint32 trader; @@ -1601,11 +1599,11 @@ struct GuildCommand_Struct { struct OnLevelMessage_Struct { - char Title[128]; - char Text[4096]; - uint32 Buttons; - uint32 Duration; - uint32 PopupID; + char Title[128]; + char Text[4096]; + uint32 Buttons; + uint32 Duration; + uint32 PopupID; uint32 NegativeID; char ButtonName0[25]; char ButtonName1[25]; @@ -1651,27 +1649,27 @@ struct GMZoneRequest_Struct { }; struct GMSummon_Struct { -/* 0*/ char charname[64]; -/* 30*/ char gmname[64]; -/* 60*/ uint32 success; +/* 0*/ char charname[64]; +/* 30*/ char gmname[64]; +/* 60*/ uint32 success; /* 61*/ uint32 zoneID; -/*92*/ float y; -/*96*/ float x; -/*100*/ float z; -/*104*/ uint32 unknown2; // E0 E0 56 00 +/*92*/ float y; +/*96*/ float x; +/*100*/ float z; +/*104*/ uint32 unknown2; // E0 E0 56 00 }; struct GMGoto_Struct { // x,y is swapped as compared to summon and makes sense as own packet -/* 0*/ char charname[64]; +/* 0*/ char charname[64]; -/* 64*/ char gmname[64]; -/* 128*/ uint32 success; -/* 132*/ uint32 zoneID; +/* 64*/ char gmname[64]; +/* 128*/uint32 success; +/* 132*/ uint32 zoneID; -/*136*/ int32 y; -/*140*/ int32 x; -/*144*/ int32 z; -/*148*/ uint32 unknown2; // E0 E0 56 00 +/*136*/ int32 y; +/*140*/ int32 x; +/*144*/ int32 z; +/*148*/ uint32 unknown2; // E0 E0 56 00 }; struct GMLastName_Struct { @@ -1679,7 +1677,7 @@ struct GMLastName_Struct { char gmname[64]; char lastname[64]; uint16 unknown[4]; // 0x00, 0x00 - // 0x01, 0x00 = Update the clients + // 0x01, 0x00 = Update the clients }; //Combat Abilities @@ -1750,7 +1748,7 @@ Wrong size on OP_LFG. Got: 80, Expected: 68 */ /*000*/ uint32 unknown000; /*004*/ uint8 value; // 0x00 = off 0x01 = on -/*005*/ uint8 MatchFilter; +/*005*/ uint8 MatchFilter; /*006*/ uint16 Unknown006; /*008*/ uint32 FromLevel; /*012*/ uint32 ToLevel; @@ -1875,7 +1873,7 @@ struct Adventure_Purchase_Struct { }; struct Adventure_Sell_Struct { -/*000*/ uint32 unknown000; //0x01 +/*000*/ uint32 unknown000; //0x01 /*004*/ uint32 npcid; /*008*/ uint32 slot; /*012*/ uint32 charges; @@ -1906,7 +1904,7 @@ struct AdventureFinish_Struct{ }; struct Weblink_Struct{ -/*000*/ char weblink[1]; +/*000*/ char weblink[1]; /*004*/ }; @@ -1993,7 +1991,7 @@ struct AdventureLeaderboard_Struct uint8 iss_unknown001[6]; };*/ -struct Illusion_Struct { //size: 256 - SoF +struct Illusion_Struct { //size: 256 - SoF /*000*/ uint32 spawnid; /*004*/ char charname[64]; // /*068*/ uint16 race; // @@ -2040,22 +2038,22 @@ struct Illusion_Struct_Old { struct QuestReward_Struct { /*000*/ uint32 from_mob; // ID of mob awarding the client -/*004*/ uint32 unknown004; -/*008*/ uint32 unknown008; -/*012*/ uint32 unknown012; -/*016*/ uint32 unknown016; -/*020*/ uint32 unknown020; +/*004*/ uint32 unknown004; +/*008*/ uint32 unknown008; +/*012*/ uint32 unknown012; +/*016*/ uint32 unknown016; +/*020*/ uint32 unknown020; /*024*/ uint32 silver; // Gives silver to the client /*028*/ uint32 gold; // Gives gold to the client /*032*/ uint32 platinum; // Gives platinum to the client -/*036*/ uint32 unknown036; -/*040*/ uint32 unknown040; -/*044*/ uint32 unknown044; -/*048*/ uint32 unknown048; -/*052*/ uint32 unknown052; -/*056*/ uint32 unknown056; -/*060*/ uint32 unknown060; -/*064*/ uint32 unknown064; +/*036*/ uint32 unknown036; +/*040*/ uint32 unknown040; +/*044*/ uint32 unknown044; +/*048*/ uint32 unknown048; +/*052*/ uint32 unknown052; +/*056*/ uint32 unknown056; +/*060*/ uint32 unknown060; +/*064*/ uint32 unknown064; /*068*/ }; @@ -2093,7 +2091,7 @@ struct ZoneUnavail_Struct { int16 unknown[4]; }; -enum { //Group action fields +enum { //Group action fields groupActJoin = 0, groupActLeave = 1, groupActDisband = 6, @@ -2226,10 +2224,10 @@ struct TradeBusy_Struct { }; struct PetitionUpdate_Struct { - uint32 petnumber; // Petition Number + uint32 petnumber; // Petition Number uint32 color; // 0x00 = green, 0x01 = yellow, 0x02 = red uint32 status; - time_t senttime; // 4 has to be 0x1F + time_t senttime; // 4 has to be 0x1F char accountid[32]; char gmsenttoo[64]; int32 quetotal; @@ -2393,7 +2391,7 @@ struct GMEmoteZone_Struct { // Variable length. struct BookText_Struct { uint8 window; // where to display the text (0xFF means new window) - uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others. + uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others. uint32 invslot; // Only used in SoF and later clients. char booktext[1]; // Variable Length }; @@ -2402,7 +2400,7 @@ struct BookText_Struct { // or in our case, the 'name' column in our books table. struct BookRequest_Struct { uint8 window; // where to display the text (0xFF means new window) - uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others. + uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others. uint32 invslot; // Only used in Sof and later clients; char txtfile[20]; }; @@ -2457,7 +2455,7 @@ struct Shielding_Struct { /* ** Click Object Action Struct ** Response to client clicking on a World Container (ie, forge) -* also sent by the client when they close the container. +** also sent by the client when they close the container. ** */ struct ClickObjectAction_Struct { @@ -2487,33 +2485,33 @@ struct CloseContainer_Struct { ** Generic Door Struct ** Length: 52 Octets ** Used in: -** cDoorSpawnsStruct(f721) +** cDoorSpawnsStruct(f721) ** */ struct Door_Struct { -/*0000*/ char name[32]; // Filename of Door // Was 10char long before... added the 6 in the next unknown to it: Daeken M. BlackBlade //changed both to 32: Trevius -/*0032*/ float yPos; // y loc -/*0036*/ float xPos; // x loc -/*0040*/ float zPos; // z loc -/*0044*/ float heading; -/*0048*/ uint32 incline; // rotates the whole door -/*0052*/ uint16 size; // 100 is normal, smaller number = smaller model -/*0054*/ uint8 unknown0038[6]; -/*0060*/ uint8 doorId; // door's id # -/*0061*/ uint8 opentype; +/*0000*/ char name[32]; // Filename of Door // Was 10char long before... added the 6 in the next unknown to it: Daeken M. BlackBlade //changed both to 32: Trevius +/*0032*/ float yPos; // y loc +/*0036*/ float xPos; // x loc +/*0040*/ float zPos; // z loc +/*0044*/ float heading; +/*0048*/ uint32 incline; // rotates the whole door +/*0052*/ uint16 size; // 100 is normal, smaller number = smaller model +/*0054*/ uint8 unknown0038[6]; +/*0060*/ uint8 doorId; // door's id # +/*0061*/ uint8 opentype; /* - * Open types: + * Open types: * 66 = PORT1414 (Qeynos) * 55 = BBBOARD (Qeynos) * 100 = QEYLAMP (Qeynos) * 56 = CHEST1 (Qeynos) * 5 = DOOR1 (Qeynos) */ -/*0062*/ uint8 state_at_spawn; -/*0063*/ uint8 invert_state; // if this is 1, the door is normally open -/*0064*/ uint32 door_param; -/*0068*/ uint8 unknown0052[12]; // mostly 0s, the last 3 bytes are something tho +/*0062*/ uint8 state_at_spawn; +/*0063*/ uint8 invert_state; // if this is 1, the door is normally open +/*0064*/ uint32 door_param; +/*0068*/ uint8 unknown0052[12]; // mostly 0s, the last 3 bytes are something tho /*0080*/ }; @@ -2524,7 +2522,7 @@ struct DoorSpawns_Struct { }; /* - OP Code: Op_ClickDoor + OP Code: Op_ClickDoor Size: 16 */ struct ClickDoor_Struct { @@ -2565,7 +2563,7 @@ struct Resurrect_Struct { /*008*/ float y; /*012*/ float x; /*016*/ float z; -/*020*/ uint32 unknown020; +/*020*/ uint32 unknown020; /*024*/ char your_name[64]; /*088*/ uint32 unknown088; /*092*/ char rezzer_name[64]; @@ -2578,12 +2576,12 @@ struct Resurrect_Struct { struct Translocate_Struct { /*000*/ uint32 ZoneID; /*004*/ uint32 SpellID; -/*008*/ uint32 unknown008; //Heading ? +/*008*/ uint32 unknown008; //Heading ? /*012*/ char Caster[64]; /*076*/ float y; -/*080*/ float x; +/*080*/ float x; /*084*/ float z; -/*088*/ uint32 Complete; +/*088*/ uint32 Complete; }; struct Sacrifice_Struct { @@ -2637,17 +2635,17 @@ enum { }; struct BazaarWindowStart_Struct { - uint8 Action; - uint8 Unknown001; - uint16 Unknown002; + uint8 Action; + uint8 Unknown001; + uint16 Unknown002; }; struct BazaarWelcome_Struct { BazaarWindowStart_Struct Beginning; - uint32 Traders; - uint32 Items; - uint8 Unknown012[8]; + uint32 Traders; + uint32 Items; + uint8 Unknown012[8]; }; struct BazaarSearch_Struct { @@ -2760,7 +2758,7 @@ struct BarterSearchRequest_Struct { struct BuyerItemSearchLinkRequest_Struct { /*000*/ uint32 Action; // 0x00000015 -/*004*/ uint32 ItemID; +/*004*/ uint32 ItemID; /*008*/ uint32 Unknown008; /*012*/ uint32 Unknown012; }; @@ -2791,10 +2789,10 @@ struct BuyerRemoveItem_Struct { }; struct ServerSideFilters_Struct { -uint8 clientattackfilters; // 0) No, 1) All (players) but self, 2) All (players) but group -uint8 npcattackfilters; // 0) No, 1) Ignore NPC misses (all), 2) Ignore NPC Misses + Attacks (all but self), 3) Ignores NPC Misses + Attacks (all but group) -uint8 clientcastfilters; // 0) No, 1) Ignore PC Casts (all), 2) Ignore PC Casts (not directed towards self) -uint8 npccastfilters; // 0) No, 1) Ignore NPC Casts (all), 2) Ignore NPC Casts (not directed towards self) +uint8 clientattackfilters; // 0) No, 1) All (players) but self, 2) All (players) but group +uint8 npcattackfilters; // 0) No, 1) Ignore NPC misses (all), 2) Ignore NPC Misses + Attacks (all but self), 3) Ignores NPC Misses + Attacks (all but group) +uint8 clientcastfilters; // 0) No, 1) Ignore PC Casts (all), 2) Ignore PC Casts (not directed towards self) +uint8 npccastfilters; // 0) No, 1) Ignore NPC Casts (all), 2) Ignore NPC Casts (not directed towards self) }; /* @@ -2821,23 +2819,23 @@ struct LDONItemViewRequest_Struct { }; /* - * Client to server packet + * Client to server packet */ struct PickPocket_Struct { // Size 18 - uint32 to; - uint32 from; - uint16 myskill; - uint8 type; // -1 you are being picked, 0 failed , 1 = plat, 2 = gold, 3 = silver, 4 = copper, 5 = item - uint8 unknown1; // 0 for response, unknown for input - uint32 coin; - uint8 lastsix[2]; + uint32 to; + uint32 from; + uint16 myskill; + uint8 type; // -1 you are being picked, 0 failed , 1 = plat, 2 = gold, 3 = silver, 4 = copper, 5 = item + uint8 unknown1; // 0 for response, unknown for input + uint32 coin; + uint8 lastsix[2]; }; /* * Server to client packet */ -enum { +enum { PickPocketFailed = 0, PickPocketPlatinum = 1, PickPocketGold = 2, @@ -2888,7 +2886,7 @@ struct LogServer_Struct { struct ApproveWorld_Struct { // Size 544 // Op_Code OP_ApproveWorld - uint8 unknown544[544]; + uint8 unknown544[544]; }; struct ClientError_Struct @@ -3017,7 +3015,7 @@ struct BecomeTrader_Struct { /*000*/ uint32 ID; /*004*/ uint32 Code; -/*008*/ char Name[64]; +/*008*/ char Name[64]; /*072*/ uint32 Unknown072; // Observed 0x33,0x91 etc on zone-in, 0x00 when sent for a new trader after zone-in /*076*/ }; @@ -3041,15 +3039,15 @@ struct TraderBuy_Struct{ /*012*/ uint32 AlreadySold; /*016*/ uint32 Price; /*020*/ uint32 Quantity; -/*024*/ char ItemName[64]; +/*024*/ char ItemName[64]; }; struct TraderItemUpdate_Struct{ - uint32 Unknown000; - uint32 TraderID; - uint8 FromSlot; - int ToSlot; //7? - uint16 Charges; + uint32 Unknown000; + uint32 TraderID; + uint8 FromSlot; + int ToSlot; //7? + uint16 Charges; }; struct TraderPriceUpdate_Struct { @@ -3131,9 +3129,9 @@ struct Internal_GuildMembers_Struct { //just for display purposes, this is not a uint32 note_length; //total length of all the public notes, excluding terminators Internal_GuildMemberEntry_Struct member[0]; /* - * followed by a set of `count` null terminated name strings - * and then a set of `count` null terminated public note strings - */ + * followed by a set of `count` null terminated name strings + * and then a set of `count` null terminated public note strings + */ }; struct GuildMOTD_Struct{ @@ -3282,15 +3280,15 @@ struct ZoneInSendName_Struct2 { static const uint32 MAX_TRIBUTE_TIERS = 10; struct StartTribute_Struct { - uint32 client_id; - uint32 tribute_master_id; - uint32 response; + uint32 client_id; + uint32 tribute_master_id; + uint32 response; }; struct TributeLevel_Struct { - uint32 level; //backwards byte order! - uint32 tribute_item_id; //backwards byte order! - uint32 cost; //backwards byte order! + uint32 level; //backwards byte order! + uint32 tribute_item_id; //backwards byte order! + uint32 cost; //backwards byte order! }; struct TributeAbility_Struct { @@ -3306,15 +3304,15 @@ struct GuildTributeAbility_Struct { }; struct SelectTributeReq_Struct { - uint32 client_id; //? maybe action ID? - uint32 tribute_id; - uint32 unknown8; //seen E3 00 00 00 + uint32 client_id; //? maybe action ID? + uint32 tribute_id; + uint32 unknown8; //seen E3 00 00 00 }; struct SelectTributeReply_Struct { - uint32 client_id; //echoed from request. - uint32 tribute_id; - char desc[0]; + uint32 client_id; //echoed from request. + uint32 tribute_id; + char desc[0]; }; struct TributeInfo_Struct { @@ -3325,23 +3323,23 @@ struct TributeInfo_Struct { }; struct TributeItem_Struct { - uint32 slot; - uint32 quantity; - uint32 tribute_master_id; - int32 tribute_points; + uint32 slot; + uint32 quantity; + uint32 tribute_master_id; + int32 tribute_points; }; struct TributePoint_Struct { - int32 tribute_points; - uint32 unknown04; - int32 career_tribute_points; - uint32 unknown12; + int32 tribute_points; + uint32 unknown04; + int32 career_tribute_points; + uint32 unknown12; }; struct TributeMoney_Struct { - uint32 platinum; - uint32 tribute_master_id; - int32 tribute_points; + uint32 platinum; + uint32 tribute_master_id; + int32 tribute_points; }; @@ -3391,7 +3389,7 @@ struct RecipesSearch_Struct { //one sent for each item, from server in reply to favorites or search struct RecipeReply_Struct { uint32 object_type; - uint32 some_id; //same as in favorites + uint32 some_id; //same as in favorites uint32 component_count; uint32 recipe_id; uint32 trivial; @@ -3433,9 +3431,9 @@ struct MerchantList{ uint32 id; uint32 slot; uint32 item; - int16 faction_required; - int8 level_required; - uint16 alt_currency_cost; + int16 faction_required; + int8 level_required; + uint16 alt_currency_cost; }; struct TempMerchantList{ uint32 npcid; @@ -3446,8 +3444,8 @@ struct TempMerchantList{ }; struct AltCurrencyDefinition_Struct { - uint32 id; - uint32 item_id; + uint32 id; + uint32 item_id; }; struct NPC_Emote_Struct { @@ -3524,13 +3522,13 @@ struct SetTitleReply_Struct { }; struct TaskMemberList_Struct { -/*00*/ uint32 gopher_id; -/*04*/ uint32 unknown04; -/*08*/ uint32 member_count; //1 less than the number of members -/*12*/ char list_pointer[0]; +/*00*/ uint32 gopher_id; +/*04*/ uint32 unknown04; +/*08*/ uint32 member_count; //1 less than the number of members +/*12*/ char list_pointer[0]; /* list is of the form: char member_name[1] //null terminated string - uint8 task_leader //boolean flag + uint8 task_leader //boolean flag */ }; @@ -3547,12 +3545,12 @@ struct TaskDescription_Struct { /*018*/ uint32 unknown18; /*022*/ uint32 unknown22; /*026*/ char desc[1]; //variable length, 0 terminated -/*027*/ uint32 reward_count; //not sure +/*027*/ uint32 reward_count; //not sure /*031*/ uint32 unknown31; /*035*/ uint32 unknown35; /*039*/ uint16 unknown39; /*041*/ char reward_link[1]; //variable length, 0 terminated -/*042*/ uint32 unknown43; //maybe crystal count? +/*042*/ uint32 unknown43; //maybe crystal count? }; // Old structs not used by Task System implentation but left for reference @@ -3570,9 +3568,9 @@ struct TaskActivity_Struct { /*034*/ uint32 goal_count; /*038*/ uint32 unknown38; //0xFFFFFFFF /*042*/ uint32 unknown42; //0xFFFFFFFF -/*046*/ uint32 unknown46; //saw 0x151,0x156 -/*050*/ uint32 unknown50; //saw 0x404,0 -/*054*/ char activity_name[1]; //variable length, 0 terminated... commonly empty +/*046*/ uint32 unknown46; //saw 0x151,0x156 +/*050*/ uint32 unknown50; //saw 0x404,0 +/*054*/ char activity_name[1]; //variable length, 0 terminated... commonly empty /*055*/ uint32 done_count; /*059*/ uint32 unknown59; //=1 except on unknown and terminal activities? /*063*/ @@ -3592,7 +3590,7 @@ struct TaskSelectorData_Struct { /*000*/ uint32 Unknown7; // Seen 0 /*000*/ char TaskName[1]; // Null Terminated /*000*/ char TaskDescription[1]; // Null Terminated -/*000*/ uint8 Unknown10; // Possibly another Null Terminated String? Seen 0 +/*000*/ uint8 Unknown10; // Possibly another Null Terminated String? Seen 0 /*000*/ uint32 ActivityCount; // Seen 5 /*000*/ TaskSelectorActivities_Struct Activities[1]; }; @@ -3626,7 +3624,7 @@ struct TaskHistory_Struct { #endif struct AcceptNewTask_Struct { - uint32 unknown00; + uint32 unknown00; uint32 task_id; //set to 0 for 'decline' uint32 task_master_id; //entity ID }; @@ -3708,7 +3706,7 @@ struct TaskDescriptionData2_Struct { }; struct TaskDescriptionTrailer_Struct { - //uint16 unknown1; // 0x0012 + //uint16 unknown1; // 0x0012 uint32 Points; }; @@ -3728,7 +3726,7 @@ struct TaskActivityData1_Struct { uint32 unknown1; // 0xffffffff uint32 unknown2; // 0xffffffff uint32 ZoneID; // seen 0x36 - uint32 unknown3; + uint32 unknown3; }; struct TaskActivityTrailer_Struct { @@ -3744,7 +3742,7 @@ struct TaskActivityShort_Struct { uint32 ActivityID; uint32 unknown3; uint32 ActivityType; // 0xffffffff for the short packet - uint32 unknown4; + uint32 unknown4; }; struct TaskActivityComplete_Struct { @@ -3778,7 +3776,7 @@ struct TaskHistoryReplyData1_Struct { }; struct TaskHistoryReplyData2_Struct { - uint32 GoalCount; + uint32 GoalCount; uint32 unknown04; // 0xffffffff uint32 unknown08; // 0xffffffff uint32 ZoneID; @@ -3816,14 +3814,14 @@ struct BankerChange_Struct { }; struct LeadershipExpUpdate_Struct { - /*0000*/ uint32 unknown0000; // All zeroes? - /*0004*/ uint32 group_leadership_exp; // Group leadership exp value - /*0008*/ uint32 group_leadership_points; // Unspent group points - /*0012*/ uint32 unknown0012; // Type? - /*0016*/ uint32 unknown0016; // All zeroes? - /*0020*/ uint32 raid_leadership_exp; // Raid leadership exp value - /*0024*/ uint32 raid_leadership_points; // Unspent raid points - /*0028*/ uint32 unknown0028; +/*0000*/ uint32 unknown0000; // All zeroes? +/*0004*/ uint32 group_leadership_exp; // Group leadership exp value +/*0008*/ uint32 group_leadership_points; // Unspent group points +/*0012*/ uint32 unknown0012; // Type? +/*0016*/ uint32 unknown0016; // All zeroes? +/*0020*/ uint32 raid_leadership_exp; // Raid leadership exp value +/*0024*/ uint32 raid_leadership_points; // Unspent raid points +/*0028*/ uint32 unknown0028; }; struct UpdateLeadershipAA_Struct { @@ -3932,19 +3930,19 @@ struct RaidMembers_Struct { }; struct DynamicWall_Struct { -/*00*/ char name[32]; -/*32*/ float y; -/*36*/ float x; -/*40*/ float z; -/*44*/ uint32 something; -/*48*/ uint32 unknown48; //0 -/*52*/ uint32 one_hundred; //0x64 -/*56*/ uint32 unknown56; //0 -/*60*/ uint32 something2; -/*64*/ int32 unknown64; //-1 -/*68*/ uint32 unknown68; //0 -/*72*/ uint32 unknown72; //0 -/*76*/ uint32 unknown76; //0x100 +/*00*/ char name[32]; +/*32*/ float y; +/*36*/ float x; +/*40*/ float z; +/*44*/ uint32 something; +/*48*/ uint32 unknown48; //0 +/*52*/ uint32 one_hundred; //0x64 +/*56*/ uint32 unknown56; //0 +/*60*/ uint32 something2; +/*64*/ int32 unknown64; //-1 +/*68*/ uint32 unknown68; //0 +/*72*/ uint32 unknown72; //0 +/*76*/ uint32 unknown76; //0x100 /*80*/ }; @@ -4099,8 +4097,8 @@ struct AA_Action { struct AA_Skills { //this should be removed and changed to AA_Array /*00*/ uint32 aa_skill; // Total AAs Spent -/*04*/ uint32 aa_value; -/*08*/ uint32 unknown08; +/*04*/ uint32 aa_value; +/*08*/ uint32 unknown08; /*12*/ }; @@ -4113,11 +4111,11 @@ struct AAExpUpdate_Struct { struct AltAdvStats_Struct { -/*000*/ uint32 experience; -/*004*/ uint16 unspent; -/*006*/ uint16 unknown006; -/*008*/ uint8 percentage; -/*009*/ uint8 unknown009[3]; +/*000*/ uint32 experience; +/*004*/ uint16 unspent; +/*006*/ uint16 unknown006; +/*008*/ uint8 percentage; +/*009*/ uint8 unknown009[3]; }; struct PlayerAA_Struct { // Is this still used? @@ -4125,8 +4123,8 @@ struct PlayerAA_Struct { // Is this still used? }; struct AATable_Struct { -/*00*/ int32 aa_spent; // Total AAs Spent -/*04*/ AA_Skills aa_list[MAX_PP_AA_ARRAY]; +/*00*/ int32 aa_spent; // Total AAs Spent +/*04*/ AA_Skills aa_list[MAX_PP_AA_ARRAY]; }; struct Weather_Struct { @@ -4152,8 +4150,8 @@ struct AnnoyingZoneUnknown_Struct { }; struct LoadSpellSet_Struct { - uint32 spell[MAX_PP_MEMSPELL]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0 - uint32 unknown; //there seems to be an extra field in this packet... + uint32 spell[MAX_PP_MEMSPELL]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0 + uint32 unknown; //there seems to be an extra field in this packet... }; // This is the structure for OP_ZonePlayerToBind opcode. Discovered on Feb 9 2007 by FNW from packet logs for titanium client @@ -4195,14 +4193,14 @@ struct RespawnWindow_Struct { /** * Shroud spawn. For others shrouding, this has their spawnId and * spawnStruct. - * + * * Length: 586 * OpCode: OP_Shroud */ struct spawnShroudOther { -/*0000*/ uint32 spawnId; // Spawn Id of the shrouded player -/*0004*/ Spawn_Struct spawn; // Updated spawn struct for the player +/*0000*/ uint32 spawnId; // Spawn Id of the shrouded player +/*0004*/ Spawn_Struct spawn; // Updated spawn struct for the player /*0586*/ }; @@ -4236,11 +4234,11 @@ struct ItemVerifyReply_Struct { #if 0 struct spawnShroudSelf { -/*00000*/ uint32 spawnId; // Spawn Id of you -/*00004*/ Spawn_Struct spawn; // Updated spawnStruct for you +/*00000*/ uint32 spawnId; // Spawn Id of you +/*00004*/ Spawn_Struct spawn; // Updated spawnStruct for you //this is a sub-struct of PlayerProfile, which we havent broken out yet. -/*00586*/ playerProfileStruct profile; // Character profile for shrouded char -/*13522*/ uint8 items; // Items on the player +/*00586*/ playerProfileStruct profile; // Character profile for shrouded char +/*13522*/ uint8 items; // Items on the player /*xxxxx*/ }; #endif @@ -4255,9 +4253,9 @@ typedef struct { } GroupLFPMemberEntry; struct ControlBoat_Struct { -/*000*/ uint32 boatId; // entitylist id of the boat +/*000*/ uint32 boatId; // entitylist id of the boat /*004*/ bool TakeControl; // 01 if taking control, 00 if releasing it -/*007*/ // no idea what these last three bytes represent +/*007*/ // no idea what these last three bytes represent }; struct AugmentInfo_Struct @@ -4347,9 +4345,9 @@ struct PVPLeaderBoardDetailsReply_Struct struct DisciplineTimer_Struct { -/*00*/ uint32 TimerID; -/*04*/ uint32 Duration; -/*08*/ uint32 Unknown08; +/*00*/ uint32 TimerID; +/*04*/ uint32 Duration; +/*08*/ uint32 Unknown08; }; struct InternalVeteranRewardItem @@ -4462,7 +4460,7 @@ struct GuildBankWithdrawItem_Struct struct GuildBankItemUpdate_Struct { void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity, - uint32 inPermissions, uint32 inAllowMerge, bool inUseable) + uint32 inPermissions, uint32 inAllowMerge, bool inUseable) { Action = inAction; Unknown004 = inUnknown004; @@ -4650,7 +4648,7 @@ struct GroupMakeLeader_Struct //any items come after in much the same way adventure merchant items do except there is no theme included #define ALT_CURRENCY_OP_POPULATE 8 #define ALT_CURRENCY_OP_UPDATE 7 - + //Server -> Client //Populates the initial Alternate Currency Window struct AltCurrencyPopulateEntry_Struct @@ -4681,7 +4679,7 @@ struct AltCurrencyUpdate_Struct { /*084*/ uint32 unknown084; //seen 0 }; -//Client -> Server +//Client -> Server //When an item is selected while the alt currency merchant window is open struct AltCurrencySelectItem_Struct { /*000*/ uint32 merchant_entity_id; @@ -4711,16 +4709,16 @@ struct AltCurrencySelectItem_Struct { //eg: "I will give you no doubloons for a cloth cap." //Probably also sends amounts somewhere struct AltCurrencySelectItemReply_Struct { -/*000*/ uint32 unknown000; -/*004*/ uint8 unknown004; //0xff -/*005*/ uint8 unknown005; //0xff -/*006*/ uint8 unknown006; //0xff -/*007*/ uint8 unknown007; //0xff -/*008*/ char item_name[64]; -/*072*/ uint32 unknown074; -/*076*/ uint32 cost; -/*080*/ uint32 unknown080; -/*084*/ uint32 unknown084; +/*000*/ uint32 unknown000; +/*004*/ uint8 unknown004; //0xff +/*005*/ uint8 unknown005; //0xff +/*006*/ uint8 unknown006; //0xff +/*007*/ uint8 unknown007; //0xff +/*008*/ char item_name[64]; +/*072*/ uint32 unknown074; +/*076*/ uint32 cost; +/*080*/ uint32 unknown080; +/*084*/ uint32 unknown084; }; //Client -> Server @@ -4801,7 +4799,7 @@ struct LFGuild_GuildToggle_Struct /*012*/ char Comment[256]; /*268*/ uint8 Unknown268[256]; /*524*/ uint32 FromLevel; -/*528*/ uint32 ToLevel; +/*528*/ uint32 ToLevel; /*532*/ uint32 Classes; /*536*/ uint32 AACount; /*540*/ uint32 TimeZone; @@ -4839,7 +4837,7 @@ struct Membership_Entry_Struct { /*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300 /*004*/ uint32 bitwise_entry; // Seen 16 to 65536 - Skips 4096 -/*008*/ +/*008*/ }; struct Membership_Setting_Struct @@ -4847,7 +4845,7 @@ struct Membership_Setting_Struct /*000*/ uint32 setting_index; // 0, 1, or 2 /*004*/ uint32 setting_id; // 0 to 21 /*008*/ int32 setting_value; // All can be 0, 1, or -1 -/*012*/ +/*012*/ }; struct Membership_Details_Struct @@ -4891,7 +4889,7 @@ struct MercenaryList_Struct { /*0045*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) /*0049*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen /*0053*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 -/*0057*/ uint8 MercUnk04; // Seen 1 +/*0057*/ uint8 MercUnk04; // Seen 1 /*0058*/ char MercName[1]; // Null Terminated Mercenary Name (00 at merchants) }; @@ -4913,7 +4911,7 @@ struct MercenaryListEntry_Struct { /*0045*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) /*0049*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen /*0053*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 -/*0057*/ uint8 MercUnk04; // Seen 1 +/*0057*/ uint8 MercUnk04; // Seen 1 /*0058*/ char MercName[1]; // Null Terminated Mercenary Name (00 at merchants) /*0000*/ MercenaryStance_Struct Stances[MAX_MERC_STANCES]; // Count Varies, but hard set to 5 max for now - From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc (1 to 9 as of April 2012) }; @@ -4923,7 +4921,7 @@ struct MercenaryListEntry_Struct { // Sent by the server when browsing the Mercenary Merchant struct MercenaryMerchantList_Struct { /*0000*/ uint32 MercTypeCount; // Number of Merc Types to follow -/*0004*/ uint32 MercGrades[MAX_MERC_GRADES]; // Count varies, but hard set to 3 max for now - From dbstr_us.txt - Apprentice (330000100), Journeyman (330000200), Master (330000300) +/*0004*/ uint32 MercGrades[MAX_MERC_GRADES]; // Count varies, but hard set to 3 max for now - From dbstr_us.txt - Apprentice (330000100), Journeyman (330000200), Master (330000300) /*0016*/ uint32 MercCount; // Number of MercenaryInfo_Struct to follow /*0020*/ MercenaryListEntry_Struct Mercs[MAX_MERC]; // Data for individual mercenaries in the Merchant List }; @@ -4953,7 +4951,7 @@ struct MercenaryData_Struct { /*0045*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) /*0049*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen /*0053*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 -/*0057*/ uint8 MercUnk04; // Seen 1 +/*0057*/ uint8 MercUnk04; // Seen 1 /*0058*/ char MercName[64]; // Null Terminated Mercenary Name (00 at merchants) /*0000*/ MercenaryStance_Struct Stances[MAX_MERC_STANCES]; // Count Varies, but hard set to 2 for now - From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc (1 to 9 as of April 2012) /*0000*/ uint32 MercUnk05; // Seen 1 - Extra Merc Data field that differs from MercenaryListEntry_Struct @@ -4963,7 +4961,7 @@ struct MercenaryData_Struct { // [OPCode: 0x6537] On Live as of April 2 2012 [Server->Client] // Should be named OP_MercenaryDataResponse, but the current opcode using that name should be renamed first // Size varies if mercenary is hired or if browsing Mercenary Merchant -// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 +// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 struct MercenaryDataUpdate_Struct { /*0000*/ int32 MercStatus; // Seen 0 with merc and -1 with no merc hired /*0004*/ uint32 MercCount; // Seen 1 with 1 merc hired and 0 with no merc hired @@ -5080,3 +5078,4 @@ typedef std::list ItemList; #pragma pack() #endif + diff --git a/common/eqemu_exception.cpp b/common/eqemu_exception.cpp index 47f023e6f..88e1ea225 100644 --- a/common/eqemu_exception.cpp +++ b/common/eqemu_exception.cpp @@ -1,65 +1,65 @@ -/* EQEmu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEmu Development Team (http://www.eqemulator.net) +/* EQEmu: Everquest Server Emulator + Copyright (C) 2001-2013 EQEmu Development Team (http://www.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 + 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 + 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_exception.h" -namespace EQEmu +namespace EQEmu { - Exception::Exception(const char* name, const std::string& description, const char* file, long line) - : line_(line), - file_(file), - desc_(description), - name_(name) - { - } - - Exception::Exception(const Exception& e) - : line_(e.line_), - file_(e.file_), - desc_(e.desc_), - name_(e.name_) - { - } + Exception::Exception(const char* name, const std::string& description, const char* file, long line) + : line_(line), + file_(file), + desc_(description), + name_(name) + { + } + + Exception::Exception(const Exception& e) + : line_(e.line_), + file_(e.file_), + desc_(e.desc_), + name_(e.name_) + { + } #ifdef EQEMU_RVALUE_MOVE - Exception::Exception(const Exception&& e) - : line_(e.line_), - file_(e.file_), - desc_(e.desc_), - name_(e.name_) - { - } + Exception::Exception(const Exception&& e) + : line_(e.line_), + file_(e.file_), + desc_(e.desc_), + name_(e.name_) + { + } #endif - - void Exception::operator=(const Exception& e) { - line_ = e.line_; - file_ = e.file_; - desc_ = e.desc_; - name_ = e.name_; - } - const std::string& Exception::full_description() const { - if(full_desc_.empty()) { - std::stringstream ss; - ss << "EQEmu Exception (" << name_ << ") in " << file_; - ss << " at line (" << line_ << "): " << desc_; - full_desc_ = ss.str(); - } - return full_desc_; - } + void Exception::operator=(const Exception& e) { + line_ = e.line_; + file_ = e.file_; + desc_ = e.desc_; + name_ = e.name_; + } + + const std::string& Exception::full_description() const { + if(full_desc_.empty()) { + std::stringstream ss; + ss << "EQEmu Exception (" << name_ << ") in " << file_; + ss << " at line (" << line_ << "): " << desc_; + full_desc_ = ss.str(); + } + return full_desc_; + } } // EQEmu diff --git a/common/eqemu_exception.h b/common/eqemu_exception.h index cf6ede925..85086d1ad 100644 --- a/common/eqemu_exception.h +++ b/common/eqemu_exception.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_EQEMUEXCEPTION_H @@ -24,83 +24,83 @@ namespace EQEmu { - //! EQEmu Exception Class - /*! - A custom exception class for things EQEmu throws. - */ - class Exception : public std::exception { - public: - - //! Detailed Constructor - /*! - \param name The name given for this exception. - \param description The description for this exception. - \param file The file name for this exception. - \param line The line number for this exception. - */ - Exception(const char* name, const std::string& description, const char* file, long line); - - //! Copy Constructor - Exception(const Exception& e); - - //! Move Constructor -#ifdef EQEMU_RVALUE_MOVE - Exception(const Exception&& e); -#endif - - //! Destructor - ~Exception() throw() { } - - //! Assignment Operator - void operator=(const Exception& e); + //! EQEmu Exception Class + /*! + A custom exception class for things EQEmu throws. + */ + class Exception : public std::exception { + public: - //! Get Name - /*! - Gets the name of the exception as it was when it was created. - These are typically descriptive categories that the exception would fall under. - */ - virtual const std::string& name() const { return name_; } - - //! Get Basic Description - /*! - Gets the description of the exception as it was when it was created. - This tends to explain the circumstances of why the exception was thrown. - */ - virtual const std::string& description() const { return desc_; } - - //! Get Full Description - /*! - Gets a full description for this exception. - This is a string containing the name, description, file and line number in a custom format. - This string is created the first time the full_description is accessed. - */ - virtual const std::string& full_description() const; - - //! Get File Name - /*! - Gets the name of the file this exception was thrown from. - */ - virtual const std::string& file() const { return file_; } - - //! Get File Line - /*! - Gets the file line this exception was thrown from. - */ - virtual const long& line() const { return line_; } - - //! std::exception overload - /*! - Overload from std::exception - Allows it to be caught as a std::exception without casting which is nice, returns the full description. - */ - const char* what() const throw() { return full_description().c_str(); } - protected: - std::string name_; //!< Exception name - std::string desc_; //!< Exception Description - mutable std::string full_desc_; //!< Full Exception Description - std::string file_; //!< File Name - long line_; // @@ -69,58 +69,58 @@ EQTime::~EQTime() 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 ) - return 0; + /* check to see if we have a reference time to go by. */ + if( eqTime.start_realtime == 0 ) + return 0; - unsigned long diff = timeConvert - eqTime.start_realtime; + unsigned long diff = timeConvert - eqTime.start_realtime; - /* There are 3 seconds per 1 EQ Minute */ - diff /= 3; + /* There are 3 seconds per 1 EQ Minute */ + diff /= 3; - /* Start off timezone offset */ + /* Start off timezone offset */ - int32 ntz = timezone; + int32 ntz = timezone; - /* The minutes range from 0 - 59 */ - diff += eqTime.start_eqtime.minute + (ntz%60); - eqTimeOfDay->minute = diff % 60; - diff /= 60; - ntz /= 60; + /* The minutes range from 0 - 59 */ + diff += eqTime.start_eqtime.minute + (ntz%60); + eqTimeOfDay->minute = diff % 60; + diff /= 60; + ntz /= 60; - // The hours range from 1-24 - // 1 = 1am - // 2 = 2am - // ... - // 23 = 11 pm - // 24 = 12 am - // - // 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 /= 24; - ntz /= 24; + // The hours range from 1-24 + // 1 = 1am + // 2 = 2am + // ... + // 23 = 11 pm + // 24 = 12 am + // + // 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 /= 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 /= 28; - ntz /= 28; + // 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 /= 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 /= 12; - ntz /= 12; + // 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 /= 12; + ntz /= 12; - eqTimeOfDay->year = eqTime.start_eqtime.year + diff + ntz; + eqTimeOfDay->year = eqTime.start_eqtime.year + diff + ntz; - return 1; + return 1; } //setEQTimeOfDay @@ -145,7 +145,7 @@ bool EQTime::saveFile(const char *filename) return false; } //Enable for debugging - //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 << endl; + //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 << endl; of << EQT_VERSION << endl; of << (long)eqTime.start_eqtime.day << endl; of << (long)eqTime.start_eqtime.hour << endl; @@ -172,7 +172,7 @@ bool EQTime::loadFile(const char *filename) 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); + 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; @@ -182,7 +182,7 @@ bool EQTime::loadFile(const char *filename) //in >> eqTime.start_eqtime.hour; in >> in_data; eqTime.start_eqtime.hour = in_data; - in.ignore(80, '\n'); + in.ignore(80, '\n'); //in >> eqTime.start_eqtime.minute; in >> in_data; in.ignore(80, '\n'); @@ -195,7 +195,7 @@ bool EQTime::loadFile(const char *filename) in.ignore(80, '\n'); in >> eqTime.start_realtime; //Enable for debugging... - //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 << endl; + //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 << endl; in.close(); return true; } @@ -228,7 +228,7 @@ bool EQTime::IsTimeBefore(TimeOfDay_Struct *base, TimeOfDay_Struct *test) { void EQTime::AddMinutes(uint32 minutes, TimeOfDay_Struct *to) { uint32 cur; - + //minutes start at 0, everything else starts at 1 cur = to->minute; cur += minutes; @@ -273,8 +273,3 @@ void EQTime::ToString(TimeOfDay_Struct *t, string &str) { str = buf; } - - - - - diff --git a/common/eqtime.h b/common/eqtime.h index 5a60db27f..50bb4b562 100644 --- a/common/eqtime.h +++ b/common/eqtime.h @@ -34,13 +34,13 @@ public: //Set functions int setEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real); void setEQTimeZone(int32 in_timezone) { timezone=in_timezone; } - + //Time math/logic functions static bool IsTimeBefore(TimeOfDay_Struct *base, TimeOfDay_Struct *test); //is test before base static void AddMinutes(uint32 minutes, TimeOfDay_Struct *to); - + static void ToString(TimeOfDay_Struct *t, string &str); - + //Database functions //bool loadDB(Database q); //bool setDB(Database q); diff --git a/common/errmsg.h b/common/errmsg.h index 8087c5269..f884d7ab2 100644 --- a/common/errmsg.h +++ b/common/errmsg.h @@ -1,22 +1,22 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB -/* Error messages for mysql clients */ -/* error messages for the demon is in share/language/errmsg.sys */ + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* Error messages for mysql clients */ +/* error messages for the demon is in share/language/errmsg.sys */ #ifdef __cplusplus extern "C" { diff --git a/common/extprofile.cpp b/common/extprofile.cpp index d4793873c..0ea3fb7a1 100644 --- a/common/extprofile.cpp +++ b/common/extprofile.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2004 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 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 + 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. + 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 + 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 "debug.h" @@ -35,10 +35,10 @@ bool SetExtendedProfile(ExtendedProfile_Struct *to, char *old, unsigned int len) memcpy(to, old, sizeof(ExtendedProfile_Struct)); return(true); } - + //convert an old block of memory of size old to the new struct //and store the new results in 'to' - + //generic converter that will work as long as the structre //only grows, and nothign gets re-arranged if(len < sizeof(ExtendedProfile_Struct)) { @@ -46,12 +46,7 @@ bool SetExtendedProfile(ExtendedProfile_Struct *to, char *old, unsigned int len) memcpy(to, old, len); return(true); } - + return(false); } - - - - - diff --git a/common/extprofile.h b/common/extprofile.h index adbf74bc1..74e9a89c3 100644 --- a/common/extprofile.h +++ b/common/extprofile.h @@ -1,22 +1,22 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2004 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 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 + 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. + 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 + 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 EXTENDED_PROFILE_H -#define EXTENDED_PROFILE_H +#define EXTENDED_PROFILE_H #include "eq_packet_structs.h" #include "Item.h" @@ -27,11 +27,11 @@ /* This is a place to store data that dosent have a home in the official player profile. - + Try not to expand or re-arrange thing in this struct to make conversion between sizes easier. if something gets removed from here, just turn it into an unused - item, so conversion is not needed. Then reuse old unused values if + item, so conversion is not needed. Then reuse old unused values if possible later instead of adding more, so long as old values left over would not be extrememly unpleasent side effects. */ @@ -43,7 +43,7 @@ struct ExtendedProfile_Struct { SpellBuff_Struct pet_buffs[BUFF_COUNT]; uint32 pet_items[MAX_MATERIALS]; char merc_name[64]; - + uint32 aa_effects; uint32 perAA; //% of exp going to AAs uint32 expended_aa; // Total of expended AA diff --git a/common/faction.cpp b/common/faction.cpp index 9a8e27db2..7016f6547 100644 --- a/common/faction.cpp +++ b/common/faction.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 "debug.h" #include "faction.h" @@ -29,20 +29,20 @@ const char *FactionValueToString(FACTION_VALUE fv) { 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"); + 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"); } @@ -50,21 +50,21 @@ const char *FactionValueToString(FACTION_VALUE fv) { //| Name: CalculateFaction; rembrant, Dec. 16, 2001 //o-------------------------------------------------------------- //| Notes: Returns the faction message value. -//| Modify these values to taste. +//| Modify these values to taste. //o-------------------------------------------------------------- FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value) { int32 character_value = tmpCharacter_value; 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 >= 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; } @@ -72,70 +72,70 @@ FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value) // neotokyo: this function should check if some races have more than one race define bool IsOfEqualRace(int r1, int 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; - } - return false; + 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; + } + return false; } // neotokyo: trolls endure ogres, dark elves, ... bool IsOfIndiffRace(int r1, int 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: - return true; - case IKSAR: - return false; - } - return false; + 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: + return true; + case IKSAR: + return false; + } + return false; } diff --git a/common/faction.h b/common/faction.h index ca9f4107d..c98fc0916 100644 --- a/common/faction.h +++ b/common/faction.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 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 + 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. + 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 + 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_FACTION_H #define _EQEMU_FACTION_H @@ -28,13 +28,13 @@ enum FACTION_VALUE { FACTION_WARMLY = 2, FACTION_KINDLY = 3, FACTION_AMIABLE = 4, - - FACTION_INDIFFERENT = 5, - - FACTION_APPREHENSIVE = 6, - FACTION_DUBIOUS = 7, - FACTION_THREATENLY = 8, - FACTION_SCOWLS = 9 + + FACTION_INDIFFERENT = 5, + + FACTION_APPREHENSIVE = 6, + FACTION_DUBIOUS = 7, + FACTION_THREATENLY = 8, + FACTION_SCOWLS = 9 }; struct NPCFactionList { @@ -57,19 +57,19 @@ struct FactionMods struct Faction { int32 id; - std::map mods; + std::map mods; int16 base; char name[50]; }; typedef std::map faction_map; -struct NPCFaction -{ - uint32 factionID; - int32 value_mod; - int8 npc_value; - uint8 temp; -}; +struct NPCFaction +{ + uint32 factionID; + int32 value_mod; + int8 npc_value; + uint8 temp; +}; const char *FactionValueToString(FACTION_VALUE fv); FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value); diff --git a/common/features.h b/common/features.h index f418f1bb5..1359e1989 100644 --- a/common/features.h +++ b/common/features.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2004 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 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 + 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. + 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 + 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 FEATURES_H #define FEATURES_H @@ -22,7 +22,7 @@ This file defines many optional features for the emu as well as various parameters used by the emu. - + If ambitious, most of these could prolly be turned into database variables, but the really frequently run pieces of code, should not be done that way for speed reasons IMO @@ -185,7 +185,7 @@ enum { //timer settings, all in milliseconds }; enum { //some random constants - //each of these attack modifiers are added to the NPC's level to determine their + //each of these attack modifiers are added to the NPC's level to determine their //probability of executing such an attack (which may or may not hit) NPCDualAttackModifier = 20, NPCTripleAttackModifier = 0, @@ -200,7 +200,7 @@ enum { //some random constants //an npc can be and still let the theif PP them #define THIEF_PICKPOCKET_OVER 5 -//this is the % chance that an NPC will dual wield a 2nd weapon +//this is the % chance that an NPC will dual wield a 2nd weapon //in its loot table, if it is able to. //Aug 2007: was 5% chance.. changed to 100% by default since that seems more normal //Kept it intact codewise incase someone wants to or is already using it. @@ -221,14 +221,14 @@ enum { //some random constants //minimum level to do alchemy #define MIN_LEVEL_ALCHEMY 25 -//chance ratio that a +//chance ratio that a #define THREATENLY_ARRGO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly // max factions per npc faction list #define MAX_NPC_FACTIONS 20 //value caps -#define MAX_FACTION 1500 +#define MAX_FACTION 1500 #define MIN_FACTION -1500 //The Level Cap: diff --git a/common/fixed_memory_hash_set.h b/common/fixed_memory_hash_set.h index d020f1b80..2b119bd3f 100644 --- a/common/fixed_memory_hash_set.h +++ b/common/fixed_memory_hash_set.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_FIXED_MEMORY_HASHSET_H @@ -25,227 +25,228 @@ namespace EQEmu { - /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an - allocator for (shared memory), we assume all keys are unsigned int - */ - template - class FixedMemoryHashSet { - typedef uint32 key_type; - typedef T value_type; - typedef uint8 byte; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - public: - /*! - Constructor which initializes the hash set - \param data Raw data - \param size Raw data size - \param element_count Max number of possible unique elements that can be inserted. - \param max_element_id Number of offsets to store: eg highest "key" that will be used. - */ - FixedMemoryHashSet(byte *data, size_type size, key_type element_count, key_type max_element_id) { - data_ = data; - size_ = size; + /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an + allocator for (shared memory), we assume all keys are unsigned int + */ + template + class FixedMemoryHashSet { + typedef uint32 key_type; + typedef T value_type; + typedef uint8 byte; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + public: + /*! + Constructor which initializes the hash set + \param data Raw data + \param size Raw data size + \param element_count Max number of possible unique elements that can be inserted. + \param max_element_id Number of offsets to store: eg highest "key" that will be used. + */ + FixedMemoryHashSet(byte *data, size_type size, key_type element_count, key_type max_element_id) { + data_ = data; + size_ = size; - byte *ptr = data; - *reinterpret_cast(ptr) = max_element_id + 1; - offset_count_ = max_element_id + 1; - ptr += sizeof(key_type); + byte *ptr = data; + *reinterpret_cast(ptr) = max_element_id + 1; + offset_count_ = max_element_id + 1; + ptr += sizeof(key_type); - *reinterpret_cast(ptr) = element_count; - max_elements_ = element_count; - ptr += sizeof(key_type); + *reinterpret_cast(ptr) = element_count; + max_elements_ = element_count; + ptr += sizeof(key_type); - *reinterpret_cast(ptr) = 0; - current_elements_ = 0; - ptr += sizeof(key_type); + *reinterpret_cast(ptr) = 0; + current_elements_ = 0; + ptr += sizeof(key_type); - offsets_ = reinterpret_cast(ptr); - memset(ptr, 0xFFFFFFFFU, sizeof(key_type) * (max_element_id + 1)); - ptr += sizeof(key_type) * (max_element_id + 1); + offsets_ = reinterpret_cast(ptr); + memset(ptr, 0xFFFFFFFFU, sizeof(key_type) * (max_element_id + 1)); + ptr += sizeof(key_type) * (max_element_id + 1); - elements_ = reinterpret_cast(ptr); - } + elements_ = reinterpret_cast(ptr); + } - /*! - Constructor which does not initialize the hash set. Builds the hash set from what data is - stored in the data pointer passed. - \param data Raw data - \param size Raw data size - */ - FixedMemoryHashSet(byte *data, size_type size) { - data_ = data; - size_ = size; + /*! + Constructor which does not initialize the hash set. Builds the hash set from what data is + stored in the data pointer passed. + \param data Raw data + \param size Raw data size + */ + FixedMemoryHashSet(byte *data, size_type size) { + data_ = data; + size_ = size; - byte *ptr = data; + byte *ptr = data; - offset_count_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); + offset_count_ = *reinterpret_cast(ptr); + ptr += sizeof(key_type); - max_elements_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); + max_elements_ = *reinterpret_cast(ptr); + ptr += sizeof(key_type); - current_elements_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); + current_elements_ = *reinterpret_cast(ptr); + ptr += sizeof(key_type); - offsets_ = reinterpret_cast(ptr); - ptr += sizeof(key_type) * offset_count_; + offsets_ = reinterpret_cast(ptr); + ptr += sizeof(key_type) * offset_count_; - elements_ = reinterpret_cast(ptr); - } + elements_ = reinterpret_cast(ptr); + } - //! Copy Constructor - FixedMemoryHashSet(const FixedMemoryHashSet& other) : - data_(other.data_), - size_(other.size_), - offset_count_(other.offset_count_), - max_elements_(other.max_elements_), - current_elements_(other.current_elements_), - offsets_(other.offsets_), - elements_(other.elements_) - { - } + //! Copy Constructor + FixedMemoryHashSet(const FixedMemoryHashSet& other) : + data_(other.data_), + size_(other.size_), + offset_count_(other.offset_count_), + max_elements_(other.max_elements_), + current_elements_(other.current_elements_), + offsets_(other.offsets_), + elements_(other.elements_) + { + } - //! RValue-Move Constructor + //! RValue-Move Constructor #ifdef EQEMU_RVALUE_MOVE - FixedMemoryHashSet(FixedMemoryHashSet&& other) : - data_(other.data_), - size_(other.size_), - offset_count_(other.offset_count_), - max_elements_(other.max_elements_), - current_elements_(other.current_elements_), - offsets_(other.offsets_), - elements_(other.elements_) - { - } + FixedMemoryHashSet(FixedMemoryHashSet&& other) : + data_(other.data_), + size_(other.size_), + offset_count_(other.offset_count_), + max_elements_(other.max_elements_), + current_elements_(other.current_elements_), + offsets_(other.offsets_), + elements_(other.elements_) + { + } #endif - //! Destructor - ~FixedMemoryHashSet() { - } + //! Destructor + ~FixedMemoryHashSet() { + } - //! Assignment operator - const FixedMemoryHashSet& operator=(const FixedMemoryHashSet& other) { - data_ = other.data_; - size_ = other.size_; - offset_count_ = other.offset_count_; - max_elements_ = other.max_elements_; - current_elements_ = other.current_elements_; - offsets_ = other.offsets_; - elements_ = other.elements_; - return *this; - } - - //! Returns whether the set is empty (has 0 elements) or not - bool empty() const { - return current_elements_ == 0; - } + //! Assignment operator + const FixedMemoryHashSet& operator=(const FixedMemoryHashSet& other) { + data_ = other.data_; + size_ = other.size_; + offset_count_ = other.offset_count_; + max_elements_ = other.max_elements_; + current_elements_ = other.current_elements_; + offsets_ = other.offsets_; + elements_ = other.elements_; + return *this; + } - //! Returns the number of unique elements in the set currently - size_type size() const { - return current_elements_; - } + //! Returns whether the set is empty (has 0 elements) or not + bool empty() const { + return current_elements_ == 0; + } - //! Returns the maximum number of elements one can insert into the set. - size_type max_size() const { - return max_elements_; - } + //! Returns the number of unique elements in the set currently + size_type size() const { + return current_elements_; + } - //! Returns the maximum key one can use with the set. - key_type max_key() const { - return offset_count_ > 0 ? (offset_count_ - 1) : 0; - } - - /*! - Retrieve value operator - \param i Index to retrieve the value from - */ - reference operator[](const key_type& i) { - if(i >= offset_count_) { - EQ_EXCEPT("Fixed Memory Hash Set", "Index out of range"); - } + //! Returns the maximum number of elements one can insert into the set. + size_type max_size() const { + return max_elements_; + } - if(offsets_[i] == 0xFFFFFFFFU) { - EQ_EXCEPT("Fixed Memory Hash Set", "Element not found."); - } + //! Returns the maximum key one can use with the set. + key_type max_key() const { + return offset_count_ > 0 ? (offset_count_ - 1) : 0; + } - return elements_[offsets_[i]]; - } + /*! + Retrieve value operator + \param i Index to retrieve the value from + */ + reference operator[](const key_type& i) { + if(i >= offset_count_) { + EQ_EXCEPT("Fixed Memory Hash Set", "Index out of range"); + } - /*! - Retrieve value function - \param i Index to retrieve the value from - */ - reference at(const key_type& i) { - if(i >= offset_count_) { - EQ_EXCEPT("Fixed Memory Hash Set", "Index out of range."); - } + if(offsets_[i] == 0xFFFFFFFFU) { + EQ_EXCEPT("Fixed Memory Hash Set", "Element not found."); + } - if(offsets_[i] == 0xFFFFFFFFU) { - EQ_EXCEPT("Fixed Memory Hash Set", "Element not found."); - } + return elements_[offsets_[i]]; + } - return elements_[offsets_[i]]; - } + /*! + Retrieve value function + \param i Index to retrieve the value from + */ + reference at(const key_type& i) { + if(i >= offset_count_) { + EQ_EXCEPT("Fixed Memory Hash Set", "Index out of range."); + } - /*! - Checks if there is a value at a certain index - \param i Index to check for a value - */ - bool exists(const key_type& i) const { - if(i >= offset_count_) { - return false; - } + if(offsets_[i] == 0xFFFFFFFFU) { + EQ_EXCEPT("Fixed Memory Hash Set", "Element not found."); + } - if(offsets_[i] == 0xFFFFFFFFU) { - return false; - } + return elements_[offsets_[i]]; + } - return true; - } + /*! + Checks if there is a value at a certain index + \param i Index to check for a value + */ + bool exists(const key_type& i) const { + if(i >= offset_count_) { + return false; + } - /*! - Inserts a value into the set at a specific index - \param i Index to insert the value at - \param v Value to insert - */ - void insert(const key_type& i, const_reference v) { - if(i >= offset_count_) { - EQ_EXCEPT("Fixed Memory Hash Set", "Index out of range."); - } + if(offsets_[i] == 0xFFFFFFFFU) { + return false; + } - if(offsets_[i] != 0xFFFFFFFFU) { - elements_[offsets_[i]] = v; - } else { - if(current_elements_ >= max_elements_) { - EQ_EXCEPT("Fixed Memory Hash Set", "Insert pointer out of range."); - } + return true; + } - offsets_[i] = current_elements_; - memcpy(&elements_[current_elements_], &v, sizeof(value_type)); - ++current_elements_; - *reinterpret_cast(data_ + (sizeof(key_type) * 2)) = current_elements_; - } - } + /*! + Inserts a value into the set at a specific index + \param i Index to insert the value at + \param v Value to insert + */ + void insert(const key_type& i, const_reference v) { + if(i >= offset_count_) { + EQ_EXCEPT("Fixed Memory Hash Set", "Index out of range."); + } - //! Calculates how much memory we should allocate based on element size and count - static size_type estimated_size(key_type element_count, key_type max_elements) { - size_type total_size = 3 * sizeof(key_type); - total_size += sizeof(key_type) * (max_elements + 1); - total_size += sizeof(T) * element_count; - return total_size; - } + if(offsets_[i] != 0xFFFFFFFFU) { + elements_[offsets_[i]] = v; + } else { + if(current_elements_ >= max_elements_) { + EQ_EXCEPT("Fixed Memory Hash Set", "Insert pointer out of range."); + } - private: - unsigned char *data_; - size_type size_; - key_type offset_count_; - key_type max_elements_; - key_type current_elements_; - key_type *offsets_; - value_type *elements_; - }; + offsets_[i] = current_elements_; + memcpy(&elements_[current_elements_], &v, sizeof(value_type)); + ++current_elements_; + *reinterpret_cast(data_ + (sizeof(key_type) * 2)) = current_elements_; + } + } + + //! Calculates how much memory we should allocate based on element size and count + static size_type estimated_size(key_type element_count, key_type max_elements) { + size_type total_size = 3 * sizeof(key_type); + total_size += sizeof(key_type) * (max_elements + 1); + total_size += sizeof(T) * element_count; + return total_size; + } + + private: + unsigned char *data_; + size_type size_; + key_type offset_count_; + key_type max_elements_; + key_type current_elements_; + key_type *offsets_; + value_type *elements_; + }; } // EQEmu #endif + diff --git a/common/fixed_memory_variable_hash_set.h b/common/fixed_memory_variable_hash_set.h index 7c3b0b004..b25fe5b2f 100644 --- a/common/fixed_memory_variable_hash_set.h +++ b/common/fixed_memory_variable_hash_set.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_FIXED_MEMORY_VARIABLE_HASHSET_H @@ -25,217 +25,217 @@ namespace EQEmu { - /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an - allocator for (shared memory), we assume all keys are unsigned int, values are a pointer and size - */ - template - class FixedMemoryVariableHashSet { - typedef uint32 key_type; - typedef T value_type; - typedef uint8 byte; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef uint32 size_type; - public: - /*! - Constructor which initializes the hash set - \param data Raw data - \param size Raw data size - \param max_element_id Number of offsets to store: eg highest "key" that will be used. - */ - FixedMemoryVariableHashSet(byte *data, size_type size, key_type max_element_id) { - data_ = data; - size_ = size; - remaining_size_ = size_ - (sizeof(key_type) * 3) - (sizeof(key_type) * (max_element_id + 1)); + /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an + allocator for (shared memory), we assume all keys are unsigned int, values are a pointer and size + */ + template + class FixedMemoryVariableHashSet { + typedef uint32 key_type; + typedef T value_type; + typedef uint8 byte; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef uint32 size_type; + public: + /*! + Constructor which initializes the hash set + \param data Raw data + \param size Raw data size + \param max_element_id Number of offsets to store: eg highest "key" that will be used. + */ + FixedMemoryVariableHashSet(byte *data, size_type size, key_type max_element_id) { + data_ = data; + size_ = size; + remaining_size_ = size_ - (sizeof(key_type) * 3) - (sizeof(key_type) * (max_element_id + 1)); - byte *ptr = data; - *reinterpret_cast(ptr) = max_element_id + 1; - offset_count_ = max_element_id + 1; - ptr += sizeof(key_type); + byte *ptr = data; + *reinterpret_cast(ptr) = max_element_id + 1; + offset_count_ = max_element_id + 1; + ptr += sizeof(key_type); - *reinterpret_cast(ptr) = remaining_size_; - ptr += sizeof(key_type); - - *reinterpret_cast(ptr) = 0; - current_offset_ = 0; - ptr += sizeof(key_type); - + *reinterpret_cast(ptr) = remaining_size_; + ptr += sizeof(key_type); - offsets_ = reinterpret_cast(ptr); - memset(ptr, 0xFFFFFFFFU, sizeof(key_type) * (max_element_id + 1)); - ptr += sizeof(key_type) * (max_element_id + 1); + *reinterpret_cast(ptr) = 0; + current_offset_ = 0; + ptr += sizeof(key_type); - elements_ = reinterpret_cast(ptr); - } - /*! - Constructor which does not initialize the hash set. Builds the hash set from what data is - stored in the data pointer passed. - \param data Raw data - \param size Raw data size - */ - FixedMemoryVariableHashSet(byte *data, size_type size) { - data_ = data; - size_ = size; + offsets_ = reinterpret_cast(ptr); + memset(ptr, 0xFFFFFFFFU, sizeof(key_type) * (max_element_id + 1)); + ptr += sizeof(key_type) * (max_element_id + 1); - byte *ptr = data; - offset_count_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); + elements_ = reinterpret_cast(ptr); + } - remaining_size_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); + /*! + Constructor which does not initialize the hash set. Builds the hash set from what data is + stored in the data pointer passed. + \param data Raw data + \param size Raw data size + */ + FixedMemoryVariableHashSet(byte *data, size_type size) { + data_ = data; + size_ = size; - current_offset_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); - - offsets_ = reinterpret_cast(ptr); - ptr += sizeof(key_type) * offset_count_; + byte *ptr = data; + offset_count_ = *reinterpret_cast(ptr); + ptr += sizeof(key_type); - elements_ = reinterpret_cast(ptr); - } + remaining_size_ = *reinterpret_cast(ptr); + ptr += sizeof(key_type); - //! Copy Constructor - FixedMemoryVariableHashSet(const FixedMemoryVariableHashSet& other) : - data_(other.data_), - size_(other.size_), - offset_count_(other.offset_count_), - remaining_size_(other.remaining_size_), - current_offset_(other.current_offset_), - offsets_(other.offsets_), - elements_(other.elements_) - { - } + current_offset_ = *reinterpret_cast(ptr); + ptr += sizeof(key_type); - //! RValue-Move Constructor + offsets_ = reinterpret_cast(ptr); + ptr += sizeof(key_type) * offset_count_; + + elements_ = reinterpret_cast(ptr); + } + + //! Copy Constructor + FixedMemoryVariableHashSet(const FixedMemoryVariableHashSet& other) : + data_(other.data_), + size_(other.size_), + offset_count_(other.offset_count_), + remaining_size_(other.remaining_size_), + current_offset_(other.current_offset_), + offsets_(other.offsets_), + elements_(other.elements_) + { + } + + //! RValue-Move Constructor #ifdef EQEMU_RVALUE_MOVE - FixedMemoryVariableHashSet(FixedMemoryVariableHashSet&& other) : - data_(other.data_), - size_(other.size_), - offset_count_(other.offset_count_), - remaining_size_(other.remaining_size_), - current_offset_(other.current_offset_), - offsets_(other.offsets_), - elements_(other.elements_) - { - } + FixedMemoryVariableHashSet(FixedMemoryVariableHashSet&& other) : + data_(other.data_), + size_(other.size_), + offset_count_(other.offset_count_), + remaining_size_(other.remaining_size_), + current_offset_(other.current_offset_), + offsets_(other.offsets_), + elements_(other.elements_) + { + } #endif - //! Destructor - ~FixedMemoryVariableHashSet() { - } + //! Destructor + ~FixedMemoryVariableHashSet() { + } - //! Assignment operator - const FixedMemoryVariableHashSet& operator=(const FixedMemoryVariableHashSet& other) { - data_ = other.data_; - size_ = other.size_; - offset_count_ = other.offset_count_; - remaining_size_ = other.remaining_size_; - current_offset_ = other.current_offset_; - offsets_ = other.offsets_; - elements_ = other.elements_; - return *this; - } - - //! Returns the number of bytes in the set currently - size_type size() const { - return size_ - remaining_size_; - } + //! Assignment operator + const FixedMemoryVariableHashSet& operator=(const FixedMemoryVariableHashSet& other) { + data_ = other.data_; + size_ = other.size_; + offset_count_ = other.offset_count_; + remaining_size_ = other.remaining_size_; + current_offset_ = other.current_offset_; + offsets_ = other.offsets_; + elements_ = other.elements_; + return *this; + } - //! Returns the maximum number of bytes one can insert into the set. - size_type max_size() const { - return size_ - (sizeof(key_type) * 2); - } + //! Returns the number of bytes in the set currently + size_type size() const { + return size_ - remaining_size_; + } - //! Returns the maximum key one can use with the set. - key_type max_key() const { - return offset_count_ > 0 ? (offset_count_ - 1) : 0; - } - - /*! - Retrieve value operator - \param i Index to retrieve the value from - */ - reference operator[](const key_type& i) { - if(i >= offset_count_) { - EQ_EXCEPT("Fixed Memory Variable Hash Set", "Index out of range"); - } + //! Returns the maximum number of bytes one can insert into the set. + size_type max_size() const { + return size_ - (sizeof(key_type) * 2); + } - if(offsets_[i] == 0xFFFFFFFFU) { - EQ_EXCEPT("Fixed Memory Variable Hash Set", "Element not found."); - } + //! Returns the maximum key one can use with the set. + key_type max_key() const { + return offset_count_ > 0 ? (offset_count_ - 1) : 0; + } - return *reinterpret_cast(&elements_[offsets_[i]]); - } + /*! + Retrieve value operator + \param i Index to retrieve the value from + */ + reference operator[](const key_type& i) { + if(i >= offset_count_) { + EQ_EXCEPT("Fixed Memory Variable Hash Set", "Index out of range"); + } - /*! - Retrieve value function - \param i Index to retrieve the value from - */ - reference at(const key_type& i) { - if(i >= offset_count_) { - EQ_EXCEPT("Fixed Memory Variable Hash Set", "Index out of range"); - } + if(offsets_[i] == 0xFFFFFFFFU) { + EQ_EXCEPT("Fixed Memory Variable Hash Set", "Element not found."); + } - if(offsets_[i] == 0xFFFFFFFFU) { - EQ_EXCEPT("Fixed Memory Variable Hash Set", "Element not found."); - } + return *reinterpret_cast(&elements_[offsets_[i]]); + } - return *reinterpret_cast(&elements_[offsets_[i]]); - } + /*! + Retrieve value function + \param i Index to retrieve the value from + */ + reference at(const key_type& i) { + if(i >= offset_count_) { + EQ_EXCEPT("Fixed Memory Variable Hash Set", "Index out of range"); + } - /*! - Checks if there is a value at a certain index - \param i Index to check for a value - */ - bool exists(const key_type& i) const { - if(i >= offset_count_) { - return false; - } + if(offsets_[i] == 0xFFFFFFFFU) { + EQ_EXCEPT("Fixed Memory Variable Hash Set", "Element not found."); + } - if(offsets_[i] == 0xFFFFFFFFU) { - return false; - } + return *reinterpret_cast(&elements_[offsets_[i]]); + } - return true; - } + /*! + Checks if there is a value at a certain index + \param i Index to check for a value + */ + bool exists(const key_type& i) const { + if(i >= offset_count_) { + return false; + } - /*! - Inserts a value into the set at a specific index - \param i Index to insert the value at - \param v Value to insert - */ - void insert(const key_type& i, byte *data, size_type size) { - if(i >= offset_count_) { - EQ_EXCEPT("Fixed Memory Variable Hash Set", "Index out of range."); - } - - if(size > remaining_size_) { - EQ_EXCEPT("Fixed Memory Hash Set", "Not enough room in hash set to insert this value."); - } + if(offsets_[i] == 0xFFFFFFFFU) { + return false; + } - if(offsets_[i] != 0xFFFFFFFFU) { - EQ_EXCEPT("Fixed Memory Hash Set", "Could not insert a repeat value at this index."); - } else { - offsets_[i] = current_offset_; - memcpy(&elements_[current_offset_], data, size); + return true; + } - remaining_size_ -= size; - *reinterpret_cast(data_ + sizeof(key_type)) = remaining_size_; + /*! + Inserts a value into the set at a specific index + \param i Index to insert the value at + \param v Value to insert + */ + void insert(const key_type& i, byte *data, size_type size) { + if(i >= offset_count_) { + EQ_EXCEPT("Fixed Memory Variable Hash Set", "Index out of range."); + } - current_offset_ += size; - *reinterpret_cast(data_ + (sizeof(key_type) * 2)) = current_offset_; - } - } + if(size > remaining_size_) { + EQ_EXCEPT("Fixed Memory Hash Set", "Not enough room in hash set to insert this value."); + } - private: - unsigned char *data_; - size_type size_; - size_type remaining_size_; - key_type current_offset_; - key_type offset_count_; - key_type *offsets_; - byte *elements_; - }; + if(offsets_[i] != 0xFFFFFFFFU) { + EQ_EXCEPT("Fixed Memory Hash Set", "Could not insert a repeat value at this index."); + } else { + offsets_[i] = current_offset_; + memcpy(&elements_[current_offset_], data, size); + + remaining_size_ -= size; + *reinterpret_cast(data_ + sizeof(key_type)) = remaining_size_; + + current_offset_ += size; + *reinterpret_cast(data_ + (sizeof(key_type) * 2)) = current_offset_; + } + } + + private: + unsigned char *data_; + size_type size_; + size_type remaining_size_; + key_type current_offset_; + key_type offset_count_; + key_type *offsets_; + byte *elements_; + }; } // EQEmu #endif diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 7a97adeba..83e3a3666 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -1,5 +1,5 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 @@ -9,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "debug.h" @@ -40,22 +40,22 @@ BaseGuildManager::~BaseGuildManager() { } bool BaseGuildManager::LoadGuilds() { - + ClearGuilds(); - + if(m_db == nullptr) { _log(GUILDS__DB, "Requested to load guilds when we have no database object."); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; map::iterator res; - + // load up all the guilds - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "SELECT id, name, leader, minstatus, motd, motd_setter,channel,url FROM guilds"), errbuf, &result)) { _log(GUILDS__ERROR, "Error loading guilds '%s': %s", query, errbuf); safe_delete_array(query); @@ -66,9 +66,9 @@ bool BaseGuildManager::LoadGuilds() { _CreateGuild(atoi(row[0]), row[1], atoi(row[2]), atoi(row[3]), row[4], row[5], row[6], row[7]); } mysql_free_result(result); - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "SELECT guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks"), errbuf, &result)) { _log(GUILDS__ERROR, "Error loading guild ranks '%s': %s", query, errbuf); safe_delete_array(query); @@ -82,15 +82,15 @@ bool BaseGuildManager::LoadGuilds() { _log(GUILDS__ERROR, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } - + res = m_guilds.find(guild_id); if(res == m_guilds.end()) { _log(GUILDS__ERROR, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); continue; } - + RankInfo &rank = res->second->ranks[rankn]; - + rank.name = row[2]; rank.permissions[GUILD_HEAR] = (row[3][0] == '1')?true:false; rank.permissions[GUILD_SPEAK] = (row[4][0] == '1')?true:false; @@ -102,7 +102,7 @@ bool BaseGuildManager::LoadGuilds() { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1')?true:false; } mysql_free_result(result); - + return(true); } @@ -111,16 +111,16 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { _log(GUILDS__DB, "Requested to refresh guild %d when we have no database object.", guild_id); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; map::iterator res; GuildInfo *info; - + // load up all the guilds - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "SELECT name, leader, minstatus, motd, motd_setter, channel,url FROM guilds WHERE id=%lu", (unsigned long)guild_id), errbuf, &result)) { _log(GUILDS__ERROR, "Error reloading guilds '%s': %s", query, errbuf); safe_delete_array(query); @@ -135,9 +135,9 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { return(false); } mysql_free_result(result); - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "SELECT guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace " "FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id), errbuf, &result)) { _log(GUILDS__ERROR, "Error reloading guild ranks '%s': %s", query, errbuf); @@ -145,7 +145,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { return(false); } safe_delete_array(query); - + while((row = mysql_fetch_row(result))) { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { @@ -153,7 +153,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { continue; } RankInfo &rank = info->ranks[rankn]; - + rank.name = row[2]; rank.permissions[GUILD_HEAR] = (row[3][0] == '1')?true:false; rank.permissions[GUILD_SPEAK] = (row[4][0] == '1')?true:false; @@ -165,23 +165,23 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1')?true:false; } mysql_free_result(result); - + _log(GUILDS__DB, "Successfully refreshed guild %d from the database.", guild_id); - + return(true); } BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, const char *guild_name, uint32 leader_char_id, uint8 minstatus, const char *guild_motd, const char *motd_setter, const char *Channel, const char *URL) { map::iterator res; - + //remove any old entry. res = m_guilds.find(guild_id); if(res != m_guilds.end()) { delete res->second; m_guilds.erase(res); } - + //make the new entry and store it into the map. GuildInfo *info = new GuildInfo; info->name = guild_name; @@ -192,7 +192,7 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con info->url = URL; info->channel = Channel; m_guilds[guild_id] = info; - + //now setup default ranks (everything defaults to false) info->ranks[0].name = "Member"; info->ranks[0].permissions[GUILD_HEAR] = true; @@ -212,7 +212,7 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con info->ranks[2].permissions[GUILD_DEMOTE] = true; info->ranks[2].permissions[GUILD_MOTD] = true; info->ranks[2].permissions[GUILD_WARPEACE] = true; - + return(info); } @@ -221,7 +221,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { _log(GUILDS__DB, "Requested to store guild %d when we have no database object.", guild_id); return(false); } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { @@ -229,26 +229,26 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { return(false); } GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //clear out old `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guilds WHERE id=%lu", (unsigned long)guild_id), errbuf)) { _log(GUILDS__ERROR, "Error clearing old guild record when storing %d '%s': %s", guild_id, query, errbuf); } safe_delete_array(query); - + //clear out old `guild_ranks` entries - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id), errbuf)) { _log(GUILDS__ERROR, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query, errbuf); } safe_delete_array(query); - + //escape our strings. char *name_esc = new char[info->name.length()*2+1]; char *motd_esc = new char[info->motd.length()*2+1]; @@ -256,10 +256,10 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { m_db->DoEscapeString(name_esc, info->name.c_str(), info->name.length()); m_db->DoEscapeString(motd_esc, info->motd.c_str(), info->motd.length()); m_db->DoEscapeString(motd_set_esc, info->motd_setter.c_str(), info->motd_setter.length()); - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "INSERT INTO guilds (id,name,leader,minstatus,motd,motd_setter) VALUES(%lu,'%s',%lu,%d,'%s', '%s')", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "INSERT INTO guilds (id,name,leader,minstatus,motd,motd_setter) VALUES(%lu,'%s',%lu,%d,'%s', '%s')", (unsigned long)guild_id, name_esc, (unsigned long)info->leader_char_id, info->minstatus, motd_esc, motd_set_esc), errbuf)) { _log(GUILDS__ERROR, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query, errbuf); @@ -273,16 +273,16 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); - + //now insert the new ranks uint8 rank; for(rank = 0; rank <= GUILD_MAX_RANK; rank++) { const RankInfo &r = info->ranks[rank]; - + char *title_esc = new char[r.name.length()*2+1]; m_db->DoEscapeString(title_esc, r.name.c_str(), r.name.length()); - - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "INSERT INTO guild_ranks (guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace)" " VALUES(%d,%d,'%s',%d,%d,%d,%d,%d,%d,%d,%d)", guild_id, rank, title_esc, @@ -303,9 +303,9 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { safe_delete_array(query); safe_delete_array(title_esc); } - + _log(GUILDS__DB, "Stored guild %d in the database", guild_id); - + return(true); } @@ -314,18 +314,18 @@ uint32 BaseGuildManager::_GetFreeGuildID() { _log(GUILDS__DB, "Requested find a free guild ID when we have no database object."); return(GUILD_NONE); } - + char errbuf[MYSQL_ERRMSG_SIZE]; - char query[100]; - MYSQL_RES *result; - + char query[100]; + MYSQL_RES *result; + //this has got to be one of the more retarded things I have seen. //none the less, im too lazy to rewrite it right now. - + uint16 x; for (x = 1; x < MAX_NUMBER_GUILDS; x++) { snprintf(query, 100, "SELECT id FROM guilds where id=%i;", x); - + if (m_db->RunQuery(query, strlen(query), errbuf, &result)) { if (mysql_num_rows(result) == 0) { mysql_free_result(result); @@ -338,39 +338,39 @@ uint32 BaseGuildManager::_GetFreeGuildID() { LogFile->write(EQEMuLog::Error, "Error in _GetFreeGuildID query '%s': %s", query, errbuf); } } - + _log(GUILDS__ERROR, "Unable to find a free guild ID when requested."); return GUILD_NONE; } - + uint32 BaseGuildManager::CreateGuild(const char* name, uint32 leader_char_id) { uint32 gid = DBCreateGuild(name, leader_char_id); if(gid == GUILD_NONE) return(GUILD_NONE); - + SendGuildRefresh(gid, true, false, false, false); SendCharRefresh(GUILD_NONE, gid, leader_char_id); - + return(gid); } bool BaseGuildManager::DeleteGuild(uint32 guild_id) { if(!DBDeleteGuild(guild_id)) return(false); - + SendGuildDelete(guild_id); - + return(true); } bool BaseGuildManager::RenameGuild(uint32 guild_id, const char* name) { if(!DBRenameGuild(guild_id, name)) return(false); - + SendGuildRefresh(guild_id, true, false, false, false); - + return(true); } @@ -382,23 +382,23 @@ bool BaseGuildManager::SetGuildLeader(uint32 guild_id, uint32 leader_char_id) { return(false); GuildInfo *info = res->second; uint32 old_leader = info->leader_char_id; - + if(!DBSetGuildLeader(guild_id, leader_char_id)) return(false); - + SendGuildRefresh(guild_id, false, false, false, false); SendCharRefresh(GUILD_NONE, guild_id, old_leader); SendCharRefresh(GUILD_NONE, guild_id, leader_char_id); - + return(true); } bool BaseGuildManager::SetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { if(!DBSetGuildMOTD(guild_id, motd, setter)) return(false); - + SendGuildRefresh(guild_id, false, true, false, false); - + return(true); } @@ -406,9 +406,9 @@ bool BaseGuildManager::SetGuildURL(uint32 GuildID, const char* URL) { if(!DBSetGuildURL(GuildID, URL)) return(false); - + SendGuildRefresh(GuildID, false, true, false, false); - + return(true); } @@ -416,28 +416,28 @@ bool BaseGuildManager::SetGuildChannel(uint32 GuildID, const char* Channel) { if(!DBSetGuildChannel(GuildID, Channel)) return(false); - + SendGuildRefresh(GuildID, false, true, false, false); - + return(true); } bool BaseGuildManager::SetGuild(uint32 charid, uint32 guild_id, uint8 rank) { if(rank > GUILD_MAX_RANK && guild_id != GUILD_NONE) return(false); - + //lookup their old guild, if they had one. uint32 old_guild = GUILD_NONE; CharGuildInfo gci; if(GetCharInfo(charid, gci)) { old_guild = gci.guild_id; } - + if(!DBSetGuild(charid, guild_id, rank)) return(false); - + SendCharRefresh(old_guild, guild_id, charid); - + return(true); } @@ -445,12 +445,12 @@ bool BaseGuildManager::SetGuild(uint32 charid, uint32 guild_id, uint8 rank) { bool BaseGuildManager::SetGuildRank(uint32 charid, uint8 rank) { if(rank > GUILD_MAX_RANK) return(false); - + if(!DBSetGuildRank(charid, rank)) return(false); - + SendCharRefresh(GUILD_NONE, 0, charid); - + return(true); } @@ -458,9 +458,9 @@ bool BaseGuildManager::SetGuildRank(uint32 charid, uint8 rank) { bool BaseGuildManager::SetBankerFlag(uint32 charid, bool is_banker) { if(!DBSetBankerFlag(charid, is_banker)) return(false); - + SendRankUpdate(charid); - + return(true); } @@ -468,7 +468,7 @@ bool BaseGuildManager::SetAltFlag(uint32 charid, bool is_alt) { if(!DBSetAltFlag(charid, is_alt)) return(false); - + SendRankUpdate(charid); return(true); @@ -477,18 +477,18 @@ bool BaseGuildManager::SetAltFlag(uint32 charid, bool is_alt) bool BaseGuildManager::SetTributeFlag(uint32 charid, bool enabled) { if(!DBSetTributeFlag(charid, enabled)) return(false); - + SendCharRefresh(GUILD_NONE, 0, charid); - + return(true); } bool BaseGuildManager::SetPublicNote(uint32 charid, const char *note) { if(!DBSetPublicNote(charid, note)) return(false); - + SendCharRefresh(GUILD_NONE, 0, charid); - + return(true); } @@ -497,24 +497,24 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) { uint32 new_id = _GetFreeGuildID(); if(new_id == GUILD_NONE) return(GUILD_NONE); - + //now make the guild record in our local manager. //this also sets up the default ranks for us. _CreateGuild(new_id, name, leader, 0, "", "", "", ""); - + //now store the resulting guild setup into the DB. if(!_StoreGuildDB(new_id)) { _log(GUILDS__ERROR, "Error storing new guild. It may have been partially created which may need manual removal."); return(GUILD_NONE); } - + _log(GUILDS__DB, "Created guild %d in the database.", new_id); - + return(new_id); } bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { - + //remove the local entry map::iterator res; res = m_guilds.find(guild_id); @@ -522,32 +522,32 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { delete res->second; m_guilds.erase(res); } - + if(m_db == nullptr) { _log(GUILDS__DB, "Requested to delete guild %d when we have no database object.", guild_id); return(false); } - + char *query = 0; - + //clear out old `guilds` entry - _RunQuery(query, MakeAnyLenString(&query, + _RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guilds WHERE id=%lu", (unsigned long)guild_id), "clearing old guild record"); - + //clear out old `guild_ranks` entries - _RunQuery(query, MakeAnyLenString(&query, + _RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id), "clearing old guild_ranks records"); - + //clear out people belonging to this guild. - _RunQuery(query, MakeAnyLenString(&query, + _RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guild_members WHERE guild_id=%lu", (unsigned long)guild_id), "clearing chars in guild"); - + // Delete the guild bank - _RunQuery(query, MakeAnyLenString(&query, + _RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id), "deleting guild bank"); - + _log(GUILDS__DB, "Deleted guild %d from the database.", guild_id); - + return(true); } @@ -556,24 +556,24 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { _log(GUILDS__DB, "Requested to rename guild %d when we have no database object.", guild_id); return(false); } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(name); char *esc = new char[len*2+1]; m_db->DoEscapeString(esc, name, len); - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "UPDATE guilds SET name='%s' WHERE id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "UPDATE guilds SET name='%s' WHERE id=%d", esc, guild_id), errbuf)) { _log(GUILDS__ERROR, "Error renaming guild %d '%s': %s", guild_id, query, errbuf); @@ -583,11 +583,11 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { } safe_delete_array(query); safe_delete_array(esc); - + _log(GUILDS__DB, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); - + info->name = name; //update our local record. - + return(true); } @@ -596,19 +596,19 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { _log(GUILDS__DB, "Requested to set the leader for guild %d when we have no database object.", guild_id); return(false); } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "UPDATE guilds SET leader='%d' WHERE id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "UPDATE guilds SET leader='%d' WHERE id=%d", leader, guild_id), errbuf)) { _log(GUILDS__ERROR, "Error changing leader on guild %d '%s': %s", guild_id, query, errbuf); @@ -616,18 +616,18 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { return(false); } safe_delete_array(query); - + //set the old leader to officer if(!DBSetGuildRank(info->leader_char_id, GUILD_OFFICER)) return(false); //set the new leader to leader if(!DBSetGuildRank(leader, GUILD_LEADER)) return(false); - + _log(GUILDS__DB, "Set guild leader for guild %d to %d in the database", guild_id, leader); - + info->leader_char_id = leader; //update our local record. - + return(true); } @@ -636,16 +636,16 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c _log(GUILDS__DB, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); return(false); } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(motd); uint32 len2 = strlen(setter); @@ -653,10 +653,10 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c char *esc_set = new char[len2*2+1]; m_db->DoEscapeString(esc, motd, len); m_db->DoEscapeString(esc_set, setter, len2); - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "UPDATE guilds SET motd='%s',motd_setter='%s' WHERE id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "UPDATE guilds SET motd='%s',motd_setter='%s' WHERE id=%d", esc, esc_set, guild_id), errbuf)) { _log(GUILDS__ERROR, "Error setting MOTD for guild %d '%s': %s", guild_id, query, errbuf); @@ -668,12 +668,12 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c safe_delete_array(query); safe_delete_array(esc); safe_delete_array(esc_set); - + _log(GUILDS__DB, "Set MOTD for guild %d in the database", guild_id); - + info->motd = motd; //update our local record. info->motd_setter = setter; //update our local record. - + return(true); } @@ -681,7 +681,7 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) { if(m_db == nullptr) return(false); - + map::const_iterator res; res = m_guilds.find(GuildID); @@ -690,17 +690,17 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(URL); char *esc = new char[len*2+1]; m_db->DoEscapeString(esc, URL, len); - + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "UPDATE guilds SET url='%s' WHERE id=%d", esc, GuildID), errbuf)) { _log(GUILDS__ERROR, "Error setting URL for guild %d '%s': %s", GuildID, query, errbuf); @@ -710,11 +710,11 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) } safe_delete_array(query); safe_delete_array(esc); - + _log(GUILDS__DB, "Set URL for guild %d in the database", GuildID); - + info->url = URL; //update our local record. - + return(true); } @@ -722,7 +722,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) { if(m_db == nullptr) return(false); - + map::const_iterator res; res = m_guilds.find(GuildID); @@ -731,17 +731,17 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) return(false); GuildInfo *info = res->second; - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(Channel); char *esc = new char[len*2+1]; m_db->DoEscapeString(esc, Channel, len); - + if (!m_db->RunQuery(query, MakeAnyLenString(&query, "UPDATE guilds SET channel='%s' WHERE id=%d", esc, GuildID), errbuf)) { _log(GUILDS__ERROR, "Error setting Channel for guild %d '%s': %s", GuildID, query, errbuf); @@ -751,11 +751,11 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) } safe_delete_array(query); safe_delete_array(esc); - + _log(GUILDS__DB, "Set Channel for guild %d in the database", GuildID); - + info->channel = Channel; //update our local record. - + return(true); } @@ -764,13 +764,13 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { _log(GUILDS__DB, "Requested to set char to guild %d when we have no database object.", guild_id); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + if(guild_id != GUILD_NONE) { - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "REPLACE INTO guild_members (char_id,guild_id,rank) VALUES(%d,%d,%d)", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "REPLACE INTO guild_members (char_id,guild_id,rank) VALUES(%d,%d,%d)", charid, guild_id, rank), errbuf)) { _log(GUILDS__ERROR, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query, errbuf); @@ -778,8 +778,8 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { return(false); } } else { - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "DELETE FROM guild_members WHERE char_id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "DELETE FROM guild_members WHERE char_id=%d", charid), errbuf)) { _log(GUILDS__ERROR, "Error removing char %d from guild '%s': %s", charid, guild_id, query, errbuf); @@ -788,23 +788,23 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { } } safe_delete_array(query); - + _log(GUILDS__DB, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); - + return(true); } bool BaseGuildManager::DBSetGuildRank(uint32 charid, uint8 rank) { char *query = 0; - return(_RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET rank=%d WHERE char_id=%d", + return(_RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET rank=%d WHERE char_id=%d", rank, charid), "setting a guild member's rank")); } bool BaseGuildManager::DBSetBankerFlag(uint32 charid, bool is_banker) { char *query = 0; - return(_RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET banker=%d WHERE char_id=%d", + return(_RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET banker=%d WHERE char_id=%d", is_banker?1:0, charid), "setting a guild member's banker flag")); } @@ -830,7 +830,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) safe_delete_array(query); if(mysql_num_rows(result) != 1) - return false; + return false; row = mysql_fetch_row(result); @@ -845,8 +845,8 @@ bool BaseGuildManager::DBSetAltFlag(uint32 charid, bool is_alt) { char *query = 0; - return(_RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET alt=%d WHERE char_id=%d", + return(_RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET alt=%d WHERE char_id=%d", is_alt?1:0, charid), "setting a guild member's alt flag")); } @@ -872,7 +872,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) safe_delete_array(query); if(mysql_num_rows(result) != 1) - return false; + return false; row = mysql_fetch_row(result); @@ -885,26 +885,26 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) bool BaseGuildManager::DBSetTributeFlag(uint32 charid, bool enabled) { char *query = 0; - return(_RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET tribute_enable=%d WHERE char_id=%d", + return(_RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET tribute_enable=%d WHERE char_id=%d", enabled?1:0, charid), "setting a guild member's tribute flag")); } bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if(m_db == nullptr) return(false); - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - + //escape our strings. uint32 len = strlen(note); char *esc = new char[len*2+1]; m_db->DoEscapeString(esc, note, len); - + //insert the new `guilds` entry - if (!m_db->RunQuery(query, MakeAnyLenString(&query, - "UPDATE guild_members SET public_note='%s' WHERE char_id=%d", + if (!m_db->RunQuery(query, MakeAnyLenString(&query, + "UPDATE guild_members SET public_note='%s' WHERE char_id=%d", esc, charid), errbuf)) { _log(GUILDS__ERROR, "Error setting public note for char %d '%s': %s", charid, query, errbuf); @@ -914,18 +914,18 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { } safe_delete_array(query); safe_delete_array(esc); - + _log(GUILDS__DB, "Set public not for char %d", charid); - + return(true); } bool BaseGuildManager::_RunQuery(char *&query, int len, const char *errmsg) { if(m_db == nullptr) return(false); - + char errbuf[MYSQL_ERRMSG_SIZE]; - + if (!m_db->RunQuery(query, len, errbuf)) { _log(GUILDS__ERROR, "Error %s: '%s': %s", errmsg, query, errbuf); @@ -933,7 +933,7 @@ bool BaseGuildManager::_RunQuery(char *&query, int len, const char *errmsg) { return(false); } safe_delete_array(query); - + return(true); } @@ -953,23 +953,23 @@ bool BaseGuildManager::_RunQuery(char *&query, int len, const char *errmsg) { #endif static void ProcessGuildMember(MYSQL_ROW &row, CharGuildInfo &into) { //fields from `characer_` - into.char_id = atoi(row[0]); - into.char_name = row[1]; - into.class_ = atoi(row[2]); - into.level = atoi(row[3]); - into.time_last_on = atoul(row[4]); - into.zone_id = atoi(row[5]); - + into.char_id = atoi(row[0]); + into.char_name = row[1]; + into.class_ = atoi(row[2]); + into.level = atoi(row[3]); + into.time_last_on = atoul(row[4]); + into.zone_id = atoi(row[5]); + //fields from `guild_members`, leave at defaults if missing - into.guild_id = row[6] ? atoi(row[6]) : GUILD_NONE; - into.rank = row[7] ? atoi(row[7]) : (GUILD_MAX_RANK+1); + into.guild_id = row[6] ? atoi(row[6]) : GUILD_NONE; + into.rank = row[7] ? atoi(row[7]) : (GUILD_MAX_RANK+1); into.tribute_enable = row[8] ? (row[8][0] == '0'?false:true) : false; into.total_tribute = row[9] ? atoi(row[9]) : 0; into.last_tribute = row[10]? atoul(row[10]) : 0; //timestamp - into.banker = row[11]? (row[11][0] == '0'?false:true) : false; + into.banker = row[11]? (row[11][0] == '0'?false:true) : false; into.public_note = row[12]? row[12] : ""; - into.alt = row[13]? (row[13][0] == '0'?false:true) : false; - + into.alt = row[13]? (row[13][0] == '0'?false:true) : false; + //a little sanity checking/cleanup if(into.guild_id == 0) into.guild_id = GUILD_NONE; @@ -980,17 +980,17 @@ static void ProcessGuildMember(MYSQL_ROW &row, CharGuildInfo &into) { bool BaseGuildManager::GetEntireGuild(uint32 guild_id, vector &members) { members.clear(); - + if(m_db == nullptr) return(false); - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, GuildMemberBaseQuery " WHERE g.guild_id=%d", guild_id ), errbuf, &result)) { _log(GUILDS__ERROR, "Error loading guild member list '%s': %s", query, errbuf); @@ -998,16 +998,16 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, vector & return(false); } safe_delete_array(query); - + while ((row = mysql_fetch_row(result))) { CharGuildInfo *ci = new CharGuildInfo; ProcessGuildMember(row, *ci); members.push_back(ci); } mysql_free_result(result); - + _log(GUILDS__DB, "Retreived entire guild member list for guild %d from the database", guild_id); - + return(true); } @@ -1016,19 +1016,19 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { _log(GUILDS__DB, "Requested char info on %s when we have no database object.", char_name); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + //escape our strings. uint32 nl = strlen(char_name); char *esc = new char[nl*2+1]; m_db->DoEscapeString(esc, char_name, nl); - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, GuildMemberBaseQuery " WHERE c.name='%s'", esc ), errbuf, &result)) { _log(GUILDS__ERROR, "Error loading guild member '%s': %s", query, errbuf); @@ -1038,7 +1038,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { } safe_delete_array(query); safe_delete_array(esc); - + bool ret = true; if ((row = mysql_fetch_row(result))) { ProcessGuildMember(row, into); @@ -1047,10 +1047,10 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { ret = true; } mysql_free_result(result); - + return(ret); - - + + } bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { @@ -1058,14 +1058,14 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { _log(GUILDS__DB, "Requested char info on %d when we have no database object.", char_id); return(false); } - + char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + //load up the rank info for each guild. - if (!m_db->RunQuery(query, MakeAnyLenString(&query, + if (!m_db->RunQuery(query, MakeAnyLenString(&query, #ifdef BOTS GuildMemberBaseQuery " WHERE c.id=%d AND c.mobtype = 'C'", char_id #else @@ -1077,7 +1077,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { return(false); } safe_delete_array(query); - + bool ret = true; if ((row = mysql_fetch_row(result))) { ProcessGuildMember(row, into); @@ -1086,18 +1086,18 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { ret = true; } mysql_free_result(result); - + return(ret); - + } //returns ownership of the buffer. uint8 *BaseGuildManager::MakeGuildList(const char *head_name, uint32 &length) const { //dynamic structs will make this a lot less painful. - + length = sizeof(GuildsList_Struct); uint8 *buffer = new uint8[length]; - + //a bit little better than memsetting the whole thing... uint32 r,pos; for(r = 0, pos = 0; r <= MAX_NUMBER_GUILDS; r++, pos += 64) { @@ -1106,9 +1106,9 @@ uint8 *BaseGuildManager::MakeGuildList(const char *head_name, uint32 &length) co // so just fill unused entries with an empty string instead. buffer[pos] = '\0'; } - + strn0cpy((char *) buffer, head_name, 64); - + map::const_iterator cur, end; cur = m_guilds.begin(); end = m_guilds.end(); @@ -1170,7 +1170,7 @@ bool BaseGuildManager::GetGuildMOTD(uint32 guild_id, char *motd_buffer, char *se strn0cpy(setter_buffer, res->second->motd_setter.c_str(), 64); return(true); } - + bool BaseGuildManager::GetGuildURL(uint32 GuildID, char *URLBuffer) const { map::const_iterator res; @@ -1181,7 +1181,7 @@ bool BaseGuildManager::GetGuildURL(uint32 GuildID, char *URLBuffer) const return(true); } - + bool BaseGuildManager::GetGuildChannel(uint32 GuildID, char *ChannelBuffer) const { map::const_iterator res; @@ -1191,7 +1191,7 @@ bool BaseGuildManager::GetGuildChannel(uint32 GuildID, char *ChannelBuffer) cons strn0cpy(ChannelBuffer, res->second->channel.c_str(), 128); return(true); } - + bool BaseGuildManager::GuildExists(uint32 guild_id) const { if(guild_id == GUILD_NONE) return(false); @@ -1242,19 +1242,19 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { _log(GUILDS__PERMISSIONS, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); return(true); //250+ as allowed anything } - + map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { _log(GUILDS__PERMISSIONS, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); return(false); //invalid guild } - + bool granted = (res->second->minstatus <= status); - - _log(GUILDS__PERMISSIONS, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", + + _log(GUILDS__PERMISSIONS, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); - + return(granted); } @@ -1271,15 +1271,15 @@ bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction guild_id, rank, GuildActionNames[act], act); return(false); //invalid guild } - + bool granted = res->second->ranks[rank].permissions[act]; - + _log(GUILDS__PERMISSIONS, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", - res->second->name.c_str(), guild_id, - res->second->ranks[rank].name.c_str(), rank, - GuildActionNames[act], act, + res->second->name.c_str(), guild_id, + res->second->ranks[rank].name.c_str(), rank, + GuildActionNames[act], act, granted?"granted":"denied"); - + return(granted); } @@ -1318,21 +1318,21 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; - + if (!m_db->RunQuery(query, - MakeAnyLenString(&query, - "select guild_id from guild_members where char_id in (select id from character_ where account_id = %i) and rank = 2", - AccountID), errbuf, &result)) + MakeAnyLenString(&query, + "select guild_id from guild_members where char_id in (select id from character_ where account_id = %i) and rank = 2", + AccountID), errbuf, &result)) { _log(GUILDS__ERROR, "Error executing query '%s': %s", query, errbuf); safe_delete_array(query); return 0; } safe_delete_array(query); - + uint32 Rows = mysql_num_rows(result); mysql_free_result(result); - + return Rows; } @@ -1341,11 +1341,11 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) bool Database::LoadGuilds(GuildRanks_Struct* guilds) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; // int i; - MYSQL_RES *result; - MYSQL_ROW row; - + MYSQL_RES *result; + MYSQL_ROW row; + for (int a = 0; a < 512; a++) { guilds[a].leader = 0; guilds[a].databaseID = 0; @@ -1376,7 +1376,7 @@ bool Database::LoadGuilds(GuildRanks_Struct* guilds) { Sleep(0); } - + if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, eqid, name, leader, minstatus, rank0title, rank1, rank1title, rank2, rank2title, rank3, rank3title, rank4, rank4title, rank5, rank5title from guilds"), errbuf, &result)) { safe_delete_array(query); @@ -1422,7 +1422,7 @@ bool Database::LoadGuilds(GuildRanks_Struct* guilds) { guilds[guildeqid].rank[i].motd = 0; guilds[guildeqid].rank[i].warpeace = 0; } - + if (guilds[guildeqid].rank[i].rankname[0] == 0) snprintf(guilds[guildeqid].rank[i].rankname, 100, "Guild Rank %i", i); } @@ -1438,14 +1438,14 @@ bool Database::LoadGuilds(GuildRanks_Struct* guilds) { safe_delete_array(query); return false; } - + return false; } void Database::SetPublicNote(uint32 guild_id,char* charname, char* note){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; char* notebuf = new char[(strlen(note)*2)+3]; DoEscapeString(notebuf, note, strlen(note)) ; if (!RunQuery(query, MakeAnyLenString(&query, "update character_ set publicnote='%s' where name='%s' and guild=%i", notebuf,charname,guild_id), errbuf)) { @@ -1459,10 +1459,10 @@ void Database::SetPublicNote(uint32 guild_id,char* charname, char* note){ bool Database::GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, eqid, name, leader, minstatus, rank0title, rank1, rank1title, rank2, rank2title, rank3, rank3title, rank4, rank4title, rank5, rank5title from guilds where eqid=%i;", guildeqid), errbuf, &result)) { safe_delete_array(query); @@ -1504,7 +1504,7 @@ bool Database::GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr) { gr->rank[i].motd = 0; gr->rank[i].warpeace = 0; } - + if (gr->rank[i].rankname[0] == 0) snprintf(gr->rank[i].rankname, 100, "Guild Rank %i", i); } @@ -1547,7 +1547,7 @@ bool Database::GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr) { safe_delete_array(query); return false; } - + return false; } diff --git a/common/guild_base.h b/common/guild_base.h index 0b3e2269e..f27afb3d0 100644 --- a/common/guild_base.h +++ b/common/guild_base.h @@ -17,7 +17,7 @@ public: uint16 level; uint32 time_last_on; uint32 zone_id; - + //fields from `guild_members` uint32 guild_id; uint8 rank; @@ -34,13 +34,13 @@ class BaseGuildManager { public: BaseGuildManager(); virtual ~BaseGuildManager(); - + //this must be called before doing anything else with this object void SetDatabase(Database *db) { m_db = db; } - + bool LoadGuilds(); bool RefreshGuild(uint32 guild_id); - + //guild edit actions. uint32 CreateGuild(const char* name, uint32 leader_char_id); bool DeleteGuild(uint32 guild_id); @@ -48,7 +48,7 @@ public: bool SetGuildMOTD(uint32 guild_id, const char* motd, const char *setter); bool SetGuildURL(uint32 GuildID, const char* URL); bool SetGuildChannel(uint32 GuildID, const char* Channel); - + //character edit actions bool SetGuildLeader(uint32 guild_id, uint32 leader_char_id); bool SetGuild(uint32 charid, uint32 guild_id, uint8 rank); @@ -59,7 +59,7 @@ public: bool GetBankerFlag(uint32 CharID); bool SetTributeFlag(uint32 charid, bool enabled); bool SetPublicNote(uint32 charid, const char *note); - + //queries bool GetCharInfo(const char *char_name, CharGuildInfo &into); bool GetCharInfo(uint32 char_id, CharGuildInfo &into); @@ -82,19 +82,19 @@ public: uint32 NumberInGuild(uint32 guild_id); // bool GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr); // bool EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* grl); - + uint8 *MakeGuildList(const char *head_name, uint32 &length) const; //make a guild list packet, returns ownership of the buffer. - + static const char *const GuildActionNames[_MaxGuildAction]; uint32 DoesAccountContainAGuildLeader(uint32 AccountID); - + protected: //the methods which must be defined by base classes. virtual void SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) = 0; virtual void SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) = 0; virtual void SendRankUpdate(uint32 CharID) = 0; virtual void SendGuildDelete(uint32 guild_id) = 0; - + uint32 DBCreateGuild(const char* name, uint32 leader_char_id); bool DBDeleteGuild(uint32 guild_id); bool DBRenameGuild(uint32 guild_id, const char* name); @@ -110,9 +110,9 @@ protected: bool DBSetPublicNote(uint32 charid, const char *note); bool _RunQuery(char *&query, int len, const char *errmsg); // void DBSetPublicNote(uint32 guild_id,char* charname, char* note); - + bool LocalDeleteGuild(uint32 guild_id); - + class RankInfo { public: RankInfo(); @@ -133,12 +133,12 @@ protected: //tribute is not in here on purpose, since it is only valid in world! RankInfo ranks[GUILD_MAX_RANK+1]; }; - + std::map m_guilds; //we own the pointers in this map void ClearGuilds(); //clears internal structure - + Database *m_db; //we do not own this - + bool _StoreGuildDB(uint32 guild_id); GuildInfo *_CreateGuild(uint32 guild_id, const char *guild_name, uint32 account_id, uint8 minstatus, const char *guild_motd, const char *motd_setter, const char *Channel, const char *URL); uint32 _GetFreeGuildID(); diff --git a/common/guilds.cpp b/common/guilds.cpp index 83dd147d2..22b2ca240 100644 --- a/common/guilds.cpp +++ b/common/guilds.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + 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 - 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 + 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 + 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/debug.h" #include "MiscFunctions.h" @@ -29,7 +29,7 @@ /* void Database::GetGuildMembers(uint32 guild_id, GuildMember_Struct* gms){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; MYSQL_RES *result; MYSQL_ROW row; uint32 count=0; @@ -59,11 +59,11 @@ void Database::GetGuildMembers(uint32 guild_id, GuildMember_Struct* gms){ } uint32 Database::NumberInGuild(uint32 guild_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - + if (RunQuery(query, MakeAnyLenString(&query, "Select count(id) from character_ where guild=%i", guild_id), errbuf, &result)) { safe_delete_array(query); if (mysql_num_rows(result) == 1) { @@ -83,9 +83,9 @@ uint32 Database::NumberInGuild(uint32 guild_id) { } bool Database::SetGuild(char* name, uint32 guild_id, uint8 guildrank) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; - + if (RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET guild=%i, guildrank=%i WHERE name='%s'", guild_id, guildrank, name), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -103,9 +103,9 @@ bool Database::SetGuild(char* name, uint32 guild_id, uint8 guildrank) { bool Database::SetGuild(uint32 charid, uint32 guild_id, uint8 guildrank) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; - + if (RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET guild=%i, guildrank=%i WHERE id=%i", guild_id, guildrank, charid), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -119,17 +119,17 @@ bool Database::SetGuild(uint32 charid, uint32 guild_id, uint8 guildrank) { safe_delete_array(query); return false; } - + return false; } bool Database::DeleteGuild(uint32 guild_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; char *query2 = 0; uint32 affected_rows = 0; - + if (RunQuery(query, MakeAnyLenString(&query, "DELETE FROM guilds WHERE id=%i;", guild_id), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) { @@ -146,17 +146,17 @@ bool Database::DeleteGuild(uint32 guild_id) safe_delete_array(query); return false; } - + return false; } bool Database::RenameGuild(uint32 guild_id, const char* name) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; char buf[65]; DoEscapeString(buf, name, strlen(name)) ; - + if (RunQuery(query, MakeAnyLenString(&query, "Update guilds set name='%s' WHERE id=%i;", buf, guild_id), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -169,7 +169,7 @@ bool Database::RenameGuild(uint32 guild_id, const char* name) { safe_delete_array(query); return false; } - + return false; } @@ -178,8 +178,8 @@ bool Database::RenameGuild(uint32 guild_id, const char* name) { bool Database::EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* grl) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - int chars = 0; + char *query = 0; + int chars = 0; uint32 affected_rows = 0; char buf[203]; char buf2[8]; @@ -192,12 +192,12 @@ bool Database::EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* buf2[GUILD_DEMOTE] = grl->demote + '0'; buf2[GUILD_MOTD] = grl->motd + '0'; buf2[GUILD_WARPEACE] = grl->warpeace + '0'; - + if (ranknum == 0) chars = MakeAnyLenString(&query, "Update guilds set rank%ititle='%s' WHERE id=%i;", ranknum, buf, guild_id); else chars = MakeAnyLenString(&query, "Update guilds set rank%ititle='%s', rank%i='%s' WHERE id=%i;", ranknum, buf, ranknum, buf2, guild_id); - + if (RunQuery(query, chars, errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -210,17 +210,17 @@ bool Database::EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* safe_delete_array(query); return false; } - + return false; } bool Database::GetGuildNameByID(uint32 guild_id, char * name) { if (!name || !guild_id) return false; char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; MYSQL_RES *result; - MYSQL_ROW row; - + MYSQL_ROW row; + if (RunQuery(query, MakeAnyLenString(&query, "select name from guilds where id='%i'", guild_id), errbuf, &result)) { safe_delete_array(query); row = mysql_fetch_row(result); @@ -234,17 +234,17 @@ bool Database::GetGuildNameByID(uint32 guild_id, char * name) { safe_delete_array(query); return false; } - + return false; } uint32 Database::GetGuildIDbyLeader(uint32 leader) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM guilds WHERE leader=%i", leader), errbuf, &result)) { safe_delete_array(query); if (mysql_num_rows(result) == 1) @@ -260,16 +260,16 @@ uint32 Database::GetGuildIDbyLeader(uint32 leader) LogFile->write(EQEMuLog::Error, "Error in Getguild_idbyLeader query '%s': %s", query, errbuf); safe_delete_array(query); } - + return 0; } bool Database::SetGuildLeader(uint32 guild_id, uint32 leader) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; - + if (RunQuery(query, MakeAnyLenString(&query, "UPDATE guilds SET leader=%i WHERE id=%i", leader, guild_id), errbuf, 0, &affected_rows)) { safe_delete_array(query); if (affected_rows == 1) @@ -282,20 +282,20 @@ bool Database::SetGuildLeader(uint32 guild_id, uint32 leader) safe_delete_array(query); return false; } - + return false; } bool Database::SetGuildMOTD(uint32 guild_id, const char* motd) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; char* motdbuf = 0; uint32 affected_rows = 0; - + motdbuf = new char[(strlen(motd)*2)+3]; DoEscapeString(motdbuf, motd, strlen(motd)) ; - + if (RunQuery(query, MakeAnyLenString(&query, "Update guilds set motd='%s' WHERE id=%i;", motdbuf, guild_id), errbuf, 0, &affected_rows)) { safe_delete_array(query); delete motdbuf; @@ -311,16 +311,16 @@ bool Database::SetGuildMOTD(uint32 guild_id, const char* motd) { delete motdbuf; return false; } - + return false; } string Database::GetGuildMOTD(uint32 guild_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; string motd_str; if (RunQuery(query, MakeAnyLenString(&query, "SELECT motd FROM guilds WHERE id=%i", guild_id), errbuf, &result)) { safe_delete_array(query); diff --git a/common/guilds.h b/common/guilds.h index 663698a70..ad91892ce 100644 --- a/common/guilds.h +++ b/common/guilds.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 GUILD_H @@ -23,7 +23,7 @@ #define GUILD_NONE 0xFFFFFFFF // user has no guild -#define GUILD_MAX_RANK 8 // 0-2 - some places in the code assume a single digit, dont go above 9 +#define GUILD_MAX_RANK 8 // 0-2 - some places in the code assume a single digit, dont go above 9 //defines for standard ranks #define GUILD_MEMBER 0 diff --git a/common/ipc_mutex.cpp b/common/ipc_mutex.cpp index 8b83d54ca..1ac88538c 100644 --- a/common/ipc_mutex.cpp +++ b/common/ipc_mutex.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 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 + 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. + 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 + 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 "ipc_mutex.h" @@ -30,91 +30,91 @@ namespace EQEmu { - struct IPCMutex::Implementation { + struct IPCMutex::Implementation { #ifdef _WINDOWS - HANDLE mut_; + HANDLE mut_; #else - int fd_; + int fd_; #endif - }; + }; - IPCMutex::IPCMutex(std::string name) : locked_(false) { - imp_ = new Implementation; + IPCMutex::IPCMutex(std::string name) : locked_(false) { + imp_ = new Implementation; #ifdef _WINDOWS - std::string final_name = "EQEmuMutex_"; - final_name += name; + std::string final_name = "EQEmuMutex_"; + final_name += name; - imp_->mut_ = CreateMutex(nullptr, - FALSE, - final_name.c_str()); + imp_->mut_ = CreateMutex(nullptr, + FALSE, + final_name.c_str()); - if(!imp_->mut_) { - EQ_EXCEPT("IPC Mutex", "Could not create mutex."); - } + if(!imp_->mut_) { + EQ_EXCEPT("IPC Mutex", "Could not create mutex."); + } #else - std::string final_name = name; - final_name += ".lock"; + std::string final_name = name; + final_name += ".lock"; - imp_->fd_ = open(final_name.c_str(), - O_RDWR | O_CREAT | O_CLOEXEC, - S_IRUSR | S_IWUSR); + imp_->fd_ = open(final_name.c_str(), + O_RDWR | O_CREAT | O_CLOEXEC, + S_IRUSR | S_IWUSR); - if(imp_->fd_ == -1) { - EQ_EXCEPT("IPC Mutex", "Could not create mutex."); - } + if(imp_->fd_ == -1) { + EQ_EXCEPT("IPC Mutex", "Could not create mutex."); + } #endif - } + } - IPCMutex::~IPCMutex() { + IPCMutex::~IPCMutex() { #ifdef _WINDOWS - if(locked_) { - ReleaseMutex(imp_->mut_); - } - CloseHandle(imp_->mut_); + if(locked_) { + ReleaseMutex(imp_->mut_); + } + CloseHandle(imp_->mut_); #else - if(locked_) { - lockf(imp_->fd_, F_ULOCK, 0); - } - close(imp_->fd_); + if(locked_) { + lockf(imp_->fd_, F_ULOCK, 0); + } + close(imp_->fd_); #endif - delete imp_; - } + delete imp_; + } - bool IPCMutex::Lock() { - if(locked_) { - return false; - } + bool IPCMutex::Lock() { + if(locked_) { + return false; + } #ifdef _WINDOWS - DWORD wait_result = WaitForSingleObject(imp_->mut_, INFINITE); - if(wait_result != WAIT_OBJECT_0) { - return false; - } + DWORD wait_result = WaitForSingleObject(imp_->mut_, INFINITE); + if(wait_result != WAIT_OBJECT_0) { + return false; + } #else - if(lockf(imp_->fd_, F_LOCK, 0) != 0) { - return false; - } + if(lockf(imp_->fd_, F_LOCK, 0) != 0) { + return false; + } #endif - locked_ = true; - return true; - } + locked_ = true; + return true; + } - bool IPCMutex::Unlock() { - if(!locked_) { - return false; - } + bool IPCMutex::Unlock() { + if(!locked_) { + return false; + } #ifdef _WINDOWS - if(!ReleaseMutex(imp_->mut_)) { - return false; - } + if(!ReleaseMutex(imp_->mut_)) { + return false; + } #else - if(lockf(imp_->fd_, F_ULOCK, 0) != 0) { - return false; - } + if(lockf(imp_->fd_, F_ULOCK, 0) != 0) { + return false; + } #endif - locked_ = false; - return true; - } + locked_ = false; + return true; + } } diff --git a/common/ipc_mutex.h b/common/ipc_mutex.h index 1e11325a6..ab0af4817 100644 --- a/common/ipc_mutex.h +++ b/common/ipc_mutex.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 _MUTEX_H_ @@ -22,44 +22,44 @@ #include namespace EQEmu { - - //! Interprocess Named Binary Semaphore (Mutex) - /*! - Important to note: while this can be used to synchronize processes, it is not in itself re-entrant or thread-safe - and thus should be used from one thread and non-recursively. It was intended to be a simple synchronization method - for our MemoryMappedFile loading. - */ - class IPCMutex { - struct Implementation; - public: - //! Constructor - /*! - Creates a named binary semaphore, basically a semaphore that is init S <- 1 - \param name The name of this mutex. - */ - IPCMutex(std::string name); - - //! Destructor - ~IPCMutex(); - - //! Lock the mutex - /*! - Same basic function as P(): for(;;) { if(S > 0) { S -= 1; break; } } - */ - bool Lock(); - - //! Unlocks the mutex - /*! - Same basic function as V(): S += 1; - */ - bool Unlock(); - private: - IPCMutex(const IPCMutex&); - const IPCMutex& operator=(const IPCMutex&); - - bool locked_; //!< Whether this mutex is locked or not - Implementation *imp_; - }; + + //! Interprocess Named Binary Semaphore (Mutex) + /*! + Important to note: while this can be used to synchronize processes, it is not in itself re-entrant or thread-safe + and thus should be used from one thread and non-recursively. It was intended to be a simple synchronization method + for our MemoryMappedFile loading. + */ + class IPCMutex { + struct Implementation; + public: + //! Constructor + /*! + Creates a named binary semaphore, basically a semaphore that is init S <- 1 + \param name The name of this mutex. + */ + IPCMutex(std::string name); + + //! Destructor + ~IPCMutex(); + + //! Lock the mutex + /*! + Same basic function as P(): for(;;) { if(S > 0) { S -= 1; break; } } + */ + bool Lock(); + + //! Unlocks the mutex + /*! + Same basic function as V(): S += 1; + */ + bool Unlock(); + private: + IPCMutex(const IPCMutex&); + const IPCMutex& operator=(const IPCMutex&); + + bool locked_; //!< Whether this mutex is locked or not + Implementation *imp_; + }; } #endif diff --git a/common/item_struct.h b/common/item_struct.h index d1dd5b1b0..2c5d95d76 100644 --- a/common/item_struct.h +++ b/common/item_struct.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + 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 -the Free Software Foundation; version 2 of the License. + 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. + 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 04111-1307 USA + 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 04111-1307 USA */ #ifndef ITEM_STRUCT_H @@ -21,25 +21,25 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA /* * Note: (Doodman) - * This structure has field names that match the DB name exactly. - * Please take care as to not mess this up as it should make - * everyones life (i.e. mine) much easier. And the DB names - * match the field name from the 13th floor (SEQ) item collectors, - * so please maintain that as well. + * This structure has field names that match the DB name exactly. + * Please take care as to not mess this up as it should make + * everyones life (i.e. mine) much easier. And the DB names + * match the field name from the 13th floor (SEQ) item collectors, + * so please maintain that as well. * * Note #2: (Doodman) - * UnkXXX fields are left in here for completeness but commented - * out since they are really unknown and since the items are now - * preserialized they should not be needed. Conversly if they - * -are- needed, then they shouldn't be unkown. + * UnkXXX fields are left in here for completeness but commented + * out since they are really unknown and since the items are now + * preserialized they should not be needed. Conversly if they + * -are- needed, then they shouldn't be unkown. * * Note #3: (Doodman) - * Please take care when adding new found data fields to add them - * to the appropriate structure. Item_Struct has elements that are - * global to all types of items only. + * Please take care when adding new found data fields to add them + * to the appropriate structure. Item_Struct has elements that are + * global to all types of items only. * * Note #4: (Doodman) - * Made ya look! Ha! + * Made ya look! Ha! */ #include "eq_constants.h" @@ -93,7 +93,7 @@ struct Item_Struct { bool PendingLoreFlag; bool ArtifactFlag; bool SummonedFlag; - uint8 FVNoDrop; // Firiona Vie nodrop flag + uint8 FVNoDrop; // Firiona Vie nodrop flag uint32 Favor; // Individual favor uint32 GuildFavor; // Guild favor uint32 PointType; @@ -155,8 +155,8 @@ struct Item_Struct { float SellRate; // Sell rate //uint32 Unk059; union { - uint32 Fulfilment; // Food fulfilment (How long it lasts) - int16 CastTime; // Cast Time for clicky effects, in milliseconds + uint32 Fulfilment; // Food fulfilment (How long it lasts) + int16 CastTime; // Cast Time for clicky effects, in milliseconds }; uint32 EliteMaterial; int32 ProcRate; @@ -205,7 +205,7 @@ struct Item_Struct { bool Stackable; bool NoTransfer; bool QuestItemFlag; - int16 StackSize; + int16 StackSize; uint8 PotionBeltSlots; ItemEffect_Struct Click, Proc, Worn, Focus, Scroll, Bard; diff --git a/common/languages.h b/common/languages.h index 39aee2717..a14e78460 100644 --- a/common/languages.h +++ b/common/languages.h @@ -1,52 +1,52 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.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 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. + 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 -*/ + 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 LANGUAGES_H #define LANGUAGES_H #include "../common/types.h" -#define LANG_COMMON_TONGUE 0 -#define LANG_BARBARIAN 1 -#define LANG_ERUDIAN 2 -#define LANG_ELVISH 3 -#define LANG_DARK_ELVISH 4 -#define LANG_DWARVISH 5 -#define LANG_TROLL 6 -#define LANG_OGRE 7 -#define LANG_GNOMISH 8 -#define LANG_HALFLING 9 -#define LANG_THIEVES_CANT 10 -#define LANG_OLD_ERUDIAN 11 -#define LANG_ELDER_ELVISH 12 -#define LANG_FROGLOK 13 -#define LANG_GOBLIN 14 -#define LANG_GNOLL 15 -#define LANG_COMBINE_TONGUE 16 -#define LANG_ELDER_TEIRDAL 17 -#define LANG_LIZARDMAN 18 -#define LANG_ORCISH 19 -#define LANG_FAERIE 20 -#define LANG_DRAGON 21 -#define LANG_ELDER_DRAGON 22 -#define LANG_DARK_SPEECH 23 -#define LANG_VAH_SHIR 24 -#define LANG_ALARAN 25 -#define LANG_HADAL 26 -#define LANG_UNKNOWN 27 +#define LANG_COMMON_TONGUE 0 +#define LANG_BARBARIAN 1 +#define LANG_ERUDIAN 2 +#define LANG_ELVISH 3 +#define LANG_DARK_ELVISH 4 +#define LANG_DWARVISH 5 +#define LANG_TROLL 6 +#define LANG_OGRE 7 +#define LANG_GNOMISH 8 +#define LANG_HALFLING 9 +#define LANG_THIEVES_CANT 10 +#define LANG_OLD_ERUDIAN 11 +#define LANG_ELDER_ELVISH 12 +#define LANG_FROGLOK 13 +#define LANG_GOBLIN 14 +#define LANG_GNOLL 15 +#define LANG_COMBINE_TONGUE 16 +#define LANG_ELDER_TEIRDAL 17 +#define LANG_LIZARDMAN 18 +#define LANG_ORCISH 19 +#define LANG_FAERIE 20 +#define LANG_DRAGON 21 +#define LANG_ELDER_DRAGON 22 +#define LANG_DARK_SPEECH 23 +#define LANG_VAH_SHIR 24 +#define LANG_ALARAN 25 +#define LANG_HADAL 26 +#define LANG_UNKNOWN 27 #endif diff --git a/common/linked_list.h b/common/linked_list.h index 491ec5804..fe8755d40 100644 --- a/common/linked_list.h +++ b/common/linked_list.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 LINKEDLIST_H #define LINKEDLIST_H @@ -24,90 +24,90 @@ enum direction{FORWARD,BACKWARD}; template class LinkedListIterator; -template +template class ListElement { private: - TYPE data; - ListElement* next; - ListElement* prev; + TYPE data; + ListElement* next; + ListElement* prev; public: - ListElement (); - ListElement (const TYPE&); - ListElement (const ListElement&); + ListElement (); + ListElement (const TYPE&); + ListElement (const ListElement&); - ~ListElement (); + ~ListElement (); - ListElement& operator= (const ListElement&); + ListElement& operator= (const ListElement&); - ListElement* GetLast () - { - ListElement* tmp = this; - while (tmp->GetNext()) { - tmp = tmp->GetNext(); + ListElement* GetLast () + { + ListElement* tmp = this; + while (tmp->GetNext()) { + tmp = tmp->GetNext(); + } + return tmp; } - return tmp; - } - ListElement* GetNext () const { return next ; } - ListElement* GetPrev () const { return prev ; } + ListElement* GetNext () const { return next ; } + ListElement* GetPrev () const { return prev ; } - inline TYPE& GetData () { return data ; } - inline const TYPE& GetData () const { return data ; } + inline TYPE& GetData () { return data ; } + inline const TYPE& GetData () const { return data ; } - void SetData ( const TYPE& d ) { data = d ; } // Quagmire - this may look like a mem leak, but dont change it, this behavior is expected where it's called - void SetLastNext ( ListElement* p ) - { - GetLast()->SetNext(p); - } - void SetNext (ListElement* n) { next = n ; } - void SetPrev (ListElement* p) { prev = p ; } + void SetData ( const TYPE& d ) { data = d ; } // Quagmire - this may look like a mem leak, but dont change it, this behavior is expected where it's called + void SetLastNext ( ListElement* p ) + { + GetLast()->SetNext(p); + } + void SetNext (ListElement* n) { next = n ; } + void SetPrev (ListElement* p) { prev = p ; } - void ReplaceData(const TYPE&); + void ReplaceData(const TYPE&); }; -template +template class LinkedList { private: - uint32 count; + uint32 count; ListElement* first; bool list_destructor_invoked; public: - LinkedList(); - ~LinkedList(); - bool dont_delete; - LinkedList& operator= (const LinkedList&); + LinkedList(); + ~LinkedList(); + bool dont_delete; + LinkedList& operator= (const LinkedList&); - void Append (const TYPE&); - void Insert (const TYPE&); - TYPE Pop(); - TYPE PeekTop(); - void Clear(); - void LCount() { count--; } - void ResetCount() { count=0; } - uint32 Count() { return count; } - ListElement* GetFirst() { return first; } + void Append (const TYPE&); + void Insert (const TYPE&); + TYPE Pop(); + TYPE PeekTop(); + void Clear(); + void LCount() { count--; } + void ResetCount() { count=0; } + uint32 Count() { return count; } + ListElement* GetFirst() { return first; } - friend class LinkedListIterator; + friend class LinkedListIterator; }; -template +template class LinkedListIterator { private: - LinkedList& list; - ListElement* current_element; - direction dir; - -public: - LinkedListIterator(LinkedList& l,direction d = FORWARD) : list(l), dir(d) {}; + LinkedList& list; + ListElement* current_element; + direction dir; - void Advance(); - const TYPE& GetData(); - bool IsFirst() +public: + LinkedListIterator(LinkedList& l,direction d = FORWARD) : list(l), dir(d) {}; + + void Advance(); + const TYPE& GetData(); + bool IsFirst() { if (current_element->GetPrev() == 0) return true; @@ -121,13 +121,13 @@ public: else return false; } - bool MoreElements(); - void MoveFirst(); - void MoveLast(); - void RemoveCurrent(bool DeleteData = true); - void Replace(const TYPE& new_data); - void Reset(); - void SetDir(direction); + bool MoreElements(); + void MoveFirst(); + void MoveLast(); + void RemoveCurrent(bool DeleteData = true); + void Replace(const TYPE& new_data); + void Reset(); + void SetDir(direction); }; template @@ -169,110 +169,110 @@ void LinkedListIterator::Advance() template bool LinkedListIterator::MoreElements() { - if (current_element == 0) - return false; - return true; + if (current_element == 0) + return false; + return true; } template const TYPE& LinkedListIterator::GetData() { - return current_element->GetData(); + return current_element->GetData(); } template void LinkedListIterator::MoveFirst() { - ListElement* prev = current_element->GetPrev(); - ListElement* next = current_element->GetNext(); + ListElement* prev = current_element->GetPrev(); + ListElement* next = current_element->GetNext(); - if (prev == 0) + if (prev == 0) { return; } -// if (prev != 0) -// { - prev->SetNext(next); -// } - if (next != 0) - { - next->SetPrev(prev); - } - current_element->SetPrev(0); - current_element->SetNext(list.first); - list.first->SetPrev(current_element); - list.first = current_element; + //if (prev != 0) + //{ + prev->SetNext(next); + //} + if (next != 0) + { + next->SetPrev(prev); + } + current_element->SetPrev(0); + current_element->SetNext(list.first); + list.first->SetPrev(current_element); + list.first = current_element; } template void LinkedListIterator::MoveLast() { - ListElement* prev = current_element->GetPrev(); - ListElement* next = current_element->GetNext(); + ListElement* prev = current_element->GetPrev(); + ListElement* next = current_element->GetNext(); - if (next == 0) + if (next == 0) { return; } - if (prev != 0) - { - prev->SetNext(next); - } + if (prev != 0) + { + prev->SetNext(next); + } else { - list.first = next; + list.first = next; } -// if (next != 0) -// { - next->SetPrev(prev); -// } - current_element->SetNext(0); - current_element->SetPrev(next->GetLast()); - next->GetLast()->SetNext(current_element); + //if (next != 0) + //{ + next->SetPrev(prev); + //} + current_element->SetNext(0); + current_element->SetPrev(next->GetLast()); + next->GetLast()->SetNext(current_element); } template void LinkedListIterator::RemoveCurrent(bool DeleteData) { - ListElement* save; + ListElement* save; - if (list.first == current_element) - { - list.first = current_element->GetNext(); - } + if (list.first == current_element) + { + list.first = current_element->GetNext(); + } - if (current_element->GetPrev() != 0) - { - current_element->GetPrev()->SetNext(current_element->GetNext()); - } - if (current_element->GetNext() != 0) - { - current_element->GetNext()->SetPrev(current_element->GetPrev()); - } - if (dir == FORWARD) - { - save = current_element->GetNext(); - } - else - { - save = current_element->GetPrev(); - } - current_element->SetNext(0); - current_element->SetPrev(0); - if (!DeleteData) - current_element->SetData(0); - safe_delete(current_element); - current_element = save; - list.LCount(); + if (current_element->GetPrev() != 0) + { + current_element->GetPrev()->SetNext(current_element->GetNext()); + } + if (current_element->GetNext() != 0) + { + current_element->GetNext()->SetPrev(current_element->GetPrev()); + } + if (dir == FORWARD) + { + save = current_element->GetNext(); + } + else + { + save = current_element->GetPrev(); + } + current_element->SetNext(0); + current_element->SetPrev(0); + if (!DeleteData) + current_element->SetData(0); + safe_delete(current_element); + current_element = save; + list.LCount(); } template void LinkedListIterator::Replace(const TYPE& new_data) { - current_element->ReplaceData(new_data); + current_element->ReplaceData(new_data); } template @@ -280,10 +280,10 @@ void LinkedListIterator::Reset() { if (!(&list)) { - current_element=0; - return; + current_element=0; + return; } - + if (dir == FORWARD) { current_element = list.first; @@ -323,15 +323,15 @@ void LinkedListIterator::Reset() template void LinkedListIterator::SetDir(direction d) { - dir = d; + dir = d; } template ListElement::ListElement(const TYPE& d) { - data = d; - next = 0; - prev = 0; + data = d; + next = 0; + prev = 0; } template @@ -353,7 +353,7 @@ template void ListElement::ReplaceData(const TYPE& new_data) { if (data != 0) - safe_delete(data); + safe_delete(data); data = new_data; } @@ -388,32 +388,32 @@ void LinkedList::Clear() { template void LinkedList::Append(const TYPE& data) { - ListElement* new_element = new ListElement(data); - - if (first == 0) - { - first = new_element; - } - else - { - new_element->SetPrev(first->GetLast()); - first->SetLastNext(new_element); - } - count++; + ListElement* new_element = new ListElement(data); + + if (first == 0) + { + first = new_element; + } + else + { + new_element->SetPrev(first->GetLast()); + first->SetLastNext(new_element); + } + count++; } template void LinkedList::Insert(const TYPE& data) { - ListElement* new_element = new ListElement(data); + ListElement* new_element = new ListElement(data); - new_element->SetNext(first); - if (first != 0) - { - first->SetPrev(new_element); - } - first = new_element; - count++; + new_element->SetNext(first); + if (first != 0) + { + first->SetPrev(new_element); + } + first = new_element; + count++; } template diff --git a/common/logsys.cpp b/common/logsys.cpp index a7cd2d698..7f04d01b8 100644 --- a/common/logsys.cpp +++ b/common/logsys.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "logsys.h" @@ -33,7 +33,7 @@ const char *log_category_names[NUMBER_OF_LOG_CATEGORIES] = { //this array is private to this file, only a const version of it is exposed #define LOG_TYPE(category, type, enabled) { enabled, LOG_ ##category, #category "__" #type }, -static LogTypeStatus real_log_type_info[NUMBER_OF_LOG_TYPES+1] = +static LogTypeStatus real_log_type_info[NUMBER_OF_LOG_TYPES+1] = { #include "logtypes.h" { false, NUMBER_OF_LOG_CATEGORIES, "BAD TYPE" } /* dummy trailing record */ @@ -97,25 +97,25 @@ bool load_log_settings(const char *filename) { #ifdef _WINDOWS if (sscanf(linebuf, "%[^=]=%[^\n]\n", type_name, value) != 2) continue; -#else +#else if (sscanf(linebuf, "%[^=]=%[^\r\n]\n", type_name, value) != 2) continue; #endif - + if(type_name[0] == '\0' || type_name[0] == '#') continue; - + //first make sure we understand the value bool enabled; if(!strcasecmp(value, "on") || !strcasecmp(value, "true") || !strcasecmp(value, "yes") || !strcasecmp(value, "enabled") || !strcmp(value, "1")) enabled = true; - else if(!strcasecmp(value, "off") || !strcasecmp(value, "false") || !strcasecmp(value, "no") || !strcasecmp(value, "disabled") || !strcmp(value, "0")) + else if(!strcasecmp(value, "off") || !strcasecmp(value, "false") || !strcasecmp(value, "no") || !strcasecmp(value, "disabled") || !strcmp(value, "0")) enabled = false; else { printf("Unable to parse value '%s' from %s. Skipping line.", value, filename); continue; } - + int r; //first see if it is a category name for(r = 0; r < NUMBER_OF_LOG_CATEGORIES; r++) { @@ -135,7 +135,7 @@ bool load_log_settings(const char *filename) { } continue; } - + for(r = 0; r < NUMBER_OF_LOG_TYPES; r++) { if(!strcasecmp(log_type_info[r].name, type_name)) break; @@ -144,7 +144,7 @@ bool load_log_settings(const char *filename) { printf("Unable to locate log type %s from file %s. Skipping line.", type_name, filename); continue; } - + //got it all figured out, do something now... if(enabled) log_enable(LogType(r)); @@ -155,6 +155,3 @@ bool load_log_settings(const char *filename) { return(true); } - - - diff --git a/common/logsys.h b/common/logsys.h index a8c27fdf9..3f9da4111 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -1,46 +1,40 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 LOGSYS_H_ #define LOGSYS_H_ /* - * - * Usage: - * - * These are the main functions provided by logsys: - * - _log(TYPE, fmt, ...) - Log a message in any context - * - mlog(TYPE, fmt, ...) - Zone only. Log a message from a Mob:: context, prefixing it with the mob's name. - * - clog(TYPE, fmt, ...) - World only. Log a message from a Client:: context, prefixing it with the client's account name. - * - zlog(TYPE, fmt, ...) - World only. Log a message from a ZoneServer:: context, prefixing it with the zones id/name or ip/port. - * - _hex(TYPE, data, length) - Log hex dump in any context. - * - mhex(TYPE, data, length) - Zone only. Log a hex dump from a Mob:: context, prefixing it with the mob's name - * - _pkt(TYPE, BasePacket *) - Log a packet hex dump with header in any context. - * - mhex(TYPE, data, length) - Zone only. Log a packet hex dump from a Mob:: context, prefixing it with the mob's name - * Types are defined in logtypes.h - * - * - * - * - * this is very C-ish, not C++ish, but thats how I felt like writting it - * - * - * - */ +* +* Usage: +* +* These are the main functions provided by logsys: +* - _log(TYPE, fmt, ...) - Log a message in any context +* - mlog(TYPE, fmt, ...) - Zone only. Log a message from a Mob:: context, prefixing it with the mob's name. +* - clog(TYPE, fmt, ...) - World only. Log a message from a Client:: context, prefixing it with the client's account name. +* - zlog(TYPE, fmt, ...) - World only. Log a message from a ZoneServer:: context, prefixing it with the zones id/name or ip/port. +* - _hex(TYPE, data, length) - Log hex dump in any context. +* - mhex(TYPE, data, length) - Zone only. Log a hex dump from a Mob:: context, prefixing it with the mob's name +* - _pkt(TYPE, BasePacket *) - Log a packet hex dump with header in any context. +* - mhex(TYPE, data, length) - Zone only. Log a packet hex dump from a Mob:: context, prefixing it with the mob's name +* Types are defined in logtypes.h +* +* this is very C-ish, not C++ish, but thats how I felt like writting it +*/ #include #include "types.h" @@ -175,13 +169,5 @@ extern void log_toggle(LogType t); extern bool load_log_settings(const char *filename); - - - #endif /*LOGSYS_H_*/ - - - - - diff --git a/common/logsys_eqemu.cpp b/common/logsys_eqemu.cpp index 56f4f2c5b..79ea82ec0 100644 --- a/common/logsys_eqemu.cpp +++ b/common/logsys_eqemu.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" @@ -33,11 +33,7 @@ void log_messageVA(LogType type, const char *fmt, va_list args) { char prefix_buffer[256]; snprintf(prefix_buffer, 255, "[%s] ", log_type_info[type].name); prefix_buffer[255] = '\0'; - + LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args); } - - - - diff --git a/common/logtypes.h b/common/logtypes.h index 156b22f18..cadfbf71a 100644 --- a/common/logtypes.h +++ b/common/logtypes.h @@ -1,23 +1,21 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 LOG_CATEGORY #define LOG_CATEGORY(name) #endif @@ -32,8 +30,6 @@ #endif - - LOG_CATEGORY( CHAT ) LOG_TYPE( CHAT, SAY, DISABLED ) LOG_TYPE( CHAT, EMOTE, DISABLED ) @@ -189,10 +185,10 @@ LOG_TYPE( CLIENT, NET_IN_TRACE, DISABLED ) LOG_TYPE( CLIENT, EXP, DISABLED ) LOG_CATEGORY( SKILLS ) -LOG_TYPE( SKILLS, GAIN, DISABLED ) +LOG_TYPE( SKILLS, GAIN, DISABLED ) LOG_CATEGORY( RULES ) -LOG_TYPE( RULES, ERROR, DISABLED ) +LOG_TYPE( RULES, ERROR, DISABLED ) LOG_TYPE( RULES, CHANGE, DISABLED ) LOG_CATEGORY( NET ) @@ -260,6 +256,3 @@ LOG_TYPE( WORLD, LAUNCH_TRACE, ENABLED ) #undef LOG_TYPE #undef LOG_CATEGORY - - - diff --git a/common/loottable.h b/common/loottable.h index 051c6c792..8ad2f1e72 100644 --- a/common/loottable.h +++ b/common/loottable.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 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 + 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. + 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 + 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_LOOTTABLE_H @@ -26,7 +26,7 @@ struct LootTableEntries_Struct { uint8 droplimit; uint8 mindrop; uint8 multiplier; - float probability; + float probability; }; struct LootTable_Struct { diff --git a/common/md5.cpp b/common/md5.cpp index f44b590bb..2933a2388 100644 --- a/common/md5.cpp +++ b/common/md5.cpp @@ -1,7 +1,7 @@ /* md5.c -- An implementation of Ron Rivest's MD5 message-digest algorithm. * Written by Colin Plumb in 1993, no copyright is claimed. This code is in the * public domain; do with it what you wish. Equivalent code is available from -* RSA Data Security, Inc. This code does not oblige you to include legal +* RSA Data Security, Inc. This code does not oblige you to include legal * boilerplate in the documentation. To compute the message digest of a string * of bytes, declare an MD5Context structure, pass it to MD5Init, call * MD5Update as needed on buffers full of bytes, and then call MD5Final, which @@ -61,7 +61,7 @@ MD5::operator const char* () { snprintf(pMD5String, sizeof(pMD5String), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", pMD5[0], pMD5[1], pMD5[2], pMD5[3], pMD5[4], pMD5[5], pMD5[6], pMD5[7], pMD5[8], pMD5[9], pMD5[10], pMD5[11], pMD5[12], pMD5[13], pMD5[14], pMD5[15]); return pMD5String; } - + bool MD5::operator== (const MD5& iMD5) { if (memcmp(pMD5, iMD5.pMD5, 16) == 0) return true; @@ -99,12 +99,12 @@ MD5* MD5::operator= (const MD5* iMD5) { /* Byte-swap an array of words to little-endian. (Byte-sex independent) */ void MD5::byteSwap(uint32 *buf, uint32 words) { - uint8 *p = (uint8 *)buf; - do { - *buf++ = (uint32)((uint32)p[3]<<8 | p[2]) << 16 | - ((uint32)p[1]<<8 | p[0]); - p += 4; - } while (--words); + uint8 *p = (uint8 *)buf; + do { + *buf++ = (uint32)((uint32)p[3]<<8 | p[2]) << 16 | + ((uint32)p[1]<<8 | p[0]); + p += 4; + } while (--words); } void MD5::Generate(const uint8* buf, uint32 len, uint8 digest[16]) { @@ -116,70 +116,70 @@ void MD5::Generate(const uint8* buf, uint32 len, uint8 digest[16]) { /* Start MD5 accumulation. */ void MD5::Init(struct MD5Context *ctx) { - ctx->hash[0] = 0x67452301; - ctx->hash[1] = 0xefcdab89; - ctx->hash[2] = 0x98badcfe; - ctx->hash[3] = 0x10325476; - ctx->bytes[1] = ctx->bytes[0] = 0; + ctx->hash[0] = 0x67452301; + ctx->hash[1] = 0xefcdab89; + ctx->hash[2] = 0x98badcfe; + ctx->hash[3] = 0x10325476; + ctx->bytes[1] = ctx->bytes[0] = 0; } /* Update ctx to reflect the addition of another buffer full of bytes. */ void MD5::Update(struct MD5Context *ctx, uint8 const *buf, uint32 len) { - uint32 t = ctx->bytes[0]; - if ((ctx->bytes[0] = t + len) < t) /* Update 64-bit byte count */ - ctx->bytes[1]++; /* Carry from low to high */ + uint32 t = ctx->bytes[0]; + if ((ctx->bytes[0] = t + len) < t) /* Update 64-bit byte count */ + ctx->bytes[1]++; /* Carry from low to high */ - t = 64 - (t & 0x3f); /* Bytes available in ctx->input (>= 1) */ - if (t > len) { - memcpy((uint8*)ctx->input+64-t, buf, len); - return; - } - /* First chunk is an odd size */ - memcpy((uint8*)ctx->input+64-t, buf, t); - byteSwap(ctx->input, 16); - Transform(ctx->hash, ctx->input); - buf += t; - len -= t; - /* Process data in 64-byte chunks */ - while (len >= 64) { - memcpy(ctx->input, buf, 64); - byteSwap(ctx->input, 16); - Transform(ctx->hash, ctx->input); - buf += 64; - len -= 64; - } - /* Buffer any remaining bytes of data */ - memcpy(ctx->input, buf, len); + t = 64 - (t & 0x3f); /* Bytes available in ctx->input (>= 1) */ + if (t > len) { + memcpy((uint8*)ctx->input+64-t, buf, len); + return; + } + /* First chunk is an odd size */ + memcpy((uint8*)ctx->input+64-t, buf, t); + byteSwap(ctx->input, 16); + Transform(ctx->hash, ctx->input); + buf += t; + len -= t; + /* Process data in 64-byte chunks */ + while (len >= 64) { + memcpy(ctx->input, buf, 64); + byteSwap(ctx->input, 16); + Transform(ctx->hash, ctx->input); + buf += 64; + len -= 64; + } + /* Buffer any remaining bytes of data */ + memcpy(ctx->input, buf, len); } /* Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, LSB-first) */ void MD5::Final(uint8 digest[16], MD5Context *ctx) { - int count = ctx->bytes[0] & 0x3F; /* Bytes mod 64 */ - uint8 *p = (uint8*)ctx->input + count; - /* Set the first byte of padding to 0x80. There is always room. */ - *p++ = 0x80; - /* Bytes of zero padding needed to make 56 bytes (-8..55) */ - count = 56 - 1 - count; - if (count < 0) { /* Padding forces an extra block */ - memset(p, 0, count+8); - byteSwap(ctx->input, 16); - Transform(ctx->hash, ctx->input); - p = (uint8*)ctx->input; - count = 56; - } - memset(p, 0, count); - byteSwap(ctx->input, 14); - /* Append 8 bytes of length in *bits* and transform */ - ctx->input[14] = ctx->bytes[0] << 3; + int count = ctx->bytes[0] & 0x3F; /* Bytes mod 64 */ + uint8 *p = (uint8*)ctx->input + count; + /* Set the first byte of padding to 0x80. There is always room. */ + *p++ = 0x80; + /* Bytes of zero padding needed to make 56 bytes (-8..55) */ + count = 56 - 1 - count; + if (count < 0) { /* Padding forces an extra block */ + memset(p, 0, count+8); + byteSwap(ctx->input, 16); + Transform(ctx->hash, ctx->input); + p = (uint8*)ctx->input; + count = 56; + } + memset(p, 0, count); + byteSwap(ctx->input, 14); + /* Append 8 bytes of length in *bits* and transform */ + ctx->input[14] = ctx->bytes[0] << 3; - ctx->input[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; - Transform(ctx->hash, ctx->input); - byteSwap(ctx->hash, 4); - memcpy(digest, ctx->hash, 16); - memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ + ctx->input[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; + Transform(ctx->hash, ctx->input); + byteSwap(ctx->hash, 4); + memcpy(digest, ctx->hash, 16); + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* The four core functions */ @@ -194,78 +194,82 @@ void MD5::Final(uint8 digest[16], MD5Context *ctx) { /* The heart of the MD5 algorithm. */ void MD5::Transform(uint32 hash[4], const uint32 input[16]) { - register uint32 a = hash[0], b = hash[1], c = hash[2], d = hash[3]; + register uint32 a = hash[0], b = hash[1], c = hash[2], d = hash[3]; - MD5STEP(F1, a, b, c, d, input[ 0]+0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, input[ 1]+0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, input[ 2]+0x242070db, 17); - MD5STEP(F1, b, c, d, a, input[ 3]+0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, input[ 4]+0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, input[ 5]+0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, input[ 6]+0xa8304613, 17); - MD5STEP(F1, b, c, d, a, input[ 7]+0xfd469501, 22); - MD5STEP(F1, a, b, c, d, input[ 8]+0x698098d8, 7); - MD5STEP(F1, d, a, b, c, input[ 9]+0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, input[10]+0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, input[11]+0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, input[12]+0x6b901122, 7); - MD5STEP(F1, d, a, b, c, input[13]+0xfd987193, 12); - MD5STEP(F1, c, d, a, b, input[14]+0xa679438e, 17); - MD5STEP(F1, b, c, d, a, input[15]+0x49b40821, 22); + MD5STEP(F1, a, b, c, d, input[ 0]+0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, input[ 1]+0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, input[ 2]+0x242070db, 17); + MD5STEP(F1, b, c, d, a, input[ 3]+0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, input[ 4]+0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, input[ 5]+0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, input[ 6]+0xa8304613, 17); + MD5STEP(F1, b, c, d, a, input[ 7]+0xfd469501, 22); + MD5STEP(F1, a, b, c, d, input[ 8]+0x698098d8, 7); + MD5STEP(F1, d, a, b, c, input[ 9]+0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, input[10]+0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, input[11]+0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, input[12]+0x6b901122, 7); + MD5STEP(F1, d, a, b, c, input[13]+0xfd987193, 12); + MD5STEP(F1, c, d, a, b, input[14]+0xa679438e, 17); + MD5STEP(F1, b, c, d, a, input[15]+0x49b40821, 22); - MD5STEP(F2, a, b, c, d, input[ 1]+0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, input[ 6]+0xc040b340, 9); - MD5STEP(F2, c, d, a, b, input[11]+0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, input[ 0]+0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, input[ 5]+0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, input[10]+0x02441453, 9); - MD5STEP(F2, c, d, a, b, input[15]+0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, input[ 4]+0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, input[ 9]+0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, input[14]+0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, input[ 3]+0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, input[ 8]+0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, input[13]+0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, input[ 2]+0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, input[ 7]+0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, input[12]+0x8d2a4c8a, 20); + MD5STEP(F2, a, b, c, d, input[ 1]+0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, input[ 6]+0xc040b340, 9); + MD5STEP(F2, c, d, a, b, input[11]+0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, input[ 0]+0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, input[ 5]+0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, input[10]+0x02441453, 9); + MD5STEP(F2, c, d, a, b, input[15]+0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, input[ 4]+0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, input[ 9]+0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, input[14]+0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, input[ 3]+0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, input[ 8]+0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, input[13]+0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, input[ 2]+0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, input[ 7]+0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, input[12]+0x8d2a4c8a, 20); - MD5STEP(F3, a, b, c, d, input[ 5]+0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, input[ 8]+0x8771f681, 11); - MD5STEP(F3, c, d, a, b, input[11]+0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, input[14]+0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, input[ 1]+0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, input[ 4]+0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, input[ 7]+0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, input[10]+0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, input[13]+0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, input[ 0]+0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, input[ 3]+0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, input[ 6]+0x04881d05, 23); - MD5STEP(F3, a, b, c, d, input[ 9]+0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, input[12]+0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, input[15]+0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, input[ 2]+0xc4ac5665, 23); + MD5STEP(F3, a, b, c, d, input[ 5]+0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, input[ 8]+0x8771f681, 11); + MD5STEP(F3, c, d, a, b, input[11]+0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, input[14]+0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, input[ 1]+0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, input[ 4]+0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, input[ 7]+0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, input[10]+0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, input[13]+0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, input[ 0]+0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, input[ 3]+0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, input[ 6]+0x04881d05, 23); + MD5STEP(F3, a, b, c, d, input[ 9]+0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, input[12]+0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, input[15]+0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, input[ 2]+0xc4ac5665, 23); - MD5STEP(F4, a, b, c, d, input[ 0]+0xf4292244, 6); - MD5STEP(F4, d, a, b, c, input[ 7]+0x432aff97, 10); - MD5STEP(F4, c, d, a, b, input[14]+0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, input[ 5]+0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, input[12]+0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, input[ 3]+0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, input[10]+0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, input[ 1]+0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, input[ 8]+0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, input[15]+0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, input[ 6]+0xa3014314, 15); - MD5STEP(F4, b, c, d, a, input[13]+0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, input[ 4]+0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, input[11]+0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, input[ 2]+0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, input[ 9]+0xeb86d391, 21); + MD5STEP(F4, a, b, c, d, input[ 0]+0xf4292244, 6); + MD5STEP(F4, d, a, b, c, input[ 7]+0x432aff97, 10); + MD5STEP(F4, c, d, a, b, input[14]+0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, input[ 5]+0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, input[12]+0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, input[ 3]+0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, input[10]+0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, input[ 1]+0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, input[ 8]+0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, input[15]+0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, input[ 6]+0xa3014314, 15); + MD5STEP(F4, b, c, d, a, input[13]+0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, input[ 4]+0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, input[11]+0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, input[ 2]+0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, input[ 9]+0xeb86d391, 21); + + hash[0] += a; + hash[1] += b; + hash[2] += c; + hash[3] += d; +} - hash[0] += a; hash[1] += b; hash[2] += c; hash[3] += d; -} diff --git a/common/md5.h b/common/md5.h index 958443c96..13dfd5f9e 100644 --- a/common/md5.h +++ b/common/md5.h @@ -11,7 +11,7 @@ public: uint32 input[16]; }; static void Generate(const uint8* buf, uint32 len, uint8 digest[16]); - + static void Init(struct MD5Context *context); static void Update(struct MD5Context *context, const uint8 *buf, uint32 len); static void Final(uint8 digest[16], struct MD5Context *context); @@ -21,7 +21,7 @@ public: MD5(const char* buf, uint32 len); MD5(const uint8 buf[16]); MD5(const char* iMD5String); - + void Generate(const char* iString); void Generate(const uint8* buf, uint32 len); bool Set(const uint8 buf[16]); diff --git a/common/memory_mapped_file.cpp b/common/memory_mapped_file.cpp index ca2ae0c6d..b8b5e2a4b 100644 --- a/common/memory_mapped_file.cpp +++ b/common/memory_mapped_file.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 "memory_mapped_file.h" @@ -29,163 +29,166 @@ #include #endif #include "eqemu_exception.h" +#ifdef FREEBSD +#include +#endif namespace EQEmu { - struct MemoryMappedFile::Implementation { + struct MemoryMappedFile::Implementation { #ifdef _WINDOWS - HANDLE mapped_object_; + HANDLE mapped_object_; #else - int fd_; + int fd_; #endif - }; + }; - MemoryMappedFile::MemoryMappedFile(std::string filename, uint32 size) - : filename_(filename), size_(size) { - imp_ = new Implementation; - -#ifdef _WINDOWS - DWORD total_size = size + sizeof(shared_memory_struct); - HANDLE file = CreateFile(filename.c_str(), - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - nullptr, - OPEN_ALWAYS, - 0, - nullptr); - - if(file == INVALID_HANDLE_VALUE) { - EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); - } - - imp_->mapped_object_ = CreateFileMapping(file, - nullptr, - PAGE_READWRITE, - 0, - total_size, - filename.c_str()); - - if(!imp_->mapped_object_) { - EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); - } - - memory_ = reinterpret_cast(MapViewOfFile(imp_->mapped_object_, - FILE_MAP_ALL_ACCESS, - 0, - 0, - total_size)); - - if(!memory_) { - EQ_EXCEPT("Shared Memory", "Could not map a view of the shared memory file."); - } - -#else - size_t total_size = size + sizeof(shared_memory_struct); - imp_->fd_ = open(filename.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if(imp_->fd_ == -1) { - EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); - } - - if(ftruncate(imp_->fd_, total_size) == -1) { - EQ_EXCEPT("Shared Memory", "Could not set file size for this shared memory segment."); - } - - memory_ = reinterpret_cast( - mmap(nullptr, total_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, imp_->fd_, 0)); - - if(memory_ == MAP_FAILED) { - EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); - } -#endif - } - - MemoryMappedFile::MemoryMappedFile(std::string filename) - : filename_(filename) { - imp_ = new Implementation; - - //get existing size - FILE *f = fopen(filename.c_str(), "rb"); - if(!f) { - EQ_EXCEPT("Shared Memory", "Could not open the file to find the existing file size."); - } - fseek(f, 0U, SEEK_END); - uint32 size = static_cast(ftell(f)) - sizeof(shared_memory_struct); - size_ = size; - fclose(f); + MemoryMappedFile::MemoryMappedFile(std::string filename, uint32 size) + : filename_(filename), size_(size) { + imp_ = new Implementation; #ifdef _WINDOWS - DWORD total_size = size + sizeof(shared_memory_struct); - HANDLE file = CreateFile(filename.c_str(), - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - nullptr, - OPEN_ALWAYS, - 0, - nullptr); - - if(file == INVALID_HANDLE_VALUE) { - EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); - } - - imp_->mapped_object_ = CreateFileMapping(file, - nullptr, - PAGE_READWRITE, - 0, - total_size, - filename.c_str()); - - if(!imp_->mapped_object_) { - EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); - } - - memory_ = reinterpret_cast(MapViewOfFile(imp_->mapped_object_, - FILE_MAP_ALL_ACCESS, - 0, - 0, - total_size)); - - if(!memory_) { - EQ_EXCEPT("Shared Memory", "Could not map a view of the shared memory file."); - } - + DWORD total_size = size + sizeof(shared_memory_struct); + HANDLE file = CreateFile(filename.c_str(), + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + nullptr, + OPEN_ALWAYS, + 0, + nullptr); + + if(file == INVALID_HANDLE_VALUE) { + EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); + } + + imp_->mapped_object_ = CreateFileMapping(file, + nullptr, + PAGE_READWRITE, + 0, + total_size, + filename.c_str()); + + if(!imp_->mapped_object_) { + EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); + } + + memory_ = reinterpret_cast(MapViewOfFile(imp_->mapped_object_, + FILE_MAP_ALL_ACCESS, + 0, + 0, + total_size)); + + if(!memory_) { + EQ_EXCEPT("Shared Memory", "Could not map a view of the shared memory file."); + } + #else - size_t total_size = size + sizeof(shared_memory_struct); - imp_->fd_ = open(filename.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if(imp_->fd_ == -1) { - EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); - } + size_t total_size = size + sizeof(shared_memory_struct); + imp_->fd_ = open(filename.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); + if(imp_->fd_ == -1) { + EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); + } - if(ftruncate(imp_->fd_, total_size) == -1) { - EQ_EXCEPT("Shared Memory", "Could not set file size for this shared memory segment."); - } + if(ftruncate(imp_->fd_, total_size) == -1) { + EQ_EXCEPT("Shared Memory", "Could not set file size for this shared memory segment."); + } - memory_ = reinterpret_cast( - mmap(nullptr, total_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, imp_->fd_, 0)); + memory_ = reinterpret_cast( + mmap(nullptr, total_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, imp_->fd_, 0)); - if(memory_ == MAP_FAILED) { - EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); - } + if(memory_ == MAP_FAILED) { + EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); + } #endif - } + } + + MemoryMappedFile::MemoryMappedFile(std::string filename) + : filename_(filename) { + imp_ = new Implementation; + + //get existing size + FILE *f = fopen(filename.c_str(), "rb"); + if(!f) { + EQ_EXCEPT("Shared Memory", "Could not open the file to find the existing file size."); + } + fseek(f, 0U, SEEK_END); + uint32 size = static_cast(ftell(f)) - sizeof(shared_memory_struct); + size_ = size; + fclose(f); - MemoryMappedFile::~MemoryMappedFile() { #ifdef _WINDOWS - if(imp_->mapped_object_) { - CloseHandle(imp_->mapped_object_); - } + DWORD total_size = size + sizeof(shared_memory_struct); + HANDLE file = CreateFile(filename.c_str(), + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + nullptr, + OPEN_ALWAYS, + 0, + nullptr); + + if(file == INVALID_HANDLE_VALUE) { + EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); + } + + imp_->mapped_object_ = CreateFileMapping(file, + nullptr, + PAGE_READWRITE, + 0, + total_size, + filename.c_str()); + + if(!imp_->mapped_object_) { + EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); + } + + memory_ = reinterpret_cast(MapViewOfFile(imp_->mapped_object_, + FILE_MAP_ALL_ACCESS, + 0, + 0, + total_size)); + + if(!memory_) { + EQ_EXCEPT("Shared Memory", "Could not map a view of the shared memory file."); + } + #else - if(memory_) { - size_t total_size = size_ + sizeof(shared_memory_struct); - munmap(reinterpret_cast(memory_), total_size); - close(imp_->fd_); - } + size_t total_size = size + sizeof(shared_memory_struct); + imp_->fd_ = open(filename.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); + if(imp_->fd_ == -1) { + EQ_EXCEPT("Shared Memory", "Could not open a file for this shared memory segment."); + } + + if(ftruncate(imp_->fd_, total_size) == -1) { + EQ_EXCEPT("Shared Memory", "Could not set file size for this shared memory segment."); + } + + memory_ = reinterpret_cast( + mmap(nullptr, total_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, imp_->fd_, 0)); + + if(memory_ == MAP_FAILED) { + EQ_EXCEPT("Shared Memory", "Could not create a file mapping for this shared memory file."); + } #endif - delete imp_; - } - - void MemoryMappedFile::ZeroFile() { - memset(reinterpret_cast(memory_), 0, sizeof(shared_memory_struct)); - memset(memory_->data, 0, size_); - memory_->size = size_; - } + } + + MemoryMappedFile::~MemoryMappedFile() { +#ifdef _WINDOWS + if(imp_->mapped_object_) { + CloseHandle(imp_->mapped_object_); + } +#else + if(memory_) { + size_t total_size = size_ + sizeof(shared_memory_struct); + munmap(reinterpret_cast(memory_), total_size); + close(imp_->fd_); + } +#endif + delete imp_; + } + + void MemoryMappedFile::ZeroFile() { + memset(reinterpret_cast(memory_), 0, sizeof(shared_memory_struct)); + memset(memory_->data, 0, size_); + memory_->size = size_; + } } // EQEmu diff --git a/common/memory_mapped_file.h b/common/memory_mapped_file.h index e4de4c728..cc4ed700d 100644 --- a/common/memory_mapped_file.h +++ b/common/memory_mapped_file.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_MEMORYMAPPEDFILE_H_ @@ -24,63 +24,63 @@ namespace EQEmu { - //! Memory Backed Shared Memory - /*! - Allows us to create shared memory that is backed by a file on both windows and unix platforms that - works in a consistent manner. Non-copyable. - */ - class MemoryMappedFile { - struct Implementation; - struct shared_memory_struct; + //! Memory Backed Shared Memory + /*! + Allows us to create shared memory that is backed by a file on both windows and unix platforms that + works in a consistent manner. Non-copyable. + */ + class MemoryMappedFile { + struct Implementation; + struct shared_memory_struct; - //! Underlying data structure. - struct shared_memory_struct { - uint32 size; - unsigned char data[1]; - }; - public: - //! Constructor - /*! - Creates a mmf for the given filename and of size. - \param filename Actual filename of the mmf. - \param size Size in bytes of the mmf. - */ - MemoryMappedFile(std::string filename, uint32 size); - - //! Constructor - /*! - Creates a mmf for the given filename and gets the size based on the existing size. - \param filename Actual filename of the mmf. - */ - MemoryMappedFile(std::string filename); + //! Underlying data structure. + struct shared_memory_struct { + uint32 size; + unsigned char data[1]; + }; + public: + //! Constructor + /*! + Creates a mmf for the given filename and of size. + \param filename Actual filename of the mmf. + \param size Size in bytes of the mmf. + */ + MemoryMappedFile(std::string filename, uint32 size); - //! Destructor - ~MemoryMappedFile(); + //! Constructor + /*! + Creates a mmf for the given filename and gets the size based on the existing size. + \param filename Actual filename of the mmf. + */ + MemoryMappedFile(std::string filename); - //! Get Data Operator - inline void *operator->() const { return memory_->data; } - - //! Get Data Function - inline void *Get() const { return memory_->data; } - - //! Get Size Function - inline uint32 Size() const { return memory_->size; } - - //! Zeros all the memory in the file, and set it to be unloaded - void ZeroFile(); - private: - //! Copy Constructor - MemoryMappedFile(const MemoryMappedFile&); - - //! Assignment Operator - const MemoryMappedFile& operator=(const MemoryMappedFile&); + //! Destructor + ~MemoryMappedFile(); - std::string filename_; //!< Filename of this shared memory object - uint32 size_; //!< Size in bytes of this shared memory object - shared_memory_struct *memory_; //!< Underlying data of the shared memory object. + //! Get Data Operator + inline void *operator->() const { return memory_->data; } - Implementation *imp_; //!< Underlying implementation. - }; + //! Get Data Function + inline void *Get() const { return memory_->data; } + + //! Get Size Function + inline uint32 Size() const { return memory_->size; } + + //! Zeros all the memory in the file, and set it to be unloaded + void ZeroFile(); + private: + //! Copy Constructor + MemoryMappedFile(const MemoryMappedFile&); + + //! Assignment Operator + const MemoryMappedFile& operator=(const MemoryMappedFile&); + + std::string filename_; //!< Filename of this shared memory object + uint32 size_; //!< Size in bytes of this shared memory object + shared_memory_struct *memory_; //!< Underlying data of the shared memory object. + + Implementation *imp_; //!< Underlying implementation. + }; } // EQEmu #endif diff --git a/common/misc.cpp b/common/misc.cpp index 1bcfd90c9..0928113e0 100644 --- a/common/misc.cpp +++ b/common/misc.cpp @@ -36,20 +36,20 @@ int print_stacktrace() #include int print_stacktrace() { - void *ba[20]; - int n = backtrace (ba, 20); - if (n != 0) - { - char **names = backtrace_symbols (ba, n); - if (names != nullptr) - { - int i; - cerr << "called from " << (char*)names[0] << endl; - for (i = 1; i < n; ++i) - cerr << " " << (char*)names[i] << endl; - free (names); - } - } + void *ba[20]; + int n = backtrace (ba, 20); + if (n != 0) + { + char **names = backtrace_symbols (ba, n); + if (names != nullptr) + { + int i; + cerr << "called from " << (char*)names[0] << endl; + for (i = 1; i < n; ++i) + cerr << " " << (char*)names[i] << endl; + free (names); + } + } return(0); } #endif //!FREEBSD @@ -387,9 +387,9 @@ void encode_chunk(char *in, int len, char *out) void decode_chunk(char *in, char *out) { - *out = DEC(*in) << 2 | DEC(in[1]) >> 4; - *(out+1) = DEC(in[1]) << 4 | DEC(in[2]) >> 2; - *(out+2) = DEC(in[2]) << 6 | DEC(in[3]); + *out = DEC(*in) << 2 | DEC(in[1]) >> 4; + *(out+1) = DEC(in[1]) << 4 | DEC(in[2]) >> 2; + *(out+2) = DEC(in[2]) << 6 | DEC(in[3]); } void dump_message_column(unsigned char *buffer, unsigned long length, string leader, FILE *to) diff --git a/common/misc.h b/common/misc.h index dffd2814e..41cfaec4c 100644 --- a/common/misc.h +++ b/common/misc.h @@ -21,7 +21,7 @@ void LoadItemDBFieldNames(); void encode_length(unsigned long length, char *out); unsigned long decode_length(char *in); -unsigned long encode(char *in, unsigned long length, char *out); +unsigned long encode(char *in, unsigned long length, char *out); void decode(char *in, char *out); void encode_chunk(char *in, int len, char *out); void decode_chunk(char *in, char *out); @@ -41,3 +41,4 @@ void build_hex_line(const char *buffer, unsigned long length, unsigned long offs void print_hex(const char *buffer, unsigned long length); #endif + diff --git a/common/moremath.cpp b/common/moremath.cpp index a3140a2a8..84f0b8900 100644 --- a/common/moremath.cpp +++ b/common/moremath.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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/debug.h" diff --git a/common/moremath.h b/common/moremath.h index 1f64d0462..d000a54b8 100644 --- a/common/moremath.h +++ b/common/moremath.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 MOREMATH_H #define MOREMATH_H diff --git a/common/opcode_dispatch.h b/common/opcode_dispatch.h index a57408b66..352fc62ef 100644 --- a/common/opcode_dispatch.h +++ b/common/opcode_dispatch.h @@ -16,7 +16,7 @@ There are currently eight (times two) dispatch modes possible, the different modes for a given state differ only in the arguments which are passed to the dispatch function. -The variable length versions ensure that the packet is +The variable length versions ensure that the packet is AT LEAST as long as the supplied structure. The variable length versions should only be used when the packet @@ -76,7 +76,7 @@ IN_Cz(OP_ReqNewZone); IN_Cz(OP_SendExpZonein); //IN_Cr(OP_ZoneComplete); -//these three should stay raw, since we ignore their contents and +//these three should stay raw, since we ignore their contents and //they overlap with the connected opcodes IN_Cr(OP_SpawnAppearance); IN_Cr(OP_WearChange); @@ -477,14 +477,14 @@ OUT(OP_ZoneEntry, ServerZoneEntry_Struct); void Handle_##op (); #define INr(op) \ void Handle_##op (const EQApplicationPacket *app); -#define OUT_C(op, s) -#define OUT_Cv(op, s) -#define OUT_Cz(op) -#define OUT_Cr(op) -#define OUT(op, s) -#define OUTv(op, s) -#define OUTz(op) -#define OUTr(op) +#define OUT_C(op, s) +#define OUT_Cv(op, s) +#define OUT_Cz(op) +#define OUT_Cr(op) +#define OUT(op, s) +#define OUTv(op, s) +#define OUTz(op) +#define OUTr(op) #include "opcode_dispatch.h" #undef IN_C #undef IN_Cr @@ -514,7 +514,7 @@ public: RawOpcodeDispatcher(proc p) { d = p; } - + virtual void dispatch(Client *on, const EQApplicationPacket *app) { (on->*d)(app); } @@ -528,7 +528,7 @@ public: ZeroOpcodeDispatcher(proc p) { d = p; } - + virtual void dispatch(Client *on, const EQApplicationPacket *app) { if(app->size != 0) { //error.. @@ -548,7 +548,7 @@ public: d = p; struct_name = sn; } - + virtual void dispatch(Client *on, const EQApplicationPacket *app) { if(app->size != sizeof(T)) { //error.. @@ -557,7 +557,7 @@ public: T * tmp = (T *) app->pBuffer; (on->*d)(tmp); } - + protected: proc d; const char *struct_name; @@ -571,7 +571,7 @@ public: d = p; struct_name = sn; } - + virtual void dispatch(Client *on, const EQApplicationPacket *app) { if(app->size < sizeof(T)) { //error.. @@ -580,13 +580,13 @@ public: T * tmp = (T *) app->pBuffer; (on->*d)(tmp, app->size); } - + protected: proc d; const char *struct_name; }; - + //... client_packet.cpp void MapOpcodes() { @@ -607,14 +607,14 @@ void MapOpcodes() { ConnectedOpcodes[op] = new ZeroOpcodeDispatcher(&Client::Handle_##op); #define INr(op) \ ConnectedOpcodes[op] = new RawOpcodeDispatcher(&Client::Handle_##op); -#define OUT_C(op, s) -#define OUT_Cv(op, s) -#define OUT_Cz(op) -#define OUT_Cr(op) -#define OUT(op, s) -#define OUTv(op, s) -#define OUTz(op) -#define OUTr(op) +#define OUT_C(op, s) +#define OUT_Cv(op, s) +#define OUT_Cz(op) +#define OUT_Cr(op) +#define OUT(op, s) +#define OUTv(op, s) +#define OUTz(op) +#define OUTr(op) #include "opcode_dispatch.h" #undef IN_C #undef IN_Cr diff --git a/common/opcodemgr.cpp b/common/opcodemgr.cpp index 06e2bfab2..a7286e686 100644 --- a/common/opcodemgr.cpp +++ b/common/opcodemgr.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" #include @@ -37,9 +37,9 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, fprintf(stderr, "Unable to open opcodes file '%s'. Thats bad.\n", filename); return(false); } - + map eq; - + //load the opcode file into eq, could swap in a nice XML parser here char line[2048]; int lineno = 0; @@ -49,11 +49,11 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, line[0] = '\0'; //for blank line at end of file if(fgets(line, sizeof(line), opf) == nullptr) break; - + //ignore any line that dosent start with OP_ if(line[0] != 'O' || line[1] != 'P' || line[2] != '_') continue; - + char *num = line+3; //skip OP_ //look for the = sign while(*num != '=' && *num != '\0') { @@ -66,19 +66,19 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, } *num = '\0'; //null terminate the name num++; //num should point to the opcode - + //read the opcode if(sscanf(num, "0x%hx", &curop) != 1) { if(report_errors) fprintf(stderr, "Malformed opcode at %s:%d\n", filename, lineno); continue; } - + //we have a name and our opcode... stick it in the map eq[line] = curop; } fclose(opf); - - + + //do the mapping and store them in the shared memory array bool ret = true; EmuOpcode emu_op; @@ -92,7 +92,7 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, if(report_errors) printf("I will let you continue, since you may have gotten all the opcodes you need.\n"); break; } - + //find the opcode in the file res = eq.find(op_name); if(res == eq.end()) { @@ -100,11 +100,11 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, //ret = false; continue; //continue to give them a list of all missing opcodes } - + //ship the mapping off to shared mem. s->Set(emu_op, res->second); } - + return(ret); } @@ -148,17 +148,17 @@ bool RegularOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) NormalMemStrategy s; s.it = this; MOpcodes.lock(); - + loaded = true; eq_to_emu = new EmuOpcode[MAX_EQ_OPCODE]; emu_to_eq = new uint16[_maxEmuOpcode]; EQOpcodeCount = MAX_EQ_OPCODE; EmuOpcodeCount = _maxEmuOpcode; - + //dont need to set eq_to_emu cause every element should get a value memset(eq_to_emu, 0, sizeof(EmuOpcode)*MAX_EQ_OPCODE); memset(emu_to_eq, 0, sizeof(uint16)*_maxEmuOpcode); - + bool ret = LoadOpcodesFile(filename, &s, report_errors); MOpcodes.unlock(); return ret; @@ -167,20 +167,19 @@ bool RegularOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) bool RegularOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) { if(!loaded) return(LoadOpcodes(filename)); - + NormalMemStrategy s; s.it = this; MOpcodes.lock(); - + memset(eq_to_emu, 0, sizeof(uint16)*MAX_EQ_OPCODE); - + bool ret = LoadOpcodesFile(filename, &s, report_errors); - + MOpcodes.unlock(); return(ret); } - uint16 RegularOpcodeManager::EmuToEQ(const EmuOpcode emu_op) { //opcode is checked for validity in GetEQOpcode uint16 res; @@ -209,19 +208,18 @@ EmuOpcode RegularOpcodeManager::EQToEmu(const uint16 eq_op) { } void RegularOpcodeManager::SetOpcode(EmuOpcode emu_op, uint16 eq_op) { - + //clear out old mapping uint16 oldop = emu_to_eq[emu_op]; if(oldop != 0) eq_to_emu[oldop] = OP_Unknown; - + //use our strategy, since we have it NormalMemStrategy s; s.it = this; s.Set(emu_op, eq_op); } - void RegularOpcodeManager::NormalMemStrategy::Set(EmuOpcode emu_op, uint16 eq_op) { if(uint32(emu_op) >= it->EmuOpcodeCount || eq_op >= it->EQOpcodeCount) return; @@ -233,7 +231,6 @@ NullOpcodeManager::NullOpcodeManager() : MutableOpcodeManager() { } - bool NullOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { return(true); } @@ -241,7 +238,7 @@ bool NullOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { bool NullOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) { return(true); } - + uint16 NullOpcodeManager::EmuToEQ(const EmuOpcode emu_op) { return(0); } @@ -254,7 +251,6 @@ EmptyOpcodeManager::EmptyOpcodeManager() : MutableOpcodeManager() { } - bool EmptyOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { return(true); } @@ -262,7 +258,7 @@ bool EmptyOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { bool EmptyOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) { return(true); } - + uint16 EmptyOpcodeManager::EmuToEQ(const EmuOpcode emu_op) { map::iterator f; f = emu_to_eq.find(emu_op); @@ -280,9 +276,3 @@ void EmptyOpcodeManager::SetOpcode(EmuOpcode emu_op, uint16 eq_op) { eq_to_emu[eq_op] = emu_op; } - - - - - - diff --git a/common/opcodemgr.h b/common/opcodemgr.h index dba37c881..64e025c57 100644 --- a/common/opcodemgr.h +++ b/common/opcodemgr.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 OPCODE_MANAGER_H @@ -38,18 +38,18 @@ class OpcodeManager { public: OpcodeManager(); virtual ~OpcodeManager() {} - + virtual bool Mutable() { return(false); } virtual bool LoadOpcodes(const char *filename, bool report_errors = false) = 0; virtual bool ReloadOpcodes(const char *filename, bool report_errors = false) = 0; - + virtual uint16 EmuToEQ(const EmuOpcode emu_op) = 0; virtual EmuOpcode EQToEmu(const uint16 eq_op) = 0; - + static const char *EmuToName(const EmuOpcode emu_op); const char *EQToName(const uint16 emu_op); EmuOpcode NameSearch(const char *name); - + //This has to be public for stupid visual studio class OpcodeSetStrategy { public: @@ -58,10 +58,10 @@ public: }; protected: - bool loaded; //true if all opcodes loaded - Mutex MOpcodes; //this only protects the local machine + bool loaded; //true if all opcodes loaded + Mutex MOpcodes; //this only protects the local machine //in a shared manager, this dosent protect others - + static bool LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, bool report_errors); }; @@ -77,13 +77,13 @@ public: class SharedOpcodeManager : public OpcodeManager { public: virtual ~SharedOpcodeManager() {} - + virtual bool LoadOpcodes(const char *filename, bool report_errors = false); virtual bool ReloadOpcodes(const char *filename, bool report_errors = false); - + virtual uint16 EmuToEQ(const EmuOpcode emu_op); virtual EmuOpcode EQToEmu(const uint16 eq_op); - + protected: class SharedMemStrategy : public OpcodeManager::OpcodeSetStrategy { public: @@ -99,17 +99,17 @@ class RegularOpcodeManager : public MutableOpcodeManager { public: RegularOpcodeManager(); virtual ~RegularOpcodeManager(); - + virtual bool Editable() { return(true); } virtual bool LoadOpcodes(const char *filename, bool report_errors = false); virtual bool ReloadOpcodes(const char *filename, bool report_errors = false); - + virtual uint16 EmuToEQ(const EmuOpcode emu_op); virtual EmuOpcode EQToEmu(const uint16 eq_op); - + //implement our editing interface virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op); - + protected: class NormalMemStrategy : public OpcodeManager::OpcodeSetStrategy { public: @@ -118,7 +118,7 @@ protected: void Set(EmuOpcode emu_op, uint16 eq_op); }; friend class NormalMemStrategy; - + uint16 *emu_to_eq; EmuOpcode *eq_to_emu; uint32 EQOpcodeCount; @@ -129,13 +129,13 @@ protected: class NullOpcodeManager : public MutableOpcodeManager { public: NullOpcodeManager(); - + virtual bool LoadOpcodes(const char *filename, bool report_errors = false); virtual bool ReloadOpcodes(const char *filename, bool report_errors = false); - + virtual uint16 EmuToEQ(const EmuOpcode emu_op); virtual EmuOpcode EQToEmu(const uint16 eq_op); - + //fake it, just used for testing anyways virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op) {} }; @@ -146,13 +146,13 @@ public: class EmptyOpcodeManager : public MutableOpcodeManager { public: EmptyOpcodeManager(); - + virtual bool LoadOpcodes(const char *filename, bool report_errors = false); virtual bool ReloadOpcodes(const char *filename, bool report_errors = false); - + virtual uint16 EmuToEQ(const EmuOpcode emu_op); virtual EmuOpcode EQToEmu(const uint16 eq_op); - + //fake it, just used for testing anyways virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op); protected: @@ -162,15 +162,3 @@ protected: #endif - - - - - - - - - - - - diff --git a/common/packet_dump.cpp b/common/packet_dump.cpp index 1a1d26d3a..bc652f6c6 100644 --- a/common/packet_dump.cpp +++ b/common/packet_dump.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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/debug.h" #include @@ -55,12 +55,12 @@ void DumpPacketHex(const uchar* buf, uint32 size, uint32 cols, uint32 skip) { return; // Output as HEX char output[4]; - int j = 0; - char* ascii = new char[cols+1]; + int j = 0; + char* ascii = new char[cols+1]; memset(ascii, 0, cols+1); uint32 i; - for(i=skip; i #include @@ -33,7 +33,7 @@ #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #else #include #endif @@ -73,8 +73,8 @@ void oldFileDumpPacketHex(const char* filename, const uchar* buf, uint32 size, u ofstream logfile(filename, ios::app); // Output as HEX char output[4]; - for(uint32 i=skip; i @@ -38,18 +38,18 @@ void EncryptProfilePacket(uchar* pBuffer, uint32 size) { uint64 crypt = 0x659365E7; uint64 next_crypt; uint32 len = size >> 3; - + uint64 swap = data[0]; data[0] = data[len/2]; data[len/2] = swap; - - for(uint32 i=0; i>0x19)|(data[i]<<0x27))+0x422437A9; - data[i] = (data[i]<<0x07)|(data[i]>>0x39); + data[i] = (data[i]<<0x07)|(data[i]>>0x39); data[i] = data[i] - crypt; crypt = next_crypt; - } + } } void EncryptZoneSpawnPacket(EQApplicationPacket* app) { @@ -61,18 +61,18 @@ void EncryptZoneSpawnPacket(uchar* pBuffer, uint32 size) { uint64 crypt = 0x0000; uint64 next_crypt; uint32 len = size >> 3; - + uint64 swap = data[0]; data[0] = data[len/2]; data[len/2] = swap; - - for(uint32 i=0; i>0x23))+0x659365E7; - data[i] = (data[i]<<0x0e)|(data[i]>>0x32); + data[i] = (data[i]<<0x0e)|(data[i]>>0x32); data[i] = data[i] - crypt; crypt = next_crypt; - } + } } #define MEMORY_DEBUG @@ -100,33 +100,33 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou #ifdef REUSE_ZLIB static bool inited = false; static z_stream zstream; - int zerror; - - if(in_data == nullptr && out_data == nullptr && in_length == 0 && max_out_length == 0) { - //special delete state - deflateEnd(&zstream); - return(0); - } - if(!inited) { + int zerror; + + if(in_data == nullptr && out_data == nullptr && in_length == 0 && max_out_length == 0) { + //special delete state + deflateEnd(&zstream); + return(0); + } + if(!inited) { memset(&zstream, 0, sizeof(zstream)); - zstream.zalloc = eqemu_alloc_func; - zstream.zfree = eqemu_free_func; - zstream.opaque = Z_NULL; + zstream.zalloc = eqemu_alloc_func; + zstream.zfree = eqemu_free_func; + zstream.opaque = Z_NULL; deflateInit(&zstream, Z_FINISH); - } - - zstream.next_in = const_cast(in_data); - zstream.avail_in = in_length; -/* zstream.zalloc = Z_NULL; - zstream.zfree = Z_NULL; - zstream.opaque = Z_NULL; + } + + zstream.next_in = const_cast(in_data); + zstream.avail_in = in_length; +/* zstream.zalloc = Z_NULL; + zstream.zfree = Z_NULL; + zstream.opaque = Z_NULL; deflateInit(&zstream, Z_FINISH);*/ - zstream.next_out = out_data; + zstream.next_out = out_data; zstream.avail_out = max_out_length; zerror = deflate(&zstream, Z_FINISH); - + deflateReset(&zstream); - + if (zerror == Z_STREAM_END) { // deflateEnd(&zstream); @@ -141,21 +141,21 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou if(in_data == nullptr) { return(0); } - + z_stream zstream; memset(&zstream, 0, sizeof(zstream)); - int zerror; - - zstream.next_in = const_cast(in_data); - zstream.avail_in = in_length; - zstream.zalloc = eqemu_alloc_func; - zstream.zfree = eqemu_free_func; - zstream.opaque = Z_NULL; + int zerror; + + zstream.next_in = const_cast(in_data); + zstream.avail_in = in_length; + zstream.zalloc = eqemu_alloc_func; + zstream.zfree = eqemu_free_func; + zstream.opaque = Z_NULL; deflateInit(&zstream, Z_FINISH); - zstream.next_out = out_data; + zstream.next_out = out_data; zstream.avail_out = max_out_length; zerror = deflate(&zstream, Z_FINISH); - + if (zerror == Z_STREAM_END) { deflateEnd(&zstream); @@ -173,37 +173,37 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint #ifdef REUSE_ZLIB static bool inited = false; static z_stream zstream; - int zerror; - - if(indata == nullptr && outdata == nullptr && indatalen == 0 && outdatalen == 0) { - //special delete state - inflateEnd(&zstream); - return(0); - } - if(!inited) { - zstream.zalloc = eqemu_alloc_func; - zstream.zfree = eqemu_free_func; - zstream.opaque = Z_NULL; + int zerror; + + if(indata == nullptr && outdata == nullptr && indatalen == 0 && outdatalen == 0) { + //special delete state + inflateEnd(&zstream); + return(0); + } + if(!inited) { + zstream.zalloc = eqemu_alloc_func; + zstream.zfree = eqemu_free_func; + zstream.opaque = Z_NULL; inflateInit2(&zstream, 15); - } + } zstream.next_in = const_cast(indata); zstream.avail_in = indatalen; zstream.next_out = outdata; zstream.avail_out = outdatalen; - zstream.zalloc = eqemu_alloc_func; - zstream.zfree = eqemu_free_func; + zstream.zalloc = eqemu_alloc_func; + zstream.zfree = eqemu_free_func; zstream.opaque = Z_NULL; - - i = inflateInit2( &zstream, 15 ); - if (i != Z_OK) { + + i = inflateInit2( &zstream, 15 ); + if (i != Z_OK) { return 0; } - + zerror = inflate( &zstream, Z_FINISH ); - + inflateReset(&zstream); - + if(zerror == Z_STREAM_END) { return zstream.total_out; } @@ -217,37 +217,37 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint DumpPacket(indata-16, indatalen+16); #endif } - + if (zerror == -4 && zstream.msg == 0) { return 0; } - + return 0; } #else if(indata == nullptr) return(0); - + z_stream zstream; int zerror = 0; int i; - + zstream.next_in = const_cast(indata); zstream.avail_in = indatalen; zstream.next_out = outdata; zstream.avail_out = outdatalen; - zstream.zalloc = eqemu_alloc_func; - zstream.zfree = eqemu_free_func; + zstream.zalloc = eqemu_alloc_func; + zstream.zfree = eqemu_free_func; zstream.opaque = Z_NULL; - - i = inflateInit2( &zstream, 15 ); - if (i != Z_OK) { + + i = inflateInit2( &zstream, 15 ); + if (i != Z_OK) { return 0; } - + zerror = inflate( &zstream, Z_FINISH ); - + if(zerror == Z_STREAM_END) { inflateEnd( &zstream ); return zstream.total_out; @@ -262,12 +262,12 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint DumpPacket(indata-16, indatalen+16); #endif } - + if (zerror == -4 && zstream.msg == 0) { return 0; } - + zerror = inflateEnd( &zstream ); return 0; } @@ -293,30 +293,30 @@ uint64 rorl(uint64 in, uint8 bits) { uint32 CRCLookup(uchar idx) { if (idx == 0) return 0x00000000; - + if (idx == 1) return 0x77073096; - + if (idx == 2) return roll(CRCLookup(1), 1); - + if (idx == 4) return 0x076DC419; - + for (uchar b=7; b>0; b--) { uchar bv = 1 << b; - + if (!(idx ^ bv)) { // bit is only one set return ( roll(CRCLookup (4), b - 2) ); } - + if (idx&bv) { // bit is set return( CRCLookup(bv) ^ CRCLookup(idx&(bv - 1)) ); } } - + //Failure return false; } @@ -325,10 +325,10 @@ uint32 GenerateCRC(uint32 b, uint32 bufsize, uchar *buf) { uint32 CRC = (b ^ 0xFFFFFFFF); uint32 bufremain = bufsize; uchar* bufptr = buf; - + while (bufremain--) { CRC = CRCLookup((uchar)(*(bufptr++)^ (CRC&0xFF))) ^ (CRC >> 8); } - + return (htonl (CRC ^ 0xFFFFFFFF)); } diff --git a/common/packet_functions.h b/common/packet_functions.h index 4ac7fa0ac..3746c7c79 100644 --- a/common/packet_functions.h +++ b/common/packet_functions.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 PACKET_FUNCTIONS_H #define PACKET_FUNCTIONS_H diff --git a/common/packetfile.cpp b/common/packetfile.cpp index ad4937e0d..bbd251968 100644 --- a/common/packetfile.cpp +++ b/common/packetfile.cpp @@ -3,7 +3,7 @@ #else #include #endif - + #include #include #include @@ -32,15 +32,15 @@ bool PacketFileWriter::SetPacketStamp(const char *name, uint32 stamp) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(false); } - + unsigned long magic = 0; - + if(fread(&magic, sizeof(magic), 1, in) != 1) { fprintf(stderr, "Error reading header from packet file: %s\n", strerror(errno)); fclose(in); return(false); } - + PacketFileReader *ret = NULL; if(magic == OLD_PACKET_FILE_MAGIC) { OldPacketFileHeader *pos = 0; @@ -69,33 +69,33 @@ bool PacketFileWriter::SetPacketStamp(const char *name, uint32 stamp) { fclose(in); return(false); } - + fclose(in); return(true); } - + bool PacketFileWriter::OpenFile(const char *name) { CloseFile(); - + printf("Opening packet file: %s\n", name); - + out = fopen(name, "wb"); if(out == NULL) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(false); } - + PacketFileHeader head; head.packet_file_magic = PACKET_FILE_MAGIC; head.packet_file_version = PACKET_FILE_CURRENT_VERSION; head.packet_file_stamp = time(NULL); - + if(fwrite(&head, sizeof(head), 1, out) != 1) { fprintf(stderr, "Error writting header to packet file: %s\n", strerror(errno)); fclose(out); return(false); } - + return(true); } @@ -110,13 +110,13 @@ void PacketFileWriter::CloseFile() { void PacketFileWriter::WritePacket(uint16 eq_op, uint32 packlen, const unsigned char *packet, bool to_server, const struct timeval &tv) { if(out == NULL) return; - + _WriteBlock(eq_op, packet, packlen, to_server, tv); - + /* Could log only the packets we care about, but this is most of the stream, so just log them all... - + switch(eq_op) { case OP_NewZone: case OP_ZoneSpawns: @@ -139,23 +139,23 @@ void PacketFileWriter::WritePacket(uint16 eq_op, uint32 packlen, const unsigned bool PacketFileWriter::_WriteBlock(uint16 eq_op, const void *d, uint16 len, bool to_server, const struct timeval &tv) { if(out == NULL) return(false); - + PacketFileSection s; s.opcode = eq_op; s.len = len; s.tv_sec = tv.tv_sec; s.tv_msec = tv.tv_usec/1000; - + if(to_server) SetToServer(s); else SetToClient(s); - + if(fwrite(&s, sizeof(s), 1, out) != 1) { fprintf(stderr, "Error writting block header: %s\n", strerror(errno)); return(false); } - + if(fwrite(d, 1, len, out) != len) { fprintf(stderr, "Error writting block body: %s\n", strerror(errno)); return(false); @@ -163,7 +163,7 @@ bool PacketFileWriter::_WriteBlock(uint16 eq_op, const void *d, uint16 len, bool if(force_flush) fflush(out); - + return(true); } @@ -179,15 +179,15 @@ PacketFileReader *PacketFileReader::OpenPacketFile(const char *name) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(NULL); } - + unsigned long magic = 0; - + if(fread(&magic, sizeof(magic), 1, in) != 1) { fprintf(stderr, "Error reading header to packet file: %s\n", strerror(errno)); fclose(in); return(NULL); } - + PacketFileReader *ret = NULL; if(magic == OLD_PACKET_FILE_MAGIC) { ret = new OldPacketFileReader(); @@ -198,12 +198,12 @@ PacketFileReader *PacketFileReader::OpenPacketFile(const char *name) { fclose(in); return(NULL); } - + if(!ret->OpenFile(name)) { safe_delete(ret); return(NULL); } - + return(ret); } @@ -220,26 +220,26 @@ OldPacketFileReader::OldPacketFileReader() OldPacketFileReader::~OldPacketFileReader() { CloseFile(); } - + bool OldPacketFileReader::OpenFile(const char *name) { CloseFile(); - + //printf("Opening packet file: %s\n", name); - + in = fopen(name, "rb"); if(in == NULL) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(false); } - + OldPacketFileHeader head; - + if(fread(&head, sizeof(head), 1, in) != 1) { fprintf(stderr, "Error reading header to packet file: %s\n", strerror(errno)); fclose(in); return(false); } - + if(head.packet_file_magic != OLD_PACKET_FILE_MAGIC) { fclose(in); if(head.packet_file_magic > (OLD_PACKET_FILE_MAGIC)) { @@ -249,16 +249,16 @@ bool OldPacketFileReader::OpenFile(const char *name) { } return(false); } - + uint32 now = time(NULL); if(head.packet_file_stamp > now) { fprintf(stderr, "Error: invalid timestamp in file. Your clock or the collector's is wrong (%d sec ahead).\n", head.packet_file_stamp-now); fclose(in); return(false); } - + packet_file_stamp = head.packet_file_stamp; - + return(true); } @@ -274,14 +274,14 @@ bool OldPacketFileReader::ResetFile() { if(in == NULL) return(false); rewind(in); - + //gotta read past the header again OldPacketFileHeader head; - + if(fread(&head, sizeof(head), 1, in) != 1) { return(false); } - + return(true); } @@ -290,23 +290,23 @@ bool OldPacketFileReader::ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned ch return(false); if(feof(in)) return(false); - + OldPacketFileSection s; - + if(fread(&s, sizeof(s), 1, in) != 1) { if(!feof(in)) fprintf(stderr, "Error reading section header: %s\n", strerror(errno)); return(false); } - + eq_op = s.opcode; - + if(packlen < s.len) { fprintf(stderr, "Packet buffer is too small! %d < %d, skipping\n", packlen, s.len); fseek(in, s.len, SEEK_CUR); return(false); } - + if(fread(packet, 1, s.len, in) != s.len) { if(feof(in)) fprintf(stderr, "Error: EOF encountered when expecting packet data.\n"); @@ -314,12 +314,12 @@ bool OldPacketFileReader::ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned ch fprintf(stderr, "Error reading packet body: %s\n", strerror(errno)); return(false); } - + packlen = s.len; to_server = false; tv.tv_sec = 0; tv.tv_usec = 0; - + return(true); } @@ -333,26 +333,26 @@ NewPacketFileReader::NewPacketFileReader() NewPacketFileReader::~NewPacketFileReader() { CloseFile(); } - + bool NewPacketFileReader::OpenFile(const char *name) { CloseFile(); - + //printf("Opening packet file: %s\n", name); - + in = fopen(name, "rb"); if(in == NULL) { fprintf(stderr, "Error opening packet file '%s': %s\n", name, strerror(errno)); return(false); } - + PacketFileHeader head; - + if(fread(&head, sizeof(head), 1, in) != 1) { fprintf(stderr, "Error reading header to packet file: %s\n", strerror(errno)); fclose(in); return(false); } - + if(head.packet_file_magic != PACKET_FILE_MAGIC) { fclose(in); if(head.packet_file_magic == (PACKET_FILE_MAGIC+1)) { @@ -362,16 +362,16 @@ bool NewPacketFileReader::OpenFile(const char *name) { } return(false); } - + uint32 now = time(NULL); if(head.packet_file_stamp > now) { fprintf(stderr, "Error: invalid timestamp in file. Your clock or the collector's is wrong (%d sec ahead).\n", head.packet_file_stamp-now); fclose(in); return(false); } - + packet_file_stamp = head.packet_file_stamp; - + return(true); } @@ -387,14 +387,14 @@ bool NewPacketFileReader::ResetFile() { if(in == NULL) return(false); rewind(in); - + //gotta read past the header again PacketFileHeader head; - + if(fread(&head, sizeof(head), 1, in) != 1) { return(false); } - + return(true); } @@ -403,23 +403,23 @@ bool NewPacketFileReader::ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned ch return(false); if(feof(in)) return(false); - + PacketFileSection s; - + if(fread(&s, sizeof(s), 1, in) != 1) { if(!feof(in)) fprintf(stderr, "Error reading section header: %s\n", strerror(errno)); return(false); } - + eq_op = s.opcode; - + if(packlen < s.len) { fprintf(stderr, "Packet buffer is too small! %d < %d, skipping\n", packlen, s.len); fseek(in, s.len, SEEK_CUR); return(false); } - + if(fread(packet, 1, s.len, in) != s.len) { if(feof(in)) fprintf(stderr, "Error: EOF encountered when expecting packet data.\n"); @@ -427,12 +427,12 @@ bool NewPacketFileReader::ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned ch fprintf(stderr, "Error reading packet body: %s\n", strerror(errno)); return(false); } - + packlen = s.len; to_server = IsToServer(s); tv.tv_sec = s.tv_sec; tv.tv_usec = 1000*s.tv_msec; - + return(true); } diff --git a/common/packetfile.h b/common/packetfile.h index 35585f83a..bacbbc2b4 100644 --- a/common/packetfile.h +++ b/common/packetfile.h @@ -49,17 +49,17 @@ class PacketFileWriter { public: PacketFileWriter(bool force_flush); ~PacketFileWriter(); - + bool OpenFile(const char *name); void CloseFile(); - + void WritePacket(uint16 eq_op, uint32 packlen, const unsigned char *packet, bool to_server, const struct timeval &tv); - + static bool SetPacketStamp(const char *file, uint32 stamp); - + protected: bool _WriteBlock(uint16 eq_op, const void *d, uint16 len, bool to_server, const struct timeval &tv); - + //gzFile out; FILE *out; bool force_flush; @@ -69,20 +69,20 @@ protected: class PacketFileReader { public: PacketFileReader(); - + virtual bool OpenFile(const char *name) = 0; virtual void CloseFile() = 0; virtual bool ResetFile() = 0; //aka rewind - + virtual bool ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned char *packet, bool &to_server, struct timeval &tv) = 0; - + time_t GetStamp() { return(time_t(packet_file_stamp)); } - + //factory method to open the right packet file. static PacketFileReader *OpenPacketFile(const char *name); - + protected: - + uint32 packet_file_stamp; }; @@ -90,38 +90,38 @@ class OldPacketFileReader : public PacketFileReader { public: OldPacketFileReader(); virtual ~OldPacketFileReader(); - + bool OpenFile(const char *name); void CloseFile(); bool ResetFile(); //aka rewind - + bool ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned char *packet, bool &to_server, struct timeval &tv); - + time_t GetStamp() { return(time_t(packet_file_stamp)); } - + protected: - + //gzFile in; - FILE *in; + FILE *in; }; class NewPacketFileReader: public PacketFileReader { public: NewPacketFileReader(); virtual ~NewPacketFileReader(); - + bool OpenFile(const char *name); void CloseFile(); bool ResetFile(); //aka rewind - + bool ReadPacket(uint16 &eq_op, uint32 &packlen, unsigned char *packet, bool &to_server, struct timeval &tv); - + time_t GetStamp() { return(time_t(packet_file_stamp)); } - + protected: - + //gzFile in; - FILE *in; + FILE *in; }; diff --git a/common/patches/Client62.cpp b/common/patches/Client62.cpp index 1a535a7f0..6f5f52fbf 100644 --- a/common/patches/Client62.cpp +++ b/common/patches/Client62.cpp @@ -19,7 +19,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -35,35 +35,35 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -138,10 +138,10 @@ ENCODE(OP_SendCharInfo) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 2 is for 6.2 if (emu->clientver <= 2 ) @@ -178,7 +178,7 @@ ENCODE(OP_SendAATable) { OUT(abilities[r].slot); } } - + FINISH_ENCODE(); } @@ -199,19 +199,19 @@ ENCODE(OP_DeleteSpawn) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + memset(eq->unknown3224, 0xff, 448); memset(eq->unknown3704, 0xff, 32); - + // OUT(checksum); OUT(gender); OUT(race); OUT(class_); OUT(level); eq->level2 = emu->level; - + eq->bind_zone_id = emu->binds[0].zoneId; eq->bind_x[0] = emu->binds[0].x; eq->bind_y[0] = emu->binds[0].y; @@ -222,8 +222,8 @@ ENCODE(OP_PlayerProfile) { eq->zone_safe_y = emu->binds[4].y; eq->zone_safe_z = emu->binds[4].z; eq->zone_safe_heading = emu->binds[4].heading; - - + + OUT(deity); OUT(intoxication); OUT_array(spellSlotRefresh, structs::MAX_PP_MEMSPELL); @@ -361,10 +361,10 @@ ENCODE(OP_PlayerProfile) { OUT(raidAutoconsent); OUT(guildAutoconsent); // OUT(showhelm); - + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -408,11 +408,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -420,16 +420,16 @@ ENCODE(OP_ZoneSpawns) { delete in; return; } - + //make the EQ struct. in->size = sizeof(structs::Spawn_Struct)*entrycount; in->pBuffer = new unsigned char[in->size]; structs::Spawn_Struct *eq = (structs::Spawn_Struct *) in->pBuffer; - + //zero out the packet. We could avoid this memset by setting all fields (including unknowns) //in the loop. memset(in->pBuffer, 0, in->size); - + //do the transform... int r; int k; @@ -492,7 +492,7 @@ ENCODE(OP_ZoneSpawns) { eq->lfg = emu->lfg; eq->flymode = emu->flymode; } - + //kill off the emu structure and send the eq packet. delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); @@ -503,7 +503,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; @@ -532,7 +532,7 @@ ENCODE(OP_CharInventory) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -543,7 +543,7 @@ ENCODE(OP_CharInventory) { return; } InternalSerializedItem_Struct *eq = (InternalSerializedItem_Struct *) in->pBuffer; - + //do the transform... int r; string serial_string; @@ -556,7 +556,7 @@ ENCODE(OP_CharInventory) { } else { _log(NET__STRUCTS, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.",eq->slot_id); } - + } in->size = serial_string.length(); @@ -571,39 +571,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -611,14 +611,14 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct - + //nice helper macro /*#define SlideStructString(field, str) \ strcpy(e->field, str.c_str()); \ @@ -632,7 +632,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -647,7 +647,7 @@ ENCODE(OP_GuildMemberList) { e->zone_id = htons(emu_e->zone_id); #undef SlideStructString #undef PutFieldN - + e++; } } @@ -661,9 +661,9 @@ ENCODE(OP_ReadBook) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; - + BookText_Struct *emu_BookText_Struct = (BookText_Struct *)__emu_buffer; in->size = sizeof(structs::BookText_Struct) + strlen(emu_BookText_Struct->booktext); @@ -857,14 +857,14 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { IN(augments[r]); } IN(link_hash); - + FINISH_DIRECT_DECODE(); } @@ -918,7 +918,7 @@ DECODE(OP_WhoAllRequest) { IN(lvlhigh); IN(gmlookup); emu->type = 3; - + FINISH_DIRECT_DECODE(); } @@ -983,7 +983,7 @@ char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 d } } - + *length=MakeAnyLenString(&serialization, "%.*s%s" // For leading quotes (and protection) if a subitem; "%s" // Instance data diff --git a/common/patches/Client62.h b/common/patches/Client62.h index e34b8cb48..f4a70bc90 100644 --- a/common/patches/Client62.h +++ b/common/patches/Client62.h @@ -7,31 +7,31 @@ class EQStreamIdentifier; namespace Client62 { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "Client62_ops.h" }; - + }; #endif /*CLIENT62_H_*/ diff --git a/common/patches/Client62_structs.h b/common/patches/Client62_structs.h index aa48fc0e6..c03777610 100644 --- a/common/patches/Client62_structs.h +++ b/common/patches/Client62_structs.h @@ -62,7 +62,7 @@ struct DuelResponse_Struct }; /* Cofruben: - Adventure stuff,not a net one,just one for our use + Adventure stuff,not a net one,just one for our use */ static const uint32 ADVENTURE_COLLECT = 0; static const uint32 ADVENTURE_MASSKILL = 1; @@ -155,15 +155,15 @@ struct CharacterSelect_Struct { ** */ -/* -** Generic Spawn Struct -** Length: 383 Octets -** Used in: +/* +** Generic Spawn Struct +** Length: 383 Octets +** Used in: ** spawnZoneStruct ** dbSpawnStruct ** petStruct ** newSpawnStruct -*/ +*/ struct Spawn_Struct { /*0000*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse,a @@ -188,9 +188,9 @@ struct Spawn_Struct signed padding0070:19; // ***Placeholder /*0074*/ uint16 deity; // Player's Deity /*0076*/ uint8 unknown[2]; -/*0078*/ union +/*0078*/ union { - struct + struct { /*0078*/ uint32 equip_helmet; // Equipment: Helmet Visual /*0082*/ uint32 equip_chest; // Equipment: Chest Visual @@ -223,9 +223,9 @@ struct Spawn_Struct /*0166*/ uint8 is_npc; // 0=no, 1=yes /*0167*/ uint8 flymode; //seems to be 3 for 'useable' npc classes /*0168*/ uint32 guildID; // Current guild -/*0172*/ union +/*0172*/ union { - struct + struct { /*0172*/ Color_Struct color_helmet; // Color of helmet item /*0176*/ Color_Struct color_chest; // Color of chest item @@ -246,12 +246,12 @@ struct Spawn_Struct /*0217*/ uint8 beardcolor; // Beard color /*0218*/ float size; // Model size /*0222*/ uint8 findable; // 0=can't be found, 1=can be found -/*0223*/ float unknown_float; +/*0223*/ float unknown_float; /*0227*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) /*0259*/ uint8 unknown0259[4]; //[0] is sometimes 100 /*0263*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader /*0264*/ uint8 unknown0264[3]; -union +union { /*0267*/ uint8 equip_chest2; // Second place in packet for chest texture (usually 0xFF in live packets) // Not sure why there are 2 of them, but it effects chest texture! @@ -337,9 +337,9 @@ struct NewZone_Struct { ** Length: 12 Bytes ** */ -struct MemorizeSpell_Struct { -uint32 slot; // Spot in the spell book/memorized slot -uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) +struct MemorizeSpell_Struct { +uint32 slot; // Spot in the spell book/memorized slot +uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming uint32 unknown12; }; @@ -373,20 +373,20 @@ struct DeleteSpell_Struct }; struct ManaChange_Struct -{ +{ uint32 new_mana; // New Mana AMount uint32 stamina; uint32 spell_id; uint32 unknown12; }; -struct SwapSpell_Struct -{ - uint32 from_slot; - uint32 to_slot; +struct SwapSpell_Struct +{ + uint32 from_slot; + uint32 to_slot; -}; +}; struct BeginCast_Struct { @@ -526,8 +526,8 @@ struct CharCreate_Struct /*0092*/ int32 hairstyle; /*0096*/ uint32 deity; ///*0072*/ int32 deity; - - + + // 0 = odus // 1 = qeynos // 2 = halas @@ -563,7 +563,7 @@ struct CharCreate_Struct struct AA_Array { uint32 AA; - uint32 value; + uint32 value; }; @@ -603,7 +603,7 @@ struct Bandolier_Struct { struct PotionBelt_Struct { BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; }; - + static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_RAID_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_LEADERSHIP_AA_ARRAY = (MAX_GROUP_LEADERSHIP_AA_ARRAY+MAX_RAID_LEADERSHIP_AA_ARRAY); @@ -650,17 +650,17 @@ struct PlayerProfile_Struct /*0200*/ float bind_heading[4]; // /*0216*/ float zone_safe_heading; /*0220*/ uint32 deity; // deity -/*0224*/ uint32 guild_id; +/*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; +/*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 unknown0245[7]; // -/*0252*/ uint32 intoxication; +/*0252*/ uint32 intoxication; /*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms /*0292*/ uint32 abilitySlotRefresh; /*0296*/ uint8 haircolor; // Player hair color @@ -684,7 +684,7 @@ struct PlayerProfile_Struct /*2416*/ char suffix[32]; //length might be wrong /*2448*/ uint32 guildid2; // /*2452*/ uint32 exp; // Current Experience -/*2456*/ uint32 unknown1496; +/*2456*/ uint32 unknown1496; /*2460*/ uint32 points; // Unspent Practice points /*2464*/ uint32 mana; // current mana /*2468*/ uint32 cur_hp; // current hp @@ -701,7 +701,7 @@ struct PlayerProfile_Struct /*2552*/ uint8 languages[MAX_PP_LANGUAGE]; /*2580*/ uint8 unknown1620[4]; /*2584*/ uint32 spell_book[MAX_PP_SPELLBOOK]; -/*4184*/ uint8 unknown3224[448]; // all 0xff +/*4184*/ uint8 unknown3224[448]; // all 0xff /*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL]; /*4668*/ uint8 unknown3704[32]; // /*4700*/ float y; // Player y position @@ -741,7 +741,7 @@ struct PlayerProfile_Struct /*5476*/ int32 hunger_level; /*5480*/ int32 thirst_level; /*5484*/ uint32 ability_up; -/*5488*/ char unknown4524[16]; +/*5488*/ char unknown4524[16]; /*5504*/ uint16 zone_id; // Current zone of the player /*5506*/ uint16 zoneInstance; // Instance ID /*5508*/ SpellBuff_Struct buffs[BUFF_COUNT]; // Buffs currently on the player @@ -900,7 +900,7 @@ struct BindWound_Struct /* ** Type: Zone Change Request (before hand) -** Length: 88 bytes +** Length: 88 bytes ** OpCode: a320 */ @@ -923,7 +923,7 @@ struct RequestClientZoneChange_Struct { /*08*/ float x; /*12*/ float z; /*16*/ float heading; -/*20*/ uint32 type; //unknown... values +/*20*/ uint32 type; //unknown... values }; struct Animation_Struct { @@ -1203,13 +1203,13 @@ struct TradeMoneyUpdate_Struct{ ** Surname struct ** Size: 100 bytes */ -struct Surname_Struct -{ +struct Surname_Struct +{ /*0000*/ char name[64]; /*0064*/ uint32 unknown0064; /*0068*/ char lastname[32]; /*0100*/ -}; +}; struct GuildsListEntry_Struct { char name[64]; @@ -1465,7 +1465,7 @@ struct Merchant_Click_Struct { /*000*/ uint32 npcid; // Merchant NPC's entity id /*004*/ uint32 playerid; /*008*/ uint32 command; //1=open, 0=cancel/close -/*012*/ float rate; //cost multiplier, dosent work anymore +/*012*/ float rate; //cost multiplier, dosent work anymore }; /* Unknowns: @@ -1584,7 +1584,7 @@ struct Illusion_Struct { /*068*/ uint16 race; /*070*/ char unknown070[2]; /*072*/ uint8 gender; -/*073*/ uint8 texture; +/*073*/ uint8 texture; /*074*/ uint8 helmtexture; /*075*/ uint8 unknown075; /*076*/ uint32 face; @@ -1636,14 +1636,14 @@ struct GroupCancel_Struct { uint8 toggle; }; -struct GroupUpdate_Struct { +struct GroupUpdate_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[5][64]; /*0388*/ char leadersname[64]; }; -struct GroupUpdate2_Struct { +struct GroupUpdate2_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[5][64]; @@ -1652,7 +1652,7 @@ struct GroupUpdate2_Struct { /*0580*/ uint8 unknown[188]; /*0768*/ }; -struct GroupJoin_Struct { +struct GroupJoin_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[64]; @@ -1666,10 +1666,10 @@ struct FaceChange_Struct { /*003*/ uint8 eyecolor2; /*004*/ uint8 hairstyle; /*005*/ uint8 beard; // vesuvias -/*006*/ uint8 face; +/*006*/ uint8 face; //vesuvias: //there are only 10 faces for barbs changing woad just -//increase the face value by ten so if there were 8 woad +//increase the face value by ten so if there were 8 woad //designs then there would be 80 barb faces }; @@ -1751,11 +1751,11 @@ struct Who_All_Struct { // 76 length total /*140*/ }; -struct Stun_Struct { // 4 bytes total +struct Stun_Struct { // 4 bytes total uint32 duration; // Duration of stun }; -struct AugmentItem_Struct { +struct AugmentItem_Struct { /*00*/ int16 container_slot; /*02*/ char unknown02[2]; /*04*/ int32 augment_slot; @@ -1769,11 +1769,11 @@ struct Emote_Struct { /*1028*/ }; -// Inspect -struct Inspect_Struct { - uint16 TargetID; - uint16 PlayerID; -}; +// Inspect +struct Inspect_Struct { + uint16 TargetID; + uint16 PlayerID; +}; //OP_InspectAnswer struct InspectResponse_Struct{//Cofruben:need to send two of this for the inspect response. /*000*/ uint32 TargetID; @@ -1958,7 +1958,7 @@ struct CloseContainer_Struct { /* ** Generic Door Struct ** Length: 52 Octets -** Used in: +** Used in: ** cDoorSpawnsStruct(f721) ** */ @@ -2557,7 +2557,7 @@ struct Split_Struct ** Last Updated: Oct-15-2003 ** */ -struct NewCombine_Struct { +struct NewCombine_Struct { /*00*/ int16 container_slot; /*02*/ char unknown02[2]; /*04*/ @@ -2862,7 +2862,7 @@ struct RaidDetails_Struct { /*000*/ uint32 action; //=6,20 /*004*/ char leader_name[64]; /*068*/ uint32 unknown68[4]; -/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order +/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order /*128*/ uint8 unknown128[142]; /*354*/ uint32 leader_id; }; @@ -3022,7 +3022,7 @@ struct AA_Action { }; struct AA_Skills { //this should be removed and changed to AA_Array -/*00*/ uint32 aa_skill; +/*00*/ uint32 aa_skill; /*04*/ uint32 aa_value; }; @@ -3053,13 +3053,13 @@ struct AATable_Struct { struct Weather_Struct { uint32 val1; //generall 0x000000FF uint32 type; //0x31=rain, 0x02=snow(i think), 0 = normal - uint32 mode; + uint32 mode; }; struct ZoneInUnknown_Struct { uint32 val1; uint32 val2; - uint32 val3; + uint32 val3; }; struct MobHealth_Struct { diff --git a/common/patches/RoF.cpp b/common/patches/RoF.cpp index f9bd001b3..079887649 100644 --- a/common/patches/RoF.cpp +++ b/common/patches/RoF.cpp @@ -22,7 +22,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -38,37 +38,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -103,7 +103,7 @@ const EQClientVersion Strategy::ClientVersion() const { return EQClientRoF; } - + #include "SSDefine.h" // Converts Titanium Slot IDs to RoF Slot IDs for use in Encodes @@ -134,7 +134,7 @@ static inline structs::ItemSlotStruct TitaniumToRoFSlot(uint32 TitaniumSlot) { RoFSlot.MainSlot += 1; } - + } /*else if (TitaniumSlot < 51) // Cursor Buffer { @@ -430,13 +430,13 @@ ENCODE(OP_TaskHistoryReply) // Skip past Text2 while(in->ReadUInt8()) ++Text2Length; - + in->ReadUInt32(); in->ReadUInt32(); in->ReadUInt32(); uint32 ZoneID = in->ReadUInt32(); in->ReadUInt32(); - + // Skip past Text3 while(in->ReadUInt8()) ++Text3Length; @@ -444,7 +444,7 @@ ENCODE(OP_TaskHistoryReply) char ZoneNumber[10]; sprintf(ZoneNumber, "%i", ZoneID); - + OutboundPacketSize += (24 + Text1Length + 1 + Text2Length + Text3Length + 1 + 7 + (strlen(ZoneNumber) * 2)); } @@ -478,7 +478,7 @@ ENCODE(OP_TaskHistoryReply) outapp->WriteUInt32(Text2Length); in->SetReadPosition(CurrentPosition); - + // Copy Text2 while(uint8 c = in->ReadUInt8()) outapp->WriteUInt8(c); @@ -494,11 +494,11 @@ ENCODE(OP_TaskHistoryReply) sprintf(ZoneNumber, "%i", ZoneID); outapp->WriteUInt32(2); - outapp->WriteUInt8(0x2d); // "-" + outapp->WriteUInt8(0x2d); // "-" outapp->WriteUInt8(0x31); // "1" outapp->WriteUInt32(2); - outapp->WriteUInt8(0x2d); // "-" + outapp->WriteUInt8(0x2d); // "-" outapp->WriteUInt8(0x31); // "1" outapp->WriteString(ZoneNumber); @@ -509,7 +509,7 @@ ENCODE(OP_TaskHistoryReply) outapp->WriteUInt8(c); outapp->WriteUInt8(0); // Text3 has a null terminator - + outapp->WriteUInt8(0x31); // "1" outapp->WriteString(ZoneNumber); } @@ -565,7 +565,7 @@ ENCODE(OP_OpenNewTasksWindow) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; @@ -601,7 +601,7 @@ ENCODE(OP_OpenNewTasksWindow) { __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen // in RoF packets. Changing it to 0x3f000000 makes the title red. - __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->unknown1 = 0x3f800000; __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; @@ -660,7 +660,7 @@ ENCODE(OP_OpenNewTasksWindow) { } delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } */ @@ -668,8 +668,8 @@ ENCODE(OP_OpenNewTasksWindow) { ENCODE(OP_SendCharInfo) { ENCODE_LENGTH_EXACT(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - - + + //EQApplicationPacket *packet = *p; //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; @@ -688,10 +688,10 @@ ENCODE(OP_SendCharInfo) { + namelen; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); - + //unsigned char *eq_buffer = new unsigned char[total_length]; //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; - + eq->char_count = char_count; //eq->total_chars = 10; @@ -747,9 +747,9 @@ ENCODE(OP_SendCharInfo) { } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } - + FINISH_ENCODE(); - + } ENCODE(OP_ZoneServerInfo) { @@ -780,10 +780,10 @@ ENCODE(OP_SendZonepoints) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 5 is for Live if (emu->clientver <= 5 ) @@ -869,9 +869,9 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt8(emu->level); // Level outapp->WriteUInt8(emu->level); // Level1 - + outapp->WriteUInt32(5); // Bind count - + for(int r = 0; r < 5; r++) { outapp->WriteUInt32(emu->binds[r].zoneId); @@ -885,7 +885,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(emu->intoxication); outapp->WriteUInt32(10); // Unknown count - + for(int r = 0; r < 10; r++) { outapp->WriteUInt32(0); // Unknown @@ -1072,7 +1072,7 @@ ENCODE(OP_PlayerProfile) } outapp->WriteUInt32(structs::MAX_PP_SPELLBOOK); // Spellbook slots - + for(uint32 r = 0; r < MAX_PP_SPELLBOOK; r++) { outapp->WriteUInt32(emu->spell_book[r]); @@ -1469,7 +1469,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(emu->air_remaining); // ? // PVP Stats - + outapp->WriteUInt32(emu->PVPKills); outapp->WriteUInt32(emu->PVPDeaths); outapp->WriteUInt32(emu->PVPCurrentPoints); @@ -1479,7 +1479,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(emu->PVPCurrentKillStreak); // Last PVP Kill - + outapp->WriteString(emu->PVPLastKill.Name); outapp->WriteUInt32(emu->PVPLastKill.Level); outapp->WriteUInt32(emu->PVPLastKill.Race); @@ -1489,7 +1489,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(emu->PVPLastKill.Points); // Last PVP Death - + outapp->WriteString(emu->PVPLastDeath.Name); outapp->WriteUInt32(emu->PVPLastDeath.Level); outapp->WriteUInt32(emu->PVPLastDeath.Race); @@ -1555,7 +1555,7 @@ ENCODE(OP_PlayerProfile) outapp->size = outapp->GetWritePosition(); outapp->SetWritePosition(4); outapp->WriteUInt32(outapp->size - 9); - + CRC32::SetEQChecksum(outapp->pBuffer, outapp->size - 1, 8); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); @@ -1601,7 +1601,7 @@ ENCODE(OP_NewZone) { OUT(SuspendBuffs); eq->FogDensity = emu->fog_density; - + /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown800 = -1; eq->unknown844 = 600; @@ -1684,7 +1684,7 @@ ENCODE(OP_PetBuffWindow) __packet->size = sz; __packet->pBuffer = new unsigned char[sz]; memset(__packet->pBuffer, 0, sz); - + __packet->WriteUInt32(emu->petid); __packet->WriteUInt32(0); // PlayerID ? __packet->WriteUInt8(1); // 1 indicates all buffs on the pet (0 to add or remove a single buff) @@ -1698,7 +1698,7 @@ ENCODE(OP_PetBuffWindow) __packet->WriteUInt32(emu->spellid[i]); __packet->WriteUInt32(emu->ticsremaining[i]); __packet->WriteUInt32(0); // Unknown - __packet->WriteString(""); + __packet->WriteString(""); } } __packet->WriteUInt8(0); // Unknown @@ -1744,7 +1744,7 @@ ENCODE(OP_Barter) delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); - + } ENCODE(OP_BazaarSearch) @@ -1808,11 +1808,11 @@ ENCODE(OP_ZoneSpawns) //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -1821,7 +1821,7 @@ ENCODE(OP_ZoneSpawns) return; } - + //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); emu = (Spawn_Struct *) __emu_buffer; @@ -1830,7 +1830,7 @@ ENCODE(OP_ZoneSpawns) char *Buffer = (char *) in->pBuffer, *BufferStart; - + int r; int k; for(r = 0; r < entrycount; r++, emu++) { @@ -1848,7 +1848,7 @@ ENCODE(OP_ZoneSpawns) if(strlen(emu->suffix)) PacketSize += strlen(emu->suffix) + 1; - + bool ShowName = 1; if(emu->bodytype >= 66) { @@ -1902,7 +1902,7 @@ ENCODE(OP_ZoneSpawns) Bitfields->targetable = 1; Bitfields->targetable_with_hotkey = (emu->IsMercenary ? 0 : 1); Bitfields->showname = ShowName; - + // Not currently found // Bitfields->statue = 0; // Bitfields->buyer = 0; @@ -1912,7 +1912,7 @@ ENCODE(OP_ZoneSpawns) uint8 OtherData = 0; if(strlen(emu->title)) - OtherData = OtherData | 16; + OtherData = OtherData | 16; if(strlen(emu->suffix)) OtherData = OtherData | 32; @@ -1949,7 +1949,7 @@ ENCODE(OP_ZoneSpawns) VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->runspeed); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->race); - + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // ShowEQ calls this 'Holding' VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->deity); if(emu->NPC) @@ -2041,7 +2041,7 @@ ENCODE(OP_ZoneSpawns) Position->deltaZ = emu->deltaZ; Buffer += sizeof(structs::Spawn_Struct_Position); - + if(strlen(emu->title)) { VARSTRUCT_ENCODE_STRING(Buffer, emu->title); @@ -2052,7 +2052,7 @@ ENCODE(OP_ZoneSpawns) VARSTRUCT_ENCODE_STRING(Buffer, emu->suffix); } - Buffer += 8; + Buffer += 8; VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->IsMercenary); VARSTRUCT_ENCODE_STRING(Buffer, "0000000000000000"); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); @@ -2067,7 +2067,7 @@ ENCODE(OP_ZoneSpawns) //_hex(NET__ERROR, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } - + delete in; } @@ -2075,7 +2075,7 @@ ENCODE(OP_MercenaryDataResponse) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryMerchantList_Struct *emu = (MercenaryMerchantList_Struct *) __emu_buffer; @@ -2139,7 +2139,7 @@ ENCODE(OP_MercenaryDataUpdate) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryDataUpdate_Struct *emu = (MercenaryDataUpdate_Struct *) __emu_buffer; @@ -2219,7 +2219,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; InternalSerializedItem_Struct *int_struct=(InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); @@ -2261,7 +2261,7 @@ ENCODE(OP_CharInventory) { return; } - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -2269,7 +2269,7 @@ ENCODE(OP_CharInventory) { if(ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -2282,7 +2282,7 @@ ENCODE(OP_CharInventory) { in->pBuffer = new uchar[4]; *(uint32 *)in->pBuffer = ItemCount; - + in->size = 4; for(int r = 0; r < ItemCount; r++, eq++) { @@ -2326,42 +2326,42 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + // Guild ID buffer += sizeof(uint32); //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -2369,12 +2369,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -2387,7 +2387,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -2404,15 +2404,15 @@ ENCODE(OP_GuildMemberList) { e->zone_id = htons(emu_e->zone_id); e->unknown_one2 = htonl(1); e->unknown04 = 0; - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -2465,7 +2465,7 @@ ENCODE(OP_GroundSpawn) in->size = strlen(emu->object_name) + sizeof(Object_Struct) - 1; in->pBuffer = new unsigned char[in->size]; - + char *OutBuffer = (char *)in->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->drop_id); @@ -2484,7 +2484,7 @@ ENCODE(OP_GroundSpawn) VARSTRUCT_ENCODE_TYPE(int32, OutBuffer, emu->object_type); // Unknown, observed 0x00000014 delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -2504,7 +2504,7 @@ ENCODE(OP_ClickObjectAction) { ENCODE(OP_SendMembership) { ENCODE_LENGTH_EXACT(Membership_Struct); SETUP_DIRECT_ENCODE(Membership_Struct, structs::Membership_Struct); - + eq->membership = emu->membership; eq->races = emu->races; eq->classes = emu->classes; @@ -2677,7 +2677,7 @@ ENCODE(OP_LogServer) { ENCODE_LENGTH_EXACT(LogServer_Struct); SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); strncpy(eq->worldshortname, emu->worldshortname, sizeof(eq->worldshortname)); - + //OUT(enablevoicemacros); // These two are lost, but must be one of the 1s in unknown[249] //OUT(enablemail); OUT(enable_pvp); @@ -3030,7 +3030,7 @@ ENCODE(OP_Stun) { FINISH_ENCODE(); } -ENCODE(OP_ZonePlayerToBind) +ENCODE(OP_ZonePlayerToBind) { ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; @@ -3083,7 +3083,7 @@ ENCODE(OP_AdventureMerchantSell) { FINISH_ENCODE(); } -ENCODE(OP_RaidUpdate) +ENCODE(OP_RaidUpdate) { EQApplicationPacket *inapp = *p; *p = nullptr; @@ -3096,7 +3096,7 @@ ENCODE(OP_RaidUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; - + add_member->raidGen.action = in_add_member->raidGen.action; add_member->raidGen.parameter = in_add_member->raidGen.parameter; strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); @@ -3173,7 +3173,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -3331,7 +3331,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - + //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); if((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { @@ -3377,10 +3377,10 @@ ENCODE(OP_GroupUpdate) { // Group Update2 //_log(NET__ERROR, "Struct is GroupUpdate2"); - + unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*) __emu_buffer; - + //_log(NET__ERROR, "Yourname is %s", gu2->yourname); int MemberCount = 1; @@ -3402,7 +3402,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; - + // Header VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Think this should be SpawnID, but it doesn't seem to matter VARSTRUCT_ENCODE_TYPE(uint32, Buffer, MemberCount); @@ -3410,7 +3410,7 @@ ENCODE(OP_GroupUpdate) // Leader // - + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_STRING(Buffer, gu2->yourname); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); @@ -3452,7 +3452,7 @@ ENCODE(OP_GroupUpdate) GLAAus->NPCMarkerID = gu2->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &gu2->leader_aas, sizeof(GLAAus->LeaderAAs)); - + dest->FastQueuePacket(&outapp); delete in; @@ -3490,7 +3490,7 @@ ENCODE(OP_ChannelMessage) in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; in->pBuffer = new unsigned char[in->size]; - + char *OutBuffer = (char *)in->pBuffer; VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sender); @@ -3538,7 +3538,7 @@ ENCODE(OP_GuildsList) } InBuffer += 64; } - + PacketSize++; // Appears to be an extra 0x00 at the very end. in->size = PacketSize; @@ -3625,7 +3625,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -3682,7 +3682,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -3708,7 +3708,7 @@ ENCODE(OP_BuffCreate) __packet->size = sz; __packet->pBuffer = new unsigned char[sz]; memset(__packet->pBuffer, 0, sz); - + __packet->WriteUInt32(emu->entity_id); __packet->WriteUInt32(0); // PlayerID ? __packet->WriteUInt8(1); // 1 indicates all buffs on the player (0 to add or remove a single buff) @@ -3727,7 +3727,7 @@ ENCODE(OP_BuffCreate) __packet->WriteUInt32(emu->entries[i].spell_id); __packet->WriteUInt32(emu->entries[i].tics_remaining); __packet->WriteUInt32(0); // Unknown - __packet->WriteString(""); + __packet->WriteString(""); } __packet->WriteUInt8(0); // Unknown @@ -3779,7 +3779,7 @@ ENCODE(OP_SpawnAppearance) dest->FastQueuePacket(&in, ack_req); return; } - + EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); ChangeSize_Struct *css = (ChangeSize_Struct *)outapp->pBuffer; @@ -3790,7 +3790,7 @@ ENCODE(OP_SpawnAppearance) css->Unknown12 = 1.0f; dest->FastQueuePacket(&outapp, ack_req); - + delete in; } @@ -3857,7 +3857,7 @@ ENCODE(OP_RespondAA) { FINISH_ENCODE(); } -ENCODE(OP_AltCurrencySell) +ENCODE(OP_AltCurrencySell) { ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -3880,7 +3880,7 @@ ENCODE(OP_AltCurrency) if(opcode == 8) { AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); structs::AltCurrencyPopulate_Struct *out_populate = (structs::AltCurrencyPopulate_Struct*)outapp->pBuffer; @@ -4064,7 +4064,7 @@ DECODE(OP_PetCommands) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySellSelection) +DECODE(OP_AltCurrencySellSelection) { DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); @@ -4073,7 +4073,7 @@ DECODE(OP_AltCurrencySellSelection) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySell) +DECODE(OP_AltCurrencySell) { DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -4094,7 +4094,7 @@ DECODE(OP_ShopRequest) { FINISH_DIRECT_DECODE(); } -DECODE(OP_GuildRemove) +DECODE(OP_GuildRemove) { DECODE_LENGTH_EXACT(structs::GuildCommand_Struct); SETUP_DIRECT_DECODE(GuildCommand_Struct, structs::GuildCommand_Struct); @@ -4105,7 +4105,7 @@ DECODE(OP_GuildRemove) FINISH_DIRECT_DECODE(); } -DECODE(OP_GuildDemote) +DECODE(OP_GuildDemote) { DECODE_LENGTH_EXACT(structs::GuildDemoteStruct); SETUP_DIRECT_DECODE(GuildDemoteStruct, structs::GuildDemoteStruct); @@ -4144,7 +4144,7 @@ DECODE(OP_InspectRequest) { /*DECODE(OP_InspectAnswer) { DECODE_LENGTH_EXACT(structs::InspectResponse_Struct); SETUP_DIRECT_DECODE(InspectResponse_Struct, structs::InspectResponse_Struct); - + IN(TargetID); IN(playerid); @@ -4278,7 +4278,7 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { @@ -4287,7 +4287,7 @@ DECODE(OP_ItemLinkClick) { // Max Augs is now 6, but no code to support that many yet IN(link_hash); IN(icon); - + FINISH_DIRECT_DECODE(); } @@ -4331,7 +4331,7 @@ DECODE(OP_ShopPlayerBuy) } DECODE(OP_ClientUpdate) { - // for some odd reason, there is an extra byte on the end of this on occasion.. + // for some odd reason, there is an extra byte on the end of this on occasion.. DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); IN(spawn_id); @@ -4351,7 +4351,7 @@ DECODE(OP_ClientUpdate) { DECODE(OP_CharacterCreate) { DECODE_LENGTH_EXACT(structs::CharCreate_Struct); SETUP_DIRECT_DECODE(CharCreate_Struct, structs::CharCreate_Struct); - + IN(gender); IN(race); IN(class_); @@ -4361,7 +4361,7 @@ DECODE(OP_CharacterCreate) { emu->start_zone = RuleI(World, TutorialZoneID); else emu->start_zone = eq->start_zone; - + IN(haircolor); IN(beard); IN(beardcolor); @@ -4396,7 +4396,7 @@ DECODE(OP_WhoAllRequest) { IN(gmlookup); IN(guildid); IN(type); - + FINISH_DIRECT_DECODE(); } @@ -4842,7 +4842,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint const Item_Struct *item = inst->GetItem(); //_log(NET__ERROR, "Serialize called for: %s", item->Name); - + RoF::structs::ItemSerializationHeader hdr; //sprintf(hdr.unknown000, "06e0002Y1W00"); @@ -5090,7 +5090,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint //_log(NET__ERROR, "ItemBody tertiary struct is %i bytes", sizeof(RoF::structs::ItemTertiaryBodyStruct)); RoF::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(RoF::structs::ItemTertiaryBodyStruct)); - + itbs.loregroup = item->LoreGroup; itbs.artifact = item->ArtifactFlag; itbs.summonedflag = item->SummonedFlag; @@ -5306,7 +5306,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint uint32 SubLengths[10]; for(int x = 0; x < 10; ++x) { - + SubSerializations[x] = nullptr; const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); diff --git a/common/patches/RoF.h b/common/patches/RoF.h index 411a0a99b..fc2e94c95 100644 --- a/common/patches/RoF.h +++ b/common/patches/RoF.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace RoF { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "RoF_ops.h" }; - + }; diff --git a/common/patches/RoF_structs.h b/common/patches/RoF_structs.h index f3565d2ce..194bbdad0 100644 --- a/common/patches/RoF_structs.h +++ b/common/patches/RoF_structs.h @@ -32,21 +32,21 @@ struct WorldObjectsSent_Struct { struct ItemSlotStruct { /*000*/ int16 SlotType; // Worn and Normal inventory = 0, Bank = 1, Shared Bank = 2, Delete Item = -1 /*002*/ int16 Unknown02; -/*004*/ int16 MainSlot; +/*004*/ int16 MainSlot; /*006*/ int16 SubSlot; /*008*/ int16 AugSlot; // Guessing - Seen 0xffff /*010*/ int16 Unknown01; // Normally 0 - Seen 13262 when deleting an item, but didn't match item ID -/*012*/ +/*012*/ }; // New for RoF - Used for Merchant_Purchase_Struct // Can't sellfrom other than main inventory so Slot Type is not needed. struct MainInvItemSlotStruct { -/*000*/ int16 MainSlot; +/*000*/ int16 MainSlot; /*002*/ int16 SubSlot; /*004*/ int16 AugSlot; /*006*/ int16 Unknown01; -/*008*/ +/*008*/ }; /* Name Approval Struct */ @@ -217,7 +217,7 @@ struct Membership_Entry_Struct { /*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300 /*004*/ uint32 bitwise_entry; // Seen 16 to 65536 - Skips 4096 -/*008*/ +/*008*/ }; struct Membership_Setting_Struct @@ -225,7 +225,7 @@ struct Membership_Setting_Struct /*000*/ uint32 setting_index; // 0, 1, or 2 /*004*/ uint32 setting_id; // 0 to 21 /*008*/ int32 setting_value; // All can be 0, 1, or -1 -/*012*/ +/*012*/ }; struct Membership_Details_Struct @@ -249,7 +249,7 @@ struct Membership_Struct /*008*/ uint32 classes; // Seen ff ff 01 01 /*012*/ uint32 entrysize; // Seen 22 /*016*/ int32 entries[22]; // Most -1, 1, and 0 for Gold Status -/*104*/ +/*104*/ }; @@ -328,7 +328,7 @@ struct Spawn_Struct_Position signed padding0001:1; /*004*/ signed deltaX:13; // change in x - signed deltaHeading:10;// change in heading + signed deltaHeading:10;// change in heading signed padding0008:9; /*008*/ signed deltaY:13; @@ -343,7 +343,7 @@ struct Spawn_Struct_Position signed padding0020:7; }; -/* +/* struct Spawn_Struct_Position { signed padding0000:12; // ***Placeholder @@ -461,7 +461,7 @@ struct Spawn_Struct /*0000*/ //char suffix[0]; // only read if(hasTitleOrSuffix & 8) char unknown20[8]; uint8 IsMercenary; // If NPC == 1 and this == 1, then the NPC name is Orange. -/*0000*/ char unknown21[55]; +/*0000*/ char unknown21[55]; }; @@ -638,7 +638,7 @@ struct BeginCast_Struct /*000*/ uint32 spell_id; /*004*/ uint16 caster_id; /*006*/ uint32 cast_time; // in miliseconds -/*010*/ +/*010*/ }; struct CastSpell_Struct @@ -707,7 +707,7 @@ struct SpellBuffFade_Struct_Live { /*008*/ float unknown008; /*012*/ uint32 spellid; /*016*/ uint32 duration; -/*020*/ uint32 playerId; // Global player ID? +/*020*/ uint32 playerId; // Global player ID? /*024*/ uint8 unknown0028[68]; /*092*/ uint32 slotid; /*096*/ uint32 bufffade; @@ -917,10 +917,10 @@ struct BindStruct { struct PlayerProfile_Struct { /*00000*/ uint32 checksum; // -/*00004*/ uint32 checksum_size; // Value = ( Packet Size - 9 ) -/*00008*/ uint8 checksum_byte; // -/*00009*/ uint8 unknown_rof1[3]; // -/*00012*/ uint32 unknown_rof2; // +/*00004*/ uint32 checksum_size; // Value = ( Packet Size - 9 ) +/*00008*/ uint8 checksum_byte; // +/*00009*/ uint8 unknown_rof1[3]; // +/*00012*/ uint32 unknown_rof2; // /*00016*/ uint8 gender; // Player Gender - 0 Male, 1 Female /*00017*/ uint32 race; // Player race /*00021*/ uint8 class_; // Player class @@ -959,7 +959,7 @@ union /*00544*/ EquipStruct equip_ring2; // Equiptment: Non-visual /*00564*/ EquipStruct equip_waist; // Equiptment: Non-visual /*00584*/ EquipStruct equip_powersource; // Equiptment: Non-visual - /*00604*/ EquipStruct equip_ammo; // Equiptment: Non-visual + /*00604*/ EquipStruct equip_ammo; // Equiptment: Non-visual } equip; /*00184*/ EquipStruct equipment[22]; }; @@ -980,10 +980,10 @@ union /*00899*/ uint32 drakkin_heritage; // /*00903*/ uint32 drakkin_tattoo; // /*00907*/ uint32 drakkin_details; // -/*00911*/ uint8 unknown_rof6; // +/*00911*/ uint8 unknown_rof6; // /*00912*/ int8 unknown_rof7; // seen -1 -/*00913*/ uint8 unknown_rof8; // -/*00914*/ uint8 unknown_rof9; // +/*00913*/ uint8 unknown_rof8; // +/*00914*/ uint8 unknown_rof9; // /*00915*/ uint8 unknown_rof10; // Seen 1 or 0 (on a female?) /*00916*/ float height; // Seen 7.0 (barb), 5.0 (woodelf), 5.5 (halfelf) /*00920*/ float unknown_rof11; // Seen 3.0 @@ -1035,7 +1035,7 @@ union /*12897*/ uint32 copper_cursor; // Copper Pieces on cursor /*12901*/ uint32 intoxication; // Alcohol level (in ticks till sober?) - Position Guessed /*12905*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3) - Position Guessed -/*12909*/ uint32 unknown_rof19; // +/*12909*/ uint32 unknown_rof19; // /*12913*/ uint32 thirst_level; // Drink (ticks till next drink) - Position Guessed /*12917*/ uint32 hunger_level; // Food (ticks till next eat) - Position Guessed /*12921*/ uint32 aapoints_spent; // Number of spent AA points @@ -1046,7 +1046,7 @@ union /*12941*/ uint32 aa_spent_class; // Seen 103 /*12945*/ uint32 aa_spent_special; // Seen 0 /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 -/*12953*/ uint16 unknown_rof20; // +/*12953*/ uint16 unknown_rof20; // /*12955*/ uint32 bandolier_count; // Seen 20 /*12959*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 @@ -1057,15 +1057,15 @@ union /*13760*/ int32 mana_total; // Guessed - Only seen on casters so far - Matches above field if caster /*13764*/ uint32 unknown_rof22[12]; // Same for all seen PPs - 48 bytes: /* -19 00 00 00 19 00 00 00 19 00 00 00 0f 00 00 00 -0f 00 00 00 0f 00 00 00 0f 00 00 00 1f 85 eb 3e +19 00 00 00 19 00 00 00 19 00 00 00 0f 00 00 00 +0f 00 00 00 0f 00 00 00 0f 00 00 00 1f 85 eb 3e 33 33 33 3f 08 00 00 00 02 00 00 00 01 00 00 00 */ /*13812*/ uint32 unknown_rof23; // Seen 5, 19, and 20 in examples -/*13816*/ uint32 unknown_rof24[4]; // +/*13816*/ uint32 unknown_rof24[4]; // /*13832*/ uint32 unknown_rof25[2]; // Seen random numbers from 0 to 2165037 /*13840*/ uint32 unknown_rof26; // Seen 106 -//END SUB-STRUCT used for shrouding. +//END SUB-STRUCT used for shrouding. /*13844*/ uint32 name_str_len; // Seen 64 /*13848*/ char name[64]; // Name of player - 19960 for Live 1180 difference /*13912*/ uint32 last_name_str_len; // Seen 32 @@ -1086,34 +1086,34 @@ union /*14024*/ float heading; // Players heading /*14028*/ uint32 air_remaining; // Air supply (seconds) /*14032*/ int32 unknown_rof28; // Seen -1 -/*14036*/ uint8 unknown_rof29[10]; // +/*14036*/ uint8 unknown_rof29[10]; // /*14046*/ uint32 unknown_rof30; // Random large number or 0 -/*14050*/ uint32 unknown_rof31; // -/*14054*/ uint32 unknown32_count; // Seen 5 -/*14058*/ uint8 unknown_rof32[29]; // +/*14050*/ uint32 unknown_rof31; // +/*14054*/ uint32 unknown32_count; // Seen 5 +/*14058*/ uint8 unknown_rof32[29]; // /*14087*/ uint32 unknown33_count; // Seen 32 for melee/hybrid and 21 for druid, 34 for mage /*14091*/ uint32 unknown_rof33[64]; // Struct contains 2 ints, so double 32 count (Variable Sized) // Position Varies after this point - Really starts varying at Bandolier names, but if no names set it starts here /*00000*/ int32 unknown_rof34; // Seen -1 /*00000*/ int32 unknown_rof35; // Seen -1 -/*00000*/ uint8 unknown_rof36[18]; // +/*00000*/ uint8 unknown_rof36[18]; // /*00000*/ uint32 unknown37_count; // Seen 5 /*00000*/ int32 unknown_rof37[10]; // Alternates -1 and 0 - Struct contains 2 ints /*00000*/ uint32 unknown38_count; // Seen 10 /*00000*/ int32 unknown_rof38[20]; // Alternates -1 and 0 - Struct contains 2 ints -/*00000*/ uint8 unknown_rof39[137]; // +/*00000*/ uint8 unknown_rof39[137]; // /*00000*/ float unknown_rof40; // Seen 1.0 -/*00000*/ uint32 unknown_rof41[9]; // +/*00000*/ uint32 unknown_rof41[9]; // /*00000*/ uint32 unknown_rof42; // Seen 0 or 1 /*00000*/ uint32 unknown_string1_count; // Seen 64 -/*00000*/ char unknown_string1[64]; // -/*00000*/ uint8 unknown_rof43[30]; // +/*00000*/ char unknown_string1[64]; // +/*00000*/ uint8 unknown_rof43[30]; // /*00000*/ uint32 unknown_string2_count; // Seen 64 -/*00000*/ char unknown_string2[64]; // +/*00000*/ char unknown_string2[64]; // /*00000*/ uint32 unknown_string3_count; // Seen 64 -/*00000*/ char unknown_string3[64]; // +/*00000*/ char unknown_string3[64]; // /*00000*/ uint32 unknown_rof44; // Seen 0 or 50 -/*00000*/ uint8 unknown_rof45[663]; // +/*00000*/ uint8 unknown_rof45[663]; // /*00000*/ uint32 char_id; // Guessed based on char creation date and values /*00000*/ uint8 unknown_rof46; // Seen 0 or 1 /*00000*/ uint32 unknown_rof47; // Seen 6 @@ -1121,7 +1121,7 @@ union /*00000*/ uint32 unknown_rof49; // Seen 64 /*00000*/ uint8 unknown_rof50[256]; // Seen mostly 0s, but one example had a 2 in the middle /*00000*/ uint32 unknown_rof51; // Seen 100 or 0 -/*00000*/ uint8 unknown_rof52[82]; // +/*00000*/ uint8 unknown_rof52[82]; // /*00000*/ uint32 unknown_rof53; // Seen 50 uint8 unknown_rof54[1325]; // Unknown Section @@ -1418,7 +1418,7 @@ struct CombatDamage_Struct /* 21 */ uint8 unknown19[9]; // was [9] /* 30 */ }; - + /* ** Consider Struct @@ -1431,7 +1431,7 @@ struct Consider_Struct{ /*012*/ uint32 level; // Level /*016*/ uint8 pvpcon; // Pvp con flag 0/1 /*017*/ uint8 unknown017[3]; // -/*020*/ +/*020*/ }; /* @@ -1526,7 +1526,7 @@ struct PlayerPositionUpdateServer_Struct signed y_pos:19; // y coord unsigned padding:1; /*0008*/ signed delta_x:13; // change in x - signed delta_heading:10;// change in heading + signed delta_heading:10;// change in heading signed padding0008:9; /*0012*/ signed delta_y:13; // change in y signed z_pos:19; // z coord @@ -1555,14 +1555,14 @@ struct PlayerPositionUpdateClient_Struct /*0014*/ float x_pos; // x coord (2nd loc value) /*0018*/ float y_pos; // y coord (1st loc value) /*0022*/ signed delta_heading:10; // change in heading - unsigned animation:10; // ***Placeholder + unsigned animation:10; // ***Placeholder unsigned padding0024:12; // animation /*0026*/ float delta_z; // Change in z /*0030*/ float delta_x; // Change in x /*0034*/ float z_pos; // z coord (3rd loc value) /*0038*/ unsigned heading:12; // Directional heading - unsigned padding0040:10; // ***Placeholder - unsigned padding0041:10; // ***Placeholder + unsigned padding0040:10; // ***Placeholder + unsigned padding0041:10; // ***Placeholder /*0042*/ }; @@ -2004,7 +2004,7 @@ struct Merchant_Click_Struct { /*012*/ float rate; // cost multiplier, dosent work anymore /*016*/ int32 unknown01; // Seen 3 from Server or -1 from Client /*020*/ int32 unknown02; // Seen 2592000 from Server or -1 from Client -/*024*/ +/*024*/ }; /* Unknowns: @@ -2097,7 +2097,7 @@ struct AltCurrencyUpdate_Struct { /*084*/ uint32 unknown084; //seen 0 }; -//Client -> Server +//Client -> Server //When an item is selected while the alt currency merchant window is open struct AltCurrencySelectItem_Struct { /*000*/ uint32 merchant_entity_id; @@ -2128,7 +2128,7 @@ struct AltCurrencySelectItem_Struct { //eg: "I will give you no doubloons for a cloth cap." //Probably also sends amounts somewhere struct AltCurrencySelectItemReply_Struct { -/*000*/ uint32 unknown000; +/*000*/ uint32 unknown000; /*004*/ uint8 unknown004; //0xff /*005*/ uint8 unknown005; //0xff /*006*/ uint8 unknown006; //0xff @@ -2232,7 +2232,7 @@ struct AdventureLeaderboard_Struct /*008*/ uint32 success; /*012*/ uint32 failure; /*016*/ uint32 our_rank; -/*020*/ +/*020*/ }; /*struct Item_Shop_Struct { @@ -2501,7 +2501,7 @@ struct Who_All_Struct { // 156 length total /*080*/ uint32 gmlookup; // FF FF = not doing /who all gm /*084*/ uint32 guildid; // Also used for Buyer/Trader/LFG /*152*/ uint32 type; // 0 = /who 3 = /who all -/*156*/ +/*156*/ }; struct Stun_Struct { // 8 bytes total @@ -2637,9 +2637,9 @@ struct BookRequest_Struct { /*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). /*0004*/ uint16 invslot; // Is the slot, but the RoF conversion causes it to fail. Turned to 0 since it isnt required anyway. /*0008*/ uint32 unknown006; // Seen FFFFFFFF -/*0010*/ uint16 unknown008; // seen 0000 +/*0010*/ uint16 unknown008; // seen 0000 /*0012*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others -/*0016*/ uint32 unknown0012; +/*0016*/ uint32 unknown0012; /*0020*/ uint16 unknown0016; /*0022*/ char txtfile[8194]; }; @@ -2735,7 +2735,7 @@ struct Door_Struct /*0054*/ uint8 unknown0054[4]; // 00 00 00 00 /*0060*/ uint8 doorId; // door's id # /*0061*/ uint8 opentype; -/*0062*/ uint8 state_at_spawn; +/*0062*/ uint8 state_at_spawn; /*0063*/ uint8 invert_state; // if this is 1, the door is normally open /*0064*/ uint32 door_param; // normally ff ff ff ff (-1) /*0068*/ uint32 unknown0068; // 00 00 00 00 @@ -3046,7 +3046,7 @@ struct Tracking_Struct_New { struct Track_Struct_New { uint16 entityid; // Entity ID uint16 unknown002; // 00 00 - uint32 unknown004; // + uint32 unknown004; // uint8 level; // level of mob uint8 unknown009; // 01 maybe type of mob? player/npc? char name[1]; // name of mob @@ -3242,13 +3242,13 @@ struct GuildMemberEntry_Struct { char name[1]; // variable length uint32 level; uint32 banker; // 1=yes, 0=no - uint32 class_; - uint32 rank; - uint32 time_last_on; - uint32 tribute_enable; + uint32 class_; + uint32 rank; + uint32 time_last_on; + uint32 tribute_enable; uint32 unknown01; // Seen 0 uint32 total_tribute; // total guild tribute donated, network byte order - uint32 last_tribute; // unix timestamp + uint32 last_tribute; // unix timestamp uint32 unknown_one; // unknown, set to 1 char public_note[1]; // variable length. uint16 zoneinstance; // Seen 0s or -1 in RoF @@ -3258,7 +3258,7 @@ struct GuildMemberEntry_Struct { }; //just for display purposes, this is not actually used in the message encoding other than for size. -struct GuildMembers_Struct { +struct GuildMembers_Struct { char player_name[1]; // variable length. uint32 guildid; // Was unknown02 - network byte order uint32 count; // network byte order @@ -3695,7 +3695,7 @@ struct TaskDescription_Struct { /*044*/ uint16 unknown39; /*046*/ char reward_link[1]; //variable length, 0 terminated /*047*/ uint32 unknown43; //maybe crystal count? -/*051*/ +/*051*/ }; #endif @@ -3724,7 +3724,7 @@ struct TaskActivity_Struct { /*032*/ char Text1[1]; // Variable length - Null terminated /*000*/ uint32 Text2Len; // Lenth of the following string /*000*/ char Text2[1]; // Variable length - not Null terminated -/*000*/ uint32 GoalCount; +/*000*/ uint32 GoalCount; /*000*/ uint32 String1Len; // Lenth of the following string - Seen 2 /*000*/ char String1[1]; // Numeric String - Seen "-1" - not Null terminated /*000*/ uint32 String2Len; // Lenth of the following string - Seen 2 @@ -4338,7 +4338,7 @@ struct ItemBodyStruct uint32 icon; uint8 unknown1; uint8 unknown2; - uint32 BenefitFlag; + uint32 BenefitFlag; uint8 tradeskills; int8 CR; int8 DR; @@ -4468,9 +4468,9 @@ struct ItemTertiaryBodyStruct uint8 no_transfer; uint16 expendablearrow; - uint32 unknown8; - uint32 unknown9; - uint32 unknown10; + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; uint32 unknown11; uint8 unknown12; uint8 unknown13; @@ -4549,7 +4549,7 @@ struct ItemQuaternaryBodyStruct int32 clairvoyance; uint8 unknown18; //Power Source Capacity or evolve filename? uint32 evolve_string; // Some String, but being evolution related is just a guess - uint8 unknown19; + uint8 unknown19; uint32 unknown20; // Bard Stuff? //uint32 unknown21; uint8 unknown22; @@ -4559,7 +4559,7 @@ struct ItemQuaternaryBodyStruct float unknown26; float unknown27; uint32 unknown_RoF6; // 0 New to March 21 2012 client - uint32 unknown28; // 0xffffffff + uint32 unknown28; // 0xffffffff uint16 unknown29; uint32 unknown30; // 0xffffffff uint16 unknown31; diff --git a/common/patches/SSDefine.h b/common/patches/SSDefine.h index ea301e0de..23d5dbbad 100644 --- a/common/patches/SSDefine.h +++ b/common/patches/SSDefine.h @@ -1,5 +1,5 @@ -#define ENCODE(x) void Strategy::Encode_##x(EQApplicationPacket **p, EQStream *dest, bool ack_req) +#define ENCODE(x) void Strategy::Encode_##x(EQApplicationPacket **p, EQStream *dest, bool ack_req) #define DECODE(x) void Strategy::Decode_##x(EQApplicationPacket *__packet) #define StructDist(in, f1, f2) (uint32(&in->f2)-uint32(&in->f1)) @@ -10,9 +10,9 @@ /* - * + * * for encoders - * + * */ //more complex operations and variable length packets #define FASTQUEUE(packet) dest->FastQueuePacket(&packet, ack_req); @@ -55,7 +55,7 @@ #define FAIL_ENCODE() \ delete[] __emu_buffer; \ delete __packet; - + //call to finish an encoder using SETUP_DIRECT_ENCODE #define FINISH_ENCODE() \ delete[] __emu_buffer; \ @@ -93,9 +93,9 @@ /* - * + * * for decoders: - * + * */ //simple buffer-to-buffer movement for fixed length packets @@ -118,10 +118,10 @@ #define FAIL_DIRECT_DECODE() \ delete[] __eq_buffer; \ p->SetOpcode(OP_Unknown); - + //call to finish an encoder using SETUP_DIRECT_DECODE #define FINISH_DIRECT_DECODE() \ - delete[] __eq_buffer; + delete[] __eq_buffer; //check length of packet before decoding. Call before setup. #define DECODE_LENGTH_EXACT(struct_) \ diff --git a/common/patches/SoD.cpp b/common/patches/SoD.cpp index cfbfba2ef..04fb6729a 100644 --- a/common/patches/SoD.cpp +++ b/common/patches/SoD.cpp @@ -22,7 +22,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -38,37 +38,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -98,7 +98,7 @@ std::string Strategy::Describe() const { r += name; return(r); } - + const EQClientVersion Strategy::ClientVersion() const { return EQClientSoD; @@ -115,7 +115,7 @@ static inline uint32 TitaniumToSoDSlot(uint32 TitaniumSlot) { { SoDSlot = TitaniumSlot + 1; } - else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor + else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor { SoDSlot = TitaniumSlot + 11; } @@ -134,20 +134,20 @@ static inline uint32 TitaniumToSoDSlot(uint32 TitaniumSlot) { else { SoDSlot = TitaniumSlot; - } - + } + return SoDSlot; } // Converts SoD Slot IDs to Titanium Slot IDs for use in Decodes static inline uint32 SoDToTitaniumSlot(uint32 SoDSlot) { uint32 TitaniumSlot = 0; - + if(SoDSlot >= 22 && SoDSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots { TitaniumSlot = SoDSlot - 1; } - else if(SoDSlot >= 262 && SoDSlot <= 351) // Bag Slots for Normal Inventory and Cursor + else if(SoDSlot >= 262 && SoDSlot <= 351) // Bag Slots for Normal Inventory and Cursor { TitaniumSlot = SoDSlot - 11; } @@ -186,7 +186,7 @@ ENCODE(OP_OpenNewTasksWindow) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; @@ -222,7 +222,7 @@ ENCODE(OP_OpenNewTasksWindow) { __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen // in Live packets. Changing it to 0x3f000000 makes the title red. - __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->unknown1 = 0x3f800000; __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; @@ -281,7 +281,7 @@ ENCODE(OP_OpenNewTasksWindow) { } delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -289,8 +289,8 @@ ENCODE(OP_OpenNewTasksWindow) { ENCODE(OP_SendCharInfo) { ENCODE_LENGTH_EXACT(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - - + + //EQApplicationPacket *packet = *p; //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; @@ -309,10 +309,10 @@ ENCODE(OP_SendCharInfo) { + namelen; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); - + //unsigned char *eq_buffer = new unsigned char[total_length]; //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; - + eq->char_count = char_count; eq->total_chars = 10; @@ -359,9 +359,9 @@ ENCODE(OP_SendCharInfo) { } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } - + FINISH_ENCODE(); - + } ENCODE(OP_ZoneServerInfo) { @@ -369,8 +369,8 @@ ENCODE(OP_ZoneServerInfo) { OUT_str(ip); OUT(port); FINISH_ENCODE(); - - //this is SUCH bullshit to be doing from down here. but the + + //this is SUCH bullshit to be doing from down here. but the // new client requires us to close immediately following this // packet, so do it. //dest->Close(); @@ -379,17 +379,17 @@ ENCODE(OP_ZoneServerInfo) { //hack hack hack ENCODE(OP_SendZonepoints) { ENCODE_LENGTH_ATLEAST(ZonePoints); - + SETUP_VAR_ENCODE(ZonePoints); ALLOC_VAR_ENCODE(structs::ZonePoints, __packet->size); - + memcpy(eq, emu, __packet->size); - + FINISH_ENCODE(); // unknown0xxx[24]; //this is utter crap... the client is waiting for this //certain 0 length opcode to come after the reqclientspawn - //stuff... so this is a dirty way to put it in there. + //stuff... so this is a dirty way to put it in there. // this needs to be done better //EQApplicationPacket hack_test(OP_PetitionUnCheckout, 0); @@ -399,10 +399,10 @@ ENCODE(OP_SendZonepoints) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 5 is for SoD if (emu->clientver <= 5 ) @@ -459,13 +459,13 @@ ENCODE(OP_LeadershipExpUpdate) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + eq->available_slots=0xffffffff; memset(eq->unknown4184, 0xff, sizeof(eq->unknown4184)); memset(eq->unknown04396, 0xff, sizeof(eq->unknown04396)); - + // OUT(checksum); OUT(gender); OUT(race); @@ -558,7 +558,7 @@ ENCODE(OP_PlayerProfile) { OUT(aapoints_spent); OUT(aapoints); // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep + //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for(r = 0; r < 4; r++) { OUT_str(bandoliers[r].name); @@ -681,12 +681,12 @@ const uint8 bytes[] = { }; memcpy(eq->unknown12864, bytes, sizeof(bytes)); - - + + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -721,7 +721,7 @@ ENCODE(OP_NewZone) { OUT_str(zone_short_name2); OUT(zone_id); OUT(zone_instance); - OUT(SuspendBuffs); + OUT(SuspendBuffs); /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown800 = -1; eq->unknown844 = 600; @@ -867,7 +867,7 @@ ENCODE(OP_Barter) delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); - + } ENCODE(OP_InspectRequest) { @@ -946,11 +946,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -959,7 +959,7 @@ ENCODE(OP_ZoneSpawns) { return; } - + //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); emu = (Spawn_Struct *) __emu_buffer; @@ -968,7 +968,7 @@ ENCODE(OP_ZoneSpawns) { char *Buffer = (char *) in->pBuffer; - + int r; int k; for(r = 0; r < entrycount; r++, emu++) { @@ -1141,7 +1141,7 @@ ENCODE(OP_ZoneSpawns) { { VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); } - + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->curHp); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->haircolor); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->beardcolor); @@ -1199,8 +1199,8 @@ ENCODE(OP_ZoneSpawns) { Position->deltaZ = emu->deltaZ; Buffer += sizeof(structs::Spawn_Struct_Position); - - if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) + + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) { for(k = 0; k < 9; ++k) { @@ -1254,7 +1254,7 @@ ENCODE(OP_ZoneSpawns) { dest->FastQueuePacket(&outapp, ack_req); } - + delete in; } @@ -1262,7 +1262,7 @@ ENCODE(OP_MercenaryDataResponse) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryMerchantList_Struct *emu = (MercenaryMerchantList_Struct *) __emu_buffer; @@ -1329,7 +1329,7 @@ ENCODE(OP_MercenaryDataUpdate) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryDataUpdate_Struct *emu = (MercenaryDataUpdate_Struct *) __emu_buffer; @@ -1400,7 +1400,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; InternalSerializedItem_Struct *int_struct=(InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); @@ -1442,7 +1442,7 @@ ENCODE(OP_CharInventory) { return; } - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -1450,7 +1450,7 @@ ENCODE(OP_CharInventory) { if(ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -1463,7 +1463,7 @@ ENCODE(OP_CharInventory) { in->pBuffer = new uchar[4]; *(uint32 *)in->pBuffer = ItemCount; - + in->size = 4; for(int r = 0; r < ItemCount; r++, eq++) { @@ -1507,39 +1507,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -1547,12 +1547,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -1568,7 +1568,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -1582,15 +1582,15 @@ ENCODE(OP_GuildMemberList) { SlideStructString( public_note, emu_note ); e->zoneinstance = 0; e->zone_id = htons(emu_e->zone_id); - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -1741,16 +1741,16 @@ ENCODE(OP_LogServer) { ENCODE_LENGTH_EXACT(LogServer_Struct); SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); strcpy(eq->worldshortname, emu->worldshortname); - + OUT(enablevoicemacros); OUT(enablemail); OUT(enable_pvp); OUT(enable_FV); - + // These next two need to be set like this for the Tutorial Button to work. eq->unknown263[0] = 0; eq->unknown263[2] = 1; - + FINISH_ENCODE(); } @@ -1977,7 +1977,7 @@ ENCODE(OP_Stun) { FINISH_ENCODE(); } -ENCODE(OP_ZonePlayerToBind) +ENCODE(OP_ZonePlayerToBind) { ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; @@ -2030,7 +2030,7 @@ ENCODE(OP_AdventureMerchantSell) { FINISH_ENCODE(); } -ENCODE(OP_RaidUpdate) +ENCODE(OP_RaidUpdate) { EQApplicationPacket *inapp = *p; *p = nullptr; @@ -2043,7 +2043,7 @@ ENCODE(OP_RaidUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; - + add_member->raidGen.action = in_add_member->raidGen.action; add_member->raidGen.parameter = in_add_member->raidGen.parameter; strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); @@ -2120,7 +2120,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -2273,7 +2273,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -2330,7 +2330,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -2359,7 +2359,7 @@ ENCODE(OP_TargetBuffs) uchar *ptr = __packet->pBuffer; *((uint32*)ptr) = emu->entity_id; ptr += sizeof(uint32); - + *((uint16*)ptr) = emu->count; ptr += sizeof(uint16); @@ -2401,7 +2401,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - + //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); if((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { @@ -2447,10 +2447,10 @@ ENCODE(OP_GroupUpdate) { // Group Update2 //_log(NET__ERROR, "Struct is GroupUpdate2"); - + unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*) __emu_buffer; - + //_log(NET__ERROR, "Yourname is %s", gu2->yourname); int MemberCount = 1; @@ -2472,7 +2472,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; - + // Header VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Think this should be SpawnID, but it doesn't seem to matter VARSTRUCT_ENCODE_TYPE(uint32, Buffer, MemberCount); @@ -2480,7 +2480,7 @@ ENCODE(OP_GroupUpdate) // Leader // - + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_STRING(Buffer, gu2->yourname); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); @@ -2522,7 +2522,7 @@ ENCODE(OP_GroupUpdate) GLAAus->NPCMarkerID = gu2->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &gu2->leader_aas, sizeof(GLAAus->LeaderAAs)); - + dest->FastQueuePacket(&outapp); delete in; @@ -2548,7 +2548,7 @@ ENCODE(OP_GroupUpdate) dest->FastQueuePacket(&outapp); } -ENCODE(OP_AltCurrencySell) +ENCODE(OP_AltCurrencySell) { ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -2689,7 +2689,7 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { @@ -2697,7 +2697,7 @@ DECODE(OP_ItemLinkClick) { } IN(link_hash); IN(icon); - + FINISH_DIRECT_DECODE(); } @@ -2740,7 +2740,7 @@ DECODE(OP_ShopPlayerBuy) } DECODE(OP_ClientUpdate) { - // for some odd reason, there is an extra byte on the end of this on occasion.. + // for some odd reason, there is an extra byte on the end of this on occasion.. DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); IN(spawn_id); @@ -2771,7 +2771,7 @@ DECODE(OP_CharacterCreate) { emu->start_zone = RuleI(World, TutorialZoneID); else emu->start_zone = eq->start_zone; - + IN(haircolor); IN(deity); IN(STR); @@ -2803,7 +2803,7 @@ DECODE(OP_WhoAllRequest) { IN(gmlookup); IN(guildid); IN(type); - + FINISH_DIRECT_DECODE(); } @@ -3277,7 +3277,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint SoD::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(SoD::structs::ItemTertiaryBodyStruct)); - + itbs.loregroup = item->LoreGroup; itbs.artifact = item->ArtifactFlag; itbs.summonedflag = item->SummonedFlag; @@ -3452,7 +3452,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint uint32 SubLengths[10]; for(int x = 0; x < 10; ++x) { - + SubSerializations[x] = nullptr; const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); @@ -3512,11 +3512,11 @@ DECODE(OP_Bug) strn0cpy(emu->target_name, eq->target_name, sizeof(emu->target_name)); strn0cpy(emu->bug, eq->bug, sizeof(emu->bug)); strn0cpy(emu->system_info, eq->system_info, sizeof(emu->system_info)); - + FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySellSelection) +DECODE(OP_AltCurrencySellSelection) { DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); @@ -3525,7 +3525,7 @@ DECODE(OP_AltCurrencySellSelection) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySell) +DECODE(OP_AltCurrencySell) { DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); diff --git a/common/patches/SoD.h b/common/patches/SoD.h index 7af599e4b..960cd2afa 100644 --- a/common/patches/SoD.h +++ b/common/patches/SoD.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace SoD { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "SoD_ops.h" }; - + }; diff --git a/common/patches/SoD_structs.h b/common/patches/SoD_structs.h index 95f4b22ef..2f1dcd990 100644 --- a/common/patches/SoD_structs.h +++ b/common/patches/SoD_structs.h @@ -621,7 +621,7 @@ struct CharCreate_Struct { /*0000*/ uint32 class_; /*0004*/ uint32 haircolor; -/*0008*/ uint32 beard; +/*0008*/ uint32 beard; /*0012*/ uint32 beardcolor; /*0016*/ uint32 gender; /*0020*/ uint32 race; @@ -845,7 +845,7 @@ struct PlayerProfile_Struct /*04160*/ uint32 INT; // Intelligence - 3c 00 00 00 - 60 /*04164*/ uint32 AGI; // Agility - 5f 00 00 00 - 95 /*04168*/ uint32 WIS; // Wisdom - 46 00 00 00 - 70 -/*04172*/ uint8 unknown04172[28]; // +/*04172*/ uint8 unknown04172[28]; // /*04200*/ uint8 face; // Player face /*04201*/ uint8 unknown02264[147]; // was [175] /*04348*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 480 = 60 pages [1920] @@ -967,7 +967,7 @@ struct PlayerProfile_Struct /*22448*/ uint32 level3; // SoF looks at the level here to determine how many leadership AA you can bank. /*22452*/ uint32 showhelm; // 0=no, 1=yes /*22456*/ uint32 RestTimer; -/*22460*/ uint8 unknown19584[1028]; // ***Placeholder (2/13/2007) was[1028]or[940]or[1380] - END of Struct +/*22460*/ uint8 unknown19584[1028]; // ***Placeholder (2/13/2007) was[1028]or[940]or[1380] - END of Struct /*23488*/ }; @@ -1223,7 +1223,7 @@ struct Consider_Struct{ /*012*/ uint32 level; // Level /*016*/ uint8 pvpcon; // Pvp con flag 0/1 /*017*/ uint8 unknown017[3]; // -/*020*/ +/*020*/ }; /* @@ -1346,14 +1346,14 @@ struct PlayerPositionUpdateClient_Struct /*0012*/ float y_pos; // y coord (1st loc value) /*0016*/ signed delta_heading:10; // change in heading unsigned padding0036:10; // animation - unsigned padding0016:12; // ***Placeholder + unsigned padding0016:12; // ***Placeholder /*0020*/ float delta_x; // Change in x /*0024*/ float delta_y; // Change in y /*0028*/ float z_pos; // z coord (3rd loc value) /*0032*/ float delta_z; // Change in z -/*0036*/ unsigned animation:10; // ***Placeholder +/*0036*/ unsigned animation:10; // ***Placeholder unsigned heading:12; // Directional heading - unsigned padding0037:10; // ***Placeholder + unsigned padding0037:10; // ***Placeholder /*0040*/ }; @@ -1900,7 +1900,7 @@ struct AdventureLeaderboard_Struct /*008*/ uint32 success; /*012*/ uint32 failure; /*016*/ uint32 our_rank; -/*020*/ +/*020*/ }; /*struct Item_Shop_Struct { @@ -1925,15 +1925,15 @@ struct Illusion_Struct { //size: 256 /*079*/ uint8 unknown079; // /*080*/ uint32 face; // /*084*/ uint8 hairstyle; // Some Races don't change Hair Style Properly in SoF -/*085*/ uint8 haircolor; // -/*086*/ uint8 beard; // -/*087*/ uint8 beardcolor; // -/*088*/ float size; // +/*085*/ uint8 haircolor; // +/*086*/ uint8 beard; // +/*087*/ uint8 beardcolor; // +/*088*/ float size; // /*092*/ uint8 unknown092[148]; /*240*/ uint32 unknown240; // Removes armor? -/*244*/ uint32 drakkin_heritage; // -/*248*/ uint32 drakkin_tattoo; // -/*252*/ uint32 drakkin_details; // +/*244*/ uint32 drakkin_heritage; // +/*248*/ uint32 drakkin_tattoo; // +/*252*/ uint32 drakkin_details; // /*256*/ }; @@ -2291,7 +2291,7 @@ struct BookRequest_Struct { /*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). /*0004*/ uint32 invslot; // The inventory slot the book is in. Not used, but echoed in the response packet. /*0008*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others -/*0012*/ uint32 unknown0012; +/*0012*/ uint32 unknown0012; /*0016*/ uint16 unknown0016; /*0018*/ char txtfile[8194]; }; @@ -2392,7 +2392,7 @@ struct Door_Struct /*0054*/ uint8 unknown0054[4]; // 00 00 00 00 /*0060*/ uint8 doorId; // door's id # /*0061*/ uint8 opentype; -/*0062*/ uint8 state_at_spawn; +/*0062*/ uint8 state_at_spawn; /*0063*/ uint8 invert_state; // if this is 1, the door is normally open /*0064*/ uint32 door_param; // normally ff ff ff ff (-1) /*0068*/ uint32 unknown0068; // 00 00 00 00 @@ -2694,7 +2694,7 @@ struct Tracking_Struct_New { struct Track_Struct_New { uint16 entityid; // Entity ID uint16 unknown002; // 00 00 - uint32 unknown004; // + uint32 unknown004; // uint8 level; // level of mob uint8 unknown009; // 01 maybe type of mob? player/npc? char name[1]; // name of mob @@ -3893,7 +3893,7 @@ struct ItemBodyStruct uint32 icon; uint8 unknown1; uint8 unknown2; - uint32 BenefitFlag; + uint32 BenefitFlag; uint8 tradeskills; int8 CR; int8 DR; @@ -3963,7 +3963,7 @@ struct ItemBodyStruct uint32 FactionMod4; int32 FactionAmt4; //int16 unknown14; - + }; struct AugSlotStruct @@ -3998,9 +3998,9 @@ struct ItemTertiaryBodyStruct uint8 no_transfer; uint16 expendablearrow; - uint32 unknown8; - uint32 unknown9; - uint32 unknown10; + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; uint32 unknown11; uint8 unknown12; uint8 unknown13; @@ -4205,7 +4205,7 @@ struct AltCurrencySellItem_Struct { }; struct MercenaryGrade_Struct { -uint32 GradeCountEntry; +uint32 GradeCountEntry; }; // Used by MercenaryListEntry_Struct @@ -4267,7 +4267,7 @@ struct MercenaryData_Struct { // [OPCode: 0x6537] On Live as of April 2 2012 [Server->Client] // Should be named OP_MercenaryDataResponse, but the current opcode using that name should be renamed first // Size varies if mercenary is hired or if browsing Mercenary Merchant -// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 +// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 struct MercenaryDataUpdate_Struct { /*0000*/ int32 MercStatus; // Seen 0 with merc and -1 with no merc hired /*0004*/ uint32 MercCount; // Seen 1 with 1 merc hired and 0 with no merc hired diff --git a/common/patches/SoF.cpp b/common/patches/SoF.cpp index 823f62d11..67610bc30 100644 --- a/common/patches/SoF.cpp +++ b/common/patches/SoF.cpp @@ -22,7 +22,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -38,37 +38,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -98,7 +98,7 @@ std::string Strategy::Describe() const { r += name; return(r); } - + const EQClientVersion Strategy::ClientVersion() const { return EQClientSoF; @@ -115,7 +115,7 @@ static inline uint32 TitaniumToSoFSlot(uint32 TitaniumSlot) { { SoFSlot = TitaniumSlot + 1; } - else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor + else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor { SoFSlot = TitaniumSlot + 11; } @@ -134,20 +134,20 @@ static inline uint32 TitaniumToSoFSlot(uint32 TitaniumSlot) { else { SoFSlot = TitaniumSlot; - } - + } + return SoFSlot; } // Converts Sof Slot IDs to Titanium Slot IDs for use in Decodes static inline uint32 SoFToTitaniumSlot(uint32 SoFSlot) { uint32 TitaniumSlot = 0; - + if(SoFSlot >= 22 && SoFSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots { TitaniumSlot = SoFSlot - 1; } - else if(SoFSlot >= 262 && SoFSlot <= 351) // Bag Slots for Normal Inventory and Cursor + else if(SoFSlot >= 262 && SoFSlot <= 351) // Bag Slots for Normal Inventory and Cursor { TitaniumSlot = SoFSlot - 11; } @@ -186,7 +186,7 @@ ENCODE(OP_OpenNewTasksWindow) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; @@ -222,7 +222,7 @@ ENCODE(OP_OpenNewTasksWindow) { __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen // in Live packets. Changing it to 0x3f000000 makes the title red. - __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->unknown1 = 0x3f800000; __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; @@ -281,7 +281,7 @@ ENCODE(OP_OpenNewTasksWindow) { } delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -289,8 +289,8 @@ ENCODE(OP_OpenNewTasksWindow) { ENCODE(OP_SendCharInfo) { ENCODE_LENGTH_EXACT(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - - + + //EQApplicationPacket *packet = *p; //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; @@ -309,10 +309,10 @@ ENCODE(OP_SendCharInfo) { + namelen; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); - + //unsigned char *eq_buffer = new unsigned char[total_length]; //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; - + eq->char_count = char_count; eq->total_chars = 10; @@ -359,9 +359,9 @@ ENCODE(OP_SendCharInfo) { } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } - + FINISH_ENCODE(); - + } ENCODE(OP_ZoneServerInfo) { @@ -369,8 +369,8 @@ ENCODE(OP_ZoneServerInfo) { OUT_str(ip); OUT(port); FINISH_ENCODE(); - - //this is SUCH bullshit to be doing from down here. but the + + //this is SUCH bullshit to be doing from down here. but the // new client requires us to close immediately following this // packet, so do it. //dest->Close(); @@ -379,17 +379,17 @@ ENCODE(OP_ZoneServerInfo) { //hack hack hack ENCODE(OP_SendZonepoints) { ENCODE_LENGTH_ATLEAST(ZonePoints); - + SETUP_VAR_ENCODE(ZonePoints); ALLOC_VAR_ENCODE(structs::ZonePoints, __packet->size); - + memcpy(eq, emu, __packet->size); - + FINISH_ENCODE(); // unknown0xxx[24]; //this is utter crap... the client is waiting for this //certain 0 length opcode to come after the reqclientspawn - //stuff... so this is a dirty way to put it in there. + //stuff... so this is a dirty way to put it in there. // this needs to be done better //EQApplicationPacket hack_test(OP_PetitionUnCheckout, 0); @@ -399,10 +399,10 @@ ENCODE(OP_SendZonepoints) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 4 is for SoF if (emu->clientver <= 4 ) @@ -459,13 +459,13 @@ ENCODE(OP_LeadershipExpUpdate) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + eq->available_slots=0xffffffff; memset(eq->unknown4184, 0xff, sizeof(eq->unknown4184)); memset(eq->unknown04396, 0xff, sizeof(eq->unknown04396)); - + // OUT(checksum); OUT(gender); OUT(race); @@ -558,7 +558,7 @@ ENCODE(OP_PlayerProfile) { OUT(aapoints_spent); OUT(aapoints); // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep + //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for(r = 0; r < 4; r++) { OUT_str(bandoliers[r].name); @@ -681,12 +681,12 @@ const uint8 bytes[] = { }; memcpy(eq->unknown12864, bytes, sizeof(bytes)); - - + + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -722,7 +722,7 @@ ENCODE(OP_NewZone) { OUT(zone_id); OUT(zone_instance); OUT(SuspendBuffs); - + /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown796 = -1; eq->unknown840 = 600; @@ -784,11 +784,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -796,16 +796,16 @@ ENCODE(OP_ZoneSpawns) { delete in; return; } - + //make the EQ struct. in->size = sizeof(structs::Spawn_Struct)*entrycount; in->pBuffer = new unsigned char[in->size]; structs::Spawn_Struct *eq = (structs::Spawn_Struct *) in->pBuffer; - + //zero out the packet. We could avoid this memset by setting all fields (including unknowns) //in the loop. memset(in->pBuffer, 0, in->size); - + //do the transform... int r; int k; @@ -931,7 +931,7 @@ ENCODE(OP_ZoneSpawns) { } char hex[] = "0123456789ABCDEF"; - + eq->lastName[len + 0] = ' '; eq->lastName[len + 1] = code; eq->lastName[len + 2] = '0' + ((ofs / 1000) % 10); @@ -997,14 +997,14 @@ ENCODE(OP_ZoneSpawns) { } }*/ } - - + + //kill off the emu structure and send the eq packet. delete[] __emu_buffer; - + //_log(NET__ERROR, "Sending zone spawns"); //_hex(NET__ERROR, in->pBuffer, in->size); - + dest->FastQueuePacket(&in, ack_req); } @@ -1013,7 +1013,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; InternalSerializedItem_Struct *int_struct=(InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); @@ -1055,7 +1055,7 @@ ENCODE(OP_CharInventory) { return; } - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -1063,7 +1063,7 @@ ENCODE(OP_CharInventory) { if(ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -1076,7 +1076,7 @@ ENCODE(OP_CharInventory) { in->pBuffer = new uchar[4]; *(uint32 *)in->pBuffer = ItemCount; - + in->size = 4; for(int r = 0; r < ItemCount; r++, eq++) { @@ -1120,39 +1120,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -1160,12 +1160,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -1181,7 +1181,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -1195,15 +1195,15 @@ ENCODE(OP_GuildMemberList) { SlideStructString( public_note, emu_note ); e->zoneinstance = 0; e->zone_id = htons(emu_e->zone_id); - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -1325,16 +1325,16 @@ ENCODE(OP_LogServer) { ENCODE_LENGTH_EXACT(LogServer_Struct); SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); strcpy(eq->worldshortname, emu->worldshortname); - + OUT(enablevoicemacros); OUT(enablemail); OUT(enable_pvp); OUT(enable_FV); - + // These next two need to be set like this for the Tutorial Button to work. eq->unknown263[0] = 0; eq->unknown263[2] = 1; - + FINISH_ENCODE(); } @@ -1476,7 +1476,7 @@ ENCODE(OP_BazaarSearch) { //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if(entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -1615,7 +1615,7 @@ ENCODE(OP_Stun) { FINISH_ENCODE(); } -ENCODE(OP_ZonePlayerToBind) +ENCODE(OP_ZonePlayerToBind) { ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; @@ -1668,7 +1668,7 @@ ENCODE(OP_AdventureMerchantSell) { FINISH_ENCODE(); } -ENCODE(OP_RaidUpdate) +ENCODE(OP_RaidUpdate) { EQApplicationPacket *inapp = *p; *p = nullptr; @@ -1681,7 +1681,7 @@ ENCODE(OP_RaidUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; - + add_member->raidGen.action = in_add_member->raidGen.action; add_member->raidGen.parameter = in_add_member->raidGen.parameter; strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); @@ -1758,7 +1758,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -1819,7 +1819,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -1876,7 +1876,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -1940,7 +1940,7 @@ ENCODE(OP_OnLevelMessage) FINISH_ENCODE(); } -ENCODE(OP_AltCurrencySell) +ENCODE(OP_AltCurrencySell) { ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -2078,7 +2078,7 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { @@ -2086,7 +2086,7 @@ DECODE(OP_ItemLinkClick) { } IN(link_hash); IN(icon); - + FINISH_DIRECT_DECODE(); } @@ -2115,7 +2115,7 @@ DECODE(OP_Consider) { } DECODE(OP_ClientUpdate) { - // for some odd reason, there is an extra byte on the end of this on occasion.. + // for some odd reason, there is an extra byte on the end of this on occasion.. DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); IN(spawn_id); @@ -2146,7 +2146,7 @@ DECODE(OP_CharacterCreate) { emu->start_zone = RuleI(World, TutorialZoneID); else emu->start_zone = eq->start_zone; - + IN(haircolor); IN(deity); IN(STR); @@ -2178,7 +2178,7 @@ DECODE(OP_WhoAllRequest) { IN(gmlookup); IN(guildid); IN(type); - + FINISH_DIRECT_DECODE(); } @@ -2596,7 +2596,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint SoF::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(SoF::structs::ItemTertiaryBodyStruct)); - + itbs.loregroup = item->LoreGroup; itbs.artifact = item->ArtifactFlag; itbs.summonedflag = item->SummonedFlag; @@ -2771,7 +2771,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint uint32 SubLengths[10]; for(int x = 0; x < 10; ++x) { - + SubSerializations[x] = nullptr; const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); @@ -2817,7 +2817,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint return item_serial; } -DECODE(OP_AltCurrencySellSelection) +DECODE(OP_AltCurrencySellSelection) { DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); @@ -2826,7 +2826,7 @@ DECODE(OP_AltCurrencySellSelection) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySell) +DECODE(OP_AltCurrencySell) { DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); diff --git a/common/patches/SoF.h b/common/patches/SoF.h index c3d7da4ce..615bc1f99 100644 --- a/common/patches/SoF.h +++ b/common/patches/SoF.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace SoF { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "SoF_ops.h" }; - + }; diff --git a/common/patches/SoF_opcode_list.h b/common/patches/SoF_opcode_list.h index ec5d8b11c..28a1ce650 100644 --- a/common/patches/SoF_opcode_list.h +++ b/common/patches/SoF_opcode_list.h @@ -3,7 +3,7 @@ // This File is not used in the build, but here as a reference for SoF. // This should be a complete list of all opcodes for SoF. // The list was generated from IDA using a script from the ShowEQ project. -// This file can be removed at any time. +// This file can be removed at any time. // It is only a reference the project to upgrade the emulator to use SoF. 0x10ff, OP_SenseTraps diff --git a/common/patches/SoF_structs.h b/common/patches/SoF_structs.h index 3305719cb..7a778767d 100644 --- a/common/patches/SoF_structs.h +++ b/common/patches/SoF_structs.h @@ -253,7 +253,7 @@ struct Spawn_Struct { /*0614*/ uint8 unknown0614[11]; /*0625*/ uint8 bodytype2; //New Field - Seems to do the same thing as bodytype /*0626*/ uint8 unknown0626[28]; -union +union { /*0654*/ uint8 equip_chest2; // This is Texture for NPCs /*0654*/ uint8 mount_color; // This should be merged into 1 field, "texture" @@ -599,7 +599,7 @@ struct CharCreate_Struct { /*0000*/ uint32 class_; /*0004*/ uint32 haircolor; -/*0008*/ uint32 beard; +/*0008*/ uint32 beard; /*0012*/ uint32 beardcolor; /*0016*/ uint32 gender; /*0020*/ uint32 race; @@ -1200,7 +1200,7 @@ struct Consider_Struct{ /*012*/ uint32 level; // Level /*016*/ uint8 pvpcon; // Pvp con flag 0/1 /*017*/ uint8 unknown017[3]; // -/*020*/ +/*020*/ }; /* @@ -1874,7 +1874,7 @@ struct AdventureLeaderboard_Struct /*008*/ uint32 success; /*012*/ uint32 failure; /*016*/ uint32 our_rank; -/*020*/ +/*020*/ }; /*struct Item_Shop_Struct { @@ -1899,15 +1899,15 @@ struct Illusion_Struct { //size: 256 /*079*/ uint8 unknown079; // /*080*/ uint32 face; // /*084*/ uint8 hairstyle; // Some Races don't change Hair Style Properly in SoF -/*085*/ uint8 haircolor; // -/*086*/ uint8 beard; // -/*087*/ uint8 beardcolor; // -/*088*/ float size; // +/*085*/ uint8 haircolor; // +/*086*/ uint8 beard; // +/*087*/ uint8 beardcolor; // +/*088*/ float size; // /*092*/ uint8 unknown092[148]; /*240*/ uint32 unknown240; // Removes armor? -/*244*/ uint32 drakkin_heritage; // -/*248*/ uint32 drakkin_tattoo; // -/*252*/ uint32 drakkin_details; // +/*244*/ uint32 drakkin_heritage; // +/*248*/ uint32 drakkin_tattoo; // +/*252*/ uint32 drakkin_details; // /*256*/ }; @@ -2225,7 +2225,7 @@ struct BookRequest_Struct { /*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). /*0004*/ uint32 invslot; // The inventory slot the book is in. Not used, but echoed in the response packet. /*0008*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others -/*0012*/ uint32 unknown0012; +/*0012*/ uint32 unknown0012; /*0016*/ uint16 unknown0016; /*0018*/ char txtfile[8194]; }; @@ -2326,7 +2326,7 @@ struct Door_Struct /*0054*/ uint8 unknown0054[4]; // 00 00 00 00 /*0060*/ uint8 doorId; // door's id # /*0061*/ uint8 opentype; -/*0062*/ uint8 state_at_spawn; +/*0062*/ uint8 state_at_spawn; /*0063*/ uint8 invert_state; // if this is 1, the door is normally open /*0064*/ uint32 door_param; // normally ff ff ff ff (-1) /*0068*/ uint32 unknown0068; // 00 00 00 00 @@ -2591,7 +2591,7 @@ struct Tracking_Struct_New { struct Track_Struct_New { uint16 entityid; // Entity ID uint16 unknown002; // 00 00 - uint32 unknown004; // + uint32 unknown004; // uint8 level; // level of mob uint8 unknown009; // 01 maybe type of mob? player/npc? char name[1]; // name of mob @@ -3750,7 +3750,7 @@ struct ItemBodyStruct uint32 icon; uint8 unknown1; uint8 unknown2; - uint32 BenefitFlag; + uint32 BenefitFlag; uint8 tradeskills; int8 CR; int8 DR; @@ -3819,7 +3819,7 @@ struct ItemBodyStruct int32 FactionAmt3; uint32 FactionMod4; int32 FactionAmt4; - + }; struct AugSlotStruct @@ -3854,9 +3854,9 @@ struct ItemTertiaryBodyStruct uint8 no_transfer; uint16 expendablearrow; - uint32 unknown8; - uint32 unknown9; - uint32 unknown10; + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; uint32 unknown11; uint8 unknown12; uint8 unknown13; diff --git a/common/patches/Titanium.cpp b/common/patches/Titanium.cpp index bfc88040d..bf92ce3c6 100644 --- a/common/patches/Titanium.cpp +++ b/common/patches/Titanium.cpp @@ -20,7 +20,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -36,37 +36,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -96,7 +96,7 @@ std::string Strategy::Describe() const { r += name; return(r); } - + const EQClientVersion Strategy::ClientVersion() const { return EQClientTitanium; @@ -147,10 +147,10 @@ ENCODE(OP_SendCharInfo) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for Titanium // clientver 1 is for all clients and 3 is for Titanium if (emu->clientver <= 3 ) @@ -202,13 +202,13 @@ ENCODE(OP_LeadershipExpUpdate) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + eq->available_slots=0xffffffff; memset(eq->unknown4184, 0xff, sizeof(eq->unknown4184)); memset(eq->unknown04396, 0xff, sizeof(eq->unknown04396)); - + // OUT(checksum); OUT(gender); OUT(race); @@ -409,12 +409,12 @@ const uint8 bytes[] = { 0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x14 }; memcpy(eq->unknown12864, bytes, sizeof(bytes)); - - + + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -458,11 +458,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -470,16 +470,16 @@ ENCODE(OP_ZoneSpawns) { delete in; return; } - + //make the EQ struct. in->size = sizeof(structs::Spawn_Struct)*entrycount; in->pBuffer = new unsigned char[in->size]; structs::Spawn_Struct *eq = (structs::Spawn_Struct *) in->pBuffer; - + //zero out the packet. We could avoid this memset by setting all fields (including unknowns) //in the loop. memset(in->pBuffer, 0, in->size); - + //do the transform... int r; int k; @@ -571,7 +571,7 @@ ENCODE(OP_ZoneSpawns) { eq->spawnId = emu->spawnId; // eq->unknown0344[4] = emu->unknown0344[4]; eq->lfg = emu->lfg; - + /* if (emu->face == 99) {eq->face = 0;} if (emu->eyecolor1 == 99) {eq->eyecolor1 = 0;} @@ -583,8 +583,8 @@ ENCODE(OP_ZoneSpawns) { */ } - - + + //kill off the emu structure and send the eq packet. delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); @@ -595,7 +595,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; @@ -625,7 +625,7 @@ ENCODE(OP_CharInventory) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -636,7 +636,7 @@ ENCODE(OP_CharInventory) { return; } InternalSerializedItem_Struct *eq = (InternalSerializedItem_Struct *) in->pBuffer; - + //do the transform... int r; string serial_string; @@ -649,7 +649,7 @@ ENCODE(OP_CharInventory) { } else { _log(NET__STRUCTS, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.",eq->slot_id); } - + } in->size = serial_string.length(); @@ -682,7 +682,7 @@ ENCODE(OP_BazaarSearch) { //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if(entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -746,39 +746,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -786,12 +786,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -807,7 +807,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -821,15 +821,15 @@ ENCODE(OP_GuildMemberList) { SlideStructString( public_note, emu_note ); e->zoneinstance = 0; e->zone_id = htons(emu_e->zone_id); - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -840,9 +840,9 @@ ENCODE(OP_ReadBook) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; - + BookText_Struct *emu_BookText_Struct = (BookText_Struct *)__emu_buffer; in->size = sizeof(structs::BookText_Struct) + strlen(emu_BookText_Struct->booktext); @@ -915,7 +915,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -1027,7 +1027,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -1084,7 +1084,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -1182,7 +1182,7 @@ DECODE(OP_InspectRequest) { DECODE(OP_InspectAnswer) { DECODE_LENGTH_EXACT(structs::InspectResponse_Struct); SETUP_DIRECT_DECODE(InspectResponse_Struct, structs::InspectResponse_Struct); - + IN(TargetID); IN(playerid); @@ -1194,7 +1194,7 @@ DECODE(OP_InspectAnswer) { // move arrow item up to last element in server array strn0cpy(emu->itemnames[21], "", sizeof(emu->itemnames[21])); strn0cpy(emu->itemnames[22], eq->itemnames[21], sizeof(emu->itemnames[22])); - + int k; for (k = 0; k <= 20; k++) { IN(itemicons[k]); @@ -1221,13 +1221,13 @@ ENCODE(OP_LFGuild) dest->FastQueuePacket(&in, ack_req); return; } - + EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, sizeof(structs::LFGuild_PlayerToggle_Struct)); memcpy(outapp->pBuffer, in->pBuffer, sizeof(structs::LFGuild_PlayerToggle_Struct)); dest->FastQueuePacket(&outapp, ack_req); - + delete in; } @@ -1264,14 +1264,14 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { IN(augments[r]); } IN(link_hash); - + FINISH_DIRECT_DECODE(); } @@ -1322,7 +1322,7 @@ DECODE(OP_WhoAllRequest) { IN(lvlhigh); IN(gmlookup); emu->type = 3; - + FINISH_DIRECT_DECODE(); } @@ -1401,7 +1401,7 @@ char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 d } } - + *length=MakeAnyLenString(&serialization, "%.*s%s" // For leading quotes (and protection) if a subitem; "%s" // Instance data diff --git a/common/patches/Titanium.h b/common/patches/Titanium.h index c2ed6136e..337556938 100644 --- a/common/patches/Titanium.h +++ b/common/patches/Titanium.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace Titanium { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "Titanium_ops.h" }; - + }; diff --git a/common/patches/Titanium_structs.h b/common/patches/Titanium_structs.h index d1aef83df..cdd7fccf8 100644 --- a/common/patches/Titanium_structs.h +++ b/common/patches/Titanium_structs.h @@ -63,7 +63,7 @@ struct DuelResponse_Struct }; /* Cofruben: - Adventure stuff,not a net one,just one for our use + Adventure stuff,not a net one,just one for our use */ static const uint32 ADVENTURE_COLLECT = 0; static const uint32 ADVENTURE_MASSKILL = 1; @@ -158,10 +158,10 @@ struct CharacterSelect_Struct { ** */ -/* -** Generic Spawn Struct -** Length: 383 Octets -** Used in: +/* +** Generic Spawn Struct +** Length: 383 Octets +** Used in: ** spawnZoneStruct ** dbSpawnStruct ** petStruct @@ -214,14 +214,14 @@ struct Spawn_Struct { /*0147*/ uint8 unknown0147[4]; /*0151*/ uint8 level; // Spawn Level /*0152*/ uint8 unknown0259[4]; // ***Placeholder -/*0156*/ uint8 beard; // Beard style +/*0156*/ uint8 beard; // Beard style /*0157*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) /*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner /*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader /*0194*/ uint8 unknown0194[3]; -/*0197*/ union +/*0197*/ union { - struct + struct { /*0197*/ uint32 equip_helmet; // Equipment: Helmet Visual /*0201*/ uint32 equip_chest; // Equipment: Chest Visual @@ -255,7 +255,7 @@ struct Spawn_Struct { /*0334*/ uint8 gender; // Gender (0=male, 1=female) /*0335*/ uint8 bodytype; // Bodytype /*0336*/ uint8 unknown0336[3]; -union +union { /*0339*/ uint8 equip_chest2; // Second place in packet for chest texture (usually 0xFF in live packets) // Not sure why there are 2 of them, but it effects chest texture! @@ -264,9 +264,9 @@ union }; /*0340*/ uint32 spawnId; // Spawn Id /*0344*/ uint8 unknown0344[4]; -/*0348*/ union +/*0348*/ union { - struct + struct { /*0348*/ Color_Struct color_helmet; // Color of helmet item /*0352*/ Color_Struct color_chest; // Color of chest item @@ -350,9 +350,9 @@ struct NewZone_Struct { ** Length: 12 Bytes ** */ -struct MemorizeSpell_Struct { -uint32 slot; // Spot in the spell book/memorized slot -uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) +struct MemorizeSpell_Struct { +uint32 slot; // Spot in the spell book/memorized slot +uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming uint32 unknown12; }; @@ -386,20 +386,20 @@ struct DeleteSpell_Struct }; struct ManaChange_Struct -{ +{ uint32 new_mana; // New Mana AMount uint32 stamina; uint32 spell_id; uint32 unknown12; }; -struct SwapSpell_Struct -{ - uint32 from_slot; - uint32 to_slot; +struct SwapSpell_Struct +{ + uint32 from_slot; + uint32 to_slot; -}; +}; struct BeginCast_Struct { @@ -571,7 +571,7 @@ struct CharCreate_Struct struct AA_Array { uint32 AA; - uint32 value; + uint32 value; }; @@ -611,7 +611,7 @@ struct Bandolier_Struct { struct PotionBelt_Struct { BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; }; - + static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_RAID_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_LEADERSHIP_AA_ARRAY = (MAX_GROUP_LEADERSHIP_AA_ARRAY+MAX_RAID_LEADERSHIP_AA_ARRAY); @@ -625,18 +625,18 @@ struct RaidLeadershipAA_Struct { uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; }; - /** -* A bind point. -* Size: 20 Octets -*/ -struct BindStruct { - /*000*/ uint32 zoneId; - /*004*/ float x; - /*008*/ float y; - /*012*/ float z; - /*016*/ float heading; - /*020*/ -}; + /** +* A bind point. +* Size: 20 Octets +*/ +struct BindStruct { + /*000*/ uint32 zoneId; + /*004*/ float x; + /*008*/ float y; + /*012*/ float z; + /*016*/ float heading; + /*020*/ +}; /* @@ -698,8 +698,8 @@ sed -e 's/_t//g' -e 's/MAX_AA/MAX_PP_AA_ARRAY/g' \ -e 's/thirst/thirst_level/g' \ -e 's/guildstatus/guildrank/g' \ -e 's/airRemaining/air_remaining/g' \ - - + + */ struct PlayerProfile_Struct @@ -741,7 +741,7 @@ struct PlayerProfile_Struct /*02264*/ uint8 face; // Player face /*02265*/ uint8 unknown02264[47]; /*02312*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook -/*03912*/ uint8 unknown4184[448]; // all 0xff after last spell +/*03912*/ uint8 unknown4184[448]; // all 0xff after last spell /*04360*/ uint32 mem_spells[MAX_PP_MEMSPELL]; // List of spells memorized /*04396*/ uint8 unknown04396[32]; /*04428*/ uint32 platinum; // Platinum Pieces on player @@ -752,7 +752,7 @@ struct PlayerProfile_Struct /*04448*/ uint32 gold_cursor; // Gold Pieces on cursor /*04452*/ uint32 silver_cursor; // Silver Pieces on cursor /*04456*/ uint32 copper_cursor; // Copper Pieces on cursor -/*04460*/ uint32 skills[MAX_PP_SKILL]; // List of skills +/*04460*/ uint32 skills[MAX_PP_SKILL]; // List of skills /*04760*/ uint8 unknown04760[236]; /*04996*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3) /*05000*/ uint32 thirst_level; // Drink (ticks till next drink) @@ -778,7 +778,7 @@ struct PlayerProfile_Struct /*13044*/ uint32 lastlogin; // character last save time /*13048*/ uint32 timePlayedMin; // time character played /*13052*/ uint8 pvp; // 1=pvp, 0=not pvp -/*13053*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon +/*13053*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon /*13054*/ uint8 gm; // 0=no, 1=yes (guessing!) /*13055*/ uint8 guildrank; // 0=member, 1=officer, 2=guildleader /*13056*/ uint32 guildbanker; @@ -791,7 +791,7 @@ struct PlayerProfile_Struct /*13116*/ float x; // Players x position /*13120*/ float y; // Players y position /*13124*/ float z; // Players z position -/*13128*/ float heading; // Players heading +/*13128*/ float heading; // Players heading /*13132*/ uint8 unknown13132[4]; // ***Placeholder /*13136*/ uint32 platinum_bank; // Platinum Pieces in Bank /*13140*/ uint32 gold_bank; // Gold Pieces in Bank @@ -805,7 +805,7 @@ struct PlayerProfile_Struct /*13260*/ uint8 unknown13260[16]; /*13276*/ uint16 zone_id; // see zones.h /*13278*/ uint16 zoneInstance; // Instance id -/*13280*/ char groupMembers[MAX_GROUP_MEMBERS][64];// all the members in group, including self +/*13280*/ char groupMembers[MAX_GROUP_MEMBERS][64];// all the members in group, including self /*13664*/ char groupLeader[64]; // Leader of the group ? /*13728*/ uint8 unknown13728[656]; /*14384*/ uint32 entityid; @@ -826,7 +826,7 @@ struct PlayerProfile_Struct /*14572*/ uint32 tribute_active; // 0 = off, 1=on /*14576*/ Tribute_Struct tributes[MAX_PLAYER_TRIBUTES]; // Current tribute loadout /*14616*/ uint32 unknown14616; -/*14620*/ double group_leadership_exp; +/*14620*/ double group_leadership_exp; /*14628*/ double raid_leadership_exp; /*14640*/ uint32 group_leadership_points; // Unspent group lead AA points /*14644*/ uint32 raid_leadership_points; // Unspent raid lead AA points @@ -858,7 +858,7 @@ struct PlayerProfile_Struct /*19580*/ uint32 showhelm; // 0=no, 1=yes /*19584*/ uint8 unknown19584[4]; // ***Placeholder (10/27/2005) /*19588*/ uint32 unknown19588; // *** Placeholder -/*19584*/ +/*19584*/ }; @@ -969,7 +969,7 @@ struct BindWound_Struct /* ** Type: Zone Change Request (before hand) -** Length: 88 bytes +** Length: 88 bytes ** OpCode: a320 */ @@ -992,7 +992,7 @@ struct RequestClientZoneChange_Struct { /*08*/ float x; /*12*/ float z; /*16*/ float heading; -/*20*/ uint32 type; //unknown... values +/*20*/ uint32 type; //unknown... values }; struct Animation_Struct { @@ -1272,13 +1272,13 @@ struct TradeMoneyUpdate_Struct{ ** Surname struct ** Size: 100 bytes */ -struct Surname_Struct -{ +struct Surname_Struct +{ /*0000*/ char name[64]; /*0064*/ uint32 unknown0064; /*0068*/ char lastname[32]; /*0100*/ -}; +}; struct GuildsListEntry_Struct { char name[64]; @@ -1534,7 +1534,7 @@ struct Merchant_Click_Struct { /*000*/ uint32 npcid; // Merchant NPC's entity id /*004*/ uint32 playerid; /*008*/ uint32 command; //1=open, 0=cancel/close -/*012*/ float rate; //cost multiplier, dosent work anymore +/*012*/ float rate; //cost multiplier, dosent work anymore }; /* Unknowns: @@ -1635,7 +1635,7 @@ struct Illusion_Struct { /*068*/ uint16 race; /*070*/ char unknown070[2]; /*072*/ uint8 gender; -/*073*/ uint8 texture; +/*073*/ uint8 texture; /*074*/ uint8 helmtexture; /*075*/ uint8 unknown075; /*076*/ uint32 face; @@ -1686,14 +1686,14 @@ struct GroupCancel_Struct { uint8 toggle; }; -struct GroupUpdate_Struct { +struct GroupUpdate_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[5][64]; /*0388*/ char leadersname[64]; }; -struct GroupUpdate2_Struct { +struct GroupUpdate2_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[5][64]; @@ -1702,7 +1702,7 @@ struct GroupUpdate2_Struct { /*0580*/ uint8 unknown[188]; /*0768*/ }; -struct GroupJoin_Struct { +struct GroupJoin_Struct { /*0000*/ uint32 action; /*0004*/ char yourname[64]; /*0068*/ char membername[64]; @@ -1716,10 +1716,10 @@ struct FaceChange_Struct { /*003*/ uint8 eyecolor2; /*004*/ uint8 hairstyle; /*005*/ uint8 beard; // vesuvias -/*006*/ uint8 face; +/*006*/ uint8 face; //vesuvias: //there are only 10 faces for barbs changing woad just -//increase the face value by ten so if there were 8 woad +//increase the face value by ten so if there were 8 woad //designs then there would be 80 barb faces }; @@ -1801,11 +1801,11 @@ struct Who_All_Struct { // 76 length total /*140*/ }; -struct Stun_Struct { // 4 bytes total +struct Stun_Struct { // 4 bytes total uint32 duration; // Duration of stun }; -struct AugmentItem_Struct { +struct AugmentItem_Struct { /*00*/ int16 container_slot; /*02*/ char unknown02[2]; /*04*/ int32 augment_slot; @@ -1819,11 +1819,11 @@ struct Emote_Struct { /*1028*/ }; -// Inspect -struct Inspect_Struct { - uint32 TargetID; - uint32 PlayerID; -}; +// Inspect +struct Inspect_Struct { + uint32 TargetID; + uint32 PlayerID; +}; //OP_InspectAnswer struct InspectResponse_Struct{//Cofruben:need to send two of this for the inspect response. /*000*/ uint32 TargetID; @@ -2005,7 +2005,7 @@ struct CloseContainer_Struct { /* ** Generic Door Struct ** Length: 52 Octets -** Used in: +** Used in: ** cDoorSpawnsStruct(f721) ** */ @@ -2616,7 +2616,7 @@ struct Split_Struct ** Last Updated: Oct-15-2003 ** */ -struct NewCombine_Struct { +struct NewCombine_Struct { /*00*/ int16 container_slot; /*02*/ char unknown02[2]; /*04*/ @@ -2882,21 +2882,21 @@ struct UpdateLeadershipAA_Struct { /*12*/ }; -/** -* Leadership AA update -* Length: 32 Octets -* OpCode: LeadExpUpdate -*/ -struct leadExpUpdateStruct { - /*0000*/ uint32 unknown0000; // All zeroes? - /*0004*/ uint32 group_leadership_exp; // Group leadership exp value - /*0008*/ uint32 group_leadership_points; // Unspent group points - /*0012*/ uint32 unknown0012; // Type? - /*0016*/ uint32 unknown0016; // All zeroes? - /*0020*/ uint32 raid_leadership_exp; // Raid leadership exp value - /*0024*/ uint32 raid_leadership_points; // Unspent raid points - /*0028*/ uint32 unknown0028; -}; +/** +* Leadership AA update +* Length: 32 Octets +* OpCode: LeadExpUpdate +*/ +struct leadExpUpdateStruct { + /*0000*/ uint32 unknown0000; // All zeroes? + /*0004*/ uint32 group_leadership_exp; // Group leadership exp value + /*0008*/ uint32 group_leadership_points; // Unspent group points + /*0012*/ uint32 unknown0012; // Type? + /*0016*/ uint32 unknown0016; // All zeroes? + /*0020*/ uint32 raid_leadership_exp; // Raid leadership exp value + /*0024*/ uint32 raid_leadership_points; // Unspent raid points + /*0028*/ uint32 unknown0028; +}; @@ -2939,7 +2939,7 @@ struct RaidDetails_Struct { /*000*/ uint32 action; //=6,20 /*004*/ char leader_name[64]; /*068*/ uint32 unknown68[4]; -/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order +/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order /*128*/ uint8 unknown128[142]; /*354*/ uint32 leader_id; }; @@ -3100,7 +3100,7 @@ struct AA_Action { }; struct AA_Skills { //this should be removed and changed to AA_Array -/*00*/ uint32 aa_skill; +/*00*/ uint32 aa_skill; /*04*/ uint32 aa_value; }; @@ -3131,13 +3131,13 @@ struct AATable_Struct { struct Weather_Struct { uint32 val1; //generall 0x000000FF uint32 type; //0x31=rain, 0x02=snow(i think), 0 = normal - uint32 mode; + uint32 mode; }; struct ZoneInUnknown_Struct { uint32 val1; uint32 val2; - uint32 val3; + uint32 val3; }; struct MobHealth_Struct { diff --git a/common/patches/Underfoot.cpp b/common/patches/Underfoot.cpp index f84eec93a..20c94d253 100644 --- a/common/patches/Underfoot.cpp +++ b/common/patches/Underfoot.cpp @@ -23,7 +23,7 @@ static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == nullptr) { @@ -39,37 +39,37 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; string pname; - + //register our world signature. pname = string(name) + "_world"; signature.ignore_eq_opcode = 0; signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - + //register our zone signature. pname = string(name) + "_zone"; signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - + + + _log(NET__IDENTIFY, "Registered patch %s", name); } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != nullptr) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -99,7 +99,7 @@ std::string Strategy::Describe() const { r += name; return(r); } - + const EQClientVersion Strategy::ClientVersion() const { return EQClientUnderfoot; @@ -116,7 +116,7 @@ static inline uint32 TitaniumToUnderfootSlot(uint32 TitaniumSlot) { { UnderfootSlot = TitaniumSlot + 1; } - else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor + else if(TitaniumSlot >= 251 && TitaniumSlot <= 340) // Bag Slots for Normal Inventory and Cursor { UnderfootSlot = TitaniumSlot + 11; } @@ -135,20 +135,20 @@ static inline uint32 TitaniumToUnderfootSlot(uint32 TitaniumSlot) { else { UnderfootSlot = TitaniumSlot; - } - + } + return UnderfootSlot; } // Converts Underfoot Slot IDs to Titanium Slot IDs for use in Decodes static inline uint32 UnderfootToTitaniumSlot(uint32 UnderfootSlot) { uint32 TitaniumSlot = 0; - + if(UnderfootSlot >= 22 && UnderfootSlot <= 54) // Cursor/Ammo/Power Source and Normal Inventory Slots { TitaniumSlot = UnderfootSlot - 1; } - else if(UnderfootSlot >= 262 && UnderfootSlot <= 351) // Bag Slots for Normal Inventory and Cursor + else if(UnderfootSlot >= 262 && UnderfootSlot <= 351) // Bag Slots for Normal Inventory and Cursor { TitaniumSlot = UnderfootSlot - 11; } @@ -187,7 +187,7 @@ ENCODE(OP_OpenNewTasksWindow) { EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; @@ -223,7 +223,7 @@ ENCODE(OP_OpenNewTasksWindow) { __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen // in Underfoot packets. Changing it to 0x3f000000 makes the title red. - __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->unknown1 = 0x3f800000; __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; @@ -282,7 +282,7 @@ ENCODE(OP_OpenNewTasksWindow) { } delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -290,8 +290,8 @@ ENCODE(OP_OpenNewTasksWindow) { ENCODE(OP_SendCharInfo) { ENCODE_LENGTH_EXACT(CharacterSelect_Struct); SETUP_VAR_ENCODE(CharacterSelect_Struct); - - + + //EQApplicationPacket *packet = *p; //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; @@ -310,10 +310,10 @@ ENCODE(OP_SendCharInfo) { + namelen; ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); - + //unsigned char *eq_buffer = new unsigned char[total_length]; //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; - + eq->char_count = char_count; eq->total_chars = 10; @@ -360,9 +360,9 @@ ENCODE(OP_SendCharInfo) { } bufptr += sizeof(structs::CharacterSelectEntry_Struct); } - + FINISH_ENCODE(); - + } ENCODE(OP_ZoneServerInfo) { @@ -393,10 +393,10 @@ ENCODE(OP_SendZonepoints) { ENCODE(OP_SendAATable) { ENCODE_LENGTH_ATLEAST(SendAA_Struct); - + SETUP_VAR_ENCODE(SendAA_Struct); ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - + // Check clientver field to verify this AA should be sent for SoF // clientver 1 is for all clients and 6 is for Underfoot if (emu->clientver <= 6 ) @@ -473,13 +473,13 @@ ENCODE(OP_RespondAA) { ENCODE(OP_PlayerProfile) { SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - + uint32 r; - + eq->available_slots=0xffffffff; memset(eq->unknown06284, 0xff, sizeof(eq->unknown06284)); memset(eq->unknown07284, 0xff, sizeof(eq->unknown07284)); - + // OUT(checksum); OUT(gender); OUT(race); @@ -554,7 +554,7 @@ ENCODE(OP_PlayerProfile) { OUT(thirst_level); OUT(hunger_level); //PS this needs to be figured out more; but it was 'good enough' - for(r = 0; r < structs::BUFF_COUNT; r++) + for(r = 0; r < structs::BUFF_COUNT; r++) { if(emu->buffs[r].spellid != 0xFFFF && emu->buffs[r].spellid != 0) { @@ -584,7 +584,7 @@ ENCODE(OP_PlayerProfile) { OUT(aapoints_spent); OUT(aapoints); // OUT(unknown06160[4]); - //NOTE: new client supports 20 bandoliers, our internal rep + //NOTE: new client supports 20 bandoliers, our internal rep //only supports 4.. for(r = 0; r < 4; r++) { OUT_str(bandoliers[r].name); @@ -707,10 +707,10 @@ const uint8 bytes[] = { }; memcpy(eq->unknown18020, bytes, sizeof(bytes)); - + //set the checksum... CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct)-4); - + FINISH_ENCODE(); } @@ -748,7 +748,7 @@ ENCODE(OP_NewZone) { OUT(SuspendBuffs); eq->FogDensity = emu->fog_density; - + /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown800 = -1; eq->unknown844 = 600; @@ -895,7 +895,7 @@ ENCODE(OP_Barter) delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); - + } ENCODE(OP_BazaarSearch) @@ -958,11 +958,11 @@ ENCODE(OP_ZoneSpawns) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Spawn_Struct *emu = (Spawn_Struct *) __emu_buffer; - + //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if(entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { @@ -971,7 +971,7 @@ ENCODE(OP_ZoneSpawns) { return; } - + //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); emu = (Spawn_Struct *) __emu_buffer; @@ -980,7 +980,7 @@ ENCODE(OP_ZoneSpawns) { char *Buffer = (char *) in->pBuffer; - + int r; int k; for(r = 0; r < entrycount; r++, emu++) { @@ -1153,7 +1153,7 @@ ENCODE(OP_ZoneSpawns) { { VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); } - + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->curHp); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->haircolor); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->beardcolor); @@ -1211,8 +1211,8 @@ ENCODE(OP_ZoneSpawns) { Position->deltaZ = emu->deltaZ; Buffer += sizeof(structs::Spawn_Struct_Position); - - if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) + + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) { for(k = 0; k < 9; ++k) { @@ -1265,7 +1265,7 @@ ENCODE(OP_ZoneSpawns) { dest->FastQueuePacket(&outapp, ack_req); } - + delete in; } @@ -1273,7 +1273,7 @@ ENCODE(OP_MercenaryDataResponse) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryMerchantList_Struct *emu = (MercenaryMerchantList_Struct *) __emu_buffer; @@ -1336,7 +1336,7 @@ ENCODE(OP_MercenaryDataUpdate) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; MercenaryDataUpdate_Struct *emu = (MercenaryDataUpdate_Struct *) __emu_buffer; @@ -1412,7 +1412,7 @@ ENCODE(OP_ItemPacket) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + unsigned char *__emu_buffer = in->pBuffer; ItemPacket_Struct *old_item_pkt=(ItemPacket_Struct *)__emu_buffer; InternalSerializedItem_Struct *int_struct=(InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); @@ -1454,7 +1454,7 @@ ENCODE(OP_CharInventory) { return; } - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; @@ -1462,7 +1462,7 @@ ENCODE(OP_CharInventory) { if(ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -1475,7 +1475,7 @@ ENCODE(OP_CharInventory) { in->pBuffer = new uchar[4]; *(uint32 *)in->pBuffer = ItemCount; - + in->size = 4; for(int r = 0; r < ItemCount; r++, eq++) { @@ -1519,39 +1519,39 @@ ENCODE(OP_GuildMemberList) { //consume the packet EQApplicationPacket *in = *p; *p = nullptr; - + //store away the emu struct unsigned char *__emu_buffer = in->pBuffer; Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *) in->pBuffer; - - - + + + //make a new EQ buffer. uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + emu->count*sizeof(structs::GuildMemberEntry_Struct) + emu->name_length + emu->note_length; in->pBuffer = new uint8[length]; in->size = length; //no memset since we fill every byte. - + uint8 *buffer; buffer = in->pBuffer; - + //easier way to setup GuildMembers_Struct //set prefix name strcpy((char *)buffer, emu->player_name); buffer += pnl; *buffer = '\0'; buffer++; - + //add member count. *((uint32 *) buffer) = htonl( emu->count ); buffer += sizeof(uint32); - + if(emu->count > 0) { Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *) (__emu_buffer + + const char *emu_name = (const char *) (__emu_buffer + sizeof(Internal_GuildMembers_Struct) + //skip header emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data ); @@ -1559,12 +1559,12 @@ ENCODE(OP_GuildMemberList) { emu->name_length + //skip name contents emu->count //skip string terminators ); - + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - + uint32 r; for(r = 0; r < emu->count; r++, emu_e++) { - + //the order we set things here must match the struct //nice helper macro @@ -1580,7 +1580,7 @@ ENCODE(OP_GuildMemberList) { } #define PutFieldN(field) \ e->field = htonl(emu_e->field) - + SlideStructString( name, emu_name ); PutFieldN(level); PutFieldN(banker); @@ -1594,15 +1594,15 @@ ENCODE(OP_GuildMemberList) { SlideStructString( public_note, emu_note ); e->zoneinstance = 0; e->zone_id = htons(emu_e->zone_id); - - + + #undef SlideStructString #undef PutFieldN - + e++; } } - + delete[] __emu_buffer; @@ -1655,7 +1655,7 @@ ENCODE(OP_GroundSpawn) in->size = strlen(emu->object_name) + 58; in->pBuffer = new unsigned char[in->size]; - + char *OutBuffer = (char *)in->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->drop_id); @@ -1668,7 +1668,7 @@ ENCODE(OP_GroundSpawn) // This next field is actually a float. There is a groundspawn in freeportwest (sack of money sitting on some barrels) which requires this // field to be set to (float)255.0 to appear at all, and also the size field below to be 5, to be the correct size. I think SoD has the same // issue. - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown, observed 0 VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // This appears to be the size field. VARSTRUCT_ENCODE_TYPE(float, OutBuffer, emu->y); @@ -1680,7 +1680,7 @@ ENCODE(OP_GroundSpawn) VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); // Unknown, observed 0x00 delete[] __emu_buffer; - + dest->FastQueuePacket(&in, ack_req); } @@ -1774,7 +1774,7 @@ ENCODE(OP_LogServer) { ENCODE_LENGTH_EXACT(LogServer_Struct); SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); strcpy(eq->worldshortname, emu->worldshortname); - + OUT(enablevoicemacros); OUT(enablemail); OUT(enable_pvp); @@ -1795,7 +1795,7 @@ ENCODE(OP_LogServer) { eq->unknown263[23] = 0x80; eq->unknown263[24] = 0x3f; eq->unknown263[33] = 1; - + FINISH_ENCODE(); } @@ -2037,7 +2037,7 @@ ENCODE(OP_Stun) { FINISH_ENCODE(); } -ENCODE(OP_ZonePlayerToBind) +ENCODE(OP_ZonePlayerToBind) { ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; @@ -2090,7 +2090,7 @@ ENCODE(OP_AdventureMerchantSell) { FINISH_ENCODE(); } -ENCODE(OP_RaidUpdate) +ENCODE(OP_RaidUpdate) { EQApplicationPacket *inapp = *p; *p = nullptr; @@ -2103,7 +2103,7 @@ ENCODE(OP_RaidUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; - + add_member->raidGen.action = in_add_member->raidGen.action; add_member->raidGen.parameter = in_add_member->raidGen.parameter; strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); @@ -2180,7 +2180,7 @@ ENCODE(OP_VetRewardsAvaliable) old_data += sizeof(InternalVeteranReward); data += sizeof(structs::VeteranReward); } - + dest->FastQueuePacket(&outapp_create); delete inapp; } @@ -2288,7 +2288,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - + //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); if((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { @@ -2334,10 +2334,10 @@ ENCODE(OP_GroupUpdate) { // Group Update2 //_log(NET__ERROR, "Struct is GroupUpdate2"); - + unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*) __emu_buffer; - + //_log(NET__ERROR, "Yourname is %s", gu2->yourname); int MemberCount = 1; @@ -2359,7 +2359,7 @@ ENCODE(OP_GroupUpdate) EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; - + // Header VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Think this should be SpawnID, but it doesn't seem to matter VARSTRUCT_ENCODE_TYPE(uint32, Buffer, MemberCount); @@ -2367,7 +2367,7 @@ ENCODE(OP_GroupUpdate) // Leader // - + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_STRING(Buffer, gu2->yourname); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); @@ -2409,7 +2409,7 @@ ENCODE(OP_GroupUpdate) GLAAus->NPCMarkerID = gu2->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &gu2->leader_aas, sizeof(GLAAus->LeaderAAs)); - + dest->FastQueuePacket(&outapp); delete in; @@ -2447,7 +2447,7 @@ ENCODE(OP_ChannelMessage) in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; in->pBuffer = new unsigned char[in->size]; - + char *OutBuffer = (char *)in->pBuffer; VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sender); @@ -2495,7 +2495,7 @@ ENCODE(OP_GuildsList) } InBuffer += 64; } - + PacketSize++; // Appears to be an extra 0x00 at the very end. in->size = PacketSize; @@ -2582,7 +2582,7 @@ ENCODE(OP_DzMemberList) ss.write((const char*)&null_term, sizeof(char)); ss.write((const char*)&emu->entries[i].status, sizeof(char)); } - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -2639,7 +2639,7 @@ ENCODE(OP_DzLeaderStatus) ss.write((const char*)&client_id, sizeof(uint32)); ss.write((const char*)&client_id, sizeof(uint32));//1 ss.write((const char*)&client_id, sizeof(uint32)); - + __packet->size = ss.str().length(); __packet->pBuffer = new unsigned char[__packet->size]; memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); @@ -2753,7 +2753,7 @@ ENCODE(OP_SpawnAppearance) dest->FastQueuePacket(&in, ack_req); return; } - + EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); ChangeSize_Struct *css = (ChangeSize_Struct *)outapp->pBuffer; @@ -2764,7 +2764,7 @@ ENCODE(OP_SpawnAppearance) css->Unknown12 = 1.0f; dest->FastQueuePacket(&outapp, ack_req); - + delete in; } @@ -2778,7 +2778,7 @@ ENCODE(OP_DisciplineUpdate) FINISH_ENCODE(); } -ENCODE(OP_AltCurrencySell) +ENCODE(OP_AltCurrencySell) { ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); @@ -2801,7 +2801,7 @@ ENCODE(OP_AltCurrency) if(opcode == 8) { AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); structs::AltCurrencyPopulate_Struct *out_populate = (structs::AltCurrencyPopulate_Struct*)outapp->pBuffer; @@ -2966,7 +2966,7 @@ DECODE(OP_ItemLinkClick) { DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); MEMSET_IN(ItemViewRequest_Struct); - + IN(item_id); int r; for (r = 0; r < 5; r++) { @@ -2974,7 +2974,7 @@ DECODE(OP_ItemLinkClick) { } IN(link_hash); IN(icon); - + FINISH_DIRECT_DECODE(); } @@ -3017,7 +3017,7 @@ DECODE(OP_ShopPlayerBuy) } DECODE(OP_ClientUpdate) { - // for some odd reason, there is an extra byte on the end of this on occasion.. + // for some odd reason, there is an extra byte on the end of this on occasion.. DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); IN(spawn_id); @@ -3048,7 +3048,7 @@ DECODE(OP_CharacterCreate) { emu->start_zone = RuleI(World, TutorialZoneID); else emu->start_zone = eq->start_zone; - + IN(haircolor); IN(deity); IN(STR); @@ -3080,7 +3080,7 @@ DECODE(OP_WhoAllRequest) { IN(gmlookup); IN(guildid); IN(type); - + FINISH_DIRECT_DECODE(); } @@ -3682,7 +3682,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint Underfoot::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(Underfoot::structs::ItemTertiaryBodyStruct)); - + itbs.loregroup = item->LoreGroup; itbs.artifact = item->ArtifactFlag; itbs.summonedflag = item->SummonedFlag; @@ -3880,7 +3880,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint uint32 SubLengths[10]; for(int x = 0; x < 10; ++x) { - + SubSerializations[x] = nullptr; const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); @@ -3926,7 +3926,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint return item_serial; } -DECODE(OP_AltCurrencySellSelection) +DECODE(OP_AltCurrencySellSelection) { DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); @@ -3935,7 +3935,7 @@ DECODE(OP_AltCurrencySellSelection) FINISH_DIRECT_DECODE(); } -DECODE(OP_AltCurrencySell) +DECODE(OP_AltCurrencySell) { DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); diff --git a/common/patches/Underfoot.h b/common/patches/Underfoot.h index 1f1c8312f..fb66a3488 100644 --- a/common/patches/Underfoot.h +++ b/common/patches/Underfoot.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace Underfoot { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; - + //magic macro to declare our opcode processors #include "SSDeclare.h" #include "Underfoot_ops.h" }; - + }; diff --git a/common/patches/Underfoot_structs.h b/common/patches/Underfoot_structs.h index 61cd189c7..daa4a0533 100644 --- a/common/patches/Underfoot_structs.h +++ b/common/patches/Underfoot_structs.h @@ -331,7 +331,7 @@ struct Spawn_Struct /*0000*/ //char suffix[0]; // only read if(hasTitleOrSuffix & 8) char unknown20[8]; uint8 IsMercenary; // If NPC == 1 and this == 1, then the NPC name is Orange. -/*0000*/ char unknown21[28]; +/*0000*/ char unknown21[28]; }; @@ -561,7 +561,7 @@ struct SpellBuffFade_Struct_Underfoot { /*012*/ uint32 spellid; /*016*/ uint32 duration; /*020*/ uint32 unknown016; -/*024*/ uint32 playerId; // Global player ID? +/*024*/ uint32 playerId; // Global player ID? /*028*/ uint32 unknown020; /*032*/ uint8 unknown0028[48]; /*080*/ uint32 slotid; @@ -645,7 +645,7 @@ struct CharCreate_Struct { /*0000*/ uint32 class_; /*0004*/ uint32 haircolor; -/*0008*/ uint32 beard; +/*0008*/ uint32 beard; /*0012*/ uint32 beardcolor; /*0016*/ uint32 gender; /*0020*/ uint32 race; @@ -871,7 +871,7 @@ struct PlayerProfile_Struct /*04176*/ uint32 INT; // Intelligence - 3c 00 00 00 - 60 /*04180*/ uint32 AGI; // Agility - 5f 00 00 00 - 95 /*04184*/ uint32 WIS; // Wisdom - 46 00 00 00 - 70 -/*04188*/ uint8 unknown04188[28]; // +/*04188*/ uint8 unknown04188[28]; // /*04216*/ uint8 face; // Player face - Actually uint32? /*04217*/ uint8 unknown04217[147]; // was [175] /*04364*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 720 = 90 pages [2880] was [1920] @@ -906,7 +906,7 @@ struct PlayerProfile_Struct /*18008*/ uint8 unknown18008[8]; /*18016*/ uint32 available_slots; /*18020*/ uint8 unknown18020[80]; // -//END SUB-STRUCT used for shrouding. +//END SUB-STRUCT used for shrouding. /*18100*/ char name[64]; // Name of player /*18164*/ char last_name[32]; // Last name of player /*18196*/ uint8 unknown18196[8]; //#### Not In Titanium #### new to SoF[12] @@ -1000,7 +1000,7 @@ struct PlayerProfile_Struct /*25584*/ uint32 level3; // SoF looks at the level here to determine how many leadership AA you can bank. /*25588*/ uint32 showhelm; // 0=no, 1=yes /*25592*/ uint32 RestTimer; -/*25596*/ uint8 unknown25596[1036]; // ***Placeholder (2/13/2007) was[1028]or[940]or[1380] - END of Struct +/*25596*/ uint8 unknown25596[1036]; // ***Placeholder (2/13/2007) was[1028]or[940]or[1380] - END of Struct /*26632*/ }; @@ -1247,7 +1247,7 @@ struct CombatDamage_Struct /* 19 */ uint8 unknown19[9]; // was [9] /* 28 */ }; - + /* ** Consider Struct @@ -1260,7 +1260,7 @@ struct Consider_Struct{ /*012*/ uint32 level; // Level /*016*/ uint8 pvpcon; // Pvp con flag 0/1 /*017*/ uint8 unknown017[3]; // -/*020*/ +/*020*/ }; /* @@ -1383,14 +1383,14 @@ struct PlayerPositionUpdateClient_Struct /*0012*/ float y_pos; // y coord (1st loc value) /*0016*/ signed delta_heading:10; // change in heading unsigned padding0036:10; // animation - unsigned padding0016:12; // ***Placeholder + unsigned padding0016:12; // ***Placeholder /*0020*/ float delta_x; // Change in x /*0024*/ float delta_y; // Change in y /*0028*/ float z_pos; // z coord (3rd loc value) /*0032*/ float delta_z; // Change in z -/*0036*/ unsigned animation:10; // ***Placeholder +/*0036*/ unsigned animation:10; // ***Placeholder unsigned heading:12; // Directional heading - unsigned padding0037:10; // ***Placeholder + unsigned padding0037:10; // ***Placeholder /*0040*/ }; @@ -1937,7 +1937,7 @@ struct AdventureLeaderboard_Struct /*008*/ uint32 success; /*012*/ uint32 failure; /*016*/ uint32 our_rank; -/*020*/ +/*020*/ }; /*struct Item_Shop_Struct { @@ -1962,15 +1962,15 @@ struct Illusion_Struct { //size: 256 /*079*/ uint8 unknown079; // /*080*/ uint32 face; // /*084*/ uint8 hairstyle; // Some Races don't change Hair Style Properly in SoF -/*085*/ uint8 haircolor; // -/*086*/ uint8 beard; // -/*087*/ uint8 beardcolor; // -/*088*/ float size; // +/*085*/ uint8 haircolor; // +/*086*/ uint8 beard; // +/*087*/ uint8 beardcolor; // +/*088*/ float size; // /*092*/ uint8 unknown092[148]; /*240*/ uint32 unknown240; // Removes armor? -/*244*/ uint32 drakkin_heritage; // -/*248*/ uint32 drakkin_tattoo; // -/*252*/ uint32 drakkin_details; // +/*244*/ uint32 drakkin_heritage; // +/*248*/ uint32 drakkin_tattoo; // +/*252*/ uint32 drakkin_details; // /*256*/ }; @@ -2330,7 +2330,7 @@ struct BookRequest_Struct { /*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). /*0004*/ uint32 invslot; // The inventory slot the book is in. Not used, but echoed in the response packet. /*0008*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others -/*0012*/ uint32 unknown0012; +/*0012*/ uint32 unknown0012; /*0016*/ uint16 unknown0016; /*0018*/ char txtfile[8194]; }; @@ -2431,7 +2431,7 @@ struct Door_Struct /*0054*/ uint8 unknown0054[4]; // 00 00 00 00 /*0060*/ uint8 doorId; // door's id # /*0061*/ uint8 opentype; -/*0062*/ uint8 state_at_spawn; +/*0062*/ uint8 state_at_spawn; /*0063*/ uint8 invert_state; // if this is 1, the door is normally open /*0064*/ uint32 door_param; // normally ff ff ff ff (-1) /*0068*/ uint32 unknown0068; // 00 00 00 00 @@ -2735,7 +2735,7 @@ struct Tracking_Struct_New { struct Track_Struct_New { uint16 entityid; // Entity ID uint16 unknown002; // 00 00 - uint32 unknown004; // + uint32 unknown004; // uint8 level; // level of mob uint8 unknown009; // 01 maybe type of mob? player/npc? char name[1]; // name of mob @@ -3942,7 +3942,7 @@ struct ItemBodyStruct uint32 icon; uint8 unknown1; uint8 unknown2; - uint32 BenefitFlag; + uint32 BenefitFlag; uint8 tradeskills; int8 CR; int8 DR; @@ -4045,9 +4045,9 @@ struct ItemTertiaryBodyStruct uint8 no_transfer; uint16 expendablearrow; - uint32 unknown8; - uint32 unknown9; - uint32 unknown10; + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; uint32 unknown11; uint8 unknown12; uint8 unknown13; @@ -4148,7 +4148,7 @@ struct ItemQuaternaryBodyStruct int32 clairvoyance; uint8 unknown18; //Power Source Capacity or evolve filename? uint32 evolve_string; // Some String, but being evolution related is just a guess - uint8 unknown19; + uint8 unknown19; uint32 unknown20; // Bard Stuff? uint32 unknown21; uint32 unknown22; @@ -4295,7 +4295,7 @@ struct MercenaryListEntry_Struct { /*0041*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) /*0045*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen /*0049*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 -/*0053*/ uint8 MercUnk04; // Seen 1 +/*0053*/ uint8 MercUnk04; // Seen 1 /*0054*/ MercenaryStance_Struct Stances[1]; // Count Varies, but hard set to 2 for now - From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc (1 to 9 as of April 2012) }; @@ -4342,7 +4342,7 @@ struct MercenaryData_Struct { // [OPCode: 0x6537] On Live as of April 2 2012 [Server->Client] // Should be named OP_MercenaryDataResponse, but the current opcode using that name should be renamed first // Size varies if mercenary is hired or if browsing Mercenary Merchant -// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 +// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 struct MercenaryDataUpdate_Struct { /*0000*/ int32 MercStatus; // Seen 0 with merc and -1 with no merc hired /*0004*/ uint32 MercCount; // Seen 1 with 1 merc hired and 0 with no merc hired diff --git a/common/patches/template.cpp b/common/patches/template.cpp index 017cfb6d3..219e30f71 100644 --- a/common/patches/template.cpp +++ b/common/patches/template.cpp @@ -12,7 +12,7 @@ namespace TEMPLATE { static const char *name = "CHANGEME"; static OpcodeManager *opcodes = NULL; static Strategy struct_strategy; - + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already if(opcodes == NULL) { @@ -27,16 +27,16 @@ void Register(EQStreamIdentifier &into) { return; } } - + //ok, now we have what we need to register. - + EQStream::Signature signature; - + //register our world signature. signature.first_length = sizeof(structs::LoginInfo_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); into.RegisterPatch(signature, name, &opcodes, &struct_strategy); - + //register our zone signature. signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); @@ -44,11 +44,11 @@ void Register(EQStreamIdentifier &into) { } void Reload() { - + //we have a big problem to solve here when we switch back to shared memory //opcode managers because we need to change the manager pointer, which means //we need to go to every stream and replace it's manager. - + if(opcodes != NULL) { //TODO: get this file name from the config file string opfile = "patch_"; @@ -85,17 +85,17 @@ std::string Strategy::Describe() const { /*ENCODE(OP_PlayerProfile) { SETUP_DIRECT(PlayerProfile_Struct, structs::PlayerProfile_Struct); - - - + + + FINISH_DIRECT(); } ENCODE(OP_NewZone) { SETUP_DIRECT(PlayerProfile_Struct, structs::PlayerProfile_Struct); - - - + + + FINISH_DIRECT(); }*/ diff --git a/common/patches/template.h b/common/patches/template.h index 9e570cc56..16f869fc1 100644 --- a/common/patches/template.h +++ b/common/patches/template.h @@ -6,30 +6,30 @@ class EQStreamIdentifier; namespace TEMPLATE { - + //these are the only public member of this namespace. extern void Register(EQStreamIdentifier &into); extern void Reload(); - - - - //you should not directly access anything below.. + + + + //you should not directly access anything below.. //I just dont feel like making a seperate header for it. - + class Strategy : public StructStrategy { public: Strategy(); - + protected: - + virtual std::string Describe() const; virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcodes #include "SSDeclare.h" #include "TEMPLATE_ops.h" - + }; - + }; diff --git a/common/perl_EQDB.cpp b/common/perl_EQDB.cpp index 35417b4a7..960809871 100644 --- a/common/perl_EQDB.cpp +++ b/common/perl_EQDB.cpp @@ -1,14 +1,14 @@ /* - * This file was generated automatically by xsubpp version 1.9508 from the - * contents of tmp. Do not edit this file, edit tmp instead. - * - * ANY CHANGES MADE HERE WILL BE LOST! - * - */ +* This file was generated automatically by xsubpp version 1.9508 from the +* contents of tmp. Do not edit this file, edit tmp instead. +* +* ANY CHANGES MADE HERE WILL BE LOST! +* +*/ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2004 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 @@ -18,11 +18,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ typedef const char Const_char; @@ -32,8 +32,8 @@ typedef const char Const_char; #include "../common/useperl.h" #include "EQDB.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS +#ifdef THIS /* this macro seems to leak out on some systems */ +#undef THIS #endif @@ -231,7 +231,7 @@ XS(boot_EQDB) char file[256]; strncpy(file, __FILE__, 256); file[255] = 0; - + if(items != 1) fprintf(stderr, "boot_quest does not take any arguments."); char buf[128]; diff --git a/common/perl_EQDBRes.cpp b/common/perl_EQDBRes.cpp index b1753e070..23837321f 100644 --- a/common/perl_EQDBRes.cpp +++ b/common/perl_EQDBRes.cpp @@ -1,14 +1,14 @@ /* - * This file was generated automatically by xsubpp version 1.9508 from the - * contents of tmp. Do not edit this file, edit tmp instead. - * - * ANY CHANGES MADE HERE WILL BE LOST! - * - */ +* This file was generated automatically by xsubpp version 1.9508 from the +* contents of tmp. Do not edit this file, edit tmp instead. +* +* ANY CHANGES MADE HERE WILL BE LOST! +* +*/ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2004 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 @@ -18,11 +18,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ typedef const char Const_char; @@ -193,12 +193,12 @@ XS(XS_EQDBRes_fetch_row_hash) RETVAL = THIS->fetch_row_hash(); ST(0) = sv_newmortal(); if (RETVAL.begin()!=RETVAL.end()) - { + { //NOTE: we are leaking the original ST(0) right now HV *hv = newHV(); sv_2mortal((SV*)hv); ST(0) = newRV((SV*)hv); - + map::const_iterator cur, end; cur = RETVAL.begin(); end = RETVAL.end(); @@ -270,7 +270,7 @@ XS(boot_EQDBRes) char file[256]; strncpy(file, __FILE__, 256); file[255] = 0; - + if(items != 1) fprintf(stderr, "boot_quest does not take any arguments."); char buf[128]; diff --git a/common/platform.cpp b/common/platform.cpp index 6ec98b364..1a7b2ed7f 100644 --- a/common/platform.cpp +++ b/common/platform.cpp @@ -3,9 +3,10 @@ EQEmuExePlatform exe_platform = ExePlatformNone; void RegisterExecutablePlatform(EQEmuExePlatform p) { - exe_platform = p; + exe_platform = p; } const EQEmuExePlatform& GetExecutablePlatform() { - return exe_platform; + return exe_platform; } + diff --git a/common/platform.h b/common/platform.h index 978b2801f..f91ccb6f3 100644 --- a/common/platform.h +++ b/common/platform.h @@ -3,14 +3,14 @@ enum EQEmuExePlatform { - ExePlatformNone = 0, - ExePlatformZone, - ExePlatformWorld, - ExePlatformLogin, - ExePlatformQueryServ, - ExePlatformUCS, - ExePlatformLaunch, - ExePlatformSharedMemory + ExePlatformNone = 0, + ExePlatformZone, + ExePlatformWorld, + ExePlatformLogin, + ExePlatformQueryServ, + ExePlatformUCS, + ExePlatformLaunch, + ExePlatformSharedMemory }; void RegisterExecutablePlatform(EQEmuExePlatform p); diff --git a/common/profiler.h b/common/profiler.h index 425fb9f2b..a66e3ac88 100644 --- a/common/profiler.h +++ b/common/profiler.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2004 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 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 + 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. + 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 + 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 PROFILER_H #define PROFILER_H @@ -35,15 +35,15 @@ public: inline virtual ~GeneralProfiler() { safe_delete_array(timers); } - + inline double getTotalDuration(unsigned int id) { return(idreset(); } - + RDTSC_Collector *timers; unsigned int count; }; diff --git a/common/ptimer.cpp b/common/ptimer.cpp index 85acf6e6b..d9bfa9428 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2005 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2005 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 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 + 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. + 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 + 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 "debug.h" @@ -128,9 +128,9 @@ PersistentTimer::PersistentTimer(uint32 char_id, pTimerType type, uint32 in_star bool PersistentTimer::Load(Database *db) { char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + char *query = 0; uint32 qlen = 0; uint32 qcount = 0; @@ -169,7 +169,7 @@ bool PersistentTimer::Store(Database *db) { return(true); char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 qlen = 0; qlen = MakeAnyLenString(&query, "REPLACE INTO timers " @@ -196,7 +196,7 @@ bool PersistentTimer::Store(Database *db) { bool PersistentTimer::Clear(Database *db) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 qlen = 0; qlen = MakeAnyLenString(&query, "DELETE FROM timers " @@ -222,30 +222,30 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { - if (this == nullptr) { + if (this == nullptr) { LogFile->write(EQEMuLog::Error, "Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); - if (current_time-start_time >= timer_time) { + if (current_time-start_time >= timer_time) { if (enabled && iReset) { start_time = current_time; // Reset timer } else if(enabled) { Clear(db); //remove it from DB too } return(true); - } + } - return(false); + return(false); } /* This function set the timer and restart it */ void PersistentTimer::Start(uint32 set_timer_time) { - start_time = get_current_time(); + start_time = get_current_time(); enabled = true; - if (set_timer_time != 0) { + if (set_timer_time != 0) { timer_time = set_timer_time; - } + } #ifdef DEBUG_PTIMERS printf("Starting timer: char %lu of type %u at %lu for %lu seconds.\n", (unsigned long)_char_id, _type, (unsigned long)start_time, (unsigned long)timer_time); #endif @@ -253,25 +253,25 @@ void PersistentTimer::Start(uint32 set_timer_time) { // This timer updates the timer without restarting it void PersistentTimer::SetTimer(uint32 set_timer_time) { - // If we were disabled before => restart the timer - timer_time = set_timer_time; - if (!enabled) { + // If we were disabled before => restart the timer + timer_time = set_timer_time; + if (!enabled) { start_time = get_current_time(); enabled = true; - } + } #ifdef DEBUG_PTIMERS printf("Setting timer: char %lu of type %u at %lu for %lu seconds.\n", (unsigned long)_char_id, _type, (unsigned long)start_time, (unsigned long)timer_time); #endif } uint32 PersistentTimer::GetRemainingTime() { - if (enabled) { + if (enabled) { uint32 current_time = get_current_time(); - if (current_time-start_time > timer_time) + if (current_time-start_time > timer_time) return 0; else return (start_time + timer_time) - current_time; - } + } else { return 0xFFFFFFFF; } @@ -310,9 +310,9 @@ bool PTimerList::Load(Database *db) { _list.clear(); char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + char *query = 0; uint32 qlen = 0; uint32 qcount = 0; @@ -382,7 +382,7 @@ bool PTimerList::Clear(Database *db) { _list.clear(); char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 qlen = 0; qlen = MakeAnyLenString(&query, "DELETE FROM timers " @@ -480,7 +480,7 @@ void PTimerList::ToVector(vector< pair > &out) { bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 qlen = 0; qlen = MakeAnyLenString(&query, "DELETE FROM timers WHERE char_id=%lu AND type=%u ",(unsigned long)char_id, type); diff --git a/common/ptimer.h b/common/ptimer.h index 919f0cfd4..56e2aa6a9 100644 --- a/common/ptimer.h +++ b/common/ptimer.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2005 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2005 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 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 + 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. + 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 + 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 PTIMER_H #define PTIMER_H @@ -41,20 +41,20 @@ enum { //values for pTimerType pTimerDisciplineReuseEnd = 24, pTimerCombatAbility = 25, pTimerBeggingPickPocket = 26, - + pTimerLayHands = 87, //these IDs are used by client too pTimerHarmTouch = 89, //so dont change them pTimerItemStart = 100, pTimerItemEnd = 200, //I don't think any items would use one this high but hey, incase. - pTimerPeqzoneReuse = 900, + pTimerPeqzoneReuse = 900, pTimerMercReuse = 901, pTimerMercSuspend = 902, pTimerAAStart = 1000, //AA re-use timers pTimerAAEnd = 2999, pTimerAAEffectStart = 3001, //AA effect timers pTimerAAEffectEnd = 4999, - + pTimerSpellStart = 5000 //Do not put any timer IDs above this one //if needed, increase its starting ID }; @@ -66,13 +66,13 @@ typedef uint16 pTimerType; class PersistentTimer { public: static PersistentTimer *LoadTimer(Database *db, uint32 char_id, pTimerType type); - + PersistentTimer(uint32 char_id, pTimerType type, uint32 duration); PersistentTimer(uint32 char_id, pTimerType type, uint32 start_time, uint32 duration, bool enable); - + bool Expired(Database *db, bool iReset = true); void Start(uint32 set_timer_time=0); - + void SetTimer(uint32 set_timer_time=0); uint32 GetRemainingTime(); inline void Enable() { enabled = true; } @@ -89,11 +89,11 @@ public: protected: uint32 get_current_time(); - + uint32 start_time; uint32 timer_time; bool enabled; - + uint32 _char_id; pTimerType _type; }; @@ -102,13 +102,13 @@ protected: class PTimerList { public: PTimerList(uint32 char_id = 0); - + ~PTimerList(); - + bool Load(Database *db); bool Store(Database *db); bool Clear(Database *db); - + void Start(pTimerType type, uint32 duration); bool Expired(Database *db, pTimerType type, bool reset = true); void Clear(Database *db, pTimerType type); @@ -117,24 +117,24 @@ public: void Disable(pTimerType type); uint32 GetRemainingTime(pTimerType type); PersistentTimer *Get(pTimerType type); - + inline void SetCharID(uint32 char_id) { _char_id = char_id; } - + void ToVector(vector< pair > &out); - + //Clear a timer for a char not logged in //this is not defined on a char which is logged in! static bool ClearOffline(Database *db, uint32 char_id, pTimerType type); - + typedef map::iterator iterator; iterator begin() { return(_list.begin()); } iterator end() { return(_list.end()); } - - + + void AddTimer(pTimerType type, uint32 start_time, uint32 duration, bool enable); protected: uint32 _char_id; - + map _list; }; diff --git a/common/queue.h b/common/queue.h index c79e81e19..00dd48cac 100644 --- a/common/queue.h +++ b/common/queue.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 QUEUE_H #define QUEUE_H @@ -25,102 +25,102 @@ template class MyQueueNode { public: - MyQueueNode(T* data) - { - next = 0; - this->data = data; - } + MyQueueNode(T* data) + { + next = 0; + this->data = data; + } - friend class MyQueue; + friend class MyQueue; private: - T* data; - MyQueueNode* next; + T* data; + MyQueueNode* next; }; template class MyQueue { public: - MyQueue() - { - head = tail = 0; - } + MyQueue() + { + head = tail = 0; + } ~MyQueue() { clear(); } - void push(T* data) - { - if (head == 0) - { - tail = head = new MyQueueNode(data); - } - else - { - tail->next = new MyQueueNode(data); - tail = tail->next; - } - } + void push(T* data) + { + if (head == 0) + { + tail = head = new MyQueueNode(data); + } + else + { + tail->next = new MyQueueNode(data); + tail = tail->next; + } + } - T* pop() - { - if (head == 0) - { - return 0; - } + T* pop() + { + if (head == 0) + { + return 0; + } - T* data = head->data; - MyQueueNode* next_node = head->next; - delete head; - head = next_node; + T* data = head->data; + MyQueueNode* next_node = head->next; + delete head; + head = next_node; - return data; - } + return data; + } - T* top() - { - if (head == 0) - { - return 0; - } + T* top() + { + if (head == 0) + { + return 0; + } - return head->data; - } + return head->data; + } - bool empty() - { - if (head == 0) - { - return true; - } + bool empty() + { + if (head == 0) + { + return true; + } - return false; - } + return false; + } - void clear() - { + void clear() + { T* d = 0; - while((d = pop())) { + while((d = pop())) { delete d; } - return; - } + return; + } - int count() - { - int count = 0; + int count() + { + int count = 0; MyQueueNode* d = head; - while(d != 0) { - count++; - d = d->next; + while(d != 0) { + count++; + d = d->next; } - return(count); - } + return(count); + } private: - MyQueueNode* head; - MyQueueNode* tail; + MyQueueNode* head; + MyQueueNode* tail; }; #endif diff --git a/common/queues.h b/common/queues.h index 66125e650..474d7d898 100644 --- a/common/queues.h +++ b/common/queues.h @@ -1,25 +1,25 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ /* - Code for generell handling of priority Queues. - Implemention of queues from "Algoritms in C" by Robert Sedgewick. - Copyright Monty Program KB. - By monty. + Code for generell handling of priority Queues. + Implemention of queues from "Algoritms in C" by Robert Sedgewick. + Copyright Monty Program KB. + By monty. */ #ifndef _queues_h @@ -29,13 +29,13 @@ extern "C" { #endif typedef struct st_queue { - byte **root; - void *first_cmp_arg; - uint elements; - uint max_elements; - uint offset_to_key; /* compare is done on element+offset */ - int max_at_top; /* Set if queue_top gives max */ - int (*compare)(void *, byte *,byte *); + byte **root; + void *first_cmp_arg; + uint elements; + uint max_elements; + uint offset_to_key; /* compare is done on element+offset */ + int max_at_top; /* Set if queue_top gives max */ + int (*compare)(void *, byte *,byte *); } QUEUE; #define queue_top(queue) ((queue)->root[1]) @@ -44,11 +44,11 @@ typedef struct st_queue { #define queue_replaced(queue) _downheap(queue,1) int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key, - pbool max_at_top, int (*compare)(void *,byte *, byte *), - void *first_cmp_arg); + pbool max_at_top, int (*compare)(void *,byte *, byte *), + void *first_cmp_arg); int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key, - pbool max_at_top, int (*compare)(void *,byte *, byte *), - void *first_cmp_arg); + pbool max_at_top, int (*compare)(void *,byte *, byte *), + void *first_cmp_arg); void delete_queue(QUEUE *queue); void queue_insert(QUEUE *queue,byte *element); byte *queue_remove(QUEUE *queue,uint idx); diff --git a/common/races.cpp b/common/races.cpp index a041845a3..d088ce185 100644 --- a/common/races.cpp +++ b/common/races.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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/debug.h" #include "../common/eq_packet_structs.h" diff --git a/common/races.h b/common/races.h index 452da9461..2c360e908 100644 --- a/common/races.h +++ b/common/races.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 RACES_H #define RACES_H @@ -104,413 +104,411 @@ inline uint32 GetRaceBitmask(uint16 race) { return uint32(pow(2.0f, float(GetArr //pulled from the client by ksmith: $races_table = array( - 1 => "Human", - 2 => "Barbarian", - 3 => "Erudite", - 4 => "Wood Elf", - 5 => "High Elf", - 6 => "Dark Elf", - 7 => "Half Elf", - 8 => "Dwarf", - 9 => "Troll", - 10 => "Ogre", - 11 => "Halfling", - 12 => "Gnome", - 13 => "Aviak", - 14 => "Were Wolf", - 15 => "Brownie", - 16 => "Centaur", - 17 => "Golem", - 18 => "Giant / Cyclops", - 19 => "Trakenon", - 20 => "Doppleganger", - 21 => "Evil Eye", - 22 => "Beetle", - 23 => "Kerra", - 24 => "Fish", - 25 => "Fairy", - 26 => "Old Froglok", - 27 => "Old Froglok Ghoul", - 28 => "Fungusman", - 29 => "Gargoyle", - 30 => "Gasbag", - 31 => "Gelatinous Cube", - 32 => "Ghost", - 33 => "Ghoul", - 34 => "Giant Bat", - 35 => "Giant Eel", - 36 => "Giant Rat", - 37 => "Giant Snake", - 38 => "Giant Spider", - 39 => "Gnoll", - 40 => "Goblin", - 41 => "Gorilla", - 42 => "Wolf", - 43 => "Bear", - 44 => "Freeport Guards", - 45 => "Demi Lich", - 46 => "Imp", - 47 => "Griffin", - 48 => "Kobold", - 49 => "Lava Dragon", - 50 => "Lion", - 51 => "Lizard Man", - 52 => "Mimic", - 53 => "Minotaur", - 54 => "Orc", - 55 => "Human Beggar", - 56 => "Pixie", - 57 => "Dracnid", - 58 => "Solusek Ro", - 59 => "Bloodgills", - 60 => "Skeleton", - 61 => "Shark", - 62 => "Tunare", - 63 => "Tiger", - 64 => "Treant", - 65 => "Vampire", - 66 => "Rallos Zek", - 67 => "Highpass Citizen", - 68 => "Tentacle", - 69 => "Will 'O Wisp", - 70 => "Zombie", - 71 => "Qeynos Citizen", - 72 => "Ship", - 73 => "Launch", - 74 => "Piranha", - 75 => "Elemental", - 76 => "Puma", - 77 => "Neriak Citizen", - 78 => "Erudite Citizen", - 79 => "Bixie", - 80 => "Reanimated Hand", - 81 => "Rivervale Citizen", - 82 => "Scarecrow", - 83 => "Skunk", - 84 => "Snake Elemental", - 85 => "Spectre", - 86 => "Sphinx", - 87 => "Armadillo", - 88 => "Clockwork Gnome", - 89 => "Drake", - 90 => "Halas Citizen", - 91 => "Alligator", - 92 => "Grobb Citizen", - 93 => "Oggok Citizen", - 94 => "Kaladim Citizen", - 95 => "Cazic Thule", - 96 => "Cockatrice", - 97 => "Daisy Man", - 98 => "Elf Vampire", - 99 => "Denizen", - 100 => "Dervish", - 101 => "Efreeti", - 102 => "Old Froglok Tadpole", - 103 => "Kedge", - 104 => "Leech", - 105 => "Swordfish", - 106 => "Felguard", - 107 => "Mammoth", - 108 => "Eye of Zomm", - 109 => "Wasp", - 110 => "Mermaid", - 111 => "Harpie", - 112 => "Fayguard", - 113 => "Drixie", - 114 => "Ghost Ship", - 115 => "Clam", - 116 => "Sea Horse", - 117 => "Ghost Dwarf", - 118 => "Erudite Ghost", - 119 => "Sabertooth Cat", - 120 => "Wolf Elemental", - 121 => "Gorgon", - 122 => "Dragon Skeleton", - 123 => "Innoruuk", - 124 => "Unicorn", - 125 => "Pegasus", - 126 => "Djinn", - 127 => "Invisible Man", - 128 => "Iksar", - 129 => "Scorpion", - 130 => "Vah Shir", - 131 => "Sarnak", - 132 => "Draglock", - 133 => "Lycanthrope", - 134 => "Mosquito", - 135 => "Rhino", - 136 => "Xalgoz", - 137 => "Kunark Goblin", - 138 => "Yeti", - 139 => "Iksar Citizen", - 140 => "Forest Giant", - 141 => "Boat", - 142 => "UNKNOWN RACE", - 143 => "UNKNOWN RACE", - 144 => "Burynai", - 145 => "Goo", - 146 => "Spectral Sarnak", - 147 => "Spectral Iksar", - 148 => "Kunark Fish", - 149 => "Iksar Scorpion", - 150 => "Erollisi", - 151 => "Tribunal", - 152 => "Bertoxxulous", - 153 => "Bristlebane", - 154 => "Fay Drake", - 155 => "Sarnak Skeleton", - 156 => "Ratman", - 157 => "Wyvern", - 158 => "Wurm", - 159 => "Devourer", - 160 => "Iksar Golem", - 161 => "Iksar Skeleton", - 162 => "Man Eating Plant", - 163 => "Raptor", - 164 => "Sarnak Golem", - 165 => "Water Dragon", - 166 => "Iksar Hand", - 167 => "Succulent", - 168 => "Flying Monkey", - 169 => "Brontotherium", - 170 => "Snow Dervish", - 171 => "Dire Wolf", - 172 => "Manticore", - 173 => "Totem", - 174 => "Cold Spectre", - 175 => "Enchanted Armor", - 176 => "Snow Bunny", - 177 => "Walrus", - 178 => "Rock-gem Men", - 179 => "UNKNOWN RACE", - 180 => "UNKNOWN RACE", - 181 => "Yak Man", - 182 => "Faun", - 183 => "Coldain", - 184 => "Velious Dragons", - 185 => "Hag", - 186 => "Hippogriff", - 187 => "Siren", - 188 => "Frost Giant", - 189 => "Storm Giant", - 190 => "Ottermen", - 191 => "Walrus Man", - 192 => "Clockwork Dragon", - 193 => "Abhorent", - 194 => "Sea Turtle", - 195 => "Black and White Dragons", - 196 => "Ghost Dragon", - 197 => "Ronnie Test", - 198 => "Prismatic Dragon", - 199 => "ShikNar", - 200 => "Rockhopper", - 201 => "Underbulk", - 202 => "Grimling", - 203 => "Vacuum Worm", - 204 => "Evan Test", - 205 => "Kahli Shah", - 206 => "Owlbear", - 207 => "Rhino Beetle", - 208 => "Vampyre", - 209 => "Earth Elemental", - 210 => "Air Elemental", - 211 => "Water Elemental", - 212 => "Fire Elemental", - 213 => "Wetfang Minnow", - 214 => "Thought Horror", - 215 => "Tegi", - 216 => "Horse", - 217 => "Shissar", - 218 => "Fungal Fiend", - 219 => "Vampire Volatalis", - 220 => "StoneGrabber", - 221 => "Scarlet Cheetah", - 222 => "Zelniak", - 223 => "Lightcrawler", - 224 => "Shade", - 225 => "Sunflower", - 226 => "Sun Revenant", - 227 => "Shrieker", - 228 => "Galorian", - 229 => "Netherbian", - 230 => "Akheva", - 231 => "Spire Spirit", - 232 => "Sonic Wolf", - 233 => "Ground Shaker", - 234 => "Vah Shir Skeleton", - 235 => "Mutant Humanoid", - 236 => "Seru", - 237 => "Recuso", - 238 => "Vah Shir King", - 239 => "Vah Shir Guard", - 240 => "Teleport Man", - 241 => "Lujein", - 242 => "Naiad", - 243 => "Nymph", - 244 => "Ent", - 245 => "Fly Man", - 246 => "Tarew Marr", - 247 => "Sol Ro", - 248 => "Clockwork Golem", - 249 => "Clockwork Brain", - 250 => "Spectral Banshee", - 251 => "Guard of Justice", - 252 => "UNKNOWN RACE", - 253 => "Disease Boss", - 254 => "Sol Ro Guard", - 255 => "New Bertox", - 256 => "New Tribunal", - 257 => "Terris Thule", - 258 => "Vegerog", - 259 => "Crocodile", - 260 => "Bat", - 261 => "Slarghilug", - 262 => "Tranquilion", - 263 => "Tin Soldier", - 264 => "Nightmare Wraith", - 265 => "Malarian", - 266 => "Knight of Pestilence", - 267 => "Lepertoloth", - 268 => "Bubonian Boss", - 269 => "Bubonian Underling", - 270 => "Pusling", - 271 => "Water Mephit", - 272 => "Stormrider", - 273 => "Junk Beast", - 274 => "Broken Clockwork", - 275 => "Giant Clockwork", - 276 => "Clockwork Beetle", - 277 => "Nightmare Goblin", - 278 => "Karana", - 279 => "Blood Raven", - 280 => "Nightmare Gargoyle", - 281 => "Mouths of Insanity", - 282 => "Skeletal Horse", - 283 => "Saryn", - 284 => "Fennin Ro", - 285 => "Tormentor", - 286 => "Necro Priest", - 287 => "Nightmare", - 288 => "New Rallos Zek", - 289 => "Vallon Zek", - 290 => "Tallon Zek", - 291 => "Air Mephit", - 292 => "Earth Mephit", - 293 => "Fire Mephit", - 294 => "Nightmare Mephit", - 295 => "Zebuxoruk", - 296 => "Mithaniel Marr", - 297 => "Undead Knight", - 298 => "The Rathe", - 299 => "Xegony", - 300 => "Fiend", - 301 => "Test Object", - 302 => "Crab", - 303 => "Phoenix", - 304 => "PoP Dragon", - 305 => "PoP Bear", - 306 => "Storm Taarid", - 307 => "Storm Satuur", - 308 => "Storm Kuraaln", - 309 => "Storm Volaas", - 310 => "Storm Mana", - 311 => "Storm Fire", - 312 => "Storm Celestial", - 313 => "War Wraith", - 314 => "Wrulon", - 315 => "Kraken", - 316 => "Poison Frog", - 317 => "Queztocoatal", - 318 => "Valorian", - 319 => "War Boar", - 320 => "PoP Efreeti", - 321 => "War Boar Unarmored", - 322 => "Black Knight", - 323 => "Animated Armor", - 324 => "Undead Footman", - 325 => "Rallos Zek Minion", - 326 => "Arachnid", - 327 => "Crystal Spider", - 328 => "Zeb Cage", - 329 => "BoT Portal", - 330 => "Froglok", - 331 => "Troll Buccaneer", - 332 => "Troll Freebooter", - 333 => "Troll Sea Rover", - 334 => "Spectre Pirate Boss", - 335 => "Pirate Boss", - 336 => "Pirate Dark Shaman", - 337 => "Pirate Officer", - 338 => "Gnome Pirate", - 339 => "Dark Elf Pirate", - 340 => "Ogre Pirate", - 341 => "Human Pirate", - 342 => "Erudite Pirate", - 343 => "Poison Dart Frog", - 344 => "Troll Zombie", - 345 => "Luggald Land", - 346 => "Luggald Armored", - 347 => "Luggald Robed", - 348 => "Froglok Mount", - 349 => "Froglok Skeleton", - 350 => "Undead Froglok", - 351 => "Chosen Warrior", - 352 => "Chosen Wizard", - 353 => "Veksar", - 354 => "Greater Veksar", - 355 => "Veksar Boss", - 356 => "Chokadai", - 357 => "Undead Chokadai", - 358 => "Undead Veksar", - 359 => "Vampire Lesser", - 360 => "Vampire Elite", - 361 => "Rujakian Orc", - 362 => "Bone Golem", - 363 => "Synarcana", - 364 => "Sand Elf", - 365 => "Vampire Master", - 366 => "Rujakian Orc Elite", - 367 => "Skeleton New", - 368 => "Mummy New", - 369 => "Goblin New", - 370 => "Insect", - 371 => "Froglok Ghost", - 372 => "Dervish New", - 373 => "Shadow Creatue", - 374 => "Golem New", - 375 => "Evil Eye New", - 376 => "Box", - 377 => "Barrel", - 378 => "Chest", - 379 => "Vase", - 380 => "Table", - 381 => "Weapons Rack", - 382 => "Coffin", - 383 => "Bones", - 384 => "Jokester", - 385 => "Talosian Nihil", - 386 => "Talosian Exile", - 387 => "Talosian Golem", - 388 => "Talosian Wolf", - 389 => "Talosian Amphibian", - 390 => "Talosian Mountain Beast", - 391 => "Talosian Trilobyte", - 392 => "Invader War Hound", - 393 => "Invader Elite Centaur", - 394 => "Invader Lamia", - 395 => "Invader Cyclops", - 396 => "Kyv", - 397 => "Invader Soldier", - 398 => "Invader Brute", - 399 => "Invader Force Commander", - 400 => "Invader Lieutenant Boss", - 401 => "Invader War Beast", - 402 => "Invader Soldier Elite", - 403 => "UNKNOWN RACE", - 404 => "Discord Ship", - - + 1 => "Human", + 2 => "Barbarian", + 3 => "Erudite", + 4 => "Wood Elf", + 5 => "High Elf", + 6 => "Dark Elf", + 7 => "Half Elf", + 8 => "Dwarf", + 9 => "Troll", + 10 => "Ogre", + 11 => "Halfling", + 12 => "Gnome", + 13 => "Aviak", + 14 => "Were Wolf", + 15 => "Brownie", + 16 => "Centaur", + 17 => "Golem", + 18 => "Giant / Cyclops", + 19 => "Trakenon", + 20 => "Doppleganger", + 21 => "Evil Eye", + 22 => "Beetle", + 23 => "Kerra", + 24 => "Fish", + 25 => "Fairy", + 26 => "Old Froglok", + 27 => "Old Froglok Ghoul", + 28 => "Fungusman", + 29 => "Gargoyle", + 30 => "Gasbag", + 31 => "Gelatinous Cube", + 32 => "Ghost", + 33 => "Ghoul", + 34 => "Giant Bat", + 35 => "Giant Eel", + 36 => "Giant Rat", + 37 => "Giant Snake", + 38 => "Giant Spider", + 39 => "Gnoll", + 40 => "Goblin", + 41 => "Gorilla", + 42 => "Wolf", + 43 => "Bear", + 44 => "Freeport Guards", + 45 => "Demi Lich", + 46 => "Imp", + 47 => "Griffin", + 48 => "Kobold", + 49 => "Lava Dragon", + 50 => "Lion", + 51 => "Lizard Man", + 52 => "Mimic", + 53 => "Minotaur", + 54 => "Orc", + 55 => "Human Beggar", + 56 => "Pixie", + 57 => "Dracnid", + 58 => "Solusek Ro", + 59 => "Bloodgills", + 60 => "Skeleton", + 61 => "Shark", + 62 => "Tunare", + 63 => "Tiger", + 64 => "Treant", + 65 => "Vampire", + 66 => "Rallos Zek", + 67 => "Highpass Citizen", + 68 => "Tentacle", + 69 => "Will 'O Wisp", + 70 => "Zombie", + 71 => "Qeynos Citizen", + 72 => "Ship", + 73 => "Launch", + 74 => "Piranha", + 75 => "Elemental", + 76 => "Puma", + 77 => "Neriak Citizen", + 78 => "Erudite Citizen", + 79 => "Bixie", + 80 => "Reanimated Hand", + 81 => "Rivervale Citizen", + 82 => "Scarecrow", + 83 => "Skunk", + 84 => "Snake Elemental", + 85 => "Spectre", + 86 => "Sphinx", + 87 => "Armadillo", + 88 => "Clockwork Gnome", + 89 => "Drake", + 90 => "Halas Citizen", + 91 => "Alligator", + 92 => "Grobb Citizen", + 93 => "Oggok Citizen", + 94 => "Kaladim Citizen", + 95 => "Cazic Thule", + 96 => "Cockatrice", + 97 => "Daisy Man", + 98 => "Elf Vampire", + 99 => "Denizen", + 100 => "Dervish", + 101 => "Efreeti", + 102 => "Old Froglok Tadpole", + 103 => "Kedge", + 104 => "Leech", + 105 => "Swordfish", + 106 => "Felguard", + 107 => "Mammoth", + 108 => "Eye of Zomm", + 109 => "Wasp", + 110 => "Mermaid", + 111 => "Harpie", + 112 => "Fayguard", + 113 => "Drixie", + 114 => "Ghost Ship", + 115 => "Clam", + 116 => "Sea Horse", + 117 => "Ghost Dwarf", + 118 => "Erudite Ghost", + 119 => "Sabertooth Cat", + 120 => "Wolf Elemental", + 121 => "Gorgon", + 122 => "Dragon Skeleton", + 123 => "Innoruuk", + 124 => "Unicorn", + 125 => "Pegasus", + 126 => "Djinn", + 127 => "Invisible Man", + 128 => "Iksar", + 129 => "Scorpion", + 130 => "Vah Shir", + 131 => "Sarnak", + 132 => "Draglock", + 133 => "Lycanthrope", + 134 => "Mosquito", + 135 => "Rhino", + 136 => "Xalgoz", + 137 => "Kunark Goblin", + 138 => "Yeti", + 139 => "Iksar Citizen", + 140 => "Forest Giant", + 141 => "Boat", + 142 => "UNKNOWN RACE", + 143 => "UNKNOWN RACE", + 144 => "Burynai", + 145 => "Goo", + 146 => "Spectral Sarnak", + 147 => "Spectral Iksar", + 148 => "Kunark Fish", + 149 => "Iksar Scorpion", + 150 => "Erollisi", + 151 => "Tribunal", + 152 => "Bertoxxulous", + 153 => "Bristlebane", + 154 => "Fay Drake", + 155 => "Sarnak Skeleton", + 156 => "Ratman", + 157 => "Wyvern", + 158 => "Wurm", + 159 => "Devourer", + 160 => "Iksar Golem", + 161 => "Iksar Skeleton", + 162 => "Man Eating Plant", + 163 => "Raptor", + 164 => "Sarnak Golem", + 165 => "Water Dragon", + 166 => "Iksar Hand", + 167 => "Succulent", + 168 => "Flying Monkey", + 169 => "Brontotherium", + 170 => "Snow Dervish", + 171 => "Dire Wolf", + 172 => "Manticore", + 173 => "Totem", + 174 => "Cold Spectre", + 175 => "Enchanted Armor", + 176 => "Snow Bunny", + 177 => "Walrus", + 178 => "Rock-gem Men", + 179 => "UNKNOWN RACE", + 180 => "UNKNOWN RACE", + 181 => "Yak Man", + 182 => "Faun", + 183 => "Coldain", + 184 => "Velious Dragons", + 185 => "Hag", + 186 => "Hippogriff", + 187 => "Siren", + 188 => "Frost Giant", + 189 => "Storm Giant", + 190 => "Ottermen", + 191 => "Walrus Man", + 192 => "Clockwork Dragon", + 193 => "Abhorent", + 194 => "Sea Turtle", + 195 => "Black and White Dragons", + 196 => "Ghost Dragon", + 197 => "Ronnie Test", + 198 => "Prismatic Dragon", + 199 => "ShikNar", + 200 => "Rockhopper", + 201 => "Underbulk", + 202 => "Grimling", + 203 => "Vacuum Worm", + 204 => "Evan Test", + 205 => "Kahli Shah", + 206 => "Owlbear", + 207 => "Rhino Beetle", + 208 => "Vampyre", + 209 => "Earth Elemental", + 210 => "Air Elemental", + 211 => "Water Elemental", + 212 => "Fire Elemental", + 213 => "Wetfang Minnow", + 214 => "Thought Horror", + 215 => "Tegi", + 216 => "Horse", + 217 => "Shissar", + 218 => "Fungal Fiend", + 219 => "Vampire Volatalis", + 220 => "StoneGrabber", + 221 => "Scarlet Cheetah", + 222 => "Zelniak", + 223 => "Lightcrawler", + 224 => "Shade", + 225 => "Sunflower", + 226 => "Sun Revenant", + 227 => "Shrieker", + 228 => "Galorian", + 229 => "Netherbian", + 230 => "Akheva", + 231 => "Spire Spirit", + 232 => "Sonic Wolf", + 233 => "Ground Shaker", + 234 => "Vah Shir Skeleton", + 235 => "Mutant Humanoid", + 236 => "Seru", + 237 => "Recuso", + 238 => "Vah Shir King", + 239 => "Vah Shir Guard", + 240 => "Teleport Man", + 241 => "Lujein", + 242 => "Naiad", + 243 => "Nymph", + 244 => "Ent", + 245 => "Fly Man", + 246 => "Tarew Marr", + 247 => "Sol Ro", + 248 => "Clockwork Golem", + 249 => "Clockwork Brain", + 250 => "Spectral Banshee", + 251 => "Guard of Justice", + 252 => "UNKNOWN RACE", + 253 => "Disease Boss", + 254 => "Sol Ro Guard", + 255 => "New Bertox", + 256 => "New Tribunal", + 257 => "Terris Thule", + 258 => "Vegerog", + 259 => "Crocodile", + 260 => "Bat", + 261 => "Slarghilug", + 262 => "Tranquilion", + 263 => "Tin Soldier", + 264 => "Nightmare Wraith", + 265 => "Malarian", + 266 => "Knight of Pestilence", + 267 => "Lepertoloth", + 268 => "Bubonian Boss", + 269 => "Bubonian Underling", + 270 => "Pusling", + 271 => "Water Mephit", + 272 => "Stormrider", + 273 => "Junk Beast", + 274 => "Broken Clockwork", + 275 => "Giant Clockwork", + 276 => "Clockwork Beetle", + 277 => "Nightmare Goblin", + 278 => "Karana", + 279 => "Blood Raven", + 280 => "Nightmare Gargoyle", + 281 => "Mouths of Insanity", + 282 => "Skeletal Horse", + 283 => "Saryn", + 284 => "Fennin Ro", + 285 => "Tormentor", + 286 => "Necro Priest", + 287 => "Nightmare", + 288 => "New Rallos Zek", + 289 => "Vallon Zek", + 290 => "Tallon Zek", + 291 => "Air Mephit", + 292 => "Earth Mephit", + 293 => "Fire Mephit", + 294 => "Nightmare Mephit", + 295 => "Zebuxoruk", + 296 => "Mithaniel Marr", + 297 => "Undead Knight", + 298 => "The Rathe", + 299 => "Xegony", + 300 => "Fiend", + 301 => "Test Object", + 302 => "Crab", + 303 => "Phoenix", + 304 => "PoP Dragon", + 305 => "PoP Bear", + 306 => "Storm Taarid", + 307 => "Storm Satuur", + 308 => "Storm Kuraaln", + 309 => "Storm Volaas", + 310 => "Storm Mana", + 311 => "Storm Fire", + 312 => "Storm Celestial", + 313 => "War Wraith", + 314 => "Wrulon", + 315 => "Kraken", + 316 => "Poison Frog", + 317 => "Queztocoatal", + 318 => "Valorian", + 319 => "War Boar", + 320 => "PoP Efreeti", + 321 => "War Boar Unarmored", + 322 => "Black Knight", + 323 => "Animated Armor", + 324 => "Undead Footman", + 325 => "Rallos Zek Minion", + 326 => "Arachnid", + 327 => "Crystal Spider", + 328 => "Zeb Cage", + 329 => "BoT Portal", + 330 => "Froglok", + 331 => "Troll Buccaneer", + 332 => "Troll Freebooter", + 333 => "Troll Sea Rover", + 334 => "Spectre Pirate Boss", + 335 => "Pirate Boss", + 336 => "Pirate Dark Shaman", + 337 => "Pirate Officer", + 338 => "Gnome Pirate", + 339 => "Dark Elf Pirate", + 340 => "Ogre Pirate", + 341 => "Human Pirate", + 342 => "Erudite Pirate", + 343 => "Poison Dart Frog", + 344 => "Troll Zombie", + 345 => "Luggald Land", + 346 => "Luggald Armored", + 347 => "Luggald Robed", + 348 => "Froglok Mount", + 349 => "Froglok Skeleton", + 350 => "Undead Froglok", + 351 => "Chosen Warrior", + 352 => "Chosen Wizard", + 353 => "Veksar", + 354 => "Greater Veksar", + 355 => "Veksar Boss", + 356 => "Chokadai", + 357 => "Undead Chokadai", + 358 => "Undead Veksar", + 359 => "Vampire Lesser", + 360 => "Vampire Elite", + 361 => "Rujakian Orc", + 362 => "Bone Golem", + 363 => "Synarcana", + 364 => "Sand Elf", + 365 => "Vampire Master", + 366 => "Rujakian Orc Elite", + 367 => "Skeleton New", + 368 => "Mummy New", + 369 => "Goblin New", + 370 => "Insect", + 371 => "Froglok Ghost", + 372 => "Dervish New", + 373 => "Shadow Creatue", + 374 => "Golem New", + 375 => "Evil Eye New", + 376 => "Box", + 377 => "Barrel", + 378 => "Chest", + 379 => "Vase", + 380 => "Table", + 381 => "Weapons Rack", + 382 => "Coffin", + 383 => "Bones", + 384 => "Jokester", + 385 => "Talosian Nihil", + 386 => "Talosian Exile", + 387 => "Talosian Golem", + 388 => "Talosian Wolf", + 389 => "Talosian Amphibian", + 390 => "Talosian Mountain Beast", + 391 => "Talosian Trilobyte", + 392 => "Invader War Hound", + 393 => "Invader Elite Centaur", + 394 => "Invader Lamia", + 395 => "Invader Cyclops", + 396 => "Kyv", + 397 => "Invader Soldier", + 398 => "Invader Brute", + 399 => "Invader Force Commander", + 400 => "Invader Lieutenant Boss", + 401 => "Invader War Beast", + 402 => "Invader Soldier Elite", + 403 => "UNKNOWN RACE", + 404 => "Discord Ship", */ - #endif + diff --git a/common/rdtsc.cpp b/common/rdtsc.cpp index 085387efc..15786397e 100644 --- a/common/rdtsc.cpp +++ b/common/rdtsc.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 "debug.h" #include "rdtsc.h" @@ -91,35 +91,35 @@ int64 RDTSC_Timer::rdtsc() { void RDTSC_Timer::init() { #ifdef USE_RDTSC int64 before, after, sum; - + int r; sum = 0; // run an average to increase accuracy of clock rate for(r = 0; r < CALIBRATE_LOOPS; r++) { before = rdtsc(); - + //sleep a know duration to figure out clock rate #ifdef _WINDOWS Sleep(SLEEP_TIME); #else usleep(SLEEP_TIME * 1000); //ms * 1000 #endif - + after = rdtsc(); - + sum += after - before; } - + //ticks per sleep / ms per sleep _ticsperms = (sum / CALIBRATE_LOOPS) / SLEEP_TIME; - + #else //if using gettimeofday, this is fixed at 1000 _ticsperms = 1000; #endif // printf("Tics per milisecond: %llu \n", _ticsperms); - - _inited = true; //only want to do this once + + _inited = true; //only want to do this once } //start the timer @@ -145,7 +145,7 @@ RDTSC_Collector::RDTSC_Collector() : RDTSC_Timer() { RDTSC_Collector::RDTSC_Collector(bool start_it) : RDTSC_Timer(start_it) { reset(); } - + void RDTSC_Collector::stop() { RDTSC_Timer::stop(); _sum += RDTSC_Timer::getTicks(); @@ -160,13 +160,9 @@ double RDTSC_Collector::getTotalDuration() { double RDTSC_Collector::getAverage() { return(((double)(getTotalTicks())) / double(_ticsperms * _count)); } - + void RDTSC_Collector::reset() { _sum = 0; _count = 0; } - - - - diff --git a/common/rdtsc.h b/common/rdtsc.h index b1babfd2b..2a36cac0f 100644 --- a/common/rdtsc.h +++ b/common/rdtsc.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 RDTSC_H #define RDTSC_H @@ -26,8 +26,8 @@ This class implementes the highest possibly prescision timer which is avaliable on the current archetecture. - - On intel, this uses the rdtsc instruction to get the actual + + On intel, this uses the rdtsc instruction to get the actual clock cycle count, and elsewhere it falls back to gettimeofday All calculations are carried out in 64 bit integers. @@ -39,18 +39,18 @@ class RDTSC_Timer { public: RDTSC_Timer(); RDTSC_Timer(bool start_it); - + void start(); //start the timer virtual void stop(); //stop the timer double getDuration(); //returns the number of miliseconds elapsed - + //access functions int64 getTicks() { return(_end - _start); } static int64 ticksPerMS() { return(_ticsperms); } - + protected: static int64 rdtsc(); - + int64 _start; int64 _end; @@ -67,21 +67,20 @@ class RDTSC_Collector : public RDTSC_Timer { public: RDTSC_Collector(); RDTSC_Collector(bool start_it); - + void reset(); - + void stop(); //stop the timer - + double getTotalDuration(); //returns the number of miliseconds elapsed double getAverage(); - + int64 getTotalTicks() { return(_sum); } int64 getCount() { return(_count); } - + protected: int64 _sum; int64 _count; }; - #endif diff --git a/common/rulesys.cpp b/common/rulesys.cpp index a6ec1a708..b7c9bd7e8 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 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 + 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. + 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 + 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 "rulesys.h" @@ -26,7 +26,7 @@ /* FatherNitwit: Added new rules subsystem to allow game rules to be changed - at runtime. more about this will come as time goes on. + at runtime. more about this will come as time goes on. FatherNitwit: Added #rules command to manage rules data from in game. FatherNitwit: Renamed old #rules to #serverrules FatherNitwit: Moved max level into the rules system (Character:MaxLevel) @@ -54,18 +54,15 @@ CREATE TABLE rule_values ( Commands: #rules: - - current -> lists current set name - - switch (set name) -> change set in the DB, but dont reload - - load (set name) -> load set into this zone without changing the world - - wload (set name) -> tell world and all zones to load this rule set - - store [set name] -> store the current rules in this zone to the set (or - active if not specified) - - reset -> reset all rule values to their defaults. - - list [catname] - - set (cat) (rule) (value) - - values [catname] -> show the values of all rules in the specified category/ - - + current -> lists current set name + switch (set name) -> change set in the DB, but dont reload + load (set name) -> load set into this zone without changing the world + wload (set name) -> tell world and all zones to load this rule set + store [set name] -> store the current rules in this zone to the set (or active if not specified) + reset -> reset all rule values to their defaults. + list [catname] + set (cat) (rule) (value) + values [catname] -> show the values of all rules in the specified category/ */ const char *RuleManager::s_categoryNames[_CatCount+1] = { @@ -76,9 +73,9 @@ const char *RuleManager::s_categoryNames[_CatCount+1] = { }; const RuleManager::RuleInfo RuleManager::s_RuleInfo[_IntRuleCount+_RealRuleCount+_BoolRuleCount+1] = { - /* this is done in three steps so we can reliably get to them by index*/ + /* this is done in three steps so we can reliably get to them by index*/ #define RULE_INT(cat, rule, default_value) \ - { #cat ":" #rule, Category__##cat, IntRule, Int__##rule }, + { #cat ":" #rule, Category__##cat, IntRule, Int__##rule }, #include "ruletypes.h" #define RULE_REAL(cat, rule, default_value) \ { #cat ":" #rule, Category__##cat, RealRule, Real__##rule }, @@ -90,8 +87,8 @@ const RuleManager::RuleInfo RuleManager::s_RuleInfo[_IntRuleCount+_RealRuleCount }; RuleManager::RuleManager() -: m_activeRuleset(0), - m_activeName("default") +: m_activeRuleset(0), + m_activeName("default") { ResetRules(); } @@ -195,7 +192,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas void RuleManager::ResetRules() { _log(RULES__CHANGE, "Resetting running rules to default values"); #define RULE_INT(cat, rule, default_value) \ - m_RuleIntValues[ Int__##rule ] = default_value; + m_RuleIntValues[ Int__##rule ] = default_value; #define RULE_REAL(cat, rule, default_value) \ m_RuleRealValues[ Real__##rule ] = default_value; #define RULE_BOOL(cat, rule, default_value) \ @@ -321,7 +318,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { } char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; if (!db->RunQuery(query, MakeAnyLenString(&query, "REPLACE INTO rule_values (ruleset_id, rule_name, rule_value) " " VALUES(%d, '%s', '%s')", @@ -376,7 +373,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) { uint32 new_id; char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; if (!db->RunQuery(query, MakeAnyLenString(&query, "INSERT INTO rule_sets (ruleset_id, name) " " VALUES(0, '%s')", @@ -445,48 +442,16 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { int32 RuleManager::GetIntRule(RuleManager::IntType t) const { - return(m_RuleIntValues[t]); + return(m_RuleIntValues[t]); } float RuleManager::GetRealRule(RuleManager::RealType t) const { - return(m_RuleRealValues[t]); + return(m_RuleRealValues[t]); } bool RuleManager::GetBoolRule(RuleManager::BoolType t) const { - return (m_RuleBoolValues[t] == 1); + return (m_RuleBoolValues[t] == 1); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/rulesys.h b/common/rulesys.h index 060a44e82..25c3a4019 100644 --- a/common/rulesys.h +++ b/common/rulesys.h @@ -1,28 +1,28 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 RULESYS_H_ #define RULESYS_H_ /* * Access to the rules system in normal code is done with three calls: -* - RuleI(category, rule) -> fetch an integer rule's value -* - RuleR(category, rule) -> fetch a real (float) rule's value -* - RuleB(category, rule) -> fetch a boolean/flag rule's value +* - RuleI(category, rule) -> fetch an integer rule's value +* - RuleR(category, rule) -> fetch a real (float) rule's value +* - RuleB(category, rule) -> fetch a boolean/flag rule's value * */ @@ -30,7 +30,7 @@ //which makes it a global for now, but with instancing we will do exactly //what we do with the zone global and just make it a member of core classes #define RuleI(cat, rule) \ - RuleManager::Instance()->GetIntRule( RuleManager::Int__##rule ) + RuleManager::Instance()->GetIntRule( RuleManager::Int__##rule ) #define RuleR(cat, rule) \ RuleManager::Instance()->GetRealRule( RuleManager::Real__##rule ) #define RuleB(cat, rule) \ @@ -54,14 +54,14 @@ public: #include "ruletypes.h" _IntRuleCount } IntType; - + typedef enum { #define RULE_REAL(cat, rule, default_value) \ Real__##rule, #include "ruletypes.h" _RealRuleCount } RealType; - + typedef enum { #define RULE_BOOL(cat, rule, default_value) \ Bool__##rule, @@ -76,25 +76,25 @@ public: _CatCount } CategoryType; - static RuleManager* Instance() { - static RuleManager rules; - return &rules; - } + static RuleManager* Instance() { + static RuleManager rules; + return &rules; + } - static const IntType InvalidInt = _IntRuleCount; + static const IntType InvalidInt = _IntRuleCount; static const RealType InvalidReal = _RealRuleCount; static const BoolType InvalidBool = _BoolRuleCount; static const CategoryType InvalidCategory = _CatCount; - + static const uint32 _RulesCount = _IntRuleCount+_RealRuleCount+_BoolRuleCount; - + //fetch routines, you should generally use the Rule* macros instead of this - int32 GetIntRule (IntType t) const; + int32 GetIntRule (IntType t) const; float GetRealRule(RealType t) const; bool GetBoolRule(BoolType t) const; //management routines - static const char *GetRuleName(IntType t) { return(s_RuleInfo[t].name); } + static const char *GetRuleName(IntType t) { return(s_RuleInfo[t].name); } static const char *GetRuleName(RealType t) { return(s_RuleInfo[t+_IntRuleCount].name); } static const char *GetRuleName(BoolType t) { return(s_RuleInfo[t+_IntRuleCount+_RealRuleCount].name); } static uint32 CountRules() { return(_RulesCount); } @@ -109,20 +109,20 @@ public: static int GetRulesetID(Database *db, const char *rulesetname); static std::string GetRulesetName(Database *db, int id); static bool ListRulesets(Database *db, std::map &into); - + void ResetRules(); bool LoadRules(Database *db, const char *ruleset = nullptr); void SaveRules(Database *db, const char *ruleset = nullptr); - + private: - RuleManager(); - RuleManager(const RuleManager&); - const RuleManager& operator=(const RuleManager&); + RuleManager(); + RuleManager(const RuleManager&); + const RuleManager& operator=(const RuleManager&); int m_activeRuleset; std::string m_activeName; #ifdef WIN64 - uint32 m_RuleIntValues [_IntRuleCount ]; + uint32 m_RuleIntValues [_IntRuleCount ]; #else int m_RuleIntValues [_IntRuleCount ]; #endif @@ -134,7 +134,7 @@ private: RealRule, BoolRule } RuleType; - + static bool _FindRule(const char *rule_name, RuleType &type_into, uint16 &index_into); static const char *_GetRuleName(RuleType type, uint16 index); static int _FindOrCreateRuleset(Database *db, const char *ruleset); @@ -148,7 +148,8 @@ private: uint16 rule_index; //index into its 'type' array } RuleInfo; static const RuleInfo s_RuleInfo[]; - + }; #endif /*RULESYS_H_*/ + diff --git a/common/ruletypes.h b/common/ruletypes.h index e5156c474..f615f42a0 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -40,11 +40,11 @@ RULE_REAL( Character, AAExpMultiplier, 0.5 ) RULE_REAL( Character, GroupExpMultiplier, 0.5 ) RULE_REAL( Character, RaidExpMultiplier, 0.2 ) RULE_BOOL( Character, UseXPConScaling, true ) -RULE_INT ( Character, LightBlueModifier, 40 ) +RULE_INT ( Character, LightBlueModifier, 40 ) RULE_INT ( Character, BlueModifier, 90 ) RULE_INT ( Character, WhiteModifier, 100 ) RULE_INT ( Character, YellowModifier, 125 ) -RULE_INT ( Character, RedModifier, 150 ) +RULE_INT ( Character, RedModifier, 150 ) RULE_INT ( Character, AutosaveIntervalS, 300 ) //0=disabled RULE_INT ( Character, HPRegenMultiplier, 100) RULE_INT ( Character, ManaRegenMultiplier, 100) @@ -86,10 +86,10 @@ RULE_BOOL ( Character, SoDClientUseSoDHPManaEnd, false) // Setting this to true RULE_BOOL ( Character, UseRaceClassExpBonuses, true) // Setting this to true will enable Class and Racial experience rate bonuses RULE_BOOL ( Character, RespawnFromHover, false) // Use Respawn window, or not. RULE_INT ( Character, RespawnFromHoverTimer, 300) // Respawn Window countdown timer, in SECONDS -RULE_BOOL ( Character, UseNewStatsWindow, true) // New stats window shows everything +RULE_BOOL ( Character, UseNewStatsWindow, true) // New stats window shows everything RULE_BOOL ( Character, ItemCastsUseFocus, false) // If true, this allows item clickies to use focuses that have limited max levels on them RULE_INT ( Character, MinStatusForNoDropExemptions, 80) // This allows status x and higher to trade no drop items. -RULE_INT ( Character, SkillCapMaxLevel, 75 ) // Sets the Max Level used for Skill Caps (from skill_caps table). -1 makes it use MaxLevel rule value. It is set to 75 because PEQ only has skillcaps up to that level, and grabbing the players' skill past 75 will return 0, breaking all skills past that level. This helps servers with obsurd level caps (75+ level cap) function without any modifications. +RULE_INT ( Character, SkillCapMaxLevel, 75 ) // Sets the Max Level used for Skill Caps (from skill_caps table). -1 makes it use MaxLevel rule value. It is set to 75 because PEQ only has skillcaps up to that level, and grabbing the players' skill past 75 will return 0, breaking all skills past that level. This helps servers with obsurd level caps (75+ level cap) function without any modifications. RULE_INT ( Character, StatCap, 0 ) RULE_BOOL ( Character, CheckCursorEmptyWhenLooting, true ) // If true, a player cannot loot a corpse (player or NPC) with an item on their cursor RULE_BOOL ( Character, MaintainIntoxicationAcrossZones, true ) // If true, alcohol effects are maintained across zoning and logging out/in. @@ -100,7 +100,7 @@ RULE_CATEGORY_END() RULE_CATEGORY( Mercs ) RULE_INT (Mercs, SuspendIntervalMS, 10000) -RULE_INT (Mercs, UpkeepIntervalMS, 180000) +RULE_INT (Mercs, UpkeepIntervalMS, 180000) RULE_INT (Mercs, SuspendIntervalS, 10) RULE_INT (Mercs, UpkeepIntervalS, 180) RULE_BOOL (Mercs, AllowMercs, false) @@ -144,19 +144,19 @@ RULE_INT ( World, ClientKeepaliveTimeoutMS, 65000 ) RULE_BOOL ( World, UseBannedIPsTable, false ) // Toggle whether or not to check incoming client connections against the Banned_IPs table. Set this value to false to disable this feature. RULE_BOOL ( World, EnableTutorialButton, true) RULE_BOOL ( World, EnableReturnHomeButton, true) -RULE_INT ( World, MaxLevelForTutorial, 10) -RULE_INT ( World, TutorialZoneID, 189) -RULE_INT ( World, GuildBankZoneID, 345) -RULE_INT ( World, MinOfflineTimeToReturnHome, 21600) // 21600 seconds is 6 Hours -RULE_INT ( World, MaxClientsPerIP, -1 ) // Maximum number of clients allowed to connect per IP address if account status is < AddMaxClientsStatus. Default value: -1 (feature disabled) -RULE_INT ( World, ExemptMaxClientsStatus, -1 ) // Exempt accounts from the MaxClientsPerIP and AddMaxClientsStatus rules, if their status is >= this value. Default value: -1 (feature disabled) -RULE_INT ( World, AddMaxClientsPerIP, -1 ) // Maximum number of clients allowed to connect per IP address if account status is < ExemptMaxClientsStatus. Default value: -1 (feature disabled) -RULE_INT ( World, AddMaxClientsStatus, -1 ) // Accounts with status >= this rule will be allowed to use the amount of accounts defined in the AddMaxClientsPerIP. Default value: -1 (feature disabled) +RULE_INT ( World, MaxLevelForTutorial, 10) +RULE_INT ( World, TutorialZoneID, 189) +RULE_INT ( World, GuildBankZoneID, 345) +RULE_INT ( World, MinOfflineTimeToReturnHome, 21600) // 21600 seconds is 6 Hours +RULE_INT ( World, MaxClientsPerIP, -1 ) // Maximum number of clients allowed to connect per IP address if account status is < AddMaxClientsStatus. Default value: -1 (feature disabled) +RULE_INT ( World, ExemptMaxClientsStatus, -1 ) // Exempt accounts from the MaxClientsPerIP and AddMaxClientsStatus rules, if their status is >= this value. Default value: -1 (feature disabled) +RULE_INT ( World, AddMaxClientsPerIP, -1 ) // Maximum number of clients allowed to connect per IP address if account status is < ExemptMaxClientsStatus. Default value: -1 (feature disabled) +RULE_INT ( World, AddMaxClientsStatus, -1 ) // Accounts with status >= this rule will be allowed to use the amount of accounts defined in the AddMaxClientsPerIP. Default value: -1 (feature disabled) RULE_BOOL ( World, MaxClientsSetByStatus, false) // If True, IP Limiting will be set to the status on the account as long as the status is > MaxClientsPerIP RULE_BOOL ( World, ClearTempMerchantlist, true) // Clears temp merchant items when world boots. RULE_BOOL ( World, DeleteStaleCorpeBackups, true) // Deletes stale corpse backups older than 2 weeks. -RULE_INT ( World, AccountSessionLimit, -1 ) //Max number of characters allowed on at once from a single account (-1 is disabled) -RULE_INT ( World, ExemptAccountLimitStatus, -1 ) //Min status required to be exempt from multi-session per account limiting (-1 is disabled) +RULE_INT ( World, AccountSessionLimit, -1 ) //Max number of characters allowed on at once from a single account (-1 is disabled) +RULE_INT ( World, ExemptAccountLimitStatus, -1 ) //Min status required to be exempt from multi-session per account limiting (-1 is disabled) RULE_BOOL ( World, GMAccountIPList, false) // Check ip list against GM Accounts, AntiHack GM Accounts. RULE_INT ( World, MinGMAntiHackStatus, 1 ) //Minimum GM status to check against AntiHack list RULE_INT ( World, SoFStartZoneID, -1 ) //Sets the Starting Zone for SoF Clients separate from Titanium Clients (-1 is disabled) @@ -168,25 +168,25 @@ RULE_BOOL (World, IPLimitDisconnectAll, false) RULE_CATEGORY_END() RULE_CATEGORY( Zone ) -RULE_INT ( Zone, NPCPositonUpdateTicCount, 32 ) //ms between intervals of sending a position update to the entire zone. -RULE_INT ( Zone, ClientLinkdeadMS, 180000) //the time a client remains link dead on the server after a sudden disconnection -RULE_INT ( Zone, GraveyardTimeMS, 1200000) //ms time until a player corpse is moved to a zone's graveyard, if one is specified for the zone +RULE_INT ( Zone, NPCPositonUpdateTicCount, 32 ) //ms between intervals of sending a position update to the entire zone. +RULE_INT ( Zone, ClientLinkdeadMS, 180000) //the time a client remains link dead on the server after a sudden disconnection +RULE_INT ( Zone, GraveyardTimeMS, 1200000) //ms time until a player corpse is moved to a zone's graveyard, if one is specified for the zone RULE_BOOL ( Zone, EnableShadowrest, 1 ) // enables or disables the shadowrest zone feature for player corpses. Default is turned on. RULE_BOOL ( Zone, UsePlayerCorpseBackups, true) // Keeps backups of player corpses. -RULE_INT ( Zone, MQWarpExemptStatus, -1 ) // Required status level to exempt the MQWarpDetector. Set to -1 to disable this feature. -RULE_INT ( Zone, MQZoneExemptStatus, -1 ) // Required status level to exempt the MQZoneDetector. Set to -1 to disable this feature. -RULE_INT ( Zone, MQGateExemptStatus, -1 ) // Required status level to exempt the MQGateDetector. Set to -1 to disable this feature. -RULE_INT ( Zone, MQGhostExemptStatus, -1 ) // Required status level to exempt the MGhostDetector. Set to -1 to disable this feature. -RULE_BOOL ( Zone, EnableMQWarpDetector, true ) // Enable the MQWarp Detector. Set to False to disable this feature. -RULE_BOOL ( Zone, EnableMQZoneDetector, true ) // Enable the MQZone Detector. Set to False to disable this feature. -RULE_BOOL ( Zone, EnableMQGateDetector, true ) // Enable the MQGate Detector. Set to False to disable this feature. -RULE_BOOL ( Zone, EnableMQGhostDetector, true ) // Enable the MQGhost Detector. Set to False to disable this feature. +RULE_INT ( Zone, MQWarpExemptStatus, -1 ) // Required status level to exempt the MQWarpDetector. Set to -1 to disable this feature. +RULE_INT ( Zone, MQZoneExemptStatus, -1 ) // Required status level to exempt the MQZoneDetector. Set to -1 to disable this feature. +RULE_INT ( Zone, MQGateExemptStatus, -1 ) // Required status level to exempt the MQGateDetector. Set to -1 to disable this feature. +RULE_INT ( Zone, MQGhostExemptStatus, -1 ) // Required status level to exempt the MGhostDetector. Set to -1 to disable this feature. +RULE_BOOL ( Zone, EnableMQWarpDetector, true ) // Enable the MQWarp Detector. Set to False to disable this feature. +RULE_BOOL ( Zone, EnableMQZoneDetector, true ) // Enable the MQZone Detector. Set to False to disable this feature. +RULE_BOOL ( Zone, EnableMQGateDetector, true ) // Enable the MQGate Detector. Set to False to disable this feature. +RULE_BOOL ( Zone, EnableMQGhostDetector, true ) // Enable the MQGhost Detector. Set to False to disable this feature. RULE_REAL ( Zone, MQWarpDetectionDistanceFactor, 9.0) //clients move at 4.4 about if in a straight line but with movement and to acct for lag we raise it a bit RULE_BOOL ( Zone, MarkMQWarpLT, false ) RULE_INT ( Zone, AutoShutdownDelay, 5000 ) //How long a dynamic zone stays loaded while empty RULE_INT ( Zone, PEQZoneReuseTime, 900 ) //How long, in seconds, until you can reuse the #peqzone command. -RULE_INT ( Zone, PEQZoneDebuff1, 4454 ) //First debuff casted by #peqzone Default is Cursed Keeper's Blight. -RULE_INT ( Zone, PEQZoneDebuff2, 2209 ) //Second debuff casted by #peqzone Default is Tendrils of Apathy. +RULE_INT ( Zone, PEQZoneDebuff1, 4454 ) //First debuff casted by #peqzone Default is Cursed Keeper's Blight. +RULE_INT ( Zone, PEQZoneDebuff2, 2209 ) //Second debuff casted by #peqzone Default is Tendrils of Apathy. RULE_BOOL ( Zone, UsePEQZoneDebuffs, true ) //Will determine if #peqzone will debuff players or not when used. RULE_REAL ( Zone, HotZoneBonus, 0.75 ) RULE_INT ( Zone, ReservedInstances, 30 ) //Will reserve this many instance ids for globals... probably not a good idea to change this while a server is running. @@ -209,7 +209,7 @@ RULE_BOOL ( Map, UseClosestZ, false) // Move mobs to the nearest Z above or be // Only set UseClosestZ true if all your .map files generated from EQGs were created // with azone2. // -RULE_INT ( Map, FindBestZHeightAdjust, 1) // Adds this to the current Z before seeking the best Z position +RULE_INT ( Map, FindBestZHeightAdjust, 1) // Adds this to the current Z before seeking the best Z position RULE_CATEGORY_END() RULE_CATEGORY( Pathing ) @@ -221,24 +221,24 @@ RULE_BOOL ( Pathing, Guard, true ) // Enable pathing for mobs moving to their g RULE_BOOL ( Pathing, Find, true ) // Enable pathing for FindPerson requests from the client. RULE_BOOL ( Pathing, Fear, true ) // Enable pathing for fear RULE_REAL ( Pathing, ZDiffThreshold, 10) // If a mob las LOS to it's target, it will run to it if the Z difference is < this. -RULE_INT ( Pathing, LOSCheckFrequency, 1000) // A mob will check for LOS to it's target this often (milliseconds). -RULE_INT ( Pathing, RouteUpdateFrequencyShort, 1000) // How often a new route will be calculated if the target has moved. -RULE_INT ( Pathing, RouteUpdateFrequencyLong, 5000) // How often a new route will be calculated if the target has moved. +RULE_INT ( Pathing, LOSCheckFrequency, 1000) // A mob will check for LOS to it's target this often (milliseconds). +RULE_INT ( Pathing, RouteUpdateFrequencyShort, 1000) // How often a new route will be calculated if the target has moved. +RULE_INT ( Pathing, RouteUpdateFrequencyLong, 5000) // How often a new route will be calculated if the target has moved. // When a path has a path node route and it's target changes position, if it has RouteUpdateFrequencyNodeCount or less nodes to go on it's // current path, it will recalculate it's path based on the RouteUpdateFrequencyShort timer, otherwise it will use the // RouteUpdateFrequencyLong timer. -RULE_INT ( Pathing, RouteUpdateFrequencyNodeCount, 5) +RULE_INT ( Pathing, RouteUpdateFrequencyNodeCount, 5) RULE_REAL ( Pathing, MinDistanceForLOSCheckShort, 40000) // (NoRoot). While following a path, only check for LOS to target within this distance. RULE_REAL ( Pathing, MinDistanceForLOSCheckLong, 1000000) // (NoRoot). Min distance when initially attempting to acquire the target. -RULE_INT ( Pathing, MinNodesLeftForLOSCheck, 4) // Only check for LOS when we are down to this many path nodes left to run. +RULE_INT ( Pathing, MinNodesLeftForLOSCheck, 4) // Only check for LOS when we are down to this many path nodes left to run. // This next rule was put in for situations where the mob and it's target may be on different sides of a 'hazard', e.g. a pit // If the mob has LOS to it's target, even though there is a hazard in it's way, it may break off from the node path and run at // the target, only to later detect the hazard and re-acquire a node path. Depending upon the placement of the path nodes, this // can lead to the mob looping. The rule is intended to allow the mob to at least get closer to it's target each time before // checking LOS and trying to head straight for it. -RULE_INT ( Pathing, MinNodesTraversedForLOSCheck, 3) // Only check for LOS after we have traversed this many path nodes. -RULE_INT ( Pathing, CullNodesFromStart, 1) // Checks LOS from Start point to second node for this many nodes and removes first node if there is LOS -RULE_INT ( Pathing, CullNodesFromEnd, 1) // Checks LOS from End point to second to last node for this many nodes and removes last node if there is LOS +RULE_INT ( Pathing, MinNodesTraversedForLOSCheck, 3) // Only check for LOS after we have traversed this many path nodes. +RULE_INT ( Pathing, CullNodesFromStart, 1) // Checks LOS from Start point to second node for this many nodes and removes first node if there is LOS +RULE_INT ( Pathing, CullNodesFromEnd, 1) // Checks LOS from End point to second to last node for this many nodes and removes last node if there is LOS RULE_REAL ( Pathing, CandidateNodeRangeXY, 400) // When searching for path start/end nodes, only nodes within this range will be considered. RULE_REAL ( Pathing, CandidateNodeRangeZ, 10) // When searching for path start/end nodes, only nodes within this range will be considered. @@ -247,7 +247,7 @@ RULE_CATEGORY_END() RULE_CATEGORY( Watermap ) // enable these to use the water detection code. Requires Water Maps generated by awater utility RULE_BOOL ( Watermap, CheckWaypointsInWaterWhenLoading, false ) // Does not apply BestZ as waypoints are loaded if they are in water -RULE_BOOL ( Watermap, CheckForWaterAtWaypoints, false) // Check if a mob has moved into/out of water when at waypoints and sets flymode +RULE_BOOL ( Watermap, CheckForWaterAtWaypoints, false) // Check if a mob has moved into/out of water when at waypoints and sets flymode RULE_BOOL ( Watermap, CheckForWaterWhenMoving, false) // Checks if a mob has moved into/out of water each time it's loc is recalculated RULE_BOOL ( Watermap, CheckForWaterOnSendTo, false) // Checks if a mob has moved into/out of water on SendTo RULE_BOOL ( Watermap, CheckForWaterWhenFishing, false) // Only lets a player fish near water (if a water map exists for the zone) @@ -321,12 +321,12 @@ RULE_REAL ( Combat, HitFalloffMajor, 50.0) //hit will fall off sharply if we're RULE_REAL ( Combat, HitBonusPerLevel, 1.2) //You gain this % of hit for every level you are above your target RULE_REAL ( Combat, WeaponSkillFalloff, 0.33) //For every weapon skill point that's not maxed you lose this % of hit RULE_REAL ( Combat, ArcheryHitPenalty, 0.25) //Archery has a hit penalty to try to help balance it with the plethora of long term +hit modifiers for it -RULE_REAL ( Combat, AgiHitFactor, 0.01) +RULE_REAL ( Combat, AgiHitFactor, 0.01) RULE_INT ( Combat, MinRangedAttackDist, 25) //Minimum Distance to use Ranged Attacks RULE_BOOL ( Combat, ArcheryBonusRequiresStationary, true) //does the 2x archery bonus chance require a stationary npc RULE_REAL ( Combat, ArcheryBaseDamageBonus, 1) // % Modifier to Base Archery Damage (.5 = 50% base damage, 1 = 100%, 2 = 200%) RULE_REAL ( Combat, ArcheryNPCMultiplier, 1.0) // this is multiplied by the regular dmg to get the archery dmg -RULE_BOOL ( Combat, AssistNoTargetSelf, true) //when assisting a target that does not have a target: true = target self, false = leave target as was before assist (false = live like) +RULE_BOOL ( Combat, AssistNoTargetSelf, true) //when assisting a target that does not have a target: true = target self, false = leave target as was before assist (false = live like) RULE_INT ( Combat, MaxRampageTargets, 3) //max number of people hit with rampage RULE_INT ( Combat, MaxFlurryHits, 2) //max number of extra hits from flurry RULE_INT ( Combat, MonkDamageTableBonus, 5) //% bonus monks get to their damage table calcs @@ -413,7 +413,7 @@ RULE_CATEGORY_END() #ifdef BOTS RULE_CATEGORY ( Bots ) RULE_REAL ( Bots, BotManaRegen, 2.0 ) // Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players. -RULE_BOOL ( Bots, BotFinishBuffing, false ) // Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat. +RULE_BOOL ( Bots, BotFinishBuffing, false ) // Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat. RULE_INT ( Bots, CreateBotCount, 150 ) // Number of bots that each account can create RULE_INT ( Bots, SpawnBotCount, 71 ) // Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid RULE_BOOL ( Bots, BotQuest, false ) // Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl diff --git a/common/seperator-2.h b/common/seperator-2.h index b681c0a8a..a57b5617a 100644 --- a/common/seperator-2.h +++ b/common/seperator-2.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 */ // This class will split up a string smartly at the div character (default is space) // Seperator.arg[i] is a copy of the string chopped at the divs diff --git a/common/seperator.h b/common/seperator.h index 5957528cb..f6438fe5d 100644 --- a/common/seperator.h +++ b/common/seperator.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 */ // This class will split up a string smartly at the div character (default is space and tab) // Seperator.arg[i] is a copy of the string chopped at the divs @@ -33,10 +33,10 @@ public: int i; argnum = 0; int len = static_cast(strlen(message_in)); - + if(arglen > len) arglen = len+1; - + //msg = strdup(message); msg = new char[len+1]; strcpy(msg, message_in); diff --git a/common/serverinfo.cpp b/common/serverinfo.cpp index 410da4c26..aaa13e7ab 100644 --- a/common/serverinfo.cpp +++ b/common/serverinfo.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 */ // Serverinfo.cpp - Server information gathering functions, used in #serverinfo - Windows specific // I'm not sure quite how to get this exact information in *nix, hopefully someone can fill that in @@ -33,21 +33,21 @@ int GetOS() { OSVERSIONINFO Ver_os; Ver_os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - + if(!(GetVersionEx(&Ver_os))) return 1; - + Ver_build = Ver_os.dwBuildNumber & 0xFFFF; Ver_min = Ver_os.dwMinorVersion; Ver_maj = Ver_os.dwMajorVersion; Ver_pid = Ver_os.dwPlatformId; - + if ((Ver_pid == 1) && (Ver_maj == 4)) { if ((Ver_min < 10) && (Ver_build == 950)) { strcpy(Ver_name, "Microsoft Windows 95"); } - else if ((Ver_min < 10) && + else if ((Ver_min < 10) && ((Ver_build > 950) && (Ver_build <= 1080))) { strcpy(Ver_name, "Microsoft Windows 95 SP1"); @@ -60,7 +60,7 @@ int GetOS() { { strcpy(Ver_name, "Microsoft Windows 98"); } - else if ((Ver_min == 10) && + else if ((Ver_min == 10) && ((Ver_build > 1998) && (Ver_build < 2183))) { strcpy(Ver_name, "Microsoft Windows 98, Service Pack 1"); @@ -99,21 +99,21 @@ int GetOS() { } return 0; -} +} #else #include #include #include - + char* GetOS(char* os_string) { utsname info; if(uname(&info)==0) { snprintf(os_string, 99, "%s %s %s %s %s", info.sysname, info.nodename, info.release, info.version, info.machine); } else { - strncpy(os_string, "Error determining OS & version!", 25); + strncpy(os_string, "Error determining OS & version!", 25); } return os_string; diff --git a/common/serverinfo.h b/common/serverinfo.h index dcba2a525..14425e6af 100644 --- a/common/serverinfo.h +++ b/common/serverinfo.h @@ -1,29 +1,29 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 SERVERINFO_H #define SERVERINFO_H #ifdef _WINDOWS - extern char Ver_name[36]; - extern DWORD Ver_build, Ver_min, Ver_maj, Ver_pid; - int GetOS(); + extern char Ver_name[36]; + extern DWORD Ver_build, Ver_min, Ver_maj, Ver_pid; + int GetOS(); #else - char* GetOS(char* os_string); + char* GetOS(char* os_string); #endif #endif diff --git a/common/servertalk.h b/common/servertalk.h index 26450d872..b5d9d6246 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -22,8 +22,8 @@ #define ServerOP_EmoteMessage 0x0009 // Worldfarts #define ServerOP_ClientList 0x000A // Update worldserver's client list, for #whos #define ServerOP_Who 0x000B // #who -#define ServerOP_ZonePlayer 0x000C // #zone, or #summon -#define ServerOP_KickPlayer 0x000D // #kick +#define ServerOP_ZonePlayer 0x000C // #zone, or #summon +#define ServerOP_KickPlayer 0x000D // #kick #define ServerOP_RefreshGuild 0x000E // Notice to all zoneservers to refresh their guild cache for ID# in packet (ServerGuildRefresh_Struct) #define ServerOP_VoiceMacro 0x000F @@ -39,8 +39,8 @@ #define ServerOP_FlagUpdate 0x0018 // GM Flag updated for character, refresh the memory cache #define ServerOP_GMGoto 0x0019 #define ServerOP_MultiLineMsg 0x001A -#define ServerOP_Lock 0x001B // For #lock/#unlock inside server -#define ServerOP_Motd 0x001C // For changing MoTD inside server. +#define ServerOP_Lock 0x001B // For #lock/#unlock inside server +#define ServerOP_Motd 0x001C // For changing MoTD inside server. #define ServerOP_Uptime 0x001D #define ServerOP_Petition 0x001E #define ServerOP_KillPlayer 0x001F @@ -59,7 +59,7 @@ #define ServerOP_ItemStatus 0x002C #define ServerOP_OOCMute 0x002D #define ServerOP_Revoke 0x002E -//#define 0x002F +//#define 0x002F #define ServerOP_GroupIDReq 0x0030 #define ServerOP_GroupIDReply 0x0031 #define ServerOP_GroupLeave 0x0032 // for disbanding out of zone folks @@ -104,26 +104,26 @@ #define ServerOP_GroupFollowAck 0x0111 #define ServerOP_GroupCancelInvite 0x0112 -#define ServerOP_InstanceUpdateTime 0x014F -#define ServerOP_AdventureRequest 0x0150 -#define ServerOP_AdventureRequestAccept 0x0151 -#define ServerOP_AdventureRequestDeny 0x0152 -#define ServerOP_AdventureRequestCreate 0x0153 -#define ServerOP_AdventureData 0x0154 -#define ServerOP_AdventureDataClear 0x0155 -#define ServerOP_AdventureCreateDeny 0x0156 -#define ServerOP_AdventureDataRequest 0x0157 -#define ServerOP_AdventureClickDoor 0x0158 -#define ServerOP_AdventureClickDoorReply 0x0159 -#define ServerOP_AdventureClickDoorError 0x015a -#define ServerOP_AdventureLeave 0x015b -#define ServerOP_AdventureLeaveReply 0x015c -#define ServerOP_AdventureLeaveDeny 0x015d -#define ServerOP_AdventureCountUpdate 0x015e -#define ServerOP_AdventureZoneData 0x015f -#define ServerOP_AdventureAssaCountUpdate 0x0160 -#define ServerOP_AdventureFinish 0x0161 -#define ServerOP_AdventureLeaderboard 0x0162 +#define ServerOP_InstanceUpdateTime 0x014F +#define ServerOP_AdventureRequest 0x0150 +#define ServerOP_AdventureRequestAccept 0x0151 +#define ServerOP_AdventureRequestDeny 0x0152 +#define ServerOP_AdventureRequestCreate 0x0153 +#define ServerOP_AdventureData 0x0154 +#define ServerOP_AdventureDataClear 0x0155 +#define ServerOP_AdventureCreateDeny 0x0156 +#define ServerOP_AdventureDataRequest 0x0157 +#define ServerOP_AdventureClickDoor 0x0158 +#define ServerOP_AdventureClickDoorReply 0x0159 +#define ServerOP_AdventureClickDoorError 0x015a +#define ServerOP_AdventureLeave 0x015b +#define ServerOP_AdventureLeaveReply 0x015c +#define ServerOP_AdventureLeaveDeny 0x015d +#define ServerOP_AdventureCountUpdate 0x015e +#define ServerOP_AdventureZoneData 0x015f +#define ServerOP_AdventureAssaCountUpdate 0x0160 +#define ServerOP_AdventureFinish 0x0161 +#define ServerOP_AdventureLeaderboard 0x0162 #define ServerOP_WhoAll 0x0210 #define ServerOP_FriendsWho 0x0211 @@ -179,12 +179,12 @@ #define ServerOP_CZMessagePlayer 0x4008 #define ServerOP_ReloadWorld 0x4009 -#define ServerOP_QSPlayerLogTrades 0x4010 -#define ServerOP_QSPlayerLogHandins 0x4011 -#define ServerOP_QSPlayerLogNPCKills 0x4012 -#define ServerOP_QSPlayerLogDeletes 0x4013 -#define ServerOP_QSPlayerLogMoves 0x4014 -#define ServerOP_QSMerchantLogTransactions 0x4015 +#define ServerOP_QSPlayerLogTrades 0x4010 +#define ServerOP_QSPlayerLogHandins 0x4011 +#define ServerOP_QSPlayerLogNPCKills 0x4012 +#define ServerOP_QSPlayerLogDeletes 0x4013 +#define ServerOP_QSPlayerLogMoves 0x4014 +#define ServerOP_QSMerchantLogTransactions 0x4015 enum { QSG_LFGuild = 0 }; enum { QSG_LFGuild_PlayerMatches = 0, QSG_LFGuild_UpdatePlayerInfo, QSG_LFGuild_RequestPlayerInfo, QSG_LFGuild_UpdateGuildInfo, QSG_LFGuild_GuildMatches, @@ -197,7 +197,7 @@ class ServerPacket { public: ~ServerPacket() { safe_delete_array(pBuffer); } - ServerPacket(uint16 in_opcode = 0, uint32 in_size = 0) { + ServerPacket(uint16 in_opcode = 0, uint32 in_size = 0) { this->compressed = false; size = in_size; opcode = in_opcode; @@ -267,7 +267,7 @@ public: uint8 ReadUInt8() { uint8 value = *(uint8 *)(pBuffer + _rpos); _rpos += sizeof(uint8); return value; } uint32 ReadUInt32() { uint32 value = *(uint32 *)(pBuffer + _rpos); _rpos += sizeof(uint32); return value; } void ReadString(char *str) { uint32 len = static_cast(strlen((char *)(pBuffer + _rpos))) + 1; memcpy(str, pBuffer + _rpos, len); _rpos += len; } - + uint32 GetWritePosition() { return _wpos; } uint32 GetReadPosition() { return _rpos; } void SetWritePosition(uint32 Newwpos) { _wpos = Newwpos; } @@ -336,15 +336,15 @@ struct ServerGroupFollowAck_Struct { struct ServerChannelMessage_Struct { - char deliverto[64]; - char to[64]; - char from[64]; + char deliverto[64]; + char to[64]; + char from[64]; uint8 fromadmin; - bool noreply; + bool noreply; uint16 chan_num; uint32 guilddbid; - uint16 language; - char message[0]; + uint16 language; + char message[0]; }; struct ServerEmoteMessage_Struct { @@ -407,9 +407,9 @@ struct ServerZonePlayer_Struct { char name[64]; char zone[25]; uint32 instance_id; - float x_pos; - float y_pos; - float z_pos; + float x_pos; + float y_pos; + float z_pos; }; struct RezzPlayer_Struct { @@ -500,18 +500,18 @@ struct ServerLSZoneSleep_Struct { struct ServerLSPlayerJoinWorld_Struct { uint32 lsaccount_id; - char key[30]; + char key[30]; }; struct ServerLSPlayerLeftWorld_Struct { uint32 lsaccount_id; - char key[30]; + char key[30]; }; struct ServerLSPlayerZoneChange_Struct { uint32 lsaccount_id; uint32 from; // 0 = world - uint32 to; // 0 = world + uint32 to; // 0 = world }; struct ServerLSClientAuth { uint32 lsaccount_id; // ID# in login server's db @@ -567,8 +567,8 @@ struct ServerUptime_Struct { }; struct ServerPetitionUpdate_Struct { - uint32 petid; // Petition Number - uint8 status; // 0x00 = ReRead DB -- 0x01 = Checkout -- More? Dunno... lol + uint32 petid; // Petition Number + uint8 status; // 0x00 = ReRead DB -- 0x01 = Checkout -- More? Dunno... lol }; struct ServerWhoAll_Struct { @@ -584,9 +584,9 @@ struct ServerWhoAll_Struct { }; struct ServerFriendsWho_Struct { - uint32 FromID; - char FromName[64]; - char FriendsString[1]; + uint32 FromID; + char FromName[64]; + char FriendsString[1]; }; struct ServerKillPlayer_Struct { @@ -640,8 +640,8 @@ struct ServerSyncWorldList_Struct { uint32 adminid; uint8 greenname; uint8 showdown; - int32 num_players; - int32 num_zones; + int32 num_players; + int32 num_zones; bool placeholder; }; @@ -708,8 +708,8 @@ struct ServerGroupChannelMessage_Struct { uint32 zoneid; uint16 instanceid; uint32 groupid; - char from[64]; - char message[0]; + char from[64]; + char message[0]; }; struct ServerDisbandGroup_Struct { @@ -838,7 +838,7 @@ struct ServerRaidGeneralAction_Struct { struct ServerRaidGroupAction_Struct { //add / remove depends on opcode. char membername[64]; //member who's adding / leaving uint32 gid; //group id to send to. - uint32 rid; //raid id to send to. + uint32 rid; //raid id to send to. }; struct ServerRaidMessage_Struct { @@ -1070,10 +1070,10 @@ struct ServerCameraShake_Struct }; struct ServerMailMessageHeader_Struct { - char from[64]; - char to[64]; - char subject[128]; - char message[0]; + char from[64]; + char to[64]; + char subject[128]; + char message[0]; }; struct Server_Speech_Struct { @@ -1111,7 +1111,7 @@ struct QSTradeItems_Struct { struct QSPlayerLogTrade_Struct { uint32 char1_id; - MoneyUpdate_Struct char1_money; + MoneyUpdate_Struct char1_money; uint16 char1_count; uint32 char2_id; MoneyUpdate_Struct char2_money; @@ -1132,20 +1132,20 @@ struct QSHandinItems_Struct { }; struct QSPlayerLogHandin_Struct { - uint32 quest_id; - uint32 char_id; - MoneyUpdate_Struct char_money; - uint16 char_count; - uint32 npc_id; - MoneyUpdate_Struct npc_money; - uint16 npc_count; + uint32 quest_id; + uint32 char_id; + MoneyUpdate_Struct char_money; + uint16 char_count; + uint32 npc_id; + MoneyUpdate_Struct npc_money; + uint16 npc_count; QSHandinItems_Struct items[0]; }; struct QSPlayerLogNPCKillSub_Struct{ uint32 NPCID; uint32 ZoneID; - uint32 Type; + uint32 Type; }; struct QSPlayerLogNPCKillsPlayers_Struct{ @@ -1169,10 +1169,10 @@ struct QSDeleteItems_Struct { }; struct QSPlayerLogDelete_Struct { - uint32 char_id; - uint16 stack_size; // '0' indicates full stack or non-stackable item move - uint16 char_count; - QSDeleteItems_Struct items[0]; + uint32 char_id; + uint16 stack_size; // '0' indicates full stack or non-stackable item move + uint16 char_count; + QSDeleteItems_Struct items[0]; }; struct QSMoveItems_Struct { @@ -1188,12 +1188,12 @@ struct QSMoveItems_Struct { }; struct QSPlayerLogMove_Struct { - uint32 char_id; - uint16 from_slot; - uint16 to_slot; - uint16 stack_size; // '0' indicates full stack or non-stackable item move - uint16 char_count; - bool postaction; + uint32 char_id; + uint16 from_slot; + uint16 to_slot; + uint16 stack_size; // '0' indicates full stack or non-stackable item move + uint16 char_count; + bool postaction; QSMoveItems_Struct items[0]; }; @@ -1209,18 +1209,18 @@ struct QSTransactionItems_Struct { }; struct QSMerchantLogTransaction_Struct { - uint32 zone_id; - uint32 merchant_id; - MoneyUpdate_Struct merchant_money; - uint16 merchant_count; - uint32 char_id; - MoneyUpdate_Struct char_money; - uint16 char_count; + uint32 zone_id; + uint32 merchant_id; + MoneyUpdate_Struct merchant_money; + uint16 merchant_count; + uint32 char_id; + MoneyUpdate_Struct char_money; + uint16 char_count; QSTransactionItems_Struct items[0]; }; struct CZMessagePlayer_Struct { - uint32 Type; + uint32 Type; char CharName[64]; char Message[512]; }; diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 6fc251374..87420550c 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1,4 +1,3 @@ - #include "shareddb.h" #include #include @@ -22,43 +21,43 @@ using namespace std; SharedDatabase::SharedDatabase() : Database(), skill_caps_mmf(nullptr), items_mmf(nullptr), items_hash(nullptr), faction_mmf(nullptr), faction_hash(nullptr), - loot_table_mmf(nullptr), loot_drop_mmf(nullptr), loot_table_hash(nullptr), loot_drop_hash(nullptr) + loot_table_mmf(nullptr), loot_drop_mmf(nullptr), loot_table_hash(nullptr), loot_drop_hash(nullptr) { } SharedDatabase::SharedDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port) -: Database(host, user, passwd, database, port), skill_caps_mmf(nullptr), items_mmf(nullptr), items_hash(nullptr), - faction_mmf(nullptr), faction_hash(nullptr), loot_table_mmf(nullptr), loot_drop_mmf(nullptr), loot_table_hash(nullptr), - loot_drop_hash(nullptr) +: Database(host, user, passwd, database, port), skill_caps_mmf(nullptr), items_mmf(nullptr), items_hash(nullptr), + faction_mmf(nullptr), faction_hash(nullptr), loot_table_mmf(nullptr), loot_drop_mmf(nullptr), loot_table_hash(nullptr), + loot_drop_hash(nullptr) { } SharedDatabase::~SharedDatabase() { - safe_delete(skill_caps_mmf); - safe_delete(items_mmf); - safe_delete(items_hash); - safe_delete(faction_mmf); - safe_delete(faction_hash); - safe_delete(loot_table_mmf); - safe_delete(loot_drop_mmf); - safe_delete(loot_table_hash); - safe_delete(loot_drop_hash); + safe_delete(skill_caps_mmf); + safe_delete(items_mmf); + safe_delete(items_hash); + safe_delete(faction_mmf); + safe_delete(faction_hash); + safe_delete(loot_table_mmf); + safe_delete(loot_drop_mmf); + safe_delete(loot_table_hash); + safe_delete(loot_drop_hash); } bool SharedDatabase::SetHideMe(uint32 account_id, uint8 hideme) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - + char *query = 0; + if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET hideme = %i where id = %i", hideme, account_id), errbuf)) { cerr << "Error in SetGMSpeed query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + safe_delete_array(query); return true; - + } uint8 SharedDatabase::GetGMSpeed(uint32 account_id) @@ -85,31 +84,31 @@ uint8 SharedDatabase::GetGMSpeed(uint32 account_id) } else { - + cerr << "Error in GetGMSpeed query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + return 0; - + } bool SharedDatabase::SetGMSpeed(uint32 account_id, uint8 gmspeed) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - + char *query = 0; + if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET gmspeed = %i where id = %i", gmspeed, account_id), errbuf)) { cerr << "Error in SetGMSpeed query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + safe_delete_array(query); return true; - + } uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) { @@ -117,8 +116,8 @@ uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) { uint32 EntitledTime = 0; const char *EntitledQuery = "select sum(ascii(substring(profile, 237, 1)) + (ascii(substring(profile, 238, 1)) * 256) +" - "(ascii(substring(profile, 239, 1)) * 65536) + (ascii(substring(profile, 240, 1)) * 16777216))" - "from character_ where account_id = %i"; + "(ascii(substring(profile, 239, 1)) * 65536) + (ascii(substring(profile, 240, 1)) * 16777216))" + "from character_ where account_id = %i"; char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; @@ -147,7 +146,7 @@ iter_queue it; int i; bool ret=true; char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; // Delete cursor items if ((ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND ( (slotid >=8000 and slotid<=8999) or slotid=30 or (slotid>=331 and slotid<=340))", char_id), errbuf))) { for(it=start,i=8000;it!=end;it++,i++) { @@ -166,11 +165,11 @@ bool ret=true; bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; MYSQL_ROW row; // Delete cursor items - if (!RunQuery(query, MakeAnyLenString(&query, + if (!RunQuery(query, MakeAnyLenString(&query, "SELECT itemid,charges FROM sharedbank " "WHERE acctid=%d AND slotid=%d", account_id, slot_id), errbuf, &result)) { @@ -180,19 +179,19 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite return(true); } safe_delete_array(query); - + row = mysql_fetch_row(result); bool found = false; if(row) { uint32 id = atoi(row[0]); uint16 charges = atoi(row[1]); - + uint16 expect_charges = 0; if(inst->GetCharges() >= 0) expect_charges = inst->GetCharges(); else expect_charges = 0x7FFF; - + if(id == inst->GetItem()->ID && charges == expect_charges) found = true; } @@ -203,30 +202,30 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id) { _CP(Database_SaveInventory); char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; bool ret = false; uint32 augslot[5] = { 0, 0, 0, 0, 0 }; //never save tribute slots: if(slot_id >= 400 && slot_id <= 404) return(true); - + if (inst && inst->IsType(ItemClassCommon)) { for(int i=0;i<5;i++) { ItemInst *auginst=inst->GetItem(i); augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } } - + if (slot_id>=2500 && slot_id<=2600) { // Shared bank inventory if (!inst) { // Delete item uint32 account_id = GetAccountIDByChar(char_id); uint32 len_query = MakeAnyLenString(&query, "DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); - + ret = RunQuery(query, len_query, errbuf); - + // Delete bag slots, if need be if (ret && Inventory::SupportsContainers(slot_id)) { safe_delete_array(query); @@ -234,7 +233,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM sharedbank WHERE acctid=%i AND slotid>=%i AND slotid<%i", account_id, base_slot_id, (base_slot_id+10)), errbuf); } - + // @merth: need to delete augments here } else { @@ -246,17 +245,17 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s else charges = 0x7FFF; - uint32 len_query = MakeAnyLenString(&query, + uint32 len_query = MakeAnyLenString(&query, "REPLACE INTO sharedbank " " (acctid,slotid,itemid,charges,custom_data," " augslot1,augslot2,augslot3,augslot4,augslot5)" " VALUES(%lu,%lu,%lu,%lu,'%s'," " %lu,%lu,%lu,%lu,%lu)", (unsigned long)account_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, - inst->GetCustomDataString().c_str(), + inst->GetCustomDataString().c_str(), (unsigned long)augslot[0],(unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4]); - + ret = RunQuery(query, len_query, errbuf); } } @@ -265,7 +264,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s // Delete item ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND slotid=%i", char_id, slot_id), errbuf); - + // Delete bag slots, if need be if (ret && Inventory::SupportsContainers(slot_id)) { safe_delete_array(query); @@ -273,7 +272,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND slotid>=%i AND slotid<%i", char_id, base_slot_id, (base_slot_id+10)), errbuf); } - + // @merth: need to delete augments here } else { @@ -283,24 +282,24 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s else charges = 0x7FFF; // Update/Insert item - uint32 len_query = MakeAnyLenString(&query, + uint32 len_query = MakeAnyLenString(&query, "REPLACE INTO inventory " " (charid,slotid,itemid,charges,instnodrop,custom_data,color," " augslot1,augslot2,augslot3,augslot4,augslot5)" " VALUES(%lu,%lu,%lu,%lu,%lu,'%s',%lu," " %lu,%lu,%lu,%lu,%lu)", - (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, - (unsigned long)(inst->IsInstNoDrop() ? 1:0),inst->GetCustomDataString().c_str(),(unsigned long)inst->GetColor(), + (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, + (unsigned long)(inst->IsInstNoDrop() ? 1:0),inst->GetCustomDataString().c_str(),(unsigned long)inst->GetColor(), (unsigned long)augslot[0],(unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4] ); - + ret = RunQuery(query, len_query, errbuf); } } - + if (!ret) LogFile->write(EQEMuLog::Error, "SaveInventory query '%s': %s", query, errbuf); safe_delete_array(query); - + // Save bag contents, if slot supports bag contents if (inst && inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) { for (uint8 idx=0; idx<10; idx++) { @@ -308,9 +307,9 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); } } - + // @merth: need to save augments here - + return ret; } @@ -338,26 +337,26 @@ int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) } else { - + cerr << "Error in GetSharedPlatinum query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + return 0; } bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET sharedplat = sharedplat + %i WHERE id = %i", amount_to_add, account_id), errbuf)) { cerr << "Error in SetSharedPlatinum query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; } - + safe_delete_array(query); return true; } @@ -369,7 +368,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, MYSQL_RES *result; MYSQL_ROW row; const Item_Struct* myitem; - + RunQuery ( query, @@ -394,7 +393,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, myitem = GetItem(itemid); if(!myitem) continue; - ItemInst* myinst = CreateBaseItem(myitem, charges); + ItemInst* myinst = CreateBaseItem(myitem, charges); if(slot < 0) slot = inv->FindFreeSlot(0,0); inv->PutItem(slot, *myinst); @@ -410,12 +409,12 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, // Retrieve shared bank inventory based on either account or character bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - uint32 len_query = 0; + char* query = 0; + uint32 len_query = 0; MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_ROW row; bool ret = false; - + if (is_charid) { len_query = MakeAnyLenString(&query, "SELECT sb.slotid,sb.itemid,sb.charges,sb.augslot1,sb.augslot2,sb.augslot3,sb.augslot4,sb.augslot5,sb.custom_data from sharedbank sb " @@ -426,7 +425,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { len_query = MakeAnyLenString(&query, "SELECT slotid,itemid,charges,augslot1,augslot2,augslot3,augslot4,augslot5,custom_data from sharedbank WHERE acctid=%i", id); } - + if (RunQuery(query, len_query, errbuf, &result)) { while ((row = mysql_fetch_row(result))) { int16 slot_id = (int16)atoi(row[0]); @@ -439,10 +438,10 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { aug[3] = (uint32)atoi(row[6]); aug[4] = (uint32)atoi(row[7]); const Item_Struct* item = GetItem(item_id); - + if (item) { int16 put_slot_id = SLOT_INVALID; - + ItemInst* inst = CreateBaseItem(item, charges); if (item->ItemClass == ItemClassCommon) { for(int i=0;i<5;i++) { @@ -451,35 +450,35 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { } } } - if(row[8]) { - std::string data_str(row[8]); - std::string id; - std::string value; - bool use_id = true; + if(row[8]) { + std::string data_str(row[8]); + std::string id; + std::string value; + bool use_id = true; - for(int i = 0; i < data_str.length(); ++i) { - if(data_str[i] == '^') { - if(!use_id) { - inst->SetCustomData(id, value); - id.clear(); - value.clear(); - } - use_id = !use_id; - } - else { - char v = data_str[i]; - if(use_id) { - id.push_back(v); - } else { - value.push_back(v); - } - } - } - } - - put_slot_id = inv->PutItem(slot_id, *inst); + for(int i = 0; i < data_str.length(); ++i) { + if(data_str[i] == '^') { + if(!use_id) { + inst->SetCustomData(id, value); + id.clear(); + value.clear(); + } + use_id = !use_id; + } + else { + char v = data_str[i]; + if(use_id) { + id.push_back(v); + } else { + value.push_back(v); + } + } + } + } + + put_slot_id = inv->PutItem(slot_id, *inst); safe_delete(inst); - + // Save ptr to item in inventory if (put_slot_id == SLOT_INVALID) { LogFile->write(EQEMuLog::Error, @@ -496,14 +495,14 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); } } - + mysql_free_result(result); ret = true; } else { LogFile->write(EQEMuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", errbuf); } - + safe_delete_array(query); return ret; } @@ -513,16 +512,16 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { _CP(Database_GetInventory); char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES* result; - MYSQL_ROW row; + char* query = 0; + MYSQL_RES* result; + MYSQL_ROW row; bool ret = false; - + // Retrieve character inventory if (RunQuery(query, MakeAnyLenString(&query, "SELECT slotid,itemid,charges,color,augslot1,augslot2,augslot3,augslot4,augslot5," - "instnodrop,custom_data FROM inventory WHERE charid=%i ORDER BY slotid", char_id), errbuf, &result)) { + "instnodrop,custom_data FROM inventory WHERE charid=%i ORDER BY slotid", char_id), errbuf, &result)) { - while ((row = mysql_fetch_row(result))) { + while ((row = mysql_fetch_row(result))) { int16 slot_id = atoi(row[0]); uint32 item_id = atoi(row[1]); uint16 charges = atoi(row[2]); @@ -536,37 +535,37 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; const Item_Struct* item = GetItem(item_id); - + if (item) { int16 put_slot_id = SLOT_INVALID; - - ItemInst* inst = CreateBaseItem(item, charges); - - if(row[10]) { - std::string data_str(row[10]); - std::string id; - std::string value; - bool use_id = true; - for(int i = 0; i < data_str.length(); ++i) { - if(data_str[i] == '^') { - if(!use_id) { - inst->SetCustomData(id, value); - id.clear(); - value.clear(); - } - use_id = !use_id; - } - else { - char v = data_str[i]; - if(use_id) { - id.push_back(v); - } else { - value.push_back(v); - } - } - } - } + ItemInst* inst = CreateBaseItem(item, charges); + + if(row[10]) { + std::string data_str(row[10]); + std::string id; + std::string value; + bool use_id = true; + + for(int i = 0; i < data_str.length(); ++i) { + if(data_str[i] == '^') { + if(!use_id) { + inst->SetCustomData(id, value); + id.clear(); + value.clear(); + } + use_id = !use_id; + } + else { + char v = data_str[i]; + if(use_id) { + id.push_back(v); + } else { + value.push_back(v); + } + } + } + } if (instnodrop || (slot_id >= 0 && slot_id <= 21 && inst->GetItem()->Attuneable)) inst->SetInstNoDrop(true); @@ -587,10 +586,10 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { if (slot_id>=8000 && slot_id <= 8999) put_slot_id = inv->PushCursor(*inst); - else + else put_slot_id = inv->PutItem(slot_id, *inst); safe_delete(inst); - + // Save ptr to item in inventory if (put_slot_id == SLOT_INVALID) { LogFile->write(EQEMuLog::Error, @@ -605,7 +604,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { } } mysql_free_result(result); - + // Retrieve shared inventory ret = GetSharedBank(char_id, inv, true); } @@ -613,7 +612,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query, errbuf); LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); } - + safe_delete_array(query); return ret; } @@ -622,15 +621,15 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) { _CP(Database_GetInventory_name); char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES* result; - MYSQL_ROW row; + char* query = 0; + MYSQL_RES* result; + MYSQL_ROW row; bool ret = false; - + // Retrieve character inventory if (RunQuery(query, MakeAnyLenString(&query, "SELECT slotid,itemid,charges,color,augslot1,augslot2,augslot3,augslot4,augslot5," - "instnodrop,custom_data FROM inventory INNER JOIN character_ ch ON ch.id=charid WHERE ch.name='%s' AND ch.account_id=%i ORDER BY slotid", - name, account_id), errbuf, &result)) + "instnodrop,custom_data FROM inventory INNER JOIN character_ ch ON ch.id=charid WHERE ch.name='%s' AND ch.account_id=%i ORDER BY slotid", + name, account_id), errbuf, &result)) { while ((row = mysql_fetch_row(result))) { int16 slot_id = atoi(row[0]); @@ -649,34 +648,34 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) if(!item) continue; - ItemInst* inst = CreateBaseItem(item, charges); + ItemInst* inst = CreateBaseItem(item, charges); inst->SetInstNoDrop(instnodrop); - if(row[10]) { - std::string data_str(row[10]); - std::string id; - std::string value; - bool use_id = true; - - for(int i = 0; i < data_str.length(); ++i) { - if(data_str[i] == '^') { - if(!use_id) { - inst->SetCustomData(id, value); - id.clear(); - value.clear(); - } - use_id = !use_id; - } - else { - char v = data_str[i]; - if(use_id) { - id.push_back(v); - } else { - value.push_back(v); - } - } - } - } + if(row[10]) { + std::string data_str(row[10]); + std::string id; + std::string value; + bool use_id = true; + + for(int i = 0; i < data_str.length(); ++i) { + if(data_str[i] == '^') { + if(!use_id) { + inst->SetCustomData(id, value); + id.clear(); + value.clear(); + } + use_id = !use_id; + } + else { + char v = data_str[i]; + if(use_id) { + id.push_back(v); + } else { + value.push_back(v); + } + } + } + } if (color > 0) inst->SetColor(color); @@ -691,10 +690,10 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) } if (slot_id>=8000 && slot_id <= 8999) put_slot_id = inv->PushCursor(*inst); - else + else put_slot_id = inv->PutItem(slot_id, *inst); safe_delete(inst); - + // Save ptr to item in inventory if (put_slot_id == SLOT_INVALID) { LogFile->write(EQEMuLog::Error, @@ -703,7 +702,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) } } mysql_free_result(result); - + // Retrieve shared inventory ret = GetSharedBank(account_id, inv, false); } @@ -711,7 +710,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query, errbuf); LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); } - + safe_delete_array(query); return ret; } @@ -719,11 +718,11 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; item_count = -1; - max_id = 0; - + max_id = 0; + char query[] = "SELECT MAX(id), count(*) FROM items"; if (RunQuery(query, static_cast(strlen(query)), errbuf, &result)) { row = mysql_fetch_row(result); @@ -740,277 +739,277 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { } bool SharedDatabase::LoadItems() { - if(items_mmf) { - return true; - } + if(items_mmf) { + return true; + } - try { - EQEmu::IPCMutex mutex("items"); - mutex.Lock(); - items_mmf = new EQEmu::MemoryMappedFile("shared/items"); + try { + EQEmu::IPCMutex mutex("items"); + mutex.Lock(); + items_mmf = new EQEmu::MemoryMappedFile("shared/items"); - int32 items = -1; - uint32 max_item = 0; - GetItemsCount(items, max_item); - if(items == -1) { - EQ_EXCEPT("SharedDatabase", "Database returned no result"); - } - uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); - if(items_mmf->Size() != size) { - EQ_EXCEPT("SharedDatabase", "Couldn't load items because items_mmf->Size() != size"); - } + int32 items = -1; + uint32 max_item = 0; + GetItemsCount(items, max_item); + if(items == -1) { + EQ_EXCEPT("SharedDatabase", "Database returned no result"); + } + uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); + if(items_mmf->Size() != size) { + EQ_EXCEPT("SharedDatabase", "Couldn't load items because items_mmf->Size() != size"); + } - items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); - mutex.Unlock(); - } catch(std::exception& ex) { - LogFile->write(EQEMuLog::Error, "Error Loading Items: %s", ex.what()); - return false; - } + items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); + mutex.Unlock(); + } catch(std::exception& ex) { + LogFile->write(EQEMuLog::Error, "Error Loading Items: %s", ex.what()); + return false; + } return true; } void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id) { - EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, items, max_item_id); - char errbuf[MYSQL_ERRMSG_SIZE]; + EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, items, max_item_id); + char errbuf[MYSQL_ERRMSG_SIZE]; MYSQL_RES *result; MYSQL_ROW row; - char ndbuffer[4]; - bool disableNoRent = false; - if(GetVariable("disablenorent", ndbuffer, 4)) { - if(ndbuffer[0] == '1' && ndbuffer[1] == '\0') { - disableNoRent = true; - } - } - bool disableNoDrop = false; - if(GetVariable("disablenodrop", ndbuffer, 4)) { - if(ndbuffer[0] == '1' && ndbuffer[1] == '\0') { - disableNoDrop = true; - } - } - bool disableLoreGroup = false; - if(GetVariable("disablelore", ndbuffer, 4)) { - if(ndbuffer[0] == '1' && ndbuffer[1] == '\0') { - disableLoreGroup = true; - } - } - bool disableNoTransfer = false; - if(GetVariable("disablenotransfer", ndbuffer, 4)) { - if(ndbuffer[0] == '1' && ndbuffer[1] == '\0') { - disableNoTransfer = true; - } - } + char ndbuffer[4]; + bool disableNoRent = false; + if(GetVariable("disablenorent", ndbuffer, 4)) { + if(ndbuffer[0] == '1' && ndbuffer[1] == '\0') { + disableNoRent = true; + } + } + bool disableNoDrop = false; + if(GetVariable("disablenodrop", ndbuffer, 4)) { + if(ndbuffer[0] == '1' && ndbuffer[1] == '\0') { + disableNoDrop = true; + } + } + bool disableLoreGroup = false; + if(GetVariable("disablelore", ndbuffer, 4)) { + if(ndbuffer[0] == '1' && ndbuffer[1] == '\0') { + disableLoreGroup = true; + } + } + bool disableNoTransfer = false; + if(GetVariable("disablenotransfer", ndbuffer, 4)) { + if(ndbuffer[0] == '1' && ndbuffer[1] == '\0') { + disableNoTransfer = true; + } + } - char query[] = "select source," + char query[] = "select source," #define F(x) "`"#x"`," #include "item_fieldlist.h" #undef F "updated" " from items order by id"; - Item_Struct item; + Item_Struct item; if(RunQuery(query, sizeof(query), errbuf, &result)) { - while((row = mysql_fetch_row(result))) { - memset(&item, 0, sizeof(Item_Struct)); - - item.ItemClass = (uint8)atoi(row[ItemField::itemclass]); - strcpy(item.Name,row[ItemField::name]); - strcpy(item.Lore,row[ItemField::lore]); - strcpy(item.IDFile,row[ItemField::idfile]); - item.ID = (uint32)atoul(row[ItemField::id]); - item.Weight = (uint8)atoi(row[ItemField::weight]); - item.NoRent = disableNoRent ? (uint8)atoi("255") : (uint8)atoi(row[ItemField::norent]); - item.NoDrop = disableNoDrop ? (uint8)atoi("255") : (uint8)atoi(row[ItemField::nodrop]); - item.Size = (uint8)atoi(row[ItemField::size]); - item.Slots = (uint32)atoul(row[ItemField::slots]); - item.Price = (uint32)atoul(row[ItemField::price]); - item.Icon = (uint32)atoul(row[ItemField::icon]); - item.BenefitFlag = (atoul(row[ItemField::benefitflag]) != 0); - item.Tradeskills = (atoi(row[ItemField::tradeskills])==0) ? false : true; - item.CR = (int8)atoi(row[ItemField::cr]); - item.DR = (int8)atoi(row[ItemField::dr]); - item.PR = (int8)atoi(row[ItemField::pr]); - item.MR = (int8)atoi(row[ItemField::mr]); - item.FR = (int8)atoi(row[ItemField::fr]); - item.AStr = (int8)atoi(row[ItemField::astr]); - item.ASta = (int8)atoi(row[ItemField::asta]); - item.AAgi = (int8)atoi(row[ItemField::aagi]); - item.ADex = (int8)atoi(row[ItemField::adex]); - item.ACha = (int8)atoi(row[ItemField::acha]); - item.AInt = (int8)atoi(row[ItemField::aint]); - item.AWis = (int8)atoi(row[ItemField::awis]); - item.HP = (int32)atoul(row[ItemField::hp]); - item.Mana = (int32)atoul(row[ItemField::mana]); - item.AC = (int32)atoul(row[ItemField::ac]); - item.Deity = (uint32)atoul(row[ItemField::deity]); - item.SkillModValue = (int32)atoul(row[ItemField::skillmodvalue]); - //item.Unk033 = (int32)atoul(row[ItemField::UNK033]); - item.SkillModType = (uint32)atoul(row[ItemField::skillmodtype]); - item.BaneDmgRace = (uint32)atoul(row[ItemField::banedmgrace]); - item.BaneDmgAmt = (int8)atoi(row[ItemField::banedmgamt]); - item.BaneDmgBody = (uint32)atoul(row[ItemField::banedmgbody]); - item.Magic = (atoi(row[ItemField::magic])==0) ? false : true; - item.CastTime_ = (int32)atoul(row[ItemField::casttime_]); - item.ReqLevel = (uint8)atoi(row[ItemField::reqlevel]); - item.BardType = (uint32)atoul(row[ItemField::bardtype]); - item.BardValue = (int32)atoul(row[ItemField::bardvalue]); - item.Light = (int8)atoi(row[ItemField::light]); - item.Delay = (uint8)atoi(row[ItemField::delay]); - item.RecLevel = (uint8)atoi(row[ItemField::reclevel]); - item.RecSkill = (uint8)atoi(row[ItemField::recskill]); - item.ElemDmgType = (uint8)atoi(row[ItemField::elemdmgtype]); - item.ElemDmgAmt = (uint8)atoi(row[ItemField::elemdmgamt]); - item.Range = (uint8)atoi(row[ItemField::range]); - item.Damage = (uint32)atoi(row[ItemField::damage]); - item.Color = (uint32)atoul(row[ItemField::color]); - item.Classes = (uint32)atoul(row[ItemField::classes]); - item.Races = (uint32)atoul(row[ItemField::races]); - //item.Unk054 = (uint32)atoul(row[ItemField::UNK054]); - item.MaxCharges = (int16)atoi(row[ItemField::maxcharges]); - item.ItemType = (uint8)atoi(row[ItemField::itemtype]); - item.Material = (uint8)atoi(row[ItemField::material]); - item.SellRate = (float)atof(row[ItemField::sellrate]); - //item.Unk059 = (uint32)atoul(row[ItemField::UNK059]); - item.CastTime = (uint32)atoul(row[ItemField::casttime]); - item.EliteMaterial = (uint32)atoul(row[ItemField::elitematerial]); - item.ProcRate = (int32)atoi(row[ItemField::procrate]); - item.CombatEffects = (int8)atoi(row[ItemField::combateffects]); - item.Shielding = (int8)atoi(row[ItemField::shielding]); - item.StunResist = (int8)atoi(row[ItemField::stunresist]); - item.StrikeThrough = (int8)atoi(row[ItemField::strikethrough]); - item.ExtraDmgSkill = (uint32)atoul(row[ItemField::extradmgskill]); - item.ExtraDmgAmt = (uint32)atoul(row[ItemField::extradmgamt]); - item.SpellShield = (int8)atoi(row[ItemField::spellshield]); - item.Avoidance = (int8)atoi(row[ItemField::avoidance]); - item.Accuracy = (int8)atoi(row[ItemField::accuracy]); - item.CharmFileID = (uint32)atoul(row[ItemField::charmfileid]); - item.FactionMod1 = (int32)atoul(row[ItemField::factionmod1]); - item.FactionMod2 = (int32)atoul(row[ItemField::factionmod2]); - item.FactionMod3 = (int32)atoul(row[ItemField::factionmod3]); - item.FactionMod4 = (int32)atoul(row[ItemField::factionmod4]); - item.FactionAmt1 = (int32)atoul(row[ItemField::factionamt1]); - item.FactionAmt2 = (int32)atoul(row[ItemField::factionamt2]); - item.FactionAmt3 = (int32)atoul(row[ItemField::factionamt3]); - item.FactionAmt4 = (int32)atoul(row[ItemField::factionamt4]); - strcpy(item.CharmFile,row[ItemField::charmfile]); - item.AugType = (uint32)atoul(row[ItemField::augtype]); - item.AugSlotType[0] = (uint8)atoi(row[ItemField::augslot1type]); - item.AugSlotVisible[0] = (uint8)atoi(row[ItemField::augslot1visible]); - item.AugSlotUnk2[0] = 0; - item.AugSlotType[1] = (uint8)atoi(row[ItemField::augslot2type]); - item.AugSlotVisible[1] = (uint8)atoi(row[ItemField::augslot2visible]); - item.AugSlotUnk2[1] = 0; - item.AugSlotType[2] = (uint8)atoi(row[ItemField::augslot3type]); - item.AugSlotVisible[2] = (uint8)atoi(row[ItemField::augslot3visible]); - item.AugSlotUnk2[2] = 0; - item.AugSlotType[3] = (uint8)atoi(row[ItemField::augslot4type]); - item.AugSlotVisible[3] = (uint8)atoi(row[ItemField::augslot4visible]); - item.AugSlotUnk2[3] = 0; - item.AugSlotType[4] = (uint8)atoi(row[ItemField::augslot5type]); - item.AugSlotVisible[4] = (uint8)atoi(row[ItemField::augslot5visible]); - item.AugSlotUnk2[4] = 0; - item.LDoNTheme = (uint32)atoul(row[ItemField::ldontheme]); - item.LDoNPrice = (uint32)atoul(row[ItemField::ldonprice]); - item.LDoNSold = (uint32)atoul(row[ItemField::ldonsold]); - item.BagType = (uint8)atoi(row[ItemField::bagtype]); - item.BagSlots = (uint8)atoi(row[ItemField::bagslots]); - item.BagSize = (uint8)atoi(row[ItemField::bagsize]); - item.BagWR = (uint8)atoi(row[ItemField::bagwr]); - item.Book = (uint8)atoi(row[ItemField::book]); - item.BookType = (uint32)atoul(row[ItemField::booktype]); - strcpy(item.Filename,row[ItemField::filename]); - item.BaneDmgRaceAmt = (uint32)atoul(row[ItemField::banedmgraceamt]); - item.AugRestrict = (uint32)atoul(row[ItemField::augrestrict]); - item.LoreGroup = disableLoreGroup ? (uint8)atoi("0") : atoi(row[ItemField::loregroup]); - item.LoreFlag = item.LoreGroup!=0; - item.PendingLoreFlag = (atoi(row[ItemField::pendingloreflag])==0) ? false : true; - item.ArtifactFlag = (atoi(row[ItemField::artifactflag])==0) ? false : true; - item.SummonedFlag = (atoi(row[ItemField::summonedflag])==0) ? false : true; - item.Favor = (uint32)atoul(row[ItemField::favor]); - item.FVNoDrop = (atoi(row[ItemField::fvnodrop])==0) ? false : true; - item.Endur = (uint32)atoul(row[ItemField::endur]); - item.DotShielding = (uint32)atoul(row[ItemField::dotshielding]); - item.Attack = (uint32)atoul(row[ItemField::attack]); - item.Regen = (uint32)atoul(row[ItemField::regen]); - item.ManaRegen = (uint32)atoul(row[ItemField::manaregen]); - item.EnduranceRegen = (uint32)atoul(row[ItemField::enduranceregen]); - item.Haste = (uint32)atoul(row[ItemField::haste]); - item.DamageShield = (uint32)atoul(row[ItemField::damageshield]); - item.RecastDelay = (uint32)atoul(row[ItemField::recastdelay]); - item.RecastType = (uint32)atoul(row[ItemField::recasttype]); - item.GuildFavor = (uint32)atoul(row[ItemField::guildfavor]); - item.AugDistiller = (uint32)atoul(row[ItemField::augdistiller]); - item.Attuneable = (atoi(row[ItemField::attuneable])==0) ? false : true; - item.NoPet = (atoi(row[ItemField::nopet])==0) ? false : true; - item.PointType = (uint32)atoul(row[ItemField::pointtype]); - item.PotionBelt = (atoi(row[ItemField::potionbelt])==0) ? false : true; - item.PotionBeltSlots = (atoi(row[ItemField::potionbeltslots])==0) ? false : true; - item.StackSize = (uint16)atoi(row[ItemField::stacksize]); - item.NoTransfer = disableNoTransfer ? false : (atoi(row[ItemField::notransfer])==0) ? false : true; - item.Stackable = (atoi(row[ItemField::stackable])==0) ? false : true; - item.Click.Effect = (uint32)atoul(row[ItemField::clickeffect]); - item.Click.Type = (uint8)atoul(row[ItemField::clicktype]); - item.Click.Level = (uint8)atoul(row[ItemField::clicklevel]); - item.Click.Level2 = (uint8)atoul(row[ItemField::clicklevel2]); - strcpy(item.CharmFile,row[ItemField::charmfile]); - item.Proc.Effect = (uint16)atoul(row[ItemField::proceffect]); - item.Proc.Type = (uint8)atoul(row[ItemField::proctype]); - item.Proc.Level = (uint8)atoul(row[ItemField::proclevel]); - item.Proc.Level2 = (uint8)atoul(row[ItemField::proclevel2]); - item.Worn.Effect = (uint16)atoul(row[ItemField::worneffect]); - item.Worn.Type = (uint8)atoul(row[ItemField::worntype]); - item.Worn.Level = (uint8)atoul(row[ItemField::wornlevel]); - item.Worn.Level2 = (uint8)atoul(row[ItemField::wornlevel2]); - item.Focus.Effect = (uint16)atoul(row[ItemField::focuseffect]); - item.Focus.Type = (uint8)atoul(row[ItemField::focustype]); - item.Focus.Level = (uint8)atoul(row[ItemField::focuslevel]); - item.Focus.Level2 = (uint8)atoul(row[ItemField::focuslevel2]); - item.Scroll.Effect = (uint16)atoul(row[ItemField::scrolleffect]); - item.Scroll.Type = (uint8)atoul(row[ItemField::scrolltype]); - item.Scroll.Level = (uint8)atoul(row[ItemField::scrolllevel]); - item.Scroll.Level2 = (uint8)atoul(row[ItemField::scrolllevel2]); - item.Bard.Effect = (uint16)atoul(row[ItemField::bardeffect]); - item.Bard.Type = (uint8)atoul(row[ItemField::bardtype]); - item.Bard.Level = (uint8)atoul(row[ItemField::bardlevel]); - item.Bard.Level2 = (uint8)atoul(row[ItemField::bardlevel2]); - item.QuestItemFlag = (atoi(row[ItemField::questitemflag])==0) ? false : true; - item.SVCorruption = (int32)atoi(row[ItemField::svcorruption]); - item.Purity = (uint32)atoul(row[ItemField::purity]); - item.BackstabDmg = (uint32)atoul(row[ItemField::backstabdmg]); - item.DSMitigation = (uint32)atoul(row[ItemField::dsmitigation]); - item.HeroicStr = (int32)atoi(row[ItemField::heroic_str]); - item.HeroicInt = (int32)atoi(row[ItemField::heroic_int]); - item.HeroicWis = (int32)atoi(row[ItemField::heroic_wis]); - item.HeroicAgi = (int32)atoi(row[ItemField::heroic_agi]); - item.HeroicDex = (int32)atoi(row[ItemField::heroic_dex]); - item.HeroicSta = (int32)atoi(row[ItemField::heroic_sta]); - item.HeroicCha = (int32)atoi(row[ItemField::heroic_cha]); - item.HeroicMR = (int32)atoi(row[ItemField::heroic_mr]); - item.HeroicFR = (int32)atoi(row[ItemField::heroic_fr]); - item.HeroicCR = (int32)atoi(row[ItemField::heroic_cr]); - item.HeroicDR = (int32)atoi(row[ItemField::heroic_dr]); - item.HeroicPR = (int32)atoi(row[ItemField::heroic_pr]); - item.HeroicSVCorrup = (int32)atoi(row[ItemField::heroic_svcorrup]); - item.HealAmt = (int32)atoi(row[ItemField::healamt]); - item.SpellDmg = (int32)atoi(row[ItemField::spelldmg]); - item.LDoNSellBackRate = (uint32)atoul(row[ItemField::ldonsellbackrate]); - item.ScriptFileID = (uint32)atoul(row[ItemField::scriptfileid]); - item.ExpendableArrow = (uint16)atoul(row[ItemField::expendablearrow]); - item.Clairvoyance = (uint32)atoul(row[ItemField::clairvoyance]); - strcpy(item.ClickName,row[ItemField::clickname]); - strcpy(item.ProcName,row[ItemField::procname]); - strcpy(item.WornName,row[ItemField::wornname]); - strcpy(item.FocusName,row[ItemField::focusname]); - strcpy(item.ScrollName,row[ItemField::scrollname]); + while((row = mysql_fetch_row(result))) { + memset(&item, 0, sizeof(Item_Struct)); - try { - hash.insert(item.ID, item); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Database::LoadItems: %s", ex.what()); - break; - } + item.ItemClass = (uint8)atoi(row[ItemField::itemclass]); + strcpy(item.Name,row[ItemField::name]); + strcpy(item.Lore,row[ItemField::lore]); + strcpy(item.IDFile,row[ItemField::idfile]); + item.ID = (uint32)atoul(row[ItemField::id]); + item.Weight = (uint8)atoi(row[ItemField::weight]); + item.NoRent = disableNoRent ? (uint8)atoi("255") : (uint8)atoi(row[ItemField::norent]); + item.NoDrop = disableNoDrop ? (uint8)atoi("255") : (uint8)atoi(row[ItemField::nodrop]); + item.Size = (uint8)atoi(row[ItemField::size]); + item.Slots = (uint32)atoul(row[ItemField::slots]); + item.Price = (uint32)atoul(row[ItemField::price]); + item.Icon = (uint32)atoul(row[ItemField::icon]); + item.BenefitFlag = (atoul(row[ItemField::benefitflag]) != 0); + item.Tradeskills = (atoi(row[ItemField::tradeskills])==0) ? false : true; + item.CR = (int8)atoi(row[ItemField::cr]); + item.DR = (int8)atoi(row[ItemField::dr]); + item.PR = (int8)atoi(row[ItemField::pr]); + item.MR = (int8)atoi(row[ItemField::mr]); + item.FR = (int8)atoi(row[ItemField::fr]); + item.AStr = (int8)atoi(row[ItemField::astr]); + item.ASta = (int8)atoi(row[ItemField::asta]); + item.AAgi = (int8)atoi(row[ItemField::aagi]); + item.ADex = (int8)atoi(row[ItemField::adex]); + item.ACha = (int8)atoi(row[ItemField::acha]); + item.AInt = (int8)atoi(row[ItemField::aint]); + item.AWis = (int8)atoi(row[ItemField::awis]); + item.HP = (int32)atoul(row[ItemField::hp]); + item.Mana = (int32)atoul(row[ItemField::mana]); + item.AC = (int32)atoul(row[ItemField::ac]); + item.Deity = (uint32)atoul(row[ItemField::deity]); + item.SkillModValue = (int32)atoul(row[ItemField::skillmodvalue]); + //item.Unk033 = (int32)atoul(row[ItemField::UNK033]); + item.SkillModType = (uint32)atoul(row[ItemField::skillmodtype]); + item.BaneDmgRace = (uint32)atoul(row[ItemField::banedmgrace]); + item.BaneDmgAmt = (int8)atoi(row[ItemField::banedmgamt]); + item.BaneDmgBody = (uint32)atoul(row[ItemField::banedmgbody]); + item.Magic = (atoi(row[ItemField::magic])==0) ? false : true; + item.CastTime_ = (int32)atoul(row[ItemField::casttime_]); + item.ReqLevel = (uint8)atoi(row[ItemField::reqlevel]); + item.BardType = (uint32)atoul(row[ItemField::bardtype]); + item.BardValue = (int32)atoul(row[ItemField::bardvalue]); + item.Light = (int8)atoi(row[ItemField::light]); + item.Delay = (uint8)atoi(row[ItemField::delay]); + item.RecLevel = (uint8)atoi(row[ItemField::reclevel]); + item.RecSkill = (uint8)atoi(row[ItemField::recskill]); + item.ElemDmgType = (uint8)atoi(row[ItemField::elemdmgtype]); + item.ElemDmgAmt = (uint8)atoi(row[ItemField::elemdmgamt]); + item.Range = (uint8)atoi(row[ItemField::range]); + item.Damage = (uint32)atoi(row[ItemField::damage]); + item.Color = (uint32)atoul(row[ItemField::color]); + item.Classes = (uint32)atoul(row[ItemField::classes]); + item.Races = (uint32)atoul(row[ItemField::races]); + //item.Unk054 = (uint32)atoul(row[ItemField::UNK054]); + item.MaxCharges = (int16)atoi(row[ItemField::maxcharges]); + item.ItemType = (uint8)atoi(row[ItemField::itemtype]); + item.Material = (uint8)atoi(row[ItemField::material]); + item.SellRate = (float)atof(row[ItemField::sellrate]); + //item.Unk059 = (uint32)atoul(row[ItemField::UNK059]); + item.CastTime = (uint32)atoul(row[ItemField::casttime]); + item.EliteMaterial = (uint32)atoul(row[ItemField::elitematerial]); + item.ProcRate = (int32)atoi(row[ItemField::procrate]); + item.CombatEffects = (int8)atoi(row[ItemField::combateffects]); + item.Shielding = (int8)atoi(row[ItemField::shielding]); + item.StunResist = (int8)atoi(row[ItemField::stunresist]); + item.StrikeThrough = (int8)atoi(row[ItemField::strikethrough]); + item.ExtraDmgSkill = (uint32)atoul(row[ItemField::extradmgskill]); + item.ExtraDmgAmt = (uint32)atoul(row[ItemField::extradmgamt]); + item.SpellShield = (int8)atoi(row[ItemField::spellshield]); + item.Avoidance = (int8)atoi(row[ItemField::avoidance]); + item.Accuracy = (int8)atoi(row[ItemField::accuracy]); + item.CharmFileID = (uint32)atoul(row[ItemField::charmfileid]); + item.FactionMod1 = (int32)atoul(row[ItemField::factionmod1]); + item.FactionMod2 = (int32)atoul(row[ItemField::factionmod2]); + item.FactionMod3 = (int32)atoul(row[ItemField::factionmod3]); + item.FactionMod4 = (int32)atoul(row[ItemField::factionmod4]); + item.FactionAmt1 = (int32)atoul(row[ItemField::factionamt1]); + item.FactionAmt2 = (int32)atoul(row[ItemField::factionamt2]); + item.FactionAmt3 = (int32)atoul(row[ItemField::factionamt3]); + item.FactionAmt4 = (int32)atoul(row[ItemField::factionamt4]); + strcpy(item.CharmFile,row[ItemField::charmfile]); + item.AugType = (uint32)atoul(row[ItemField::augtype]); + item.AugSlotType[0] = (uint8)atoi(row[ItemField::augslot1type]); + item.AugSlotVisible[0] = (uint8)atoi(row[ItemField::augslot1visible]); + item.AugSlotUnk2[0] = 0; + item.AugSlotType[1] = (uint8)atoi(row[ItemField::augslot2type]); + item.AugSlotVisible[1] = (uint8)atoi(row[ItemField::augslot2visible]); + item.AugSlotUnk2[1] = 0; + item.AugSlotType[2] = (uint8)atoi(row[ItemField::augslot3type]); + item.AugSlotVisible[2] = (uint8)atoi(row[ItemField::augslot3visible]); + item.AugSlotUnk2[2] = 0; + item.AugSlotType[3] = (uint8)atoi(row[ItemField::augslot4type]); + item.AugSlotVisible[3] = (uint8)atoi(row[ItemField::augslot4visible]); + item.AugSlotUnk2[3] = 0; + item.AugSlotType[4] = (uint8)atoi(row[ItemField::augslot5type]); + item.AugSlotVisible[4] = (uint8)atoi(row[ItemField::augslot5visible]); + item.AugSlotUnk2[4] = 0; + item.LDoNTheme = (uint32)atoul(row[ItemField::ldontheme]); + item.LDoNPrice = (uint32)atoul(row[ItemField::ldonprice]); + item.LDoNSold = (uint32)atoul(row[ItemField::ldonsold]); + item.BagType = (uint8)atoi(row[ItemField::bagtype]); + item.BagSlots = (uint8)atoi(row[ItemField::bagslots]); + item.BagSize = (uint8)atoi(row[ItemField::bagsize]); + item.BagWR = (uint8)atoi(row[ItemField::bagwr]); + item.Book = (uint8)atoi(row[ItemField::book]); + item.BookType = (uint32)atoul(row[ItemField::booktype]); + strcpy(item.Filename,row[ItemField::filename]); + item.BaneDmgRaceAmt = (uint32)atoul(row[ItemField::banedmgraceamt]); + item.AugRestrict = (uint32)atoul(row[ItemField::augrestrict]); + item.LoreGroup = disableLoreGroup ? (uint8)atoi("0") : atoi(row[ItemField::loregroup]); + item.LoreFlag = item.LoreGroup!=0; + item.PendingLoreFlag = (atoi(row[ItemField::pendingloreflag])==0) ? false : true; + item.ArtifactFlag = (atoi(row[ItemField::artifactflag])==0) ? false : true; + item.SummonedFlag = (atoi(row[ItemField::summonedflag])==0) ? false : true; + item.Favor = (uint32)atoul(row[ItemField::favor]); + item.FVNoDrop = (atoi(row[ItemField::fvnodrop])==0) ? false : true; + item.Endur = (uint32)atoul(row[ItemField::endur]); + item.DotShielding = (uint32)atoul(row[ItemField::dotshielding]); + item.Attack = (uint32)atoul(row[ItemField::attack]); + item.Regen = (uint32)atoul(row[ItemField::regen]); + item.ManaRegen = (uint32)atoul(row[ItemField::manaregen]); + item.EnduranceRegen = (uint32)atoul(row[ItemField::enduranceregen]); + item.Haste = (uint32)atoul(row[ItemField::haste]); + item.DamageShield = (uint32)atoul(row[ItemField::damageshield]); + item.RecastDelay = (uint32)atoul(row[ItemField::recastdelay]); + item.RecastType = (uint32)atoul(row[ItemField::recasttype]); + item.GuildFavor = (uint32)atoul(row[ItemField::guildfavor]); + item.AugDistiller = (uint32)atoul(row[ItemField::augdistiller]); + item.Attuneable = (atoi(row[ItemField::attuneable])==0) ? false : true; + item.NoPet = (atoi(row[ItemField::nopet])==0) ? false : true; + item.PointType = (uint32)atoul(row[ItemField::pointtype]); + item.PotionBelt = (atoi(row[ItemField::potionbelt])==0) ? false : true; + item.PotionBeltSlots = (atoi(row[ItemField::potionbeltslots])==0) ? false : true; + item.StackSize = (uint16)atoi(row[ItemField::stacksize]); + item.NoTransfer = disableNoTransfer ? false : (atoi(row[ItemField::notransfer])==0) ? false : true; + item.Stackable = (atoi(row[ItemField::stackable])==0) ? false : true; + item.Click.Effect = (uint32)atoul(row[ItemField::clickeffect]); + item.Click.Type = (uint8)atoul(row[ItemField::clicktype]); + item.Click.Level = (uint8)atoul(row[ItemField::clicklevel]); + item.Click.Level2 = (uint8)atoul(row[ItemField::clicklevel2]); + strcpy(item.CharmFile,row[ItemField::charmfile]); + item.Proc.Effect = (uint16)atoul(row[ItemField::proceffect]); + item.Proc.Type = (uint8)atoul(row[ItemField::proctype]); + item.Proc.Level = (uint8)atoul(row[ItemField::proclevel]); + item.Proc.Level2 = (uint8)atoul(row[ItemField::proclevel2]); + item.Worn.Effect = (uint16)atoul(row[ItemField::worneffect]); + item.Worn.Type = (uint8)atoul(row[ItemField::worntype]); + item.Worn.Level = (uint8)atoul(row[ItemField::wornlevel]); + item.Worn.Level2 = (uint8)atoul(row[ItemField::wornlevel2]); + item.Focus.Effect = (uint16)atoul(row[ItemField::focuseffect]); + item.Focus.Type = (uint8)atoul(row[ItemField::focustype]); + item.Focus.Level = (uint8)atoul(row[ItemField::focuslevel]); + item.Focus.Level2 = (uint8)atoul(row[ItemField::focuslevel2]); + item.Scroll.Effect = (uint16)atoul(row[ItemField::scrolleffect]); + item.Scroll.Type = (uint8)atoul(row[ItemField::scrolltype]); + item.Scroll.Level = (uint8)atoul(row[ItemField::scrolllevel]); + item.Scroll.Level2 = (uint8)atoul(row[ItemField::scrolllevel2]); + item.Bard.Effect = (uint16)atoul(row[ItemField::bardeffect]); + item.Bard.Type = (uint8)atoul(row[ItemField::bardtype]); + item.Bard.Level = (uint8)atoul(row[ItemField::bardlevel]); + item.Bard.Level2 = (uint8)atoul(row[ItemField::bardlevel2]); + item.QuestItemFlag = (atoi(row[ItemField::questitemflag])==0) ? false : true; + item.SVCorruption = (int32)atoi(row[ItemField::svcorruption]); + item.Purity = (uint32)atoul(row[ItemField::purity]); + item.BackstabDmg = (uint32)atoul(row[ItemField::backstabdmg]); + item.DSMitigation = (uint32)atoul(row[ItemField::dsmitigation]); + item.HeroicStr = (int32)atoi(row[ItemField::heroic_str]); + item.HeroicInt = (int32)atoi(row[ItemField::heroic_int]); + item.HeroicWis = (int32)atoi(row[ItemField::heroic_wis]); + item.HeroicAgi = (int32)atoi(row[ItemField::heroic_agi]); + item.HeroicDex = (int32)atoi(row[ItemField::heroic_dex]); + item.HeroicSta = (int32)atoi(row[ItemField::heroic_sta]); + item.HeroicCha = (int32)atoi(row[ItemField::heroic_cha]); + item.HeroicMR = (int32)atoi(row[ItemField::heroic_mr]); + item.HeroicFR = (int32)atoi(row[ItemField::heroic_fr]); + item.HeroicCR = (int32)atoi(row[ItemField::heroic_cr]); + item.HeroicDR = (int32)atoi(row[ItemField::heroic_dr]); + item.HeroicPR = (int32)atoi(row[ItemField::heroic_pr]); + item.HeroicSVCorrup = (int32)atoi(row[ItemField::heroic_svcorrup]); + item.HealAmt = (int32)atoi(row[ItemField::healamt]); + item.SpellDmg = (int32)atoi(row[ItemField::spelldmg]); + item.LDoNSellBackRate = (uint32)atoul(row[ItemField::ldonsellbackrate]); + item.ScriptFileID = (uint32)atoul(row[ItemField::scriptfileid]); + item.ExpendableArrow = (uint16)atoul(row[ItemField::expendablearrow]); + item.Clairvoyance = (uint32)atoul(row[ItemField::clairvoyance]); + strcpy(item.ClickName,row[ItemField::clickname]); + strcpy(item.ProcName,row[ItemField::procname]); + strcpy(item.WornName,row[ItemField::wornname]); + strcpy(item.FocusName,row[ItemField::focusname]); + strcpy(item.ScrollName,row[ItemField::scrollname]); + + try { + hash.insert(item.ID, item); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "Database::LoadItems: %s", ex.what()); + break; + } } - + mysql_free_result(result); } else { @@ -1019,46 +1018,46 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } const Item_Struct* SharedDatabase::GetItem(uint32 id) { - if(!items_hash || id > items_hash->max_key()) { - return nullptr; - } + if(!items_hash || id > items_hash->max_key()) { + return nullptr; + } - if(items_hash->exists(id)) { - return &(items_hash->at(id)); - } + if(items_hash->exists(id)) { + return &(items_hash->at(id)); + } - return nullptr; + return nullptr; } const Item_Struct* SharedDatabase::IterateItems(uint32* id) { - if(!items_hash || !id) { - return nullptr; - } + if(!items_hash || !id) { + return nullptr; + } - for(;;) { - if(*id > items_hash->max_key()) { - break; - } + for(;;) { + if(*id > items_hash->max_key()) { + break; + } - if(items_hash->exists(*id)) { - return &(items_hash->at((*id)++)); - } else { - ++(*id); - } - } + if(items_hash->exists(*id)) { + return &(items_hash->at((*id)++)); + } else { + ++(*id); + } + } - return nullptr; + return nullptr; } string SharedDatabase::GetBook(const char *txtfile) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; char txtfile2[20]; string txtout; - strcpy(txtfile2,txtfile); + strcpy(txtfile2,txtfile); if (!RunQuery(query, MakeAnyLenString(&query, "SELECT txtfile FROM books where name='%s'", txtfile2), errbuf, &result)) { cerr << "Error in GetBook query '" << query << "' " << errbuf << endl; if (query != 0) @@ -1084,144 +1083,144 @@ string SharedDatabase::GetBook(const char *txtfile) } void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { - list_count = 0; - max_lists = 0; - const char *query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + list_count = 0; + max_lists = 0; + const char *query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; + char errbuf[MYSQL_ERRMSG_SIZE]; + MYSQL_RES *result; + MYSQL_ROW row; - if(RunQuery(query, strlen(query), errbuf, &result)) { - if(row = mysql_fetch_row(result)) { - list_count = static_cast(atoul(row[0])); - max_lists = static_cast(atoul(row[1])); - } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query, errbuf); - } + if(RunQuery(query, strlen(query), errbuf, &result)) { + if(row = mysql_fetch_row(result)) { + list_count = static_cast(atoul(row[0])); + max_lists = static_cast(atoul(row[1])); + } + mysql_free_result(result); + } else { + LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query, errbuf); + } } const NPCFactionList* SharedDatabase::GetNPCFactionEntry(uint32 id) { if(!faction_hash) { - return nullptr; - } + return nullptr; + } - if(faction_hash->exists(id)) { - return &(faction_hash->at(id)); - } + if(faction_hash->exists(id)) { + return &(faction_hash->at(id)); + } - return nullptr; + return nullptr; } void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_count, uint32 max_lists) { - EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, list_count, max_lists); - const char *query = "SELECT npc_faction.id, npc_faction.primaryfaction, npc_faction.ignore_primary_assist, " - "npc_faction_entries.faction_id, npc_faction_entries.value, npc_faction_entries.npc_value, npc_faction_entries.temp " - "FROM npc_faction LEFT JOIN npc_faction_entries ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY " - "npc_faction.id;"; + EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, list_count, max_lists); + const char *query = "SELECT npc_faction.id, npc_faction.primaryfaction, npc_faction.ignore_primary_assist, " + "npc_faction_entries.faction_id, npc_faction_entries.value, npc_faction_entries.npc_value, npc_faction_entries.temp " + "FROM npc_faction LEFT JOIN npc_faction_entries ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY " + "npc_faction.id;"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - NPCFactionList faction; + char errbuf[MYSQL_ERRMSG_SIZE]; + MYSQL_RES *result; + MYSQL_ROW row; + NPCFactionList faction; - if(RunQuery(query, strlen(query), errbuf, &result)) { - uint32 current_id = 0; - uint32 current_entry = 0; - while(row = mysql_fetch_row(result)) { - uint32 id = static_cast(atoul(row[0])); - if(id != current_id) { - if(current_id != 0) { - hash.insert(current_id, faction); - } + if(RunQuery(query, strlen(query), errbuf, &result)) { + uint32 current_id = 0; + uint32 current_entry = 0; + while(row = mysql_fetch_row(result)) { + uint32 id = static_cast(atoul(row[0])); + if(id != current_id) { + if(current_id != 0) { + hash.insert(current_id, faction); + } - memset(&faction, 0, sizeof(faction)); - current_entry = 0; - current_id = id; - faction.id = id; - faction.primaryfaction = static_cast(atoul(row[1])); - faction.assistprimaryfaction = (atoi(row[2]) == 0); - } + memset(&faction, 0, sizeof(faction)); + current_entry = 0; + current_id = id; + faction.id = id; + faction.primaryfaction = static_cast(atoul(row[1])); + faction.assistprimaryfaction = (atoi(row[2]) == 0); + } - if(!row[3]) { - continue; - } + if(!row[3]) { + continue; + } - if(current_entry >= MAX_NPC_FACTIONS) { - continue; - } + if(current_entry >= MAX_NPC_FACTIONS) { + continue; + } - faction.factionid[current_entry] = static_cast(atoul(row[3])); - faction.factionvalue[current_entry] = static_cast(atoi(row[4])); - faction.factionnpcvalue[current_entry] = static_cast(atoi(row[5])); - faction.factiontemp[current_entry] = static_cast(atoi(row[6])); - ++current_entry; - } + faction.factionid[current_entry] = static_cast(atoul(row[3])); + faction.factionvalue[current_entry] = static_cast(atoi(row[4])); + faction.factionnpcvalue[current_entry] = static_cast(atoi(row[5])); + faction.factiontemp[current_entry] = static_cast(atoi(row[6])); + ++current_entry; + } - if(current_id != 0) { - hash.insert(current_id, faction); - } + if(current_id != 0) { + hash.insert(current_id, faction); + } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query, errbuf); - } + mysql_free_result(result); + } else { + LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query, errbuf); +} } bool SharedDatabase::LoadNPCFactionLists() { - if(faction_hash) { - return true; - } - - try { - EQEmu::IPCMutex mutex("faction"); - mutex.Lock(); - faction_mmf = new EQEmu::MemoryMappedFile("shared/faction"); + if(faction_hash) { + return true; + } - uint32 list_count = 0; - uint32 max_lists = 0; - GetFactionListInfo(list_count, max_lists); - if(list_count == 0) { - EQ_EXCEPT("SharedDatabase", "Database returned no result"); - } - uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size( - list_count, max_lists)); + try { + EQEmu::IPCMutex mutex("faction"); + mutex.Lock(); + faction_mmf = new EQEmu::MemoryMappedFile("shared/faction"); - if(faction_mmf->Size() != size) { - EQ_EXCEPT("SharedDatabase", "Couldn't load npc factions because faction_mmf->Size() != size"); - } + uint32 list_count = 0; + uint32 max_lists = 0; + GetFactionListInfo(list_count, max_lists); + if(list_count == 0) { + EQ_EXCEPT("SharedDatabase", "Database returned no result"); + } + uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size( + list_count, max_lists)); - faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); - mutex.Unlock(); - } catch(std::exception& ex) { - LogFile->write(EQEMuLog::Error, "Error Loading npc factions: %s", ex.what()); - return false; - } + if(faction_mmf->Size() != size) { + EQ_EXCEPT("SharedDatabase", "Couldn't load npc factions because faction_mmf->Size() != size"); + } - return true; + faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); + mutex.Unlock(); + } catch(std::exception& ex) { + LogFile->write(EQEMuLog::Error, "Error Loading npc factions: %s", ex.what()); + return false; + } + + return true; } // Get the player profile and inventory for the given account "account_id" and -// character name "name". Return true if the character was found, otherwise false. +// character name "name". Return true if the character was found, otherwise false. // False will also be returned if there is a database error. bool SharedDatabase::GetPlayerProfile(uint32 account_id, char* name, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext, char* current_zone, uint32 *current_instance) { _CP(Database_GetPlayerProfile); char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES* result; - MYSQL_ROW row; + char* query = 0; + MYSQL_RES* result; + MYSQL_ROW row; bool ret = false; - + unsigned long* lengths; - + if (RunQuery(query, MakeAnyLenString(&query, "SELECT profile,zonename,x,y,z,extprofile,instanceid FROM character_ WHERE account_id=%i AND name='%s'", account_id, name), errbuf, &result)) { - if (mysql_num_rows(result) == 1) { + if (mysql_num_rows(result) == 1) { row = mysql_fetch_row(result); lengths = mysql_fetch_lengths(result); if (lengths[0] == sizeof(PlayerProfile_Struct)) { memcpy(pp, row[0], sizeof(PlayerProfile_Struct)); - + if (current_zone) strcpy(current_zone, row[1]); pp->zone_id = GetZoneID(row[1]); @@ -1234,12 +1233,12 @@ bool SharedDatabase::GetPlayerProfile(uint32 account_id, char* name, PlayerProfi if(current_instance) *current_instance = pp->zoneInstance; - + if(ext) { //SetExtendedProfile handles any conversion SetExtendedProfile(ext, row[5], lengths[5]); } - + // Retrieve character inventory ret = GetInventory(account_id, name, inv); } @@ -1248,13 +1247,13 @@ bool SharedDatabase::GetPlayerProfile(uint32 account_id, char* name, PlayerProfi lengths[0], sizeof(PlayerProfile_Struct)); } } - + mysql_free_result(result); } else { LogFile->write(EQEMuLog::Error, "GetPlayerProfile query '%s' %s", query, errbuf); } - + safe_delete_array(query); return ret; } @@ -1265,22 +1264,22 @@ bool SharedDatabase::SetPlayerProfile(uint32 account_id, uint32 charid, PlayerPr char* query = 0; uint32 affected_rows = 0; bool ret = false; - + if (RunQuery(query, SetPlayerProfile_MQ(&query, account_id, charid, pp, inv, ext, current_zone, current_instance, MaxXTargets), errbuf, 0, &affected_rows)) { ret = (affected_rows != 0); } - + if (!ret) { LogFile->write(EQEMuLog::Error, "SetPlayerProfile query '%s' %s", query, errbuf); - } - + } + safe_delete_array(query); return ret; } // Generate SQL for updating player profile uint32 SharedDatabase::SetPlayerProfile_MQ(char** query, uint32 account_id, uint32 charid, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext, uint32 current_zone, uint32 current_instance, uint8 MaxXTargets) { - *query = new char[396 + sizeof(PlayerProfile_Struct)*2 + sizeof(ExtendedProfile_Struct)*2 + 4]; + *query = new char[396 + sizeof(PlayerProfile_Struct)*2 + sizeof(ExtendedProfile_Struct)*2 + 4]; char* end = *query; if (!current_zone) current_zone = pp->zone_id; @@ -1290,13 +1289,13 @@ uint32 SharedDatabase::SetPlayerProfile_MQ(char** query, uint32 account_id, uint if(strlen(pp->name) == 0) // Sanity check in case pp never loaded return false; - + end += sprintf(end, "UPDATE character_ SET timelaston=unix_timestamp(now()),name=\'%s\', zonename=\'%s\', zoneid=%u, instanceid=%u, x = %f, y = %f, z = %f, profile=\'", pp->name, GetZoneName(current_zone), current_zone, current_instance, pp->x, pp->y, pp->z); end += DoEscapeString(end, (char*)pp, sizeof(PlayerProfile_Struct)); end += sprintf(end,"\', extprofile=\'"); end += DoEscapeString(end, (char*)ext, sizeof(ExtendedProfile_Struct)); - end += sprintf(end,"\',class=%d,level=%d,xtargets=%u WHERE id=%u", pp->class_, pp->level, MaxXTargets, charid); - + end += sprintf(end,"\',class=%d,level=%d,xtargets=%u WHERE id=%u", pp->class_, pp->level, MaxXTargets, charid); + return (uint32) (end - (*query)); } @@ -1333,14 +1332,14 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst->PutAugment(this, 3, aug4); inst->PutAugment(this, 4, aug5); } - + return inst; } ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) { ItemInst* inst = nullptr; if (item) { - // if maxcharges is -1 that means it is an unlimited use item. + // if maxcharges is -1 that means it is an unlimited use item. // set it to 1 charge so that it is usable on creation if (charges == 0 && item->MaxCharges == -1) charges = 1; @@ -1349,22 +1348,22 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new EvoItemInst(item, charges); ((EvoItemInst*)inst)->Initialize(this); } - else - inst = new ItemInst(item, charges); + else + inst = new ItemInst(item, charges); } return inst; } int32 SharedDatabase::DeleteStalePlayerCorpses() { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if(RuleB(Zone, EnableShadowrest)) { if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried=0 and " - "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", - (RuleI(Character, CorpseDecayTimeMS) / 1000)), errbuf, 0, &affected_rows)) + "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", + (RuleI(Character, CorpseDecayTimeMS) / 1000)), errbuf, 0, &affected_rows)) { safe_delete_array(query); return -1; @@ -1373,8 +1372,8 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { else { if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where (UNIX_TIMESTAMP() - " - "UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", (RuleI(Character, CorpseDecayTimeMS) / 1000)), - errbuf, 0, &affected_rows)) + "UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", (RuleI(Character, CorpseDecayTimeMS) / 1000)), + errbuf, 0, &affected_rows)) { safe_delete_array(query); return -1; @@ -1387,7 +1386,7 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { int32 SharedDatabase::DeleteStalePlayerBackups() { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; // 1209600 seconds = 2 weeks @@ -1396,15 +1395,15 @@ int32 SharedDatabase::DeleteStalePlayerBackups() { return -1; } safe_delete_array(query); - + return affected_rows; } bool SharedDatabase::GetCommandSettings(map &commands) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; query = new char[256]; strcpy(query, "SELECT command,access from commands"); commands.clear(); @@ -1420,151 +1419,151 @@ bool SharedDatabase::GetCommandSettings(map &commands) { safe_delete_array(query); return false; } - + return false; } bool SharedDatabase::LoadSkillCaps() { - if(skill_caps_mmf) - return true; + if(skill_caps_mmf) + return true; uint32 class_count = PLAYER_CLASS_COUNT; uint32 skill_count = HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; - uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); + uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); - try { - EQEmu::IPCMutex mutex("skill_caps"); - mutex.Lock(); - skill_caps_mmf = new EQEmu::MemoryMappedFile("shared/skill_caps"); - if(skill_caps_mmf->Size() != size) { - EQ_EXCEPT("SharedDatabase", "Unable to load skill caps: skill_caps_mmf->Size() != size"); - } + try { + EQEmu::IPCMutex mutex("skill_caps"); + mutex.Lock(); + skill_caps_mmf = new EQEmu::MemoryMappedFile("shared/skill_caps"); + if(skill_caps_mmf->Size() != size) { + EQ_EXCEPT("SharedDatabase", "Unable to load skill caps: skill_caps_mmf->Size() != size"); + } - mutex.Unlock(); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Error loading skill caps: %s", ex.what()); - return false; - } + mutex.Unlock(); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "Error loading skill caps: %s", ex.what()); + return false; + } - return true; + return true; } void SharedDatabase::LoadSkillCaps(void *data) { - uint32 class_count = PLAYER_CLASS_COUNT; + uint32 class_count = PLAYER_CLASS_COUNT; uint32 skill_count = HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; - uint16 *skill_caps_table = reinterpret_cast(data); + uint16 *skill_caps_table = reinterpret_cast(data); - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if(RunQuery(query, MakeAnyLenString(&query, - "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"), - errbuf, &result)) { - safe_delete_array(query); - - while((row = mysql_fetch_row(result))) { - uint8 skillID = atoi(row[0]); - uint8 class_ = atoi(row[1]) - 1; - uint8 level = atoi(row[2]); - uint16 cap = atoi(row[3]); - if(skillID >= skill_count || class_ >= class_count || level >= level_count) - continue; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + if(RunQuery(query, MakeAnyLenString(&query, + "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"), + errbuf, &result)) { + safe_delete_array(query); - uint32 index = (((class_ * skill_count) + skillID) * level_count) + level; - skill_caps_table[index] = cap; + while((row = mysql_fetch_row(result))) { + uint8 skillID = atoi(row[0]); + uint8 class_ = atoi(row[1]) - 1; + uint8 level = atoi(row[2]); + uint16 cap = atoi(row[3]); + if(skillID >= skill_count || class_ >= class_count || level >= level_count) + continue; + + uint32 index = (((class_ * skill_count) + skillID) * level_count) + level; + skill_caps_table[index] = cap; } mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error loading skill caps from database: %s", errbuf); - safe_delete_array(query); - } + } else { + LogFile->write(EQEMuLog::Error, "Error loading skill caps from database: %s", errbuf); + safe_delete_array(query); + } } uint16 SharedDatabase::GetSkillCap(uint8 Class_, SkillType Skill, uint8 Level) { - if(!skill_caps_mmf) { - return 0; - } + if(!skill_caps_mmf) { + return 0; + } - if(Class_ == 0) - return 0; + if(Class_ == 0) + return 0; - int SkillMaxLevel = RuleI(Character, SkillCapMaxLevel); - if(SkillMaxLevel < 1) { - SkillMaxLevel = RuleI(Character, MaxLevel); - } + int SkillMaxLevel = RuleI(Character, SkillCapMaxLevel); + if(SkillMaxLevel < 1) { + SkillMaxLevel = RuleI(Character, MaxLevel); + } - uint32 class_count = PLAYER_CLASS_COUNT; + uint32 class_count = PLAYER_CLASS_COUNT; uint32 skill_count = HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; - if(Class_ > class_count || static_cast(Skill) > skill_count || Level > level_count) { - return 0; - } + if(Class_ > class_count || static_cast(Skill) > skill_count || Level > level_count) { + return 0; + } - if(Level > static_cast(SkillMaxLevel)){ - Level = static_cast(SkillMaxLevel); - } + if(Level > static_cast(SkillMaxLevel)){ + Level = static_cast(SkillMaxLevel); + } - uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count) + Level; - uint16 *skill_caps_table = reinterpret_cast(skill_caps_mmf->Get()); - return skill_caps_table[index]; + uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count) + Level; + uint16 *skill_caps_table = reinterpret_cast(skill_caps_mmf->Get()); + return skill_caps_table[index]; } uint8 SharedDatabase::GetTrainLevel(uint8 Class_, SkillType Skill, uint8 Level) { - if(!skill_caps_mmf) { - return 0; - } + if(!skill_caps_mmf) { + return 0; + } - if(Class_ == 0) - return 0; + if(Class_ == 0) + return 0; - int SkillMaxLevel = RuleI(Character, SkillCapMaxLevel); - if (SkillMaxLevel < 1) { - SkillMaxLevel = RuleI(Character, MaxLevel); - } + int SkillMaxLevel = RuleI(Character, SkillCapMaxLevel); + if (SkillMaxLevel < 1) { + SkillMaxLevel = RuleI(Character, MaxLevel); + } - uint32 class_count = PLAYER_CLASS_COUNT; + uint32 class_count = PLAYER_CLASS_COUNT; uint32 skill_count = HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; - if(Class_ > class_count || static_cast(Skill) > skill_count || Level > level_count) { - return 0; - } - - uint8 ret = 0; + if(Class_ > class_count || static_cast(Skill) > skill_count || Level > level_count) { + return 0; + } + + uint8 ret = 0; if(Level > static_cast(SkillMaxLevel)) { - uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count); - uint16 *skill_caps_table = reinterpret_cast(skill_caps_mmf->Get()); - for(uint8 x = 0; x < Level; x++){ - if(skill_caps_table[index + x]){ - ret = x; - break; - } - } + uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count); + uint16 *skill_caps_table = reinterpret_cast(skill_caps_mmf->Get()); + for(uint8 x = 0; x < Level; x++){ + if(skill_caps_table[index + x]){ + ret = x; + break; + } + } } else { - uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count); - uint16 *skill_caps_table = reinterpret_cast(skill_caps_mmf->Get()); - for(int x = 0; x < SkillMaxLevel; x++){ - if(skill_caps_table[index + x]){ - ret = x; - break; - } - } + uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count); + uint16 *skill_caps_table = reinterpret_cast(skill_caps_mmf->Get()); + for(int x = 0; x < SkillMaxLevel; x++){ + if(skill_caps_table[index + x]){ + ret = x; + break; + } + } } - - if(ret > GetSkillCap(Class_, Skill, Level)) - ret = static_cast(GetSkillCap(Class_, Skill, Level)); - return ret; + if(ret > GetSkillCap(Class_, Skill, Level)) + ret = static_cast(GetSkillCap(Class_, Skill, Level)); + + return ret; } void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) { const char *DSQuery = "SELECT `spellid`, `type` from `damageshieldtypes` WHERE `spellid` > 0 " - "AND `spellid` <= %i"; + "AND `spellid` <= %i"; const char *ERR_MYSQLERROR = "Error in LoadDamageShieldTypes: %s %s"; @@ -1578,7 +1577,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe while((row = mysql_fetch_row(result))) { int SpellID = atoi(row[0]); - if((SpellID > 0) && (SpellID <= iMaxSpellID)) { + if((SpellID > 0) && (SpellID <= iMaxSpellID)) { sp[SpellID].DamageShieldType = atoi(row[1]); } } @@ -1597,11 +1596,11 @@ const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) { int SharedDatabase::GetMaxSpellID() { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = nullptr; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = nullptr; + MYSQL_RES *result; + MYSQL_ROW row; int32 ret = 0; - if(RunQuery(query, MakeAnyLenString(&query, "SELECT MAX(id) FROM spells_new"), + if(RunQuery(query, MakeAnyLenString(&query, "SELECT MAX(id) FROM spells_new"), errbuf, &result)) { safe_delete_array(query); row = mysql_fetch_row(result); @@ -1616,344 +1615,344 @@ int SharedDatabase::GetMaxSpellID() { } void SharedDatabase::LoadSpells(void *data, int max_spells) { - SPDat_Spell_Struct *sp = reinterpret_cast(data); + SPDat_Spell_Struct *sp = reinterpret_cast(data); char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; - if(RunQuery(query, MakeAnyLenString(&query, - "SELECT * FROM spells_new ORDER BY id ASC"), + if(RunQuery(query, MakeAnyLenString(&query, + "SELECT * FROM spells_new ORDER BY id ASC"), errbuf, &result)) { safe_delete_array(query); - - int tempid = 0; + + int tempid = 0; int counter = 0; - while (row = mysql_fetch_row(result)) { - tempid = atoi(row[0]); - if(tempid >= max_spells) { - _log(SPELLS__LOAD_ERR, "Non fatal error: spell.id >= max_spells, ignoring."); - continue; - } + while (row = mysql_fetch_row(result)) { + tempid = atoi(row[0]); + if(tempid >= max_spells) { + _log(SPELLS__LOAD_ERR, "Non fatal error: spell.id >= max_spells, ignoring."); + continue; + } - ++counter; - strn0cpy(sp[tempid].name, row[1], sizeof(sp[tempid].name)); - strn0cpy(sp[tempid].player_1, row[2], sizeof(sp[tempid].player_1)); - strn0cpy(sp[tempid].teleport_zone, row[3], sizeof(sp[tempid].teleport_zone)); - strn0cpy(sp[tempid].you_cast, row[4], sizeof(sp[tempid].you_cast)); - strn0cpy(sp[tempid].other_casts, row[5], sizeof(sp[tempid].other_casts)); - strn0cpy(sp[tempid].cast_on_you, row[6], sizeof(sp[tempid].cast_on_you)); - strn0cpy(sp[tempid].cast_on_other, row[7], sizeof(sp[tempid].cast_on_other)); - strn0cpy(sp[tempid].spell_fades, row[8], sizeof(sp[tempid].spell_fades)); + ++counter; + strn0cpy(sp[tempid].name, row[1], sizeof(sp[tempid].name)); + strn0cpy(sp[tempid].player_1, row[2], sizeof(sp[tempid].player_1)); + strn0cpy(sp[tempid].teleport_zone, row[3], sizeof(sp[tempid].teleport_zone)); + strn0cpy(sp[tempid].you_cast, row[4], sizeof(sp[tempid].you_cast)); + strn0cpy(sp[tempid].other_casts, row[5], sizeof(sp[tempid].other_casts)); + strn0cpy(sp[tempid].cast_on_you, row[6], sizeof(sp[tempid].cast_on_you)); + strn0cpy(sp[tempid].cast_on_other, row[7], sizeof(sp[tempid].cast_on_other)); + strn0cpy(sp[tempid].spell_fades, row[8], sizeof(sp[tempid].spell_fades)); - sp[tempid].range=static_cast(atof(row[9])); - sp[tempid].aoerange=static_cast(atof(row[10])); - sp[tempid].pushback=static_cast(atof(row[11])); - sp[tempid].pushup=static_cast(atof(row[12])); - sp[tempid].cast_time=atoi(row[13]); - sp[tempid].recovery_time=atoi(row[14]); - sp[tempid].recast_time=atoi(row[15]); - sp[tempid].buffdurationformula=atoi(row[16]); - sp[tempid].buffduration=atoi(row[17]); - sp[tempid].AEDuration=atoi(row[18]); - sp[tempid].mana=atoi(row[19]); - - int y=0; - for(y=0; y< EFFECT_COUNT;y++) - sp[tempid].base[y]=atoi(row[20+y]); // effect_base_value - for(y=0; y < EFFECT_COUNT; y++) - sp[tempid].base2[y]=atoi(row[32+y]); // effect_limit_value - for(y=0; y< EFFECT_COUNT;y++) - sp[tempid].max[y]=atoi(row[44+y]); - - for(y=0; y< 4;y++) - sp[tempid].components[y]=atoi(row[58+y]); - - for(y=0; y< 4;y++) - sp[tempid].component_counts[y]=atoi(row[62+y]); - - for(y=0; y< 4;y++) - sp[tempid].NoexpendReagent[y]=atoi(row[66+y]); - - for(y=0; y< EFFECT_COUNT;y++) - sp[tempid].formula[y]=atoi(row[70+y]); - - sp[tempid].goodEffect=atoi(row[83]); - sp[tempid].Activated=atoi(row[84]); - sp[tempid].resisttype=atoi(row[85]); - - for(y=0; y< EFFECT_COUNT;y++) - sp[tempid].effectid[y]=atoi(row[86+y]); - - sp[tempid].targettype = (SpellTargetType) atoi(row[98]); - sp[tempid].basediff=atoi(row[99]); - int tmp_skill = atoi(row[100]);; - if(tmp_skill < 0 || tmp_skill > HIGHEST_SKILL) - sp[tempid].skill = BEGGING; /* not much better we can do. */ - else - sp[tempid].skill = (SkillType) tmp_skill; - sp[tempid].zonetype=atoi(row[101]); - sp[tempid].EnvironmentType=atoi(row[102]); - sp[tempid].TimeOfDay=atoi(row[103]); - - for(y=0; y < PLAYER_CLASS_COUNT;y++) - sp[tempid].classes[y]=atoi(row[104+y]); - - sp[tempid].CastingAnim=atoi(row[120]); - sp[tempid].SpellAffectIndex=atoi(row[123]); - sp[tempid].disallow_sit=atoi(row[124]); + sp[tempid].range=static_cast(atof(row[9])); + sp[tempid].aoerange=static_cast(atof(row[10])); + sp[tempid].pushback=static_cast(atof(row[11])); + sp[tempid].pushup=static_cast(atof(row[12])); + sp[tempid].cast_time=atoi(row[13]); + sp[tempid].recovery_time=atoi(row[14]); + sp[tempid].recast_time=atoi(row[15]); + sp[tempid].buffdurationformula=atoi(row[16]); + sp[tempid].buffduration=atoi(row[17]); + sp[tempid].AEDuration=atoi(row[18]); + sp[tempid].mana=atoi(row[19]); - for (y = 0; y < 16; y++) - sp[tempid].deities[y]=atoi(row[126+y]); + int y=0; + for(y=0; y< EFFECT_COUNT;y++) + sp[tempid].base[y]=atoi(row[20+y]); // effect_base_value + for(y=0; y < EFFECT_COUNT; y++) + sp[tempid].base2[y]=atoi(row[32+y]); // effect_limit_value + for(y=0; y< EFFECT_COUNT;y++) + sp[tempid].max[y]=atoi(row[44+y]); - sp[tempid].uninterruptable=atoi(row[146]); - sp[tempid].ResistDiff=atoi(row[147]); - sp[tempid].RecourseLink = atoi(row[150]); + for(y=0; y< 4;y++) + sp[tempid].components[y]=atoi(row[58+y]); - sp[tempid].short_buff_box = atoi(row[154]); - sp[tempid].descnum = atoi(row[155]); - sp[tempid].effectdescnum = atoi(row[157]); - - sp[tempid].bonushate=atoi(row[162]); + for(y=0; y< 4;y++) + sp[tempid].component_counts[y]=atoi(row[62+y]); - sp[tempid].EndurCost=atoi(row[166]); - sp[tempid].EndurTimerIndex=atoi(row[167]); - sp[tempid].HateAdded=atoi(row[173]); - sp[tempid].EndurUpkeep=atoi(row[174]); - sp[tempid].numhits = atoi(row[176]); - sp[tempid].pvpresistbase=atoi(row[177]); - sp[tempid].pvpresistcalc=atoi(row[178]); - sp[tempid].pvpresistcap=atoi(row[179]); - sp[tempid].spell_category=atoi(row[180]); - sp[tempid].can_mgb=atoi(row[185]); - sp[tempid].dispel_flag = atoi(row[186]); - sp[tempid].MinResist = atoi(row[189]); - sp[tempid].MaxResist = atoi(row[190]); - sp[tempid].viral_targets = atoi(row[191]); - sp[tempid].viral_timer = atoi(row[192]); - sp[tempid].NimbusEffect = atoi(row[193]); - sp[tempid].directional_start = (float)atoi(row[194]); - sp[tempid].directional_end = (float)atoi(row[195]); - sp[tempid].spellgroup=atoi(row[207]); - sp[tempid].powerful_flag=atoi(row[209]); - sp[tempid].CastRestriction = atoi(row[211]); - sp[tempid].AllowRest = atoi(row[212]) != 0; - sp[tempid].DamageShieldType = 0; - } - mysql_free_result(result); + for(y=0; y< 4;y++) + sp[tempid].NoexpendReagent[y]=atoi(row[66+y]); - LoadDamageShieldTypes(sp, max_spells); - } else { + for(y=0; y< EFFECT_COUNT;y++) + sp[tempid].formula[y]=atoi(row[70+y]); + + sp[tempid].goodEffect=atoi(row[83]); + sp[tempid].Activated=atoi(row[84]); + sp[tempid].resisttype=atoi(row[85]); + + for(y=0; y< EFFECT_COUNT;y++) + sp[tempid].effectid[y]=atoi(row[86+y]); + + sp[tempid].targettype = (SpellTargetType) atoi(row[98]); + sp[tempid].basediff=atoi(row[99]); + int tmp_skill = atoi(row[100]);; + if(tmp_skill < 0 || tmp_skill > HIGHEST_SKILL) + sp[tempid].skill = BEGGING; /* not much better we can do. */ + else + sp[tempid].skill = (SkillType) tmp_skill; + sp[tempid].zonetype=atoi(row[101]); + sp[tempid].EnvironmentType=atoi(row[102]); + sp[tempid].TimeOfDay=atoi(row[103]); + + for(y=0; y < PLAYER_CLASS_COUNT;y++) + sp[tempid].classes[y]=atoi(row[104+y]); + + sp[tempid].CastingAnim=atoi(row[120]); + sp[tempid].SpellAffectIndex=atoi(row[123]); + sp[tempid].disallow_sit=atoi(row[124]); + + for (y = 0; y < 16; y++) + sp[tempid].deities[y]=atoi(row[126+y]); + + sp[tempid].uninterruptable=atoi(row[146]); + sp[tempid].ResistDiff=atoi(row[147]); + sp[tempid].RecourseLink = atoi(row[150]); + + sp[tempid].short_buff_box = atoi(row[154]); + sp[tempid].descnum = atoi(row[155]); + sp[tempid].effectdescnum = atoi(row[157]); + + sp[tempid].bonushate=atoi(row[162]); + + sp[tempid].EndurCost=atoi(row[166]); + sp[tempid].EndurTimerIndex=atoi(row[167]); + sp[tempid].HateAdded=atoi(row[173]); + sp[tempid].EndurUpkeep=atoi(row[174]); + sp[tempid].numhits = atoi(row[176]); + sp[tempid].pvpresistbase=atoi(row[177]); + sp[tempid].pvpresistcalc=atoi(row[178]); + sp[tempid].pvpresistcap=atoi(row[179]); + sp[tempid].spell_category=atoi(row[180]); + sp[tempid].can_mgb=atoi(row[185]); + sp[tempid].dispel_flag = atoi(row[186]); + sp[tempid].MinResist = atoi(row[189]); + sp[tempid].MaxResist = atoi(row[190]); + sp[tempid].viral_targets = atoi(row[191]); + sp[tempid].viral_timer = atoi(row[192]); + sp[tempid].NimbusEffect = atoi(row[193]); + sp[tempid].directional_start = (float)atoi(row[194]); + sp[tempid].directional_end = (float)atoi(row[195]); + sp[tempid].spellgroup=atoi(row[207]); + sp[tempid].powerful_flag=atoi(row[209]); + sp[tempid].CastRestriction = atoi(row[211]); + sp[tempid].AllowRest = atoi(row[212]) != 0; + sp[tempid].DamageShieldType = 0; + } + mysql_free_result(result); + + LoadDamageShieldTypes(sp, max_spells); + } else { _log(SPELLS__LOAD_ERR, "Error in LoadSpells query '%s' %s", query, errbuf); safe_delete_array(query); } } void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot_table, uint32 &loot_table_entries) { - loot_table_count = 0; - max_loot_table = 0; - loot_table_entries = 0; - const char *query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + loot_table_count = 0; + max_loot_table = 0; + loot_table_entries = 0; + const char *query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; + char errbuf[MYSQL_ERRMSG_SIZE]; + MYSQL_RES *result; + MYSQL_ROW row; - if(RunQuery(query, strlen(query), errbuf, &result)) { - if(row = mysql_fetch_row(result)) { - loot_table_count = static_cast(atoul(row[0])); - max_loot_table = static_cast(atoul(row[1])); - loot_table_entries = static_cast(atoul(row[2])); - } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); - } + if(RunQuery(query, strlen(query), errbuf, &result)) { + if(row = mysql_fetch_row(result)) { + loot_table_count = static_cast(atoul(row[0])); + max_loot_table = static_cast(atoul(row[1])); + loot_table_entries = static_cast(atoul(row[2])); + } + mysql_free_result(result); + } else { + LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); + } } void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_drop, uint32 &loot_drop_entries) { - loot_drop_count = 0; - max_loot_drop = 0; - loot_drop_entries = 0; - const char *query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + loot_drop_count = 0; + max_loot_drop = 0; + loot_drop_entries = 0; + const char *query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; + char errbuf[MYSQL_ERRMSG_SIZE]; + MYSQL_RES *result; + MYSQL_ROW row; - if(RunQuery(query, strlen(query), errbuf, &result)) { - if(row = mysql_fetch_row(result)) { - loot_drop_count = static_cast(atoul(row[0])); - max_loot_drop = static_cast(atoul(row[1])); - loot_drop_entries = static_cast(atoul(row[2])); - } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); - } + if(RunQuery(query, strlen(query), errbuf, &result)) { + if(row = mysql_fetch_row(result)) { + loot_drop_count = static_cast(atoul(row[0])); + max_loot_drop = static_cast(atoul(row[1])); + loot_drop_entries = static_cast(atoul(row[2])); + } + mysql_free_result(result); + } else { + LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); + } } void SharedDatabase::LoadLootTables(void *data, uint32 size) { - EQEmu::FixedMemoryVariableHashSet hash(reinterpret_cast(data), size); - const char *query = "SELECT loottable.id, loottable.mincash, loottable.maxcash, loottable.avgcoin," - " loottable_entries.lootdrop_id, loottable_entries.multiplier, loottable_entries.droplimit, " - "loottable_entries.mindrop, loottable_entries.probability FROM loottable LEFT JOIN loottable_entries" - " ON loottable.id = loottable_entries.loottable_id ORDER BY id"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - uint8 loot_table[sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128)]; - LootTable_Struct *lt = reinterpret_cast(loot_table); + EQEmu::FixedMemoryVariableHashSet hash(reinterpret_cast(data), size); + const char *query = "SELECT loottable.id, loottable.mincash, loottable.maxcash, loottable.avgcoin," + " loottable_entries.lootdrop_id, loottable_entries.multiplier, loottable_entries.droplimit, " + "loottable_entries.mindrop, loottable_entries.probability FROM loottable LEFT JOIN loottable_entries" + " ON loottable.id = loottable_entries.loottable_id ORDER BY id"; + char errbuf[MYSQL_ERRMSG_SIZE]; + MYSQL_RES *result; + MYSQL_ROW row; + uint8 loot_table[sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128)]; + LootTable_Struct *lt = reinterpret_cast(loot_table); - if(RunQuery(query, strlen(query), errbuf, &result)) { - uint32 current_id = 0; - uint32 current_entry = 0; - while(row = mysql_fetch_row(result)) { - uint32 id = static_cast(atoul(row[0])); - if(id != current_id) { - if(current_id != 0) { - hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + - (sizeof(LootTableEntries_Struct) * lt->NumEntries))); - } - - memset(loot_table, 0, sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128)); - current_entry = 0; - current_id = id; - lt->mincash = static_cast(atoul(row[1])); - lt->maxcash = static_cast(atoul(row[2])); - lt->avgcoin = static_cast(atoul(row[3])); - } - - if(current_entry > 128) { - continue; - } + if(RunQuery(query, strlen(query), errbuf, &result)) { + uint32 current_id = 0; + uint32 current_entry = 0; + while(row = mysql_fetch_row(result)) { + uint32 id = static_cast(atoul(row[0])); + if(id != current_id) { + if(current_id != 0) { + hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + + (sizeof(LootTableEntries_Struct) * lt->NumEntries))); + } - if(!row[4]) { - continue; - } - - lt->Entries[current_entry].lootdrop_id = static_cast(atoul(row[4])); - lt->Entries[current_entry].multiplier = static_cast(atoi(row[5])); - lt->Entries[current_entry].droplimit = static_cast(atoi(row[6])); - lt->Entries[current_entry].mindrop = static_cast(atoi(row[7])); - lt->Entries[current_entry].probability = static_cast(atof(row[8])); - - ++(lt->NumEntries); - ++current_entry; - } - if(current_id != 0) { - hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + - (sizeof(LootTableEntries_Struct) * lt->NumEntries))); - } + memset(loot_table, 0, sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128)); + current_entry = 0; + current_id = id; + lt->mincash = static_cast(atoul(row[1])); + lt->maxcash = static_cast(atoul(row[2])); + lt->avgcoin = static_cast(atoul(row[3])); + } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); - } + if(current_entry > 128) { + continue; + } + + if(!row[4]) { + continue; + } + + lt->Entries[current_entry].lootdrop_id = static_cast(atoul(row[4])); + lt->Entries[current_entry].multiplier = static_cast(atoi(row[5])); + lt->Entries[current_entry].droplimit = static_cast(atoi(row[6])); + lt->Entries[current_entry].mindrop = static_cast(atoi(row[7])); + lt->Entries[current_entry].probability = static_cast(atof(row[8])); + + ++(lt->NumEntries); + ++current_entry; + } + if(current_id != 0) { + hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + + (sizeof(LootTableEntries_Struct) * lt->NumEntries))); + } + + mysql_free_result(result); + } else { + LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); + } } void SharedDatabase::LoadLootDrops(void *data, uint32 size) { - EQEmu::FixedMemoryVariableHashSet hash(reinterpret_cast(data), size); - const char *query = "SELECT lootdrop.id, lootdrop_entries.item_id, lootdrop_entries.item_charges, " - "lootdrop_entries.equip_item, lootdrop_entries.chance, lootdrop_entries.minlevel, " - "lootdrop_entries.maxlevel, lootdrop_entries.multiplier FROM lootdrop JOIN lootdrop_entries " - "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + EQEmu::FixedMemoryVariableHashSet hash(reinterpret_cast(data), size); + const char *query = "SELECT lootdrop.id, lootdrop_entries.item_id, lootdrop_entries.item_charges, " + "lootdrop_entries.equip_item, lootdrop_entries.chance, lootdrop_entries.minlevel, " + "lootdrop_entries.maxlevel, lootdrop_entries.multiplier FROM lootdrop JOIN lootdrop_entries " + "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; + char errbuf[MYSQL_ERRMSG_SIZE]; + MYSQL_RES *result; + MYSQL_ROW row; - uint8 loot_drop[sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * 1260)]; - LootDrop_Struct *ld = reinterpret_cast(loot_drop); - if(RunQuery(query, strlen(query), errbuf, &result)) { - uint32 current_id = 0; - uint32 current_entry = 0; - while(row = mysql_fetch_row(result)) { - uint32 id = static_cast(atoul(row[0])); - if(id != current_id) { - if(current_id != 0) { - hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + - (sizeof(LootDropEntries_Struct) * ld->NumEntries))); - } + uint8 loot_drop[sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * 1260)]; + LootDrop_Struct *ld = reinterpret_cast(loot_drop); + if(RunQuery(query, strlen(query), errbuf, &result)) { + uint32 current_id = 0; + uint32 current_entry = 0; + while(row = mysql_fetch_row(result)) { + uint32 id = static_cast(atoul(row[0])); + if(id != current_id) { + if(current_id != 0) { + hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + + (sizeof(LootDropEntries_Struct) * ld->NumEntries))); + } - memset(loot_drop, 0, sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * 1260)); - current_entry = 0; - current_id = id; - } + memset(loot_drop, 0, sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * 1260)); + current_entry = 0; + current_id = id; + } - if(current_entry > 1260) { - continue; - } + if(current_entry > 1260) { + continue; + } - ld->Entries[current_entry].item_id = static_cast(atoul(row[1])); - ld->Entries[current_entry].item_charges = static_cast(atoi(row[2])); - ld->Entries[current_entry].equip_item = static_cast(atoi(row[3])); - ld->Entries[current_entry].chance = static_cast(atof(row[4])); - ld->Entries[current_entry].minlevel = static_cast(atoi(row[5])); - ld->Entries[current_entry].maxlevel = static_cast(atoi(row[6])); - ld->Entries[current_entry].multiplier = static_cast(atoi(row[7])); + ld->Entries[current_entry].item_id = static_cast(atoul(row[1])); + ld->Entries[current_entry].item_charges = static_cast(atoi(row[2])); + ld->Entries[current_entry].equip_item = static_cast(atoi(row[3])); + ld->Entries[current_entry].chance = static_cast(atof(row[4])); + ld->Entries[current_entry].minlevel = static_cast(atoi(row[5])); + ld->Entries[current_entry].maxlevel = static_cast(atoi(row[6])); + ld->Entries[current_entry].multiplier = static_cast(atoi(row[7])); - ++(ld->NumEntries); - ++current_entry; - } - if(current_id != 0) { - hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + - (sizeof(LootDropEntries_Struct) * ld->NumEntries))); - } + ++(ld->NumEntries); + ++current_entry; + } + if(current_id != 0) { + hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + + (sizeof(LootDropEntries_Struct) * ld->NumEntries))); + } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting loot drop info from database: %s, %s", query, errbuf); - } + mysql_free_result(result); + } else { + LogFile->write(EQEMuLog::Error, "Error getting loot drop info from database: %s, %s", query, errbuf); + } } bool SharedDatabase::LoadLoot() { - if(loot_table_mmf || loot_drop_mmf) - return true; + if(loot_table_mmf || loot_drop_mmf) + return true; - try { - EQEmu::IPCMutex mutex("loot"); - mutex.Lock(); - loot_table_mmf = new EQEmu::MemoryMappedFile("shared/loot_table"); - loot_table_hash = new EQEmu::FixedMemoryVariableHashSet( - reinterpret_cast(loot_table_mmf->Get()), - loot_table_mmf->Size()); - loot_drop_mmf = new EQEmu::MemoryMappedFile("shared/loot_drop"); - loot_drop_hash = new EQEmu::FixedMemoryVariableHashSet( - reinterpret_cast(loot_drop_mmf->Get()), - loot_drop_mmf->Size()); - mutex.Unlock(); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Error loading loot: %s", ex.what()); - return false; - } + try { + EQEmu::IPCMutex mutex("loot"); + mutex.Lock(); + loot_table_mmf = new EQEmu::MemoryMappedFile("shared/loot_table"); + loot_table_hash = new EQEmu::FixedMemoryVariableHashSet( + reinterpret_cast(loot_table_mmf->Get()), + loot_table_mmf->Size()); + loot_drop_mmf = new EQEmu::MemoryMappedFile("shared/loot_drop"); + loot_drop_hash = new EQEmu::FixedMemoryVariableHashSet( + reinterpret_cast(loot_drop_mmf->Get()), + loot_drop_mmf->Size()); + mutex.Unlock(); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "Error loading loot: %s", ex.what()); + return false; + } - return true; + return true; } const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { if(!loot_table_hash) - return nullptr; + return nullptr; - try { - if(loot_table_hash->exists(loottable_id)) { - return &loot_table_hash->at(loottable_id); - } - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Could not get loot table: %s", ex.what()); - } - return nullptr; + try { + if(loot_table_hash->exists(loottable_id)) { + return &loot_table_hash->at(loottable_id); + } + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "Could not get loot table: %s", ex.what()); + } + return nullptr; } const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { if(!loot_drop_hash) - return nullptr; + return nullptr; - try { - if(loot_drop_hash->exists(lootdrop_id)) { - return &loot_drop_hash->at(lootdrop_id); - } - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Could not get loot drop: %s", ex.what()); - } - return nullptr; + try { + if(loot_drop_hash->exists(lootdrop_id)) { + return &loot_drop_hash->at(lootdrop_id); + } + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "Could not get loot drop: %s", ex.what()); + } + return nullptr; } void SharedDatabase::GetPlayerInspectMessage(char* playername, InspectMessage_Struct* message) { @@ -1982,12 +1981,12 @@ void SharedDatabase::GetPlayerInspectMessage(char* playername, InspectMessage_St void SharedDatabase::SetPlayerInspectMessage(char* playername, const InspectMessage_Struct* message) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - + char *query = 0; + if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET inspectmessage='%s' WHERE name='%s'", message->text, playername), errbuf)) { cerr << "Error in SetPlayerInspectMessage query '" << query << "' " << errbuf << endl; } - + safe_delete_array(query); } @@ -2017,11 +2016,11 @@ void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* m void SharedDatabase::SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - + char *query = 0; + if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE bots SET BotInspectMessage='%s' WHERE BotID=%i", message->text, botid), errbuf)) { cerr << "Error in SetBotInspectMessage query '" << query << "' " << errbuf << endl; } - + safe_delete_array(query); } diff --git a/common/shareddb.h b/common/shareddb.h index d739bef19..33ca3aae0 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -19,7 +19,7 @@ struct Faction; struct LootTable_Struct; struct LootDrop_Struct; namespace EQEmu { - class MemoryMappedFile; + class MemoryMappedFile; } /* @@ -34,8 +34,8 @@ public: virtual ~SharedDatabase(); /* - * General Character Related Stuff - */ + * General Character Related Stuff + */ bool SetGMSpeed(uint32 account_id, uint8 gmspeed); uint8 GetGMSpeed(uint32 account_id); bool SetHideMe(uint32 account_id, uint8 hideme); @@ -48,12 +48,12 @@ public: void SetPlayerInspectMessage(char* playername, const InspectMessage_Struct* message); void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message); void SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message); - bool GetCommandSettings(map &commands); + bool GetCommandSettings(map &commands); uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID); /* - * Character Inventory - */ + * Character Inventory + */ bool SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end); bool SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id); bool VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst); @@ -62,65 +62,65 @@ public: bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add); bool GetInventory(uint32 char_id, Inventory* inv); bool GetInventory(uint32 account_id, char* name, Inventory* inv); - bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); - - + bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); + + string GetBook(const char *txtfile); - + /* - * Item Methods - */ + * Item Methods + */ ItemInst* CreateItem(uint32 item_id, int16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); ItemInst* CreateItem(const Item_Struct* item, int16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); ItemInst* CreateBaseItem(const Item_Struct* item, int16 charges=0); - - /* - * Shared Memory crap - */ - //items - void GetItemsCount(int32 &item_count, uint32 &max_id); - void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id); - bool LoadItems(); - const Item_Struct* IterateItems(uint32* id); - const Item_Struct* GetItem(uint32 id); - const EvolveInfo* GetEvolveInfo(uint32 loregroup); - - //faction lists - void GetFactionListInfo(uint32 &list_count, uint32 &max_lists); + /* + * Shared Memory crap + */ + + //items + void GetItemsCount(int32 &item_count, uint32 &max_id); + void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id); + bool LoadItems(); + const Item_Struct* IterateItems(uint32* id); + const Item_Struct* GetItem(uint32 id); + const EvolveInfo* GetEvolveInfo(uint32 loregroup); + + //faction lists + void GetFactionListInfo(uint32 &list_count, uint32 &max_lists); const NPCFactionList* GetNPCFactionEntry(uint32 id); - void LoadNPCFactionLists(void *data, uint32 size, uint32 list_count, uint32 max_lists); + void LoadNPCFactionLists(void *data, uint32 size, uint32 list_count, uint32 max_lists); bool LoadNPCFactionLists(); - //loot - void GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot_table, uint32 &loot_table_entries); - void GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_drop, uint32 &loot_drop_entries); - void LoadLootTables(void *data, uint32 size); - void LoadLootDrops(void *data, uint32 size); - bool LoadLoot(); - const LootTable_Struct* GetLootTable(uint32 loottable_id); + //loot + void GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot_table, uint32 &loot_table_entries); + void GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_drop, uint32 &loot_drop_entries); + void LoadLootTables(void *data, uint32 size); + void LoadLootDrops(void *data, uint32 size); + bool LoadLoot(); + const LootTable_Struct* GetLootTable(uint32 loottable_id); const LootDrop_Struct* GetLootDrop(uint32 lootdrop_id); - void LoadSkillCaps(void *data); - bool LoadSkillCaps(); + void LoadSkillCaps(void *data); + bool LoadSkillCaps(); uint16 GetSkillCap(uint8 Class_, SkillType Skill, uint8 Level); uint8 GetTrainLevel(uint8 Class_, SkillType Skill, uint8 Level); - int GetMaxSpellID(); - void LoadSpells(void *data, int max_spells); - void LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID); + int GetMaxSpellID(); + void LoadSpells(void *data, int max_spells); + void LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID); protected: - - EQEmu::MemoryMappedFile *items_mmf; - EQEmu::FixedMemoryHashSet *items_hash; - EQEmu::MemoryMappedFile *faction_mmf; - EQEmu::FixedMemoryHashSet *faction_hash; - EQEmu::MemoryMappedFile *loot_table_mmf; - EQEmu::FixedMemoryVariableHashSet *loot_table_hash; - EQEmu::MemoryMappedFile *loot_drop_mmf; - EQEmu::FixedMemoryVariableHashSet *loot_drop_hash; - EQEmu::MemoryMappedFile *skill_caps_mmf; + + EQEmu::MemoryMappedFile *items_mmf; + EQEmu::FixedMemoryHashSet *items_hash; + EQEmu::MemoryMappedFile *faction_mmf; + EQEmu::FixedMemoryHashSet *faction_hash; + EQEmu::MemoryMappedFile *loot_table_mmf; + EQEmu::FixedMemoryVariableHashSet *loot_table_hash; + EQEmu::MemoryMappedFile *loot_drop_mmf; + EQEmu::FixedMemoryVariableHashSet *loot_drop_hash; + EQEmu::MemoryMappedFile *skill_caps_mmf; }; #endif /*SHAREDDB_H_*/ diff --git a/common/skills.h b/common/skills.h index 43b8227bc..0b0c6e025 100644 --- a/common/skills.h +++ b/common/skills.h @@ -1,101 +1,101 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.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 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 + 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. + 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 + 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 SKILLS_H #define SKILLS_H // Correct Skill Numbers as of 4-14-2002 typedef enum { - _1H_BLUNT = 0, - _1H_SLASHING = 1, - _2H_BLUNT = 2, - _2H_SLASHING = 3, - ABJURE = 4, - ALTERATION = 5, - APPLY_POISON = 6, - ARCHERY = 7, - BACKSTAB = 8, - BIND_WOUND = 9, - BASH = 10, - BLOCKSKILL = 11, - BRASS_INSTRUMENTS = 12, - CHANNELING = 13, - CONJURATION = 14, - DEFENSE = 15, - DISARM = 16, - DISARM_TRAPS = 17, - DIVINATION = 18, - DODGE = 19, - DOUBLE_ATTACK = 20, - DRAGON_PUNCH = 21 , //aka Tail Rake - DUAL_WIELD = 22, - EAGLE_STRIKE = 23, - EVOCATION = 24, - FEIGN_DEATH = 25, - FLYING_KICK = 26, - FORAGE = 27, - HAND_TO_HAND = 28, - HIDE = 29, - KICK = 30, - MEDITATE = 31, - MEND = 32, - OFFENSE = 33, - PARRY = 34, - PICK_LOCK = 35, - PIERCING = 36, - RIPOSTE = 37, - ROUND_KICK = 38, - SAFE_FALL = 39, - SENSE_HEADING = 40, - SINGING = 41, - SNEAK = 42, - SPECIALIZE_ABJURE = 43, - SPECIALIZE_ALTERATION = 44, - SPECIALIZE_CONJURATION = 45, - SPECIALIZE_DIVINATION = 46, - SPECIALIZE_EVOCATION = 47, - PICK_POCKETS = 48, - STRINGED_INSTRUMENTS = 49, - SWIMMING = 50, - THROWING = 51, - TIGER_CLAW = 52, - TRACKING = 53, - WIND_INSTRUMENTS = 54, - FISHING = 55, - MAKE_POISON = 56, - TINKERING = 57, - RESEARCH = 58, - ALCHEMY = 59, - BAKING = 60, - TAILORING = 61, - SENSE_TRAPS = 62, - BLACKSMITHING = 63, - FLETCHING = 64, - BREWING = 65, - ALCOHOL_TOLERANCE = 66, - BEGGING = 67, - JEWELRY_MAKING = 68, - POTTERY = 69, - PERCUSSION_INSTRUMENTS = 70, - INTIMIDATION = 71, - BERSERKING = 72, - TAUNT = 73, - FRENZY = 74, - GENERIC_TRADESKILL = 75 + _1H_BLUNT = 0, + _1H_SLASHING = 1, + _2H_BLUNT = 2, + _2H_SLASHING = 3, + ABJURE = 4, + ALTERATION = 5, + APPLY_POISON = 6, + ARCHERY = 7, + BACKSTAB = 8, + BIND_WOUND = 9, + BASH = 10, + BLOCKSKILL = 11, + BRASS_INSTRUMENTS = 12, + CHANNELING = 13, + CONJURATION = 14, + DEFENSE = 15, + DISARM = 16, + DISARM_TRAPS = 17, + DIVINATION = 18, + DODGE = 19, + DOUBLE_ATTACK = 20, + DRAGON_PUNCH = 21 , //aka Tail Rake + DUAL_WIELD = 22, + EAGLE_STRIKE = 23, + EVOCATION = 24, + FEIGN_DEATH = 25, + FLYING_KICK = 26, + FORAGE = 27, + HAND_TO_HAND = 28, + HIDE = 29, + KICK = 30, + MEDITATE = 31, + MEND = 32, + OFFENSE = 33, + PARRY = 34, + PICK_LOCK = 35, + PIERCING = 36, + RIPOSTE = 37, + ROUND_KICK = 38, + SAFE_FALL = 39, + SENSE_HEADING = 40, + SINGING = 41, + SNEAK = 42, + SPECIALIZE_ABJURE = 43, + SPECIALIZE_ALTERATION = 44, + SPECIALIZE_CONJURATION = 45, + SPECIALIZE_DIVINATION = 46, + SPECIALIZE_EVOCATION = 47, + PICK_POCKETS = 48, + STRINGED_INSTRUMENTS = 49, + SWIMMING = 50, + THROWING = 51, + TIGER_CLAW = 52, + TRACKING = 53, + WIND_INSTRUMENTS = 54, + FISHING = 55, + MAKE_POISON = 56, + TINKERING = 57, + RESEARCH = 58, + ALCHEMY = 59, + BAKING = 60, + TAILORING = 61, + SENSE_TRAPS = 62, + BLACKSMITHING = 63, + FLETCHING = 64, + BREWING = 65, + ALCOHOL_TOLERANCE = 66, + BEGGING = 67, + JEWELRY_MAKING = 68, + POTTERY = 69, + PERCUSSION_INSTRUMENTS = 70, + INTIMIDATION = 71, + BERSERKING = 72, + TAUNT = 73, + FRENZY = 74, + GENERIC_TRADESKILL = 75 } SkillType; #define HIGHEST_SKILL FRENZY diff --git a/common/spdat.cpp b/common/spdat.cpp index 319e94f14..4cf4ab1a6 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -1,32 +1,32 @@ -/* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 */ /* solar: General outline of spell casting process - + 1. - a) Client clicks a spell bar gem, ability, or item. client_process.cpp + a) Client clicks a spell bar gem, ability, or item. client_process.cpp gets the op and calls CastSpell() with all the relevant info including cast time. - b) NPC does CastSpell() from AI + b) NPC does CastSpell() from AI 2. a) CastSpell() determines there is a cast time and sets some state keeping @@ -41,7 +41,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) 4. CastedSpellFinished() checks some timed spell specific things, like - wether to interrupt or not, due to movement or melee. If successful + wether to interrupt or not, due to movement or melee. If successful SpellFinished() is called. 5. @@ -215,7 +215,7 @@ bool IsBeneficialSpell(uint16 spell_id) if(tt != ST_Self && tt != ST_Pet){ if(IsEffectInSpell(spell_id, SE_CancelMagic)) return false; - } + } if(tt == ST_Target || tt == ST_AETarget || tt == ST_Animal || tt == ST_Undead || tt == ST_Pet) { uint16 sai = spells[spell_id].SpellAffectIndex; if(spells[spell_id].resisttype == RESIST_MAGIC){ @@ -347,7 +347,7 @@ bool IsPureNukeSpell(uint16 spell_id) return ( - effect_count == 1 && IsEffectInSpell(spell_id, SE_CurrentHP) && + effect_count == 1 && IsEffectInSpell(spell_id, SE_CurrentHP) && spells[spell_id].buffduration == 0 && IsDamageSpell(spell_id) ); } @@ -364,15 +364,15 @@ bool IsPBAENukeSpell(uint16 spell_id) bool IsAERainNukeSpell(uint16 spell_id) { - return IsValidSpell(spell_id) && IsPureNukeSpell(spell_id) + return IsValidSpell(spell_id) && IsPureNukeSpell(spell_id) && spells[spell_id].aoerange > 0 && spells[spell_id].AEDuration > 1000; } bool IsPartialCapableSpell(uint16 spell_id) { - if(IsPureNukeSpell(spell_id) || - IsFearSpell(spell_id) || - IsEffectInSpell(spell_id, SE_Root) || + if(IsPureNukeSpell(spell_id) || + IsFearSpell(spell_id) || + IsEffectInSpell(spell_id, SE_Root) || IsEffectInSpell(spell_id, SE_Charm)) { return true; @@ -383,7 +383,7 @@ bool IsPartialCapableSpell(uint16 spell_id) bool IsResistableSpell(uint16 spell_id) { - // solar: for now only detrimental spells are resistable. later on i will + // solar: for now only detrimental spells are resistable. later on i will // add specific exceptions for the beneficial spells that are resistable if(IsDetrimentalSpell(spell_id)) { @@ -401,7 +401,7 @@ bool IsGroupSpell(uint16 spell_id) IsValidSpell(spell_id) && ( spells[spell_id].targettype == ST_AEBard || - spells[spell_id].targettype == ST_Group || + spells[spell_id].targettype == ST_Group || spells[spell_id].targettype == ST_GroupTeleport ) ); @@ -439,7 +439,7 @@ bool IsEffectInSpell(uint16 spellid, int effect) return false; for(j = 0; j < EFFECT_COUNT; j++) - if(spells[spellid].effectid[j] == effect) + if(spells[spellid].effectid[j] == effect) return true; return false; @@ -460,7 +460,7 @@ bool IsBlankSpellEffect(uint16 spellid, int effect_index) ( effect == SE_Blank || // blank marker ( // spacer - effect == SE_CHA && + effect == SE_CHA && base == 0 && formula == 100 ) @@ -475,7 +475,7 @@ bool IsValidSpell(uint32 spellid) { return ( - SPDAT_RECORDS > 0 && + SPDAT_RECORDS > 0 && spellid != 0 && spellid != 1 && spellid != 0xFFFFFFFF && @@ -493,7 +493,7 @@ int GetMinLevel(uint16 spell_id) { if(spell.classes[r] < min) min = spell.classes[r]; } - + //if we can't cast the spell return 0 //just so it wont screw up calculations used in other areas of the code if(min == 255) @@ -503,15 +503,15 @@ int GetMinLevel(uint16 spell_id) { } int GetSpellLevel(uint16 spell_id, int classa) { - if(classa >= PLAYER_CLASS_COUNT) { - return 255; - } + if(classa >= PLAYER_CLASS_COUNT) { + return 255; + } const SPDat_Spell_Struct &spell = spells[spell_id]; return spell.classes[classa - 1]; } -// solar: this will find the first occurance of effect. this is handy +// solar: this will find the first occurance of effect. this is handy // for spells like mez and charm, but if the effect appears more than once // in a spell this will just give back the first one. int GetSpellEffectIndex(uint16 spell_id, int effect) @@ -536,7 +536,7 @@ int GetSpellEffectIndex(uint16 spell_id, int effect) int CanUseSpell(uint16 spellid, int classa, int level) { int level_to_use; - + if(!IsValidSpell(spellid) || classa >= PLAYER_CLASS_COUNT) return 0; @@ -557,7 +557,7 @@ int CanUseSpell(uint16 spellid, int classa, int level) bool BeneficialSpell(uint16 spell_id) { - if (spell_id <= 0 || spell_id >= SPDAT_RECORDS + if (spell_id <= 0 || spell_id >= SPDAT_RECORDS /*|| spells[spell_id].stacking == 27*/ ) { return true; @@ -598,7 +598,7 @@ int32 CalculatePoisonCounters(uint16 spell_id){ Counters += spells[spell_id].base[i]; } } - return Counters; + return Counters; } int32 CalculateDiseaseCounters(uint16 spell_id){ @@ -612,7 +612,7 @@ int32 CalculateDiseaseCounters(uint16 spell_id){ Counters += spells[spell_id].base[i]; } } - return Counters; + return Counters; } int32 CalculateCurseCounters(uint16 spell_id){ @@ -626,7 +626,7 @@ int32 CalculateCurseCounters(uint16 spell_id){ Counters += spells[spell_id].base[i]; } } - return Counters; + return Counters; } int32 CalculateCorruptionCounters(uint16 spell_id){ @@ -640,27 +640,27 @@ int32 CalculateCorruptionCounters(uint16 spell_id){ Counters += spells[spell_id].base[i]; } } - return Counters; + return Counters; } int32 CalculateCounters(uint16 spell_id) { - int32 counter = CalculatePoisonCounters(spell_id); - if(counter != 0) { - return counter; - } + int32 counter = CalculatePoisonCounters(spell_id); + if(counter != 0) { + return counter; + } - counter = CalculateDiseaseCounters(spell_id); - if(counter != 0) { - return counter; - } + counter = CalculateDiseaseCounters(spell_id); + if(counter != 0) { + return counter; + } - counter = CalculateCurseCounters(spell_id); - if(counter != 0) { - return counter; - } + counter = CalculateCurseCounters(spell_id); + if(counter != 0) { + return counter; + } - counter = CalculateCorruptionCounters(spell_id); - return counter; + counter = CalculateCorruptionCounters(spell_id); + return counter; } bool IsDisciplineBuff(uint16 spell_id) @@ -668,9 +668,9 @@ bool IsDisciplineBuff(uint16 spell_id) if(!IsValidSpell(spell_id)) return false; - if(spells[spell_id].mana == 0 + if(spells[spell_id].mana == 0 && spells[spell_id].short_buff_box == 0 - && (spells[spell_id].EndurCost || spells[spell_id].EndurUpkeep) + && (spells[spell_id].EndurCost || spells[spell_id].EndurUpkeep) && spells[spell_id].targettype == ST_Self) { return true; @@ -836,7 +836,7 @@ int GetSpellEffectDescNum(uint16 spell_id) } } -DmgShieldType GetDamageShieldType(uint16 spell_id) +DmgShieldType GetDamageShieldType(uint16 spell_id) { // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, @@ -844,8 +844,8 @@ DmgShieldType GetDamageShieldType(uint16 spell_id) // if( (spell_id > 0) && (spell_id < SPDAT_RECORDS) ){ - _log(SPELLS__EFFECT_VALUES, "DamageShieldType for spell %i (%s) is %X\n", spell_id, - spells[spell_id].name, spells[spell_id].DamageShieldType); + _log(SPELLS__EFFECT_VALUES, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + spells[spell_id].name, spells[spell_id].DamageShieldType); if(spells[spell_id].DamageShieldType) return (DmgShieldType) spells[spell_id].DamageShieldType; @@ -865,10 +865,10 @@ DmgShieldType GetDamageShieldType(uint16 spell_id) return DS_THORNS; } -bool IsLDoNObjectSpell(uint16 spell_id) +bool IsLDoNObjectSpell(uint16 spell_id) { - if(IsEffectInSpell(spell_id, SE_AppraiseLDonChest) || - IsEffectInSpell(spell_id, SE_DisarmLDoNTrap) || + if(IsEffectInSpell(spell_id, SE_AppraiseLDonChest) || + IsEffectInSpell(spell_id, SE_DisarmLDoNTrap) || IsEffectInSpell(spell_id, SE_UnlockLDoNChest)) { return true; @@ -898,7 +898,7 @@ bool IsHealOverTimeSpell(uint16 spell_id) { } bool IsCompleteHealSpell(uint16 spell_id) { - + if(spell_id == 13 || IsEffectInSpell(spell_id, SE_CompleteHeal) || IsPercentalHealSpell(spell_id) && !IsGroupSpell(spell_id)) return true; else @@ -936,58 +936,58 @@ bool IsRegularSingleTargetHealSpell(uint16 spell_id) { bool IsRegularGroupHealSpell(uint16 spell_id) { - if(IsGroupSpell(spell_id) && !IsCompleteHealSpell(spell_id) && !IsHealOverTimeSpell(spell_id)) - return true; - else - return false; + if(IsGroupSpell(spell_id) && !IsCompleteHealSpell(spell_id) && !IsHealOverTimeSpell(spell_id)) + return true; + else + return false; } bool IsGroupCompleteHealSpell(uint16 spell_id) { - if(IsGroupSpell(spell_id) && IsCompleteHealSpell(spell_id)) - return true; - else - return false; + if(IsGroupSpell(spell_id) && IsCompleteHealSpell(spell_id)) + return true; + else + return false; } bool IsGroupHealOverTimeSpell(uint16 spell_id) { - if(IsGroupSpell(spell_id) && IsHealOverTimeSpell(spell_id) && spells[spell_id].buffduration < 10) - return true; - else - return false; + if(IsGroupSpell(spell_id) && IsHealOverTimeSpell(spell_id) && spells[spell_id].buffduration < 10) + return true; + else + return false; } bool IsDebuffSpell(uint16 spell_id) { - if(IsBeneficialSpell(spell_id) || IsEffectHitpointsSpell(spell_id) || IsStunSpell(spell_id) || IsMezSpell(spell_id) - || IsCharmSpell(spell_id) || IsSlowSpell(spell_id) || IsEffectInSpell(spell_id, SE_Root) || IsEffectInSpell(spell_id, SE_CancelMagic) - || IsEffectInSpell(spell_id, SE_MovementSpeed) || IsFearSpell(spell_id) || IsEffectInSpell(spell_id, SE_Calm)) - return false; - else - return true; + if(IsBeneficialSpell(spell_id) || IsEffectHitpointsSpell(spell_id) || IsStunSpell(spell_id) || IsMezSpell(spell_id) + || IsCharmSpell(spell_id) || IsSlowSpell(spell_id) || IsEffectInSpell(spell_id, SE_Root) || IsEffectInSpell(spell_id, SE_CancelMagic) + || IsEffectInSpell(spell_id, SE_MovementSpeed) || IsFearSpell(spell_id) || IsEffectInSpell(spell_id, SE_Calm)) + return false; + else + return true; } bool IsResistDebuffSpell(uint16 spell_id) { - if((IsEffectInSpell(spell_id, SE_ResistFire) || IsEffectInSpell(spell_id, SE_ResistCold) || IsEffectInSpell(spell_id, SE_ResistPoison) - || IsEffectInSpell(spell_id, SE_ResistDisease) || IsEffectInSpell(spell_id, SE_ResistMagic) || IsEffectInSpell(spell_id, SE_ResistAll) - || IsEffectInSpell(spell_id, SE_ResistCorruption)) && !IsBeneficialSpell(spell_id)) - return true; - else - return false; + if((IsEffectInSpell(spell_id, SE_ResistFire) || IsEffectInSpell(spell_id, SE_ResistCold) || IsEffectInSpell(spell_id, SE_ResistPoison) + || IsEffectInSpell(spell_id, SE_ResistDisease) || IsEffectInSpell(spell_id, SE_ResistMagic) || IsEffectInSpell(spell_id, SE_ResistAll) + || IsEffectInSpell(spell_id, SE_ResistCorruption)) && !IsBeneficialSpell(spell_id)) + return true; + else + return false; } bool IsSelfConversionSpell(uint16 spell_id) { - if(GetSpellTargetType(spell_id) == ST_Self && IsEffectInSpell(spell_id, SE_CurrentMana) && IsEffectInSpell(spell_id, SE_CurrentHP) - && spells[spell_id].base[GetSpellEffectIndex(spell_id, SE_CurrentMana)] > 0 && spells[spell_id].base[GetSpellEffectIndex(spell_id, SE_CurrentHP)] < 0) - return true; - else - return false; + if(GetSpellTargetType(spell_id) == ST_Self && IsEffectInSpell(spell_id, SE_CurrentMana) && IsEffectInSpell(spell_id, SE_CurrentHP) + && spells[spell_id].base[GetSpellEffectIndex(spell_id, SE_CurrentMana)] > 0 && spells[spell_id].base[GetSpellEffectIndex(spell_id, SE_CurrentHP)] < 0) + return true; + else + return false; } -uint32 GetMorphTrigger(uint32 spell_id) +uint32 GetMorphTrigger(uint32 spell_id) { for(int i = 0; i < EFFECT_COUNT; ++i) { diff --git a/common/spdat.h b/common/spdat.h index a936f9975..7e3cd71a4 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2005 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 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 + 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. + 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 + 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 SPDAT_H #define SPDAT_H @@ -67,7 +67,7 @@ enum SpellAffectIndex { SAI_Calm = 12, // Lull and Alliance Spells SAI_Dispell_Sight = 14, // Dispells and Spells like Bind Sight SAI_Memory_Blur = 27, - SAI_Calm_Song = 43 // Lull and Alliance Songs + SAI_Calm_Song = 43 // Lull and Alliance Songs }; enum RESISTTYPE { @@ -80,7 +80,7 @@ enum RESISTTYPE RESIST_CHROMATIC = 6, RESIST_PRISMATIC = 7, RESIST_PHYSICAL = 8, // see Muscle Shock, Back Swing - RESIST_CORRUPTION = 9 + RESIST_CORRUPTION = 9 }; //Target Type IDs @@ -134,7 +134,7 @@ typedef enum { /* 47 */ //ST_PetMaster = 0x2e, // uses the master as target } SpellTargetType; -typedef enum { +typedef enum { DS_DECAY = 244, DS_CHILLED = 245, DS_FREEZING = 246, @@ -250,17 +250,17 @@ typedef enum { #define SE_CallPet 103 // implemented - Summon Companion #define SE_Translocate 104 // implemented #define SE_AntiGate 105 // implemented - Translocational Anchor -#define SE_SummonBSTPet 106 // implemented +#define SE_SummonBSTPet 106 // implemented //#define SE_Unknown107 107 // not used -#define SE_Familiar 108 // implemented +#define SE_Familiar 108 // implemented #define SE_SummonItemIntoBag 109 // implemented - summons stuff into container //#define SE_Unknown110 110 // not used -#define SE_ResistAll 111 // implemented -#define SE_CastingLevel 112 // implemented -#define SE_SummonHorse 113 // implemented +#define SE_ResistAll 111 // implemented +#define SE_CastingLevel 112 // implemented +#define SE_SummonHorse 113 // implemented #define SE_ChangeAggro 114 // implemented - Hate modifing buffs(ie horrifying visage) #define SE_Hunger 115 // implemented - Song of Sustenance -#define SE_CurseCounter 116 // implemented +#define SE_CurseCounter 116 // implemented #define SE_MagicWeapon 117 // implemented - makes weapon magical #define SE_SingingSkill 118 // *implemented - needs AA conversion #define SE_AttackSpeed3 119 // implemented @@ -288,12 +288,12 @@ typedef enum { #define SE_LimitInstant 141 // implemented #define SE_LimitMinLevel 142 // implemented #define SE_LimitCastTime 143 // implemented -//#define SE_Unknown144 144 // not used +//#define SE_Unknown144 144 // not used #define SE_Teleport2 145 // implemented - Banishment of the Pantheon //#define SE_Unknown146 146 // not used (Lightning Rod) Electrical Resist? (exp. VoA) #define SE_PercentalHeal 147 // implemented #define SE_StackingCommand_Block 148 // implemented? -#define SE_StackingCommand_Overwrite 149 // implemented? +#define SE_StackingCommand_Overwrite 149 // implemented? #define SE_DeathSave 150 // implemented #define SE_SuspendPet 151 // *not implemented as bonus #define SE_TemporaryPets 152 // implemented @@ -358,7 +358,7 @@ typedef enum { #define SE_AEMelee 211 // implemented #define SE_CastingSkills 212 // *not implemented -Include/Exclude Casting Skill type. (*no longer used on live) #define SE_PetMaxHP 213 // implemented[AA] - increases the maximum hit points of your pet -#define SE_MaxHPChange 214 // implemented +#define SE_MaxHPChange 214 // implemented #define SE_PetAvoidance 215 // implemented[AA] - increases pet ability to avoid melee damage #define SE_Accuracy 216 // implemented #define SE_HeadShot 217 // not implemented as bonus - ability to head shot (base2 = damage) @@ -383,8 +383,8 @@ typedef enum { //#define SE_Unknown236 236 // not used #define SE_GivePetGroupTarget 237 // implemented[AA] - (Pet Affinity) #define SE_IllusionPersistence 238 // *not implemented - lends persistence to your illusionary disguises, causing them to last until you die or the illusion is forcibly removed. -#define SE_FeignedCastOnChance 239 // *not implemented as bonus - ability gives you an increasing chance for your feigned deaths to not be revealed by spells cast upon you. -//#define SE_Unknown240 240 // not used [Likely related to above - you become immune to feign breaking on a resisted spell and have a good chance of feigning through a spell that successfully lands upon you.] +#define SE_FeignedCastOnChance 239 // *not implemented as bonus - ability gives you an increasing chance for your feigned deaths to not be revealed by spells cast upon you. +//#define SE_Unknown240 240 // not used [Likely related to above - you become immune to feign breaking on a resisted spell and have a good chance of feigning through a spell that successfully lands upon you.] #define SE_ImprovedReclaimEnergy 241 // not implemented as bonus - increase the amount of mana returned to you when reclaiming your pet. #define SE_ChanceWipeHateList 242 // *not implemented - increases the chance to wipe hate with memory blurr #define SE_CharmBreakChance 243 // implemented - Total Domination @@ -410,7 +410,7 @@ typedef enum { #define SE_TradeSkillMastery 263 // implemented - lets you raise more than one tradeskill above master. #define SE_HastenedAASkill 264 // not implemented as bonus - Use redux field in aa_actions table for this effect #define SE_MasteryofPast 265 // implemented[AA] - Spells less than effect values level can not be fizzled -#define SE_ExtraAttackChance 266 // implemented - increase chance to score an extra attack with a 2-Handed Weapon. +#define SE_ExtraAttackChance 266 // implemented - increase chance to score an extra attack with a 2-Handed Weapon. #define SE_PetDiscipline2 267 // *not implemented - /pet focus, /pet no cast #define SE_ReduceTradeskillFail 268 // *not implemented? - reduces chance to fail with given tradeskill by a percent chance #define SE_MaxBindWound 269 // implemented[AA] - Increase max HP you can bind wound. @@ -425,7 +425,7 @@ typedef enum { #define SE_FinishingBlow 278 // implemented[AA] - chance to do massive damage under 10% HP (base1 = chance, base2 = damage) #define SE_Flurry 279 // implemented #define SE_PetFlurry 280 // implemented[AA] -#define SE_FeignedMinion 281 // *not implemented[AA] ability allows you to instruct your pet to feign death via the '/pet feign' command. value = succeed chance +#define SE_FeignedMinion 281 // *not implemented[AA] ability allows you to instruct your pet to feign death via the '/pet feign' command. value = succeed chance #define SE_ImprovedBindWound 282 // implemented[AA] - increase bind wound amount by percent. #define SE_DoubleSpecialAttack 283 // implemented[AA] - Chance to perform second special attack as monk //#define SE_Unknown284 284 // not used @@ -433,7 +433,7 @@ typedef enum { #define SE_SpellDamage 286 // implemented - adds direct spell damage #define SE_SpellDurationIncByTic 287 // implemented #define SE_SpecialAttackKBProc 288 // implemented[AA] - Chance to to do a knockback from special attacks [AA Dragon Punch]. -#define SE_ImprovedSpellEffect 289 // implemented +#define SE_ImprovedSpellEffect 289 // implemented #define SE_IncreaseRunSpeedCap 290 // implemented[AA] - increases run speed over the hard cap #define SE_Purify 291 // implemented - Removes determental effects #define SE_StrikeThrough2 292 // implemented[AA] - increasing chance of bypassing an opponent's special defenses, such as dodge, block, parry, and riposte. @@ -450,8 +450,8 @@ typedef enum { #define SE_FF_Damage_Amount 303 // implemented - adds direct spell damage #define SE_OffhandRiposteFail 304 // not implemented as bonus - enemy cannot riposte offhand attacks #define SE_MitigateDamageShield 305 // implemented - off hand attacks only (Shielding Resistance) -#define SE_ArmyOfTheDead 306 // *not implemented NecroAA - This ability calls up to five shades of nearby corpses back to life to serve the necromancer. The soulless abominations will mindlessly fight the target until called back to the afterlife some time later. The first rank summons up to three shades that serve for 60 seconds, and each additional rank adds one more possible shade and increases their duration by 15 seconds -#define SE_Appraisal 307 // *not implemented Rogue AA - This ability allows you to estimate the selling price of an item you are holding on your cursor. +#define SE_ArmyOfTheDead 306 // *not implemented NecroAA - This ability calls up to five shades of nearby corpses back to life to serve the necromancer. The soulless abominations will mindlessly fight the target until called back to the afterlife some time later. The first rank summons up to three shades that serve for 60 seconds, and each additional rank adds one more possible shade and increases their duration by 15 seconds +#define SE_Appraisal 307 // *not implemented Rogue AA - This ability allows you to estimate the selling price of an item you are holding on your cursor. #define SE_SuspendMinion 308 // not implemented as bonus #define SE_YetAnotherGate 309 // implemented #define SE_ReduceReuseTimer 310 // implemented @@ -484,7 +484,7 @@ typedef enum { #define SE_PercentXPIncrease 337 // implemented #define SE_SummonAndResAllCorpses 338 // implemented #define SE_TriggerOnCast 339 // implemented -#define SE_SpellTrigger 340 // implemented - chance to trigger spell +#define SE_SpellTrigger 340 // implemented - chance to trigger spell #define SE_ItemAttackCapIncrease 341 // implemented[AA] - increases the maximum amount of attack you can gain from items. #define SE_ImmuneFleeing 342 // implemented - stop mob from fleeing #define SE_InterruptCasting 343 // implemented - % chance to interrupt spells being cast every tic. Cacophony (8272) @@ -494,23 +494,23 @@ typedef enum { #define SE_ExtraArcheryAttack 347 // not implemented - chance at an additional archery attack (consumes arrow) #define SE_LimitManaCost 348 // implemented #define SE_ShieldEquipHateMod 349 // *not implemented[AA] ie. used to increase melee hate when wearing a shield w/ Shield Specialist AA. -#define SE_ManaBurn 350 // implemented - Drains mana for damage/heal at a defined ratio up to a defined maximum amount of mana. +#define SE_ManaBurn 350 // implemented - Drains mana for damage/heal at a defined ratio up to a defined maximum amount of mana. #define SE_PersistentEffect 351 // *not implemented. creates a trap/totem that casts a spell (spell id + base1?) when anything comes near it. can probably make a beacon for this #define SE_Unknown352 352 // *not implemented - looks to be some type of invulnerability? Test ITC (8755) #define SE_AdditionalAura 353 // *not implemented - allows use of more than 1 aura, aa effect #define SE_Unknown354 354 // *not implemented - looks to be some type of invulnerability? Test DAT (8757) #define SE_Unknown355 355 // *not implemented - looks to be some type of invulnerability? Test LT (8758) //#define SE_Unknown356 356 // not used -//#define SE_Unknown357 357 // *not implemented - (Stunted Growth) Something to do with negate effects? Focus? Chance? -#define SE_CurrentManaOnce 358 // implemented +//#define SE_Unknown357 357 // *not implemented - (Stunted Growth) Something to do with negate effects? Focus? Chance? +#define SE_CurrentManaOnce 358 // implemented #define SE_Invulnerabilty 359 // *not implemented - Invulnerability (Brell's Blessing) #define SE_SpellOnKill 360 // implemented - a buff that has a base1 % to cast spell base2 when you kill a "challenging foe" base3 min level -#define SE_SpellOnDeath 361 // implemented - casts spell on death of buffed +#define SE_SpellOnDeath 361 // implemented - casts spell on death of buffed #define SE_PotionBeltSlots 362 // *not implemented[AA] 'Quick Draw' expands the potion belt by one additional available item slot per rank. #define SE_BandolierSlots 363 // *not implemented[AA] 'Battle Ready' expands the bandolier by one additional save slot per rank. #define SE_TripleAttackChance 364 // implemented #define SE_SpellOnKill2 365 // implemented - chance to trigger a spell on kill when the kill is caused by a specific spell with this effect in it (10470 Venin) -#define SE_ShieldEquipDmgMod 366 // *not implemented - [AA Shield Specialist] - damage bonus to weapon if shield equiped. +#define SE_ShieldEquipDmgMod 366 // *not implemented - [AA Shield Specialist] - damage bonus to weapon if shield equiped. #define SE_SetBodyType 367 // implemented - set body type of base1 so it can be affected by spells that are limited to that type (Plant, Animal, Undead, etc) #define SE_FactionMod 368 // *not implemented - increases faction with base1 (faction id, live won't match up w/ ours) by base2 #define SE_CorruptionCounter 369 // implemented @@ -518,7 +518,7 @@ typedef enum { #define SE_AttackSpeed4 371 // implemented - stackable slow effect 'Inhibit Melee' #define SE_ForageSkill 372 // *not implemented[AA] Will increase the skill cap for those that have the Forage skill and grant the skill and raise the cap to those that do not. #define SE_CastOnWearoff 373 // implemented -#define SE_ApplyEffect 374 // implemented +#define SE_ApplyEffect 374 // implemented #define SE_DotCritDmgIncrease 375 // implemented - Increase damage of DoT critical amount //#define SE_Unknown376 376 // *not implemented - used in 2 spells #define SE_BossSpellTrigger 377 // implemented - spell is cast on fade @@ -572,14 +572,14 @@ typedef enum { #define SE_Display 425 // *not implemented - Illusion: Flying Dragon(21626) #define SE_IncreaseExtTargetWindow 426 // *not implmented[AA] - increases the capacity of your extended target window #define SE_SkillProc 427 // implemented - chance to proc when using a skill(ie taunt) -#define SE_LimitToSkill 428 // implemented - limits what skills will effect a skill proc +#define SE_LimitToSkill 428 // implemented - limits what skills will effect a skill proc #define SE_SkillProc2 429 // implemented - chance to proc when using a skill (most have hit limits) //#define SE_Unknown430 430 // *not implemented - Fear of the Dark(27641) //#define SE_Unknown431 431 // *not implemented - Fear of the Dark(27641) //#define SE_Unknown432 432 // not used //#define SE_Uknonwn433 433 // not used #define SE_CriticalHealChance2 434 // implemented - increase critical heal chance -#define SE_CriticalHealOverTime2 435 // implemented - increase critical heal over time chance +#define SE_CriticalHealOverTime2 435 // implemented - increase critical heal over time chance //#define SE_Unknown432 436 // not used #define SE_Anchor 437 // *not implemented - Teleport Guild Hall Anchor(33099) //#define SE_Unknown438 438 // not used @@ -597,8 +597,8 @@ typedef enum { // solar: note this struct is historical, we don't actually need it to be // aligned to anything, but for maintaining it it is kept in the order that -// the fields in the text file are. the numbering is not offset, but field -// number. note that the id field is counted as 0, this way the numbers +// the fields in the text file are. the numbering is not offset, but field +// number. note that the id field is counted as 0, this way the numbers // here match the numbers given to sep in the loading function net.cpp // struct SPDat_Spell_Struct @@ -609,7 +609,7 @@ struct SPDat_Spell_Struct /* 003 */ char teleport_zone[64]; // Teleport zone, pet name summoned, or item summoned /* 004 */ char you_cast[64]; // Message when you cast /* 005 */ char other_casts[64]; // Message when other casts -/* 006 */ char cast_on_you[64]; // Message when spell is cast on you +/* 006 */ char cast_on_you[64]; // Message when spell is cast on you /* 007 */ char cast_on_other[64]; // Message when spell is cast on someone else /* 008 */ char spell_fades[64]; // Spell fades /* 009 */ float range; @@ -623,26 +623,26 @@ struct SPDat_Spell_Struct /* 017 */ uint32 buffduration; /* 018 */ uint32 AEDuration; // sentinel, rain of something /* 019 */ uint16 mana; // Mana Used -/* 020 */ int base[EFFECT_COUNT]; //various purposes -/* 032 */ int base2[EFFECT_COUNT]; //various purposes +/* 020 */ int base[EFFECT_COUNT]; //various purposes +/* 032 */ int base2[EFFECT_COUNT]; //various purposes /* 044 */ int16 max[EFFECT_COUNT]; /* 056 */ //uint16 icon; // Spell icon /* 057 */ //uint16 memicon; // Icon on membarthing /* 058 */ int32 components[4]; // reagents /* 062 */ int component_counts[4]; // amount of regents used -/* 066 */ int NoexpendReagent[4]; // focus items (Need but not used; Flame Lick has a Fire Beetle Eye focus.) +/* 066 */ int NoexpendReagent[4]; // focus items (Need but not used; Flame Lick has a Fire Beetle Eye focus.) // If it is a number between 1-4 it means components[number] is a focus and not to expend it // If it is a valid itemid it means this item is a focus as well /* 070 */ uint16 formula[EFFECT_COUNT]; // Spell's value formula /* 082 */ //int LightType; // probaly another effecttype flag /* 083 */ int8 goodEffect; //0=detrimental, 1=Beneficial, 2=Beneficial, Group Only -/* 084 */ int Activated; // probaly another effecttype flag +/* 084 */ int Activated; // probaly another effecttype flag /* 085 */ int resisttype; /* 086 */ int effectid[EFFECT_COUNT]; // Spell's effects /* 098 */ SpellTargetType targettype; // Spell's Target /* 099 */ int basediff; // base difficulty fizzle adjustment /* 100 */ SkillType skill; -/* 101 */ int8 zonetype; // 01=Outdoors, 02=dungeons, ff=Any +/* 101 */ int8 zonetype; // 01=Outdoors, 02=dungeons, ff=Any /* 102 */ int8 EnvironmentType; /* 103 */ int8 TimeOfDay; /* 104 */ uint8 classes[PLAYER_CLASS_COUNT]; // Classes, and their min levels @@ -650,59 +650,59 @@ struct SPDat_Spell_Struct /* 121 */ //uint8 TargetAnim; /* 122 */ //uint32 TravelType; /* 123 */ uint16 SpellAffectIndex; -/* 124 */ int8 disallow_sit; // 124: high-end Yaulp spells (V, VI, VII, VIII [Rk 1, 2, & 3], & Gallenite's Bark of Fury -/* 125 */ // 125: Words of the Skeptic +/* 124 */ int8 disallow_sit; // 124: high-end Yaulp spells (V, VI, VII, VIII [Rk 1, 2, & 3], & Gallenite's Bark of Fury +/* 125 */ // 125: Words of the Skeptic /* 126 */ int8 deities[16]; // Deity check. 201 - 216 per http://www.eqemulator.net/wiki/wikka.php?wakka=DeityList // -1: Restrict to Deity; 1: Restrict to Deity, but only used on non-Live (Test Server "Blessing of ...") spells; 0: Don't restrict -/* 142 */ // 142: between 0 & 100 +/* 142 */ // 142: between 0 & 100 // 143: always set to 0 -/* 144 */ //int16 new_icon // Spell icon used by the client in uifiles/default/spells??.tga, both for spell gems & buff window. Looks to depreciate icon & memicon -/* 145 */ //int16 spellanim; // Doesn't look like it's the same as #doanim, so not sure what this is +/* 144 */ //int16 new_icon // Spell icon used by the client in uifiles/default/spells??.tga, both for spell gems & buff window. Looks to depreciate icon & memicon +/* 145 */ //int16 spellanim; // Doesn't look like it's the same as #doanim, so not sure what this is /* 146 */ int8 uninterruptable; // Looks like anything != 0 is uninterruptable. Values are mostly -1, 0, & 1 (Fetid Breath = 90?) -/* 147 */ int16 ResistDiff; -/* 148 */ //int dot_stacking_exempt; -/* 149 */ //int deletable; +/* 147 */ int16 ResistDiff; +/* 148 */ //int dot_stacking_exempt; +/* 149 */ //int deletable; /* 150 */ uint16 RecourseLink; -/* 151 */ // 151: -1, 0, or 1 +/* 151 */ // 151: -1, 0, or 1 // 152 & 153: all set to 0 -/* 154 */ int8 short_buff_box; // != 0, goes to short buff box. -/* 155 */ int descnum; // eqstr of description of spell -/* 156 */ //int typedescnum; // eqstr of type description -/* 157 */ int effectdescnum; // eqstr of effect description -/* 158 */ -/* 162 */ int bonushate; -/* 163 */ -/* 166 */ int EndurCost; -/* 167 */ int8 EndurTimerIndex; -/* 168 */ //int IsDisciplineBuff; //Will goto the combat window when cast -/* 169 */ -/* 173 */ int HateAdded; -/* 174 */ int EndurUpkeep; -/* 175 */ -/* 176 */ int numhits; -/* 177 */ int pvpresistbase; -/* 178 */ int pvpresistcalc; -/* 179 */ int pvpresistcap; -/* 180 */ int spell_category; -/* 181 */ -/* 185 */ int8 can_mgb; // 0=no, -1 or 1 = yes -/* 186 */ int dispel_flag; -/* 189 */ int MinResist; -/* 190 */ int MaxResist; -/* 191 */ uint8 viral_targets; -/* 192 */ uint8 viral_timer; -/* 193 */ int NimbusEffect; -/* 194 */ float directional_start; -/* 195 */ float directional_end; -/* 207 */ int spellgroup; -/* 209 */ int powerful_flag; // Need more investigation to figure out what to call this, for now we know -1 makes charm spells not break before their duration is complete, it does alot more though -/* 211 */ int CastRestriction; //Various restriction categories for spells most seem targetable race related but have also seen others for instance only castable if target hp 20% or lower or only if target out of combat -/* 212 */ bool AllowRest; +/* 154 */ int8 short_buff_box; // != 0, goes to short buff box. +/* 155 */ int descnum; // eqstr of description of spell +/* 156 */ //int typedescnum; // eqstr of type description +/* 157 */ int effectdescnum; // eqstr of effect description +/* 158 */ +/* 162 */ int bonushate; +/* 163 */ +/* 166 */ int EndurCost; +/* 167 */ int8 EndurTimerIndex; +/* 168 */ //int IsDisciplineBuff; //Will goto the combat window when cast +/* 169 */ +/* 173 */ int HateAdded; +/* 174 */ int EndurUpkeep; +/* 175 */ +/* 176 */ int numhits; +/* 177 */ int pvpresistbase; +/* 178 */ int pvpresistcalc; +/* 179 */ int pvpresistcap; +/* 180 */ int spell_category; +/* 181 */ +/* 185 */ int8 can_mgb; // 0=no, -1 or 1 = yes +/* 186 */ int dispel_flag; +/* 189 */ int MinResist; +/* 190 */ int MaxResist; +/* 191 */ uint8 viral_targets; +/* 192 */ uint8 viral_timer; +/* 193 */ int NimbusEffect; +/* 194 */ float directional_start; +/* 195 */ float directional_end; +/* 207 */ int spellgroup; +/* 209 */ int powerful_flag; // Need more investigation to figure out what to call this, for now we know -1 makes charm spells not break before their duration is complete, it does alot more though +/* 211 */ int CastRestriction; //Various restriction categories for spells most seem targetable race related but have also seen others for instance only castable if target hp 20% or lower or only if target out of combat +/* 212 */ bool AllowRest; /* 219 */ //int maxtargets; // not in DB yet, is used for beam and ring spells for target # limits uint8 DamageShieldType; // This field does not exist in spells_us.txt }; -extern const SPDat_Spell_Struct* spells; +extern const SPDat_Spell_Struct* spells; extern int32 SPDAT_RECORDS; bool IsTargetableAESpell(uint16 spell_id); diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index aeebf7706..cb3ee775b 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2005 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 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 + 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. + 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 + 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/debug.h" @@ -54,7 +54,7 @@ void TimeoutManager::CheckTimeouts() { void TimeoutManager::AddMember(Timeoutable *who) { if(who == nullptr) return; - + DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG diff --git a/common/timeoutmgr.h b/common/timeoutmgr.h index ac968f5b3..43e85a2c2 100644 --- a/common/timeoutmgr.h +++ b/common/timeoutmgr.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2005 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 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 + 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. + 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 + 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 TIMEOUT_MANAGER_H #define TIMEOUT_MANAGER_H @@ -38,7 +38,7 @@ public: //this frequency should generally be a multiple of TIMEOUT_GRANULARITY Timeoutable(uint32 check_frequency); virtual ~Timeoutable(); - + virtual void CheckTimeout() = 0; private: @@ -50,15 +50,15 @@ class TimeoutManager { friend class Timeoutable; public: TimeoutManager(); - + void CheckTimeouts(); - + protected: - + //methods called by Timeoutable objects: void AddMember(Timeoutable *who); void DeleteMember(Timeoutable *who); - + vector members; }; diff --git a/common/timer.cpp b/common/timer.cpp index c75f44b51..280c49545 100644 --- a/common/timer.cpp +++ b/common/timer.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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/debug.h" // Disgrace: for windows compile @@ -65,7 +65,7 @@ int gettimeofday (timeval *tp, ...) ftime (&tb); - tp->tv_sec = tb.time; + tp->tv_sec = tb.time; tp->tv_usec = tb.millitm * 1000; return 0; @@ -76,13 +76,13 @@ int gettimeofday (timeval *tp, ...) bool Timer::Check(bool iReset) { _CP(Timer_Check); - if (this==0) { - cerr << "Null timer during ->Check()!?\n"; - return true; + if (this==0) { + cerr << "Null timer during ->Check()!?\n"; + return true; } // if (!current_time || !start_time || !timer_time) {cerr << "Timer::Check on a timer that does not have a vital member defined."; // return true;} - if (enabled && current_time-start_time > timer_time) { + if (enabled && current_time-start_time > timer_time) { if (iReset) { if (pUseAcurateTiming) start_time += timer_time; @@ -91,9 +91,9 @@ bool Timer::Check(bool iReset) timer_time = set_at_trigger; } return true; - } - - return false; + } + + return false; } /* This function disables the timer */ @@ -106,37 +106,37 @@ void Timer::Enable() { } /* This function set the timer and restart it */ -void Timer::Start(uint32 set_timer_time, bool ChangeResetTimer) { - start_time = current_time; +void Timer::Start(uint32 set_timer_time, bool ChangeResetTimer) { + start_time = current_time; enabled = true; - if (set_timer_time != 0) - { + if (set_timer_time != 0) + { timer_time = set_timer_time; if (ChangeResetTimer) set_at_trigger = set_timer_time; - } + } } /* This timer updates the timer without restarting it */ void Timer::SetTimer(uint32 set_timer_time) { - /* If we were disabled before => restart the timer */ - if (!enabled) { + /* If we were disabled before => restart the timer */ + if (!enabled) { start_time = current_time; enabled = true; - } - if (set_timer_time != 0) { + } + if (set_timer_time != 0) { timer_time = set_timer_time; set_at_trigger = set_timer_time; - } + } } uint32 Timer::GetRemainingTime() { - if (enabled) { - if (current_time-start_time > timer_time) + if (enabled) { + if (current_time-start_time > timer_time) return 0; else return (start_time + timer_time) - current_time; - } + } else { return 0xFFFFFFFF; } @@ -158,37 +158,38 @@ void Timer::Trigger() } const uint32 Timer::GetCurrentTime() -{ - return current_time; +{ + return current_time; } //just to keep all time related crap in one place... not really related to timers. const uint32 Timer::GetTimeSeconds() { - struct timeval read_time; + struct timeval read_time; - gettimeofday(&read_time,0); - return(read_time.tv_sec); + gettimeofday(&read_time,0); + return(read_time.tv_sec); } const uint32 Timer::SetCurrentTime() { - struct timeval read_time; - uint32 this_time; + struct timeval read_time; + uint32 this_time; - gettimeofday(&read_time,0); - this_time = read_time.tv_sec * 1000 + read_time.tv_usec / 1000; + gettimeofday(&read_time,0); + this_time = read_time.tv_sec * 1000 + read_time.tv_usec / 1000; - if (last_time == 0) - { + if (last_time == 0) + { current_time = 0; - } - else - { + } + else + { current_time += this_time - last_time; - } - + } + last_time = this_time; // cerr << "Current time:" << current_time << endl; return current_time; } + diff --git a/common/timer.h b/common/timer.h index b9f489d31..7ac31e489 100644 --- a/common/timer.h +++ b/common/timer.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 TIMER_H #define TIMER_H diff --git a/common/types.h b/common/types.h index 21f530467..d5ac9297e 100644 --- a/common/types.h +++ b/common/types.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 TYPES_H #define TYPES_H @@ -32,11 +32,11 @@ typedef int64_t int64; #else typedef unsigned char byte; typedef unsigned char uint8; -typedef signed char int8; +typedef signed char int8; typedef unsigned short uint16; -typedef signed short int16; +typedef signed short int16; typedef unsigned int uint32; -typedef signed int int32; +typedef signed int int32; #ifdef _WINDOWS #if defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 @@ -54,7 +54,7 @@ typedef signed long long int64; #endif #ifdef _WINDOWS - #pragma warning( disable : 4200 ) + #pragma warning( disable : 4200 ) #endif #ifndef __cplusplus @@ -72,9 +72,9 @@ typedef const char Const_char; //for perl XS #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp typedef void ThreadReturnType; - #define THREAD_RETURN(x) _endthread(); return; + #define THREAD_RETURN(x) _endthread(); return; #else typedef void* ThreadReturnType; #define THREAD_RETURN(x) return(x); @@ -110,6 +110,4 @@ typedef const char Const_char; //for perl XS #define DLLFUNC extern "C" #endif - - #endif diff --git a/common/unix.cpp b/common/unix.cpp index 953eeff99..0e69a3b69 100644 --- a/common/unix.cpp +++ b/common/unix.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 _WINDOWS @@ -43,7 +43,6 @@ char* strlwr(char* tmp) { } #else - int joe = 1; + int joe = 1; #endif /* !WIN32 */ - diff --git a/common/unix.h b/common/unix.h index dd974ba79..c78d05cb2 100644 --- a/common/unix.h +++ b/common/unix.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 _WINDOWS #ifndef __UNIX_H__ @@ -32,3 +32,4 @@ char* strlwr(char* tmp); #endif #endif #endif + diff --git a/common/useperl.h b/common/useperl.h index b20863c42..3c0bf8f1c 100644 --- a/common/useperl.h +++ b/common/useperl.h @@ -3,7 +3,7 @@ //headers from the Perl distribution -#include +#include #define WIN32IO_IS_STDIO #ifndef WIN32 @@ -17,11 +17,11 @@ extern "C" { //the perl headers dont do this for us... #ifdef WIN32 #ifndef snprintf -#define snprintf _snprintf +#define snprintf _snprintf #endif #endif -//perl defines these macros and dosent clean them up, lazy bastards. -- I hate them too! +//perl defines these macros and dosent clean them up, lazy bastards. -- I hate them too! #ifdef Copy #undef Copy #endif @@ -42,9 +42,10 @@ extern "C" { //the perl headers dont do this for us... #undef Zero #endif -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS +#ifdef THIS /* this macro seems to leak out on some systems */ +#undef THIS #endif #endif /*EMU_PERL_H_*/ + diff --git a/common/version.h b/common/version.h index 531064665..432d8157f 100644 --- a/common/version.h +++ b/common/version.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 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 + 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. + 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 + 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_VERSION_H diff --git a/common/worldconn.cpp b/common/worldconn.cpp index ef3922bf7..d6f6cccb3 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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/debug.h" @@ -52,7 +52,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) { void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); _log(NET__WORLD, "Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); - + ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); SendPacket(pack); @@ -61,7 +61,7 @@ void WorldConnection::OnConnected() { void WorldConnection::Process() { _CP(WorldConnection_Process); - + //persistent connection.... if (!Connected()) { pConnected = tcpc.Connected(); @@ -71,14 +71,14 @@ void WorldConnection::Process() { else return; } - + } void WorldConnection::AsyncConnect() { const EQEmuConfig *Config=EQEmuConfig::get(); tcpc.AsyncConnect(Config->WorldIP.c_str(), Config->WorldTCPPort); } - + bool WorldConnection::Connect() { const EQEmuConfig *Config=EQEmuConfig::get(); char errbuf[TCPConnection_ErrorBufferSize]; @@ -94,8 +94,3 @@ void WorldConnection::Disconnect() { tcpc.Disconnect(); } - - - - - diff --git a/common/worldconn.h b/common/worldconn.h index 3821d3c9a..08ceafb37 100644 --- a/common/worldconn.h +++ b/common/worldconn.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 WORLDCONNECTION_H @@ -30,24 +30,24 @@ class ServerPacket; class WorldConnection { public: WorldConnection(EmuTCPConnection::ePacketMode mode, const char *password = ""); - virtual ~WorldConnection(); + virtual ~WorldConnection(); virtual void Process(); bool SendPacket(ServerPacket* pack); - + uint32 GetIP() const { return tcpc.GetrIP(); } uint16 GetPort() const { return tcpc.GetrPort(); } bool Connected() const { return (pConnected && tcpc.Connected()); } - + void SetPassword(const char *password) { m_password = password; } bool Connect(); void AsyncConnect(); void Disconnect(); inline bool TryReconnect() const { return pTryReconnect; } - + protected: virtual void OnConnected(); - + std::string m_password; EmuTCPConnection tcpc; bool pTryReconnect; diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt index 14257fef9..6097279d2 100644 --- a/eqlaunch/CMakeLists.txt +++ b/eqlaunch/CMakeLists.txt @@ -1,14 +1,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(eqlaunch_sources - eqlaunch.cpp - worldserver.cpp - ZoneLaunch.cpp + eqlaunch.cpp + worldserver.cpp + ZoneLaunch.cpp ) SET(eqlaunch_headers - worldserver.h - ZoneLaunch.h + worldserver.h + ZoneLaunch.h ) ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers}) @@ -16,22 +16,24 @@ ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers}) TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) - - SET_TARGET_PROPERTIES(eqlaunch PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(eqlaunch "Ws2_32.lib") + + SET_TARGET_PROPERTIES(eqlaunch PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + TARGET_LINK_LIBRARIES(eqlaunch "Ws2_32.lib") ENDIF(MSVC) IF(MINGW) - TARGET_LINK_LIBRARIES(eqlaunch "WS2_32") + TARGET_LINK_LIBRARIES(eqlaunch "WS2_32") ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(eqlaunch "dl") - TARGET_LINK_LIBRARIES(eqlaunch "z") - TARGET_LINK_LIBRARIES(eqlaunch "m") - TARGET_LINK_LIBRARIES(eqlaunch "rt") - TARGET_LINK_LIBRARIES(eqlaunch "pthread") - ADD_DEFINITIONS(-fPIC) + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(eqlaunch "dl") + ENDIF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(eqlaunch "z") + TARGET_LINK_LIBRARIES(eqlaunch "m") + TARGET_LINK_LIBRARIES(eqlaunch "rt") + TARGET_LINK_LIBRARIES(eqlaunch "pthread") + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/eqlaunch/ZoneLaunch.cpp b/eqlaunch/ZoneLaunch.cpp index 6b038d8bf..e1332fdce 100644 --- a/eqlaunch/ZoneLaunch.cpp +++ b/eqlaunch/ZoneLaunch.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 */ @@ -33,17 +33,17 @@ void ZoneLaunch::InitStartTimer() { s_startTimer.Trigger(); } -ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name, - const char *zone_name, const EQEmuConfig *config) +ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name, +const char *zone_name, const EQEmuConfig *config) : m_state(StateStartPending), - m_world(world), - m_zone(zone_name), - m_launcherName(launcher_name), - m_config(config), - m_timer(config->RestartWait), - m_ref(ProcLauncher::ProcError), - m_startCount(0), - m_killFails(0) + m_world(world), + m_zone(zone_name), + m_launcherName(launcher_name), + m_config(config), + m_timer(config->RestartWait), + m_ref(ProcLauncher::ProcError), + m_startCount(0), + m_killFails(0) { //trigger the startup timer initially so it boots the first time. m_timer.Trigger(); @@ -68,7 +68,7 @@ void ZoneLaunch::Start() { spec->args.push_back(m_launcherName); spec->handler = this; spec->logFile = m_config->LogPrefix + m_zone + m_config->LogSuffix; - + //spec is consumed, even on failure m_ref = ProcLauncher::get()->Launch(spec); if(m_ref == ProcLauncher::ProcError) { @@ -76,14 +76,14 @@ void ZoneLaunch::Start() { m_timer.Start(m_config->RestartWait); return; } - + m_startCount++; m_state = StateStarted; s_running++; m_killFails = 0; - + SendStatus(); - + _log(LAUNCHER__STATUS, "Zone %s has been started.", m_zone.c_str()); } @@ -158,15 +158,15 @@ bool ZoneLaunch::Process() { //we have to wait on the shared timer now.. break; } - + //ok, both timers say we can start. //disable our internal timer, will get started again if it is needed. m_timer.Disable(); - + //actually start up the program _log(LAUNCHER__STATUS, "Starting zone %s", m_zone.c_str()); Start(); - + //now update the shared timer to reflect the proper start interval. if(s_running == 1) { //we are the first zone started. wait that interval. @@ -177,7 +177,7 @@ bool ZoneLaunch::Process() { _log(LAUNCHER__STATUS, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); s_startTimer.Start(m_config->ZoneBootInterval); } - + } //else, timer still ticking, keep waiting break; case StateStarted: @@ -218,7 +218,7 @@ bool ZoneLaunch::Process() { //called when the process actually dies off... void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLauncher::Spec *spec) { s_running--; - + switch(m_state) { case StateStartPending: _log(LAUNCHER__STATUS, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); @@ -246,42 +246,7 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche _log(LAUNCHER__STATUS, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); break; } - + SendStatus(); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eqlaunch/ZoneLaunch.h b/eqlaunch/ZoneLaunch.h index 9c68e7e5f..2694e5bd5 100644 --- a/eqlaunch/ZoneLaunch.h +++ b/eqlaunch/ZoneLaunch.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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 ZONELAUNCH_H_ #define ZONELAUNCH_H_ @@ -30,27 +30,27 @@ public: ZoneLaunch(WorldServer *world, const char *launcher_name, const char *zone_name, const EQEmuConfig *config); virtual ~ZoneLaunch(); - + void Stop(bool graceful = true); void Restart(); - + bool Process(); - + void SendStatus() const; - + const char *GetZone() const { return(m_zone.c_str()); } uint32 GetStartCount() const { return(m_startCount); } - + //should only be called during process init to setup the start timer. static void InitStartTimer(); - + protected: bool IsRunning() const { return(m_state == StateStarted || m_state == StateStopPending || m_state == StateRestartPending); } - + void Start(); - + void OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLauncher::Spec *spec); - + enum { StateStartPending, StateStarted, @@ -58,30 +58,21 @@ protected: StateStopPending, StateStopped } m_state; - + WorldServer *const m_world; const std::string m_zone; const char *const m_launcherName; const EQEmuConfig *const m_config; - + Timer m_timer; ProcLauncher::ProcRef m_ref; uint32 m_startCount; - + uint32 m_killFails; - + private: static int s_running; static Timer s_startTimer; }; - - - - - - - - - #endif /*ZONELAUNCH_H_*/ diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 06ccd718b..121fc1b55 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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/debug.h" @@ -37,8 +37,8 @@ bool RunLoops = false; void CatchSignal(int sig_num); int main(int argc, char *argv[]) { - RegisterExecutablePlatform(ExePlatformLaunch); - set_exception_handler(); + RegisterExecutablePlatform(ExePlatformLaunch); + set_exception_handler(); string launcher_name; if(argc == 2) { @@ -48,17 +48,17 @@ int main(int argc, char *argv[]) { _log(LAUNCHER__ERROR, "You must specfify a launcher name as the first argument to this program."); return(1); } - + _log(LAUNCHER__INIT, "Loading server configuration.."); if (!EQEmuConfig::LoadConfig()) { _log(LAUNCHER__ERROR, "Loading server configuration failed."); return(1); } const EQEmuConfig *Config = EQEmuConfig::get(); - + /* - * Setup nice signal handlers - */ + * Setup nice signal handlers + */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { _log(LAUNCHER__ERROR, "Could not set signal handler"); return 1; @@ -72,10 +72,10 @@ int main(int argc, char *argv[]) { _log(LAUNCHER__ERROR, "Could not set signal handler"); return 1; } - + /* - * Add '.' to LD_LIBRARY_PATH - */ + * Add '.' to LD_LIBRARY_PATH + */ //the storage passed to putenv must remain valid... crazy unix people const char *pv = getenv("LD_LIBRARY_PATH"); if(pv == nullptr) { @@ -86,51 +86,51 @@ int main(int argc, char *argv[]) { putenv(v); } #endif - + map zones; WorldServer world(zones, launcher_name.c_str(), Config); if (!world.Connect()) { _log(LAUNCHER__ERROR, "worldserver.Connect() FAILED! Will retry."); } - + map::iterator zone, zend; set to_remove; - + Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - + _log(LAUNCHER__INIT, "Starting main loop..."); - + // zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1"); - + ProcLauncher *launch = ProcLauncher::get(); RunLoops = true; while(RunLoops) { //Advance the timer to our current point in time Timer::SetCurrentTime(); - + /* - * Process the world connection - */ + * Process the world connection + */ world.Process(); - + /* - * Let the process manager look for dead children - */ + * Let the process manager look for dead children + */ launch->Process(); - + /* - * Give all zones a chance to process. - */ + * Give all zones a chance to process. + */ zone = zones.begin(); zend = zones.end(); for(; zone != zend; zone++) { if(!zone->second->Process()) to_remove.insert(zone->first); } - + /* - * Kill off any zones which have stopped - */ + * Kill off any zones which have stopped + */ while(!to_remove.empty()) { string rem = *to_remove.begin(); to_remove.erase(rem); @@ -142,22 +142,22 @@ int main(int argc, char *argv[]) { delete zone->second; zones.erase(rem); } - - + + if (InterserverTimer.Check()) { if (world.TryReconnect() && (!world.Connected())) world.AsyncConnect(); } - + /* - * Take a nice nap until next cycle - */ + * Take a nice nap until next cycle + */ if(zones.empty()) Sleep(5000); else Sleep(2000); } - + //try to be semi-nice about this... without waiting too long zone = zones.begin(); zend = zones.end(); @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) { for(; zone != zend; zone++) { delete zone->second; } - + return(0); } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 1f314bd8f..d97b5877f 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 + 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 + 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/debug.h" #include "worldserver.h" @@ -24,9 +24,9 @@ WorldServer::WorldServer(map &zones, const char *name, const EQEmuConfig *config) : WorldConnection(EmuTCPConnection::packetModeLauncher, config->SharedKey.c_str()), - m_name(name), - m_config(config), - m_zones(zones) + m_name(name), + m_config(config), + m_zones(zones) { } @@ -35,7 +35,7 @@ WorldServer::~WorldServer() { void WorldServer::OnConnected() { WorldConnection::OnConnected(); - + ServerPacket* pack = new ServerPacket(ServerOP_LauncherConnectInfo, sizeof(LauncherConnectInfo)); LauncherConnectInfo* sci = (LauncherConnectInfo*) pack->pBuffer; strn0cpy(sci->name, m_name, sizeof(sci->name)); @@ -43,7 +43,7 @@ void WorldServer::OnConnected() { // strcpy(sci->address, net.GetZoneAddress()); SendPacket(pack); safe_delete(pack); - + //send status for all zones... std::map::iterator cur, end; cur = m_zones.begin(); @@ -54,9 +54,9 @@ void WorldServer::OnConnected() { } void WorldServer::Process() { - + WorldConnection::Process(); - + if (!Connected()) return; @@ -83,8 +83,8 @@ void WorldServer::Process() { break; } const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer; - - + + switch(ZoneRequestCommands(lzr->command)) { case ZR_Start: { if(m_zones.find(lzr->short_name) != m_zones.end()) { @@ -123,7 +123,7 @@ void WorldServer::Process() { //ignore this, world is still being dumb break; } - + default: { _log(LAUNCHER__NET, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); break; @@ -138,11 +138,11 @@ void WorldServer::Process() { void WorldServer::SendStatus(const char *short_name, uint32 start_count, bool running) { ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneStatus, sizeof(LauncherZoneStatus)); LauncherZoneStatus* it =(LauncherZoneStatus*) pack->pBuffer; - + strn0cpy(it->short_name, short_name, 32); it->start_count = start_count; it->running = running?1:0; - + SendPacket(pack); safe_delete(pack); } diff --git a/eqlaunch/worldserver.h b/eqlaunch/worldserver.h index b6d6314ad..ee74c3916 100644 --- a/eqlaunch/worldserver.h +++ b/eqlaunch/worldserver.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) +/* 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 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 + 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. + 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 + 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 WORLDSERVER_H #define WORLDSERVER_H @@ -29,15 +29,15 @@ class EQEmuConfig; class WorldServer : public WorldConnection { public: WorldServer(std::map &zones, const char *name, const EQEmuConfig *config); - virtual ~WorldServer(); + virtual ~WorldServer(); virtual void Process(); - + void SendStatus(const char *short_name, uint32 start_count, bool running); - + private: virtual void OnConnected(); - + const char *const m_name; const EQEmuConfig *const m_config; std::map &m_zones; diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index 5ded6a0c7..fd13b8041 100644 --- a/loginserver/CMakeLists.txt +++ b/loginserver/CMakeLists.txt @@ -1,41 +1,41 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(eqlogin_sources - Client.cpp - ClientManager.cpp - Config.cpp - DatabaseMySQL.cpp - DatabasePostgreSQL.cpp - ErrorLog.cpp - Main.cpp - ServerManager.cpp - WorldServer.cpp + Client.cpp + ClientManager.cpp + Config.cpp + DatabaseMySQL.cpp + DatabasePostgreSQL.cpp + ErrorLog.cpp + Main.cpp + ServerManager.cpp + WorldServer.cpp ) IF(MSVC OR MINGW) - SET(eqlogin_sources ${eqlogin_sources} Encryption.cpp) + SET(eqlogin_sources ${eqlogin_sources} Encryption.cpp) ENDIF(MSVC OR MINGW) SET(eqlogin_headers - Client.h - ClientManager.h - Config.h - Database.h - DatabaseMySQL.h - DatabasePostgreSQL.h - Encryption.h - EQCryptoAPI.h - ErrorLog.h - LoginServer.h - LoginStructures.h - Options.h - ServerManager.h - WorldServer.h + Client.h + ClientManager.h + Config.h + Database.h + DatabaseMySQL.h + DatabasePostgreSQL.h + Encryption.h + EQCryptoAPI.h + ErrorLog.h + LoginServer.h + LoginStructures.h + Options.h + ServerManager.h + WorldServer.h ) IF(UNIX) - SET(EQEMU_UNIX_ENC_LIBRARY_LOC "${CMAKE_SOURCE_DIR}/dependencies" CACHE PATH "Location of EQEmuAuthCrypto and cryptopp") - LINK_DIRECTORIES(${EQEMU_UNIX_ENC_LIBRARY_LOC}) + SET(EQEMU_UNIX_ENC_LIBRARY_LOC "${CMAKE_SOURCE_DIR}/dependencies" CACHE PATH "Location of EQEmuAuthCrypto and cryptopp") + LINK_DIRECTORIES(${EQEMU_UNIX_ENC_LIBRARY_LOC}) ENDIF(UNIX) ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers}) @@ -43,24 +43,26 @@ ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers}) TARGET_LINK_LIBRARIES(loginserver Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) IF(MSVC) - - SET_TARGET_PROPERTIES(loginserver PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(loginserver "Ws2_32.lib") + + SET_TARGET_PROPERTIES(loginserver PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + TARGET_LINK_LIBRARIES(loginserver "Ws2_32.lib") ENDIF(MSVC) IF(MINGW) - TARGET_LINK_LIBRARIES(loginserver "WS2_32") + TARGET_LINK_LIBRARIES(loginserver "WS2_32") ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(loginserver "dl") - TARGET_LINK_LIBRARIES(loginserver "z") - TARGET_LINK_LIBRARIES(loginserver "m") - TARGET_LINK_LIBRARIES(loginserver "rt") - TARGET_LINK_LIBRARIES(loginserver "pthread") - TARGET_LINK_LIBRARIES(loginserver "EQEmuAuthCrypto") - TARGET_LINK_LIBRARIES(loginserver "cryptopp") - ADD_DEFINITIONS(-fPIC) + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(loginserver "dl") + ENDIF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(loginserver "z") + TARGET_LINK_LIBRARIES(loginserver "m") + TARGET_LINK_LIBRARIES(loginserver "rt") + TARGET_LINK_LIBRARIES(loginserver "pthread") + TARGET_LINK_LIBRARIES(loginserver "EQEmuAuthCrypto") + TARGET_LINK_LIBRARIES(loginserver "cryptopp") + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/loginserver/Client.cpp b/loginserver/Client.cpp index a487849e1..9fd96118a 100644 --- a/loginserver/Client.cpp +++ b/loginserver/Client.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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 "Client.h" #include "ErrorLog.h" @@ -137,8 +137,8 @@ void Client::Handle_SessionReady(const char* data, unsigned int size) status = cs_waiting_for_login; /** - * The packets are mostly the same but slightly different between the two versions. - */ + * The packets are mostly the same but slightly different between the two versions. + */ if(version == cv_sod) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChatMessage, 17); @@ -197,7 +197,7 @@ void Client::Handle_Login(const char* data, unsigned int size) #ifdef WIN32 e_buffer = server.eq_crypto->DecryptUsernamePassword(data, size, server.options.GetEncryptionMode()); - + int buffer_len = strlen(e_buffer); e_hash.assign(e_buffer, buffer_len); e_user.assign((e_buffer + buffer_len + 1), strlen(e_buffer + buffer_len + 1)); @@ -353,7 +353,7 @@ void Client::Handle_Play(const char* data) void Client::SendServerListPacket() { EQApplicationPacket *outapp = server.SM->CreateServerListPacket(this); - + if(server.options.IsDumpOutPacketsOn()) { DumpPacket(outapp); @@ -380,12 +380,12 @@ void Client::GenerateKey() int count = 0; while(count < 10) { - static const char key_selection[] = + static const char key_selection[] = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', - 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', - 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', - 'Y', 'Z', '0', '1', '2', '3', '4', '5', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; diff --git a/loginserver/Client.h b/loginserver/Client.h index 7ca7cf9a2..1cb248344 100644 --- a/loginserver/Client.h +++ b/loginserver/Client.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_CLIENT_H #define EQEMU_CLIENT_H @@ -49,85 +49,85 @@ enum LoginMode }; /** - * Client class, controls a single client and it's - * connection to the login server. - */ +* Client class, controls a single client and it's +* connection to the login server. +*/ class Client { public: /** - * Constructor, sets our connection to c and version to v - */ + * Constructor, sets our connection to c and version to v + */ Client(EQStream *c, ClientVersion v); /** - * Destructor. - */ + * Destructor. + */ ~Client() { } /** - * Processes the client's connection and does various actions. - */ + * Processes the client's connection and does various actions. + */ bool Process(); /** - * Sends our reply to session ready packet. - */ + * Sends our reply to session ready packet. + */ void Handle_SessionReady(const char* data, unsigned int size); /** - * Verifies login and send a reply. - */ + * Verifies login and send a reply. + */ void Handle_Login(const char* data, unsigned int size); /** - * Sends a packet to the requested server to see if the client is allowed or not. - */ + * Sends a packet to the requested server to see if the client is allowed or not. + */ void Handle_Play(const char* data); /** - * Sends a server list packet to the client. - */ + * Sends a server list packet to the client. + */ void SendServerListPacket(); /** - * Sends the input packet to the client and clears our play response states. - */ + * Sends the input packet to the client and clears our play response states. + */ void SendPlayResponse(EQApplicationPacket *outapp); /** - * Generates a random login key for the client during login. - */ + * Generates a random login key for the client during login. + */ void GenerateKey(); /** - * Gets the account id of this client. - */ + * Gets the account id of this client. + */ unsigned int GetAccountID() const { return account_id; } /** - * Gets the account name of this client. - */ + * Gets the account name of this client. + */ string GetAccountName() const { return account_name; } /** - * Gets the key generated at login for this client. - */ + * Gets the key generated at login for this client. + */ string GetKey() const { return key; } /** - * Gets the server selected to be played on for this client. - */ + * Gets the server selected to be played on for this client. + */ unsigned int GetPlayServerID() const { return play_server_id; } /** - * Gets the play sequence state for this client. - */ + * Gets the play sequence state for this client. + */ unsigned int GetPlaySequence() const { return play_sequence_id; } /** - * Gets the connection for this client. - */ + * Gets the connection for this client. + */ EQStream *GetConnection() { return connection; } private: EQStream *connection; diff --git a/loginserver/ClientManager.cpp b/loginserver/ClientManager.cpp index 73791ef6b..06b44aaf4 100644 --- a/loginserver/ClientManager.cpp +++ b/loginserver/ClientManager.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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 "ClientManager.h" #include "ErrorLog.h" @@ -30,7 +30,7 @@ ClientManager::ClientManager() titanium_ops = new RegularOpcodeManager; if(!titanium_ops->LoadOpcodes(server.config->GetVariable("Titanium", "opcodes").c_str())) { - server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.", + server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.", server.config->GetVariable("Titanium", "opcodes").c_str()); run_server = false; } @@ -50,7 +50,7 @@ ClientManager::ClientManager() sod_ops = new RegularOpcodeManager; if(!sod_ops->LoadOpcodes(server.config->GetVariable("SoD", "opcodes").c_str())) { - server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.", + server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.", server.config->GetVariable("SoD", "opcodes").c_str()); run_server = false; } diff --git a/loginserver/ClientManager.h b/loginserver/ClientManager.h index 4b279c116..287a9212d 100644 --- a/loginserver/ClientManager.h +++ b/loginserver/ClientManager.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_CLIENTMANAGER_H #define EQEMU_CLIENTMANAGER_H @@ -28,45 +28,45 @@ using namespace std; /** - * Client manager class, holds all the client objects and does basic processing. - */ +* Client manager class, holds all the client objects and does basic processing. +*/ class ClientManager { public: /** - * Constructor, sets up the stream factories and opcode managers. - */ + * Constructor, sets up the stream factories and opcode managers. + */ ClientManager(); /** - * Destructor, shuts down the streams and opcode managers. - */ + * Destructor, shuts down the streams and opcode managers. + */ ~ClientManager(); /** - * Processes every client in the internal list, removes them if necessary. - */ + * Processes every client in the internal list, removes them if necessary. + */ void Process(); /** - * Sends a new server list to every client. - */ + * Sends a new server list to every client. + */ void UpdateServerList(); /** - * Removes a client with a certain account id. - */ + * Removes a client with a certain account id. + */ void RemoveExistingClient(unsigned int account_id); /** - * Gets a client (if exists) by their account id. - */ + * Gets a client (if exists) by their account id. + */ Client *GetClient(unsigned int account_id); private: /** - * Processes disconnected clients, removes them if necessary. - */ + * Processes disconnected clients, removes them if necessary. + */ void ProcessDisconnect(); list clients; diff --git a/loginserver/Config.cpp b/loginserver/Config.cpp index ecf544464..419a668d0 100644 --- a/loginserver/Config.cpp +++ b/loginserver/Config.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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/debug.h" #include "Config.h" @@ -21,10 +21,10 @@ extern ErrorLog *server_log; /** - * Retrieves the variable we want from our title or theme - * First gets the map from the title - * Then gets the argument from the map we got from title - */ +* Retrieves the variable we want from our title or theme +* First gets the map from the title +* Then gets the argument from the map we got from title +*/ string Config::GetVariable(string title, string parameter) { map >::iterator iter = vars.find(title); @@ -41,9 +41,9 @@ string Config::GetVariable(string title, string parameter) } /** - * Opens a file and passes it to the tokenizer - * Then it parses the tokens returned and puts them into titles and variables. - */ +* Opens a file and passes it to the tokenizer +* Then it parses the tokens returned and puts them into titles and variables. +*/ void Config::Parse(const char *file_name) { if(file_name == nullptr) @@ -138,15 +138,15 @@ void Config::Parse(const char *file_name) } /** - * Pretty basic lexical analyzer - * Breaks up the input character stream into tokens and puts them into the list provided. - * Ignores # as a line comment - */ +* Pretty basic lexical analyzer +* Breaks up the input character stream into tokens and puts them into the list provided. +* Ignores # as a line comment +*/ void Config::Tokenize(FILE *input, list &tokens) { char c = fgetc(input); string lexeme; - + while(c != EOF) { if(isspace(c)) diff --git a/loginserver/Config.h b/loginserver/Config.h index 37ce9902a..e00f8447d 100644 --- a/loginserver/Config.h +++ b/loginserver/Config.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_CONFIG_H #define EQEMU_CONFIG_H @@ -37,13 +37,13 @@ public: ~Config() { } /** - * Parses the selected file for variables, will clear current variables if selected. - */ + * Parses the selected file for variables, will clear current variables if selected. + */ virtual void Parse(const char *file_name); - + /** - * Gets a variable if it exists. - */ + * Gets a variable if it exists. + */ string GetVariable(string title, string parameter); protected: @@ -51,11 +51,11 @@ protected: private: /** - * Breaks our input up into tokens for Parse(). - * This is private because it's not intended to be overloaded by a derived class which - * may get it's input from other places than a C file pointer. (a http get request for example). - * The programmer of a derived class would be expected to make their own Tokenize function for their own Parse(). - */ + * Breaks our input up into tokens for Parse(). + * This is private because it's not intended to be overloaded by a derived class which + * may get it's input from other places than a C file pointer. (a http get request for example). + * The programmer of a derived class would be expected to make their own Tokenize function for their own Parse(). + */ void Tokenize(FILE* input, list &tokens); }; diff --git a/loginserver/Database.h b/loginserver/Database.h index 08bc3b70d..318d15793 100644 --- a/loginserver/Database.h +++ b/loginserver/Database.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_DATABASE_H #define EQEMU_DATABASE_H @@ -26,8 +26,8 @@ using namespace std; //#define EQEMU_POSTGRESQL_ENABLED /** - * Base database class, intended to be extended. - */ +* Base database class, intended to be extended. +*/ class Database { public: @@ -35,43 +35,43 @@ public: virtual ~Database() { } /** - * Returns true if the database successfully connected. - */ + * Returns true if the database successfully connected. + */ virtual bool IsConnected() { return false; } /** - * Retrieves the login data (password hash and account id) from the account name provided - * Needed for client login procedure. - * Returns true if the record was found, false otherwise. - */ + * Retrieves the login data (password hash and account id) from the account name provided + * Needed for client login procedure. + * Returns true if the record was found, false otherwise. + */ virtual bool GetLoginDataFromAccountName(string name, string &password, unsigned int &id) { return false; } /** - * Retrieves the world registration from the long and short names provided. - * Needed for world login procedure. - * Returns true if the record was found, false otherwise. - */ - virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, + * Retrieves the world registration from the long and short names provided. + * Needed for world login procedure. + * Returns true if the record was found, false otherwise. + */ + virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password) { return false; } /** - * Updates the ip address of the client with account id = id - */ + * Updates the ip address of the client with account id = id + */ virtual void UpdateLSAccountData(unsigned int id, string ip_address) { } /** - * Updates or creates the login server account with info from world server - */ + * Updates or creates the login server account with info from world server + */ virtual void UpdateLSAccountInfo(unsigned int id, string name, string password, string email) { } /** - * Updates the ip address of the world with account id = id - */ + * Updates the ip address of the world with account id = id + */ virtual void UpdateWorldRegistration(unsigned int id, string long_name, string ip_address) { } /** - * Creates new world registration for unregistered servers and returns new id - */ + * Creates new world registration for unregistered servers and returns new id + */ virtual bool CreateWorldRegistration(string long_name, string short_name, unsigned int &id) { return false; } protected: string user, pass, host, port, name; diff --git a/loginserver/DatabaseMySQL.cpp b/loginserver/DatabaseMySQL.cpp index df1577f3d..780fbac17 100644 --- a/loginserver/DatabaseMySQL.cpp +++ b/loginserver/DatabaseMySQL.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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/debug.h" #include "Database.h" @@ -40,7 +40,7 @@ DatabaseMySQL::DatabaseMySQL(string user, string pass, string host, string port, { my_bool r = 1; mysql_options(db, MYSQL_OPT_RECONNECT, &r); - if(!mysql_real_connect(db, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0)) + if(!mysql_real_connect(db, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0)) { mysql_close(db); server_log->Log(log_database, "Failed to connect to MySQL database."); @@ -73,7 +73,7 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u query << "SELECT LoginServerID, AccountPassword FROM " << server.options.GetAccountTable() << " WHERE AccountName = '"; query << name; query << "'"; - + if(mysql_query(db, query.str().c_str()) != 0) { server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str()); @@ -97,7 +97,7 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u return false; } -bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, +bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password) { if(!db) @@ -118,7 +118,7 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un query << " WHERE WSR.ServerShortName = '"; query << escaped_short_name; query << "'"; - + if(mysql_query(db, query.str().c_str()) != 0) { server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str()); @@ -155,7 +155,7 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un { if((row = mysql_fetch_row(res)) != nullptr) { - account = row[0]; + account = row[0]; password = row[1]; mysql_free_result(res); return true; diff --git a/loginserver/DatabaseMySQL.h b/loginserver/DatabaseMySQL.h index 87aa2c45b..21e3f10c4 100644 --- a/loginserver/DatabaseMySQL.h +++ b/loginserver/DatabaseMySQL.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_DATABASEMYSQL_H #define EQEMU_DATABASEMYSQL_H @@ -29,64 +29,64 @@ using namespace std; /** - * Mysql Database class - */ +* Mysql Database class +*/ class DatabaseMySQL : public Database { public: /** - * Constructor, sets our database to null. - */ + * Constructor, sets our database to null. + */ DatabaseMySQL() { db = nullptr; } /** - * Constructor, tries to set our database to connect to the supplied options. - */ + * Constructor, tries to set our database to connect to the supplied options. + */ DatabaseMySQL(string user, string pass, string host, string port, string name); /** - * Destructor, frees our database if needed. - */ + * Destructor, frees our database if needed. + */ virtual ~DatabaseMySQL(); /** - * @return Returns true if the database successfully connected. - */ + * @return Returns true if the database successfully connected. + */ virtual bool IsConnected() { return (db != nullptr); } /** - * Retrieves the login data (password hash and account id) from the account name provided - * Needed for client login procedure. - * Returns true if the record was found, false otherwise. - */ + * Retrieves the login data (password hash and account id) from the account name provided + * Needed for client login procedure. + * Returns true if the record was found, false otherwise. + */ virtual bool GetLoginDataFromAccountName(string name, string &password, unsigned int &id); /** - * Retrieves the world registration from the long and short names provided. - * Needed for world login procedure. - * Returns true if the record was found, false otherwise. - */ - virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, + * Retrieves the world registration from the long and short names provided. + * Needed for world login procedure. + * Returns true if the record was found, false otherwise. + */ + virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password); /** - * Updates the ip address of the client with account id = id - */ + * Updates the ip address of the client with account id = id + */ virtual void UpdateLSAccountData(unsigned int id, string ip_address); /** - * Updates or creates the login server account with info from world server - */ + * Updates or creates the login server account with info from world server + */ virtual void UpdateLSAccountInfo(unsigned int id, string name, string password, string email); /** - * Updates the ip address of the world with account id = id - */ + * Updates the ip address of the world with account id = id + */ virtual void UpdateWorldRegistration(unsigned int id, string long_name, string ip_address); /** - * Creates new world registration for unregistered servers and returns new id - */ + * Creates new world registration for unregistered servers and returns new id + */ virtual bool CreateWorldRegistration(string long_name, string short_name, unsigned int &id); protected: string user, pass, host, port, name; diff --git a/loginserver/DatabasePostgreSQL.cpp b/loginserver/DatabasePostgreSQL.cpp index fd23ff347..9effac49b 100644 --- a/loginserver/DatabasePostgreSQL.cpp +++ b/loginserver/DatabasePostgreSQL.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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/debug.h" #include "Database.h" @@ -61,9 +61,9 @@ bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &passwo } /** - * PostgreSQL doesn't have automatic reconnection option like mysql - * but it's easy to check and reconnect - */ + * PostgreSQL doesn't have automatic reconnection option like mysql + * but it's easy to check and reconnect + */ if(PQstatus(db) != CONNECTION_OK) { PQreset(db); @@ -100,7 +100,7 @@ bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &passwo return false; } -bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, +bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password) { if(!db) @@ -109,9 +109,9 @@ bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_nam } /** - * PostgreSQL doesn't have automatic reconnection option like mysql - * but it's easy to check and reconnect - */ + * PostgreSQL doesn't have automatic reconnection option like mysql + * but it's easy to check and reconnect + */ if(PQstatus(db) != CONNECTION_OK) { PQreset(db); @@ -147,7 +147,7 @@ bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_nam trusted = atoi(PQgetvalue(res, 0, 2)); list_id = atoi(PQgetvalue(res, 0, 3)); list_desc = PQgetvalue(res, 0, 4); - account = PQgetvalue(res, 0, 5); + account = PQgetvalue(res, 0, 5); password = PQgetvalue(res, 0, 6); PQclear(res); @@ -166,9 +166,9 @@ void DatabasePostgreSQL::UpdateLSAccountData(unsigned int id, string ip_address) } /** - * PostgreSQL doesn't have automatic reconnection option like mysql - * but it's easy to check and reconnect - */ + * PostgreSQL doesn't have automatic reconnection option like mysql + * but it's easy to check and reconnect + */ if(PQstatus(db) != CONNECTION_OK) { PQreset(db); @@ -201,9 +201,9 @@ void DatabasePostgreSQL::UpdateWorldRegistration(unsigned int id, string long_na } /** - * PostgreSQL doesn't have automatic reconnection option like mysql - * but it's easy to check and reconnect - */ + * PostgreSQL doesn't have automatic reconnection option like mysql + * but it's easy to check and reconnect + */ if(PQstatus(db) != CONNECTION_OK) { PQreset(db); diff --git a/loginserver/DatabasePostgreSQL.h b/loginserver/DatabasePostgreSQL.h index 28922f403..8d2685fcc 100644 --- a/loginserver/DatabasePostgreSQL.h +++ b/loginserver/DatabasePostgreSQL.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_DATABASEPOSTGRESQL_H #define EQEMU_DATABASEPOSTGRESQL_H @@ -35,53 +35,53 @@ class DatabasePostgreSQL : public Database { public: /** - * Constructor, sets our database to null. - */ + * Constructor, sets our database to null. + */ DatabasePostgreSQL() { db = nullptr; } /** - * Constructor, tries to set our database to connect to the supplied options. - */ + * Constructor, tries to set our database to connect to the supplied options. + */ DatabasePostgreSQL(string user, string pass, string host, string port, string name); /** - * Destructor, frees our database if needed. - */ + * Destructor, frees our database if needed. + */ virtual ~DatabasePostgreSQL(); /** - * Returns true if the database successfully connected. - */ + * Returns true if the database successfully connected. + */ virtual bool IsConnected() { return (db != nullptr); } /** - * Retrieves the login data (password hash and account id) from the account name provided - * Needed for client login procedure. - * Returns true if the record was found, false otherwise. - */ + * Retrieves the login data (password hash and account id) from the account name provided + * Needed for client login procedure. + * Returns true if the record was found, false otherwise. + */ virtual bool GetLoginDataFromAccountName(string name, string &password, unsigned int &id); /** - * Retrieves the world registration from the long and short names provided. - * Needed for world login procedure. - * Returns true if the record was found, false otherwise. - */ - virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, + * Retrieves the world registration from the long and short names provided. + * Needed for world login procedure. + * Returns true if the record was found, false otherwise. + */ + virtual bool GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id, unsigned int &trusted, string &list_desc, string &account, string &password); /** - * Updates the ip address of the client with account id = id - */ + * Updates the ip address of the client with account id = id + */ virtual void UpdateLSAccountData(unsigned int id, string ip_address); /** - * Updates the ip address of the world with account id = id - */ + * Updates the ip address of the world with account id = id + */ virtual void UpdateWorldRegistration(unsigned int id, string long_name, string ip_address); /** - * Creates new world registration for unregistered servers and returns new id - */ + * Creates new world registration for unregistered servers and returns new id + */ virtual bool CreateWorldRegistration(string long_name, string short_name, unsigned int &id); protected: string user, pass, host, port, name; diff --git a/loginserver/EQCryptoAPI.h b/loginserver/EQCryptoAPI.h index b0a890193..d722bcb53 100644 --- a/loginserver/EQCryptoAPI.h +++ b/loginserver/EQCryptoAPI.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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 EQEMUCAPI__H #define EQEMUCAPI__H @@ -23,3 +23,4 @@ char* Encrypt(const char* buffer, unsigned int bufferSize, unsigned int &outSize void _HeapDeleteCharBuffer(char *buffer); #endif + diff --git a/loginserver/Encryption.cpp b/loginserver/Encryption.cpp index 0a7986fc0..129ab18e3 100644 --- a/loginserver/Encryption.cpp +++ b/loginserver/Encryption.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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/debug.h" #include "Encryption.h" @@ -96,15 +96,15 @@ bool Encryption::Load(const char *name) h_dll = LoadLibrary(name); #endif - if(h_dll == NULL) + if(h_dll == NULL) { return false; } - else - { - SetLastError(0); + else + { + SetLastError(0); } - + return true; } diff --git a/loginserver/Encryption.h b/loginserver/Encryption.h index 10c432794..907b3e325 100644 --- a/loginserver/Encryption.h +++ b/loginserver/Encryption.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_ENCRYPTION_H #define EQEMU_ENCRYPTION_H @@ -29,70 +29,70 @@ typedef char*(*DLLFUNC_Encrypt)(const char*, unsigned int, unsigned int&); typedef void(*DLLFUNC_HeapDelete)(char*); /** - * Basic windows encryption plugin. - * Handles the managment of the plugin. - */ +* Basic windows encryption plugin. +* Handles the managment of the plugin. +*/ class Encryption { public: /** - * Constructor, sets all member pointers to nullptr. - */ + * Constructor, sets all member pointers to nullptr. + */ Encryption() : h_dll(nullptr), encrypt_func(nullptr), decrypt_func(nullptr), delete_func(nullptr) { }; /** - * Destructor, if it's loaded it unloads this library. - */ + * Destructor, if it's loaded it unloads this library. + */ ~Encryption() { if(Loaded()) { Unload(); } } /** - * Returns true if the dll is loaded, otherwise false. - */ + * Returns true if the dll is loaded, otherwise false. + */ inline bool Loaded() { return (h_dll != nullptr); } /** - * Loads the plugin. - * True if there are no errors, false if there was an error. - */ + * Loads the plugin. + * True if there are no errors, false if there was an error. + */ bool LoadCrypto(string name); /** - * Wrapper around the plugin's decrypt function. - */ + * Wrapper around the plugin's decrypt function. + */ char* DecryptUsernamePassword(const char* encryptedBuffer, unsigned int bufferSize, int mode); /** - * Wrapper around the plugin's encrypt function. - */ + * Wrapper around the plugin's encrypt function. + */ char* Encrypt(const char* buffer, unsigned int bufferSize, unsigned int &outSize); /** - * Wrapper around the plugin's delete function. - */ + * Wrapper around the plugin's delete function. + */ void DeleteHeap(char* buffer); private: /** - * Loads the named dll into memory. - * Returns true if there were no errors, otherwise return false. - */ + * Loads the named dll into memory. + * Returns true if there were no errors, otherwise return false. + */ bool Load(const char *name); /** - * Frees the dll from memory if it's loaded. - */ + * Frees the dll from memory if it's loaded. + */ void Unload(); /** - * Similar in function to *sym = GetProcAddress(h_dll, name). - * Returns true if there were no errors, false otherwise. - */ + * Similar in function to *sym = GetProcAddress(h_dll, name). + * Returns true if there were no errors, false otherwise. + */ bool GetSym(const char *name, void **sym); /** - * Similar in function to return GetProcAddress(h_dll, name). - * Returns a pointer to the function if it is found, null on an error. - */ + * Similar in function to return GetProcAddress(h_dll, name). + * Returns a pointer to the function if it is found, null on an error. + */ void *GetSym(const char *name); HINSTANCE h_dll; diff --git a/loginserver/ErrorLog.cpp b/loginserver/ErrorLog.cpp index 9ec6db87a..db5b6c89a 100644 --- a/loginserver/ErrorLog.cpp +++ b/loginserver/ErrorLog.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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 #include "ErrorLog.h" @@ -68,30 +68,30 @@ void ErrorLog::Log(eqLogType type, const char *message, ...) m_time = localtime(&m_clock); log_mutex->lock(); - printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", - eqLogTypes[type], - m_time->tm_mon+1, - m_time->tm_mday, - m_time->tm_year%100, - m_time->tm_hour, - m_time->tm_min, - m_time->tm_sec, + printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", + eqLogTypes[type], + m_time->tm_mon+1, + m_time->tm_mday, + m_time->tm_year%100, + m_time->tm_hour, + m_time->tm_min, + m_time->tm_sec, buffer); if(error_log) { - fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", - eqLogTypes[type], - m_time->tm_mon+1, - m_time->tm_mday, - m_time->tm_year%100, - m_time->tm_hour, - m_time->tm_min, - m_time->tm_sec, + fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", + eqLogTypes[type], + m_time->tm_mon+1, + m_time->tm_mday, + m_time->tm_year%100, + m_time->tm_hour, + m_time->tm_min, + m_time->tm_sec, buffer); fflush(error_log); } - + log_mutex->unlock(); delete[] buffer; } @@ -110,26 +110,26 @@ void ErrorLog::LogPacket(eqLogType type, const char *data, size_t size) m_time = localtime(&m_clock); log_mutex->lock(); - printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u:\n", - eqLogTypes[type], - m_time->tm_mon+1, - m_time->tm_mday, - m_time->tm_year%100, - m_time->tm_hour, - m_time->tm_min, - m_time->tm_sec, + printf("[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u:\n", + eqLogTypes[type], + m_time->tm_mon+1, + m_time->tm_mday, + m_time->tm_year%100, + m_time->tm_hour, + m_time->tm_min, + m_time->tm_sec, (unsigned int)size); if(error_log) { - fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u\n", - eqLogTypes[type], - m_time->tm_mon+1, - m_time->tm_mday, - m_time->tm_year%100, - m_time->tm_hour, - m_time->tm_min, - m_time->tm_sec, + fprintf(error_log, "[%s] [%02d.%02d.%02d - %02d:%02d:%02d] dumping packet of size %u\n", + eqLogTypes[type], + m_time->tm_mon+1, + m_time->tm_mday, + m_time->tm_year%100, + m_time->tm_hour, + m_time->tm_min, + m_time->tm_sec, (unsigned int)size); } @@ -162,7 +162,7 @@ void ErrorLog::LogPacket(eqLogType type, const char *data, size_t size) fprintf(error_log, "- "); } } - + printf("%02X ", (unsigned int)data[i]); if(error_log) { @@ -207,3 +207,4 @@ void ErrorLog::LogPacket(eqLogType type, const char *data, size_t size) log_mutex->unlock(); } + diff --git a/loginserver/ErrorLog.h b/loginserver/ErrorLog.h index 13f2a2ab0..bcc8fb9c7 100644 --- a/loginserver/ErrorLog.h +++ b/loginserver/ErrorLog.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_ERROR_LOG_H #define EQEMU_ERROR_LOG_H @@ -53,23 +53,23 @@ class ErrorLog { public: /** - * Constructor: opens the log file for writing and creates our mutex for writing to the log. - */ + * Constructor: opens the log file for writing and creates our mutex for writing to the log. + */ ErrorLog(const char* file_name); /** - * Closes the file and destroys the mutex. - */ + * Closes the file and destroys the mutex. + */ ~ErrorLog(); /** - * Writes to the log system a variable message. - */ + * Writes to the log system a variable message. + */ void Log(eqLogType type, const char *message, ...); /** - * Writes to the log system a packet. - */ + * Writes to the log system a packet. + */ void LogPacket(eqLogType type, const char *data, size_t size); protected: diff --git a/loginserver/LoginServer.h b/loginserver/LoginServer.h index a3fc7301f..54e62e551 100644 --- a/loginserver/LoginServer.h +++ b/loginserver/LoginServer.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_LOGINSERVER_H #define EQEMU_LOGINSERVER_H @@ -29,16 +29,16 @@ #include "ClientManager.h" /** - * Login server struct, contains every variable for the server that needs to exist - * outside the scope of main(). - */ +* Login server struct, contains every variable for the server that needs to exist +* outside the scope of main(). +*/ struct LoginServer { public: /** - * I don't really like how this looks with all the ifdefs... - * but it's the most trivial way to do this. - */ + * I don't really like how this looks with all the ifdefs... + * but it's the most trivial way to do this. + */ #ifdef WIN32 LoginServer() : config(nullptr), db(nullptr), eq_crypto(nullptr), SM(nullptr) { } #else diff --git a/loginserver/LoginStructures.h b/loginserver/LoginStructures.h index cee9a7665..60d10a653 100644 --- a/loginserver/LoginStructures.h +++ b/loginserver/LoginStructures.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_LOGINSTRUCTURES_H #define EQEMU_LOGINSTRUCTURES_H @@ -21,11 +21,11 @@ #pragma pack(1) struct LoginChatMessage_Struct { - short Unknown0; + short Unknown0; uint32 Unknown1; uint32 Unknown2; uint32 Unknown3; - uint8 Unknown4; + uint8 Unknown4; char ChatMessage[1]; }; @@ -35,7 +35,7 @@ struct LoginLoginRequest_Struct { short unknown3; short unknown4; short unknown5; - char unknown6[16]; + char unknown6[16]; }; struct LoginLoginAccepted_Struct { @@ -44,7 +44,7 @@ struct LoginLoginAccepted_Struct { short unknown3; short unknown4; short unknown5; - char encrypt[80]; + char encrypt[80]; }; struct Login_ReplyBlock_Struct @@ -74,7 +74,7 @@ struct LoginLoginFailed_Struct { short unknown3; short unknown4; short unknown5; - char unknown6[74]; + char unknown6[74]; }; struct ServerListHeader_Struct { @@ -86,7 +86,7 @@ struct ServerListHeader_Struct { uint32 NumberOfServers; }; -struct PlayEverquestRequest_Struct +struct PlayEverquestRequest_Struct { uint16 Sequence; uint32 Unknown1; @@ -104,9 +104,9 @@ struct PlayEverquestResponse_Struct { }; static const unsigned char FailedLoginResponseData[] = { - 0xf6, 0x85, 0x9c, 0x23, 0x57, 0x7e, 0x3e, 0x55, 0xb3, 0x4c, 0xf8, 0xc8, 0xcb, 0x77, 0xd5, 0x16, - 0x09, 0x7a, 0x63, 0xdc, 0x57, 0x7e, 0x3e, 0x55, 0xb3, 0x4c, 0xf8, 0xc8, 0xcb, 0x77, 0xd5, 0x16, - 0x09, 0x7a, 0x63, 0xdc, 0x57, 0x7e, 0x3e, 0x55, 0xb3 }; + 0xf6, 0x85, 0x9c, 0x23, 0x57, 0x7e, 0x3e, 0x55, 0xb3, 0x4c, 0xf8, 0xc8, 0xcb, 0x77, 0xd5, 0x16, + 0x09, 0x7a, 0x63, 0xdc, 0x57, 0x7e, 0x3e, 0x55, 0xb3, 0x4c, 0xf8, 0xc8, 0xcb, 0x77, 0xd5, 0x16, + 0x09, 0x7a, 0x63, 0xdc, 0x57, 0x7e, 0x3e, 0x55, 0xb3 }; #pragma pack() diff --git a/loginserver/Main.cpp b/loginserver/Main.cpp index 5714456d5..fa127673f 100644 --- a/loginserver/Main.cpp +++ b/loginserver/Main.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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/debug.h" #include "../common/types.h" @@ -40,8 +40,8 @@ void CatchSignal(int sig_num) int main() { - RegisterExecutablePlatform(ExePlatformLogin); - set_exception_handler(); + RegisterExecutablePlatform(ExePlatformLogin); + set_exception_handler(); //Create our error log, is of format login_.log time_t current_time = time(nullptr); @@ -58,7 +58,7 @@ int main() server.config = new Config(); server_log->Log(log_debug, "Config System Init."); server.config->Parse("login.ini"); - + //Parse unregistered allowed option. if(server.config->GetVariable("options", "unregistered_allowed").compare("FALSE") == 0) { @@ -143,10 +143,10 @@ int main() #ifdef EQEMU_MYSQL_ENABLED server_log->Log(log_debug, "MySQL Database Init."); server.db = (Database*)new DatabaseMySQL( - server.config->GetVariable("database", "user"), - server.config->GetVariable("database", "password"), - server.config->GetVariable("database", "host"), - server.config->GetVariable("database", "port"), + server.config->GetVariable("database", "user"), + server.config->GetVariable("database", "password"), + server.config->GetVariable("database", "host"), + server.config->GetVariable("database", "port"), server.config->GetVariable("database", "db")); #endif } @@ -155,10 +155,10 @@ int main() #ifdef EQEMU_POSTGRESQL_ENABLED server_log->Log(log_debug, "PostgreSQL Database Init."); server.db = (Database*)new DatabasePostgreSQL( - server.config->GetVariable("database", "user"), - server.config->GetVariable("database", "password"), - server.config->GetVariable("database", "host"), - server.config->GetVariable("database", "port"), + server.config->GetVariable("database", "user"), + server.config->GetVariable("database", "password"), + server.config->GetVariable("database", "host"), + server.config->GetVariable("database", "port"), server.config->GetVariable("database", "db")); #endif } diff --git a/loginserver/Options.h b/loginserver/Options.h index 4f04457e3..38d5d109f 100644 --- a/loginserver/Options.h +++ b/loginserver/Options.h @@ -1,160 +1,160 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_OPTIONS_H #define EQEMU_OPTIONS_H /** - * Collects options on one object, because having a bunch of global variables floating around is + * Collects options on one object, because having a bunch of global variables floating around is * really ugly and just a little dangerous. */ class Options { public: /** - * Constructor, sets the default options. - */ - Options() : - allow_unregistered(true), - trace(false), - dump_in_packets(false), - dump_out_packets(false), - encryption_mode(5), - local_network("127.0.0.1"), + * Constructor, sets the default options. + */ + Options() : + allow_unregistered(true), + trace(false), + dump_in_packets(false), + dump_out_packets(false), + encryption_mode(5), + local_network("127.0.0.1"), reject_duplicate_servers(false) { } /** - * Sets allow_unregistered. - */ + * Sets allow_unregistered. + */ inline void AllowUnregistered(bool b) { allow_unregistered = b; } /** - * Returns the value of allow_unregistered. - */ + * Returns the value of allow_unregistered. + */ inline bool IsUnregisteredAllowed() const { return allow_unregistered; } /** - * Sets trace. - */ + * Sets trace. + */ inline void Trace(bool b) { trace = b; } /** - * Returns the value of trace. - */ + * Returns the value of trace. + */ inline bool IsTraceOn() const { return trace; } /** - * Sets trace. - */ + * Sets trace. + */ inline void WorldTrace(bool b) { world_trace = b; } /** - * Returns the value of trace. - */ + * Returns the value of trace. + */ inline bool IsWorldTraceOn() const { return world_trace; } /** - * Sets dump_in_packets. - */ + * Sets dump_in_packets. + */ inline void DumpInPackets(bool b) { dump_in_packets = b; } /** - * Returns the value of dump_in_packets. - */ + * Returns the value of dump_in_packets. + */ inline bool IsDumpInPacketsOn() const { return dump_in_packets; } /** - * Sets dump_out_packets. - */ + * Sets dump_out_packets. + */ inline void DumpOutPackets(bool b) { dump_out_packets = b; } /** - * Returns the value of dump_out_packets. - */ + * Returns the value of dump_out_packets. + */ inline bool IsDumpOutPacketsOn() const { return dump_out_packets; } /** - * Sets encryption_mode. - */ + * Sets encryption_mode. + */ inline void EncryptionMode(int m) { encryption_mode = m; } /** - * Returns the value of encryption_mode. - */ + * Returns the value of encryption_mode. + */ inline int GetEncryptionMode() const { return encryption_mode; } /** - * Sets local_network. - */ + * Sets local_network. + */ inline void LocalNetwork(string n) { local_network = n; } /** - * Return the value of local_network. - */ + * Return the value of local_network. + */ inline string GetLocalNetwork() const { return local_network; } /** - * Sets account table. - */ + * Sets account table. + */ inline void AccountTable(string t) { account_table = t; } /** - * Return the value of local_network. - */ + * Return the value of local_network. + */ inline string GetAccountTable() const { return account_table; } /** - * Sets world account table. - */ + * Sets world account table. + */ inline void WorldRegistrationTable(string t) { world_registration_table = t; } /** - * Return the value of world account table. - */ + * Return the value of world account table. + */ inline string GetWorldRegistrationTable() const { return world_registration_table; } /** - * Sets world admin account table. - */ + * Sets world admin account table. + */ inline void WorldAdminRegistrationTable(string t) { world_admin_registration_table = t; } /** - * Return the value of world admin account table. - */ + * Return the value of world admin account table. + */ inline string GetWorldAdminRegistrationTable() const { return world_admin_registration_table; } /** - * Sets world server type table. - */ + * Sets world server type table. + */ inline void WorldServerTypeTable(string t) { world_server_type_table = t; } /** - * Return the value of world admin account table. - */ + * Return the value of world admin account table. + */ inline string GetWorldServerTypeTable() const { return world_server_type_table; } /** - * Sets whether we are rejecting duplicate servers or not. - */ + * Sets whether we are rejecting duplicate servers or not. + */ inline void RejectDuplicateServers(bool b) { reject_duplicate_servers = b; } /** - * Returns whether we are rejecting duplicate servers or not. - */ + * Returns whether we are rejecting duplicate servers or not. + */ inline bool IsRejectingDuplicateServers() { return reject_duplicate_servers; } private: diff --git a/loginserver/ServerManager.cpp b/loginserver/ServerManager.cpp index c40cfd462..042963c43 100644 --- a/loginserver/ServerManager.cpp +++ b/loginserver/ServerManager.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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 "ServerManager.h" #include "LoginServer.h" @@ -25,7 +25,7 @@ extern ErrorLog *server_log; extern LoginServer server; extern bool run_server; -ServerManager::ServerManager() +ServerManager::ServerManager() { char error_buffer[TCPConnection_ErrorBufferSize]; @@ -60,7 +60,7 @@ void ServerManager::Process() in_addr tmp; tmp.s_addr = tcp_c->GetrIP(); server_log->Log(log_network, "New world server connection from %s:%d", inet_ntoa(tmp), tcp_c->GetrPort()); - + WorldServer *cur = GetServerByAddress(tcp_c->GetrIP()); if(cur) { @@ -172,13 +172,13 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c) sl->Unknown2 = 0x00000000; sl->Unknown3 = 0x01650000; /** - * Not sure what this is but it should be noted setting it to - * 0xFFFFFFFF crashes the client so: don't do that. - */ + * Not sure what this is but it should be noted setting it to + * 0xFFFFFFFF crashes the client so: don't do that. + */ sl->Unknown4 = 0x00000000; sl->NumberOfServers = server_count; - unsigned char *data_ptr = outapp->pBuffer; + unsigned char *data_ptr = outapp->pBuffer; data_ptr += sizeof(ServerListHeader_Struct); iter = world_servers.begin(); @@ -280,7 +280,7 @@ void ServerManager::SendUserToWorldRequest(unsigned int server_id, unsigned int utwr->lsaccountid = client_account_id; (*iter)->GetConnection()->SendPacket(outapp); found = true; - + if(server.options.IsDumpInPacketsOn()) { DumpPacket(outapp); @@ -342,3 +342,4 @@ void ServerManager::DestroyServerByName(string l_name, string s_name, WorldServe iter++; } } + diff --git a/loginserver/ServerManager.h b/loginserver/ServerManager.h index c3b410b3f..aac10f09e 100644 --- a/loginserver/ServerManager.h +++ b/loginserver/ServerManager.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_SERVERMANAGER_H #define EQEMU_SERVERMANAGER_H @@ -31,56 +31,56 @@ using namespace std; /** - * Server manager class, deals with management of the world servers. - */ +* Server manager class, deals with management of the world servers. +*/ class ServerManager { public: /** - * Constructor, sets up the TCP server and starts listening. - */ + * Constructor, sets up the TCP server and starts listening. + */ ServerManager(); /** - * Destructor, shuts down the TCP server. - */ + * Destructor, shuts down the TCP server. + */ ~ServerManager(); /** - * Does basic processing for all the servers. - */ + * Does basic processing for all the servers. + */ void Process(); /** - * Sends a request to world to see if the client is banned or suspended. - */ + * Sends a request to world to see if the client is banned or suspended. + */ void SendUserToWorldRequest(unsigned int server_id, unsigned int client_account_id); /** - * Creates a server list packet for the client. - */ + * Creates a server list packet for the client. + */ EQApplicationPacket *CreateServerListPacket(Client *c); /** - * Checks to see if there is a server exists with this name, ignoring option. - */ + * Checks to see if there is a server exists with this name, ignoring option. + */ bool ServerExists(string l_name, string s_name, WorldServer *ignore = nullptr); /** - * Destroys a server with this name, ignoring option. - */ + * Destroys a server with this name, ignoring option. + */ void DestroyServerByName(string l_name, string s_name, WorldServer *ignore = nullptr); private: /** - * Processes all the disconnected connections in Process(), not used outside. - */ + * Processes all the disconnected connections in Process(), not used outside. + */ void ProcessDisconnect(); /** - * Retrieves a server(if exists) by ip address - * Useful utility for the reconnect process. - */ + * Retrieves a server(if exists) by ip address + * Useful utility for the reconnect process. + */ WorldServer* GetServerByAddress(unsigned int address); EmuTCPServer* tcps; diff --git a/loginserver/WorldServer.cpp b/loginserver/WorldServer.cpp index b641161d7..4d688f416 100644 --- a/loginserver/WorldServer.cpp +++ b/loginserver/WorldServer.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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 "WorldServer.h" #include "ErrorLog.h" @@ -141,11 +141,11 @@ bool WorldServer::Process() } UsertoWorldResponse_Struct *utwr = (UsertoWorldResponse_Struct*)app->pBuffer; - server_log->Log(log_client, "Trying to find client with user id of %u.", utwr->lsaccountid); + server_log->Log(log_client, "Trying to find client with user id of %u.", utwr->lsaccountid); Client *c = server.CM->GetClient(utwr->lsaccountid); if(c) { - server_log->Log(log_client, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str()); + server_log->Log(log_client, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str()); EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayEverquestResponse, sizeof(PlayEverquestResponse_Struct)); PlayEverquestResponse_Struct *per = (PlayEverquestResponse_Struct*)outapp->pBuffer; per->Sequence = c->GetPlaySequence(); @@ -180,7 +180,7 @@ bool WorldServer::Process() if(server.options.IsTraceOn()) { - server_log->Log(log_network_trace, "Sending play response with following data, allowed %u, sequence %u, server number %u, message %u", + server_log->Log(log_network_trace, "Sending play response with following data, allowed %u, sequence %u, server number %u, message %u", per->Allowed, per->Sequence, per->ServerNumber, per->Message); server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size); } @@ -371,7 +371,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) { if(s_acct_name.size() == 0 || s_acct_pass.size() == 0) { - server_log->Log(log_world, "Server %s(%s) successfully logged into account that had no user/password requirement.", + server_log->Log(log_world, "Server %s(%s) successfully logged into account that had no user/password requirement.", long_name.c_str(), short_name.c_str()); authorized = true; SetRuntimeID(s_id); @@ -380,7 +380,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) } else if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0) { - server_log->Log(log_world, "Server %s(%s) successfully logged in.", + server_log->Log(log_world, "Server %s(%s) successfully logged in.", long_name.c_str(), short_name.c_str()); authorized = true; SetRuntimeID(s_id); @@ -403,14 +403,14 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) } else { - server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.", + server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.", long_name.c_str(), short_name.c_str()); return; } } else { - server_log->Log(log_world, "Server %s(%s) did not attempt to log in but only registered servers are allowed.", + server_log->Log(log_world, "Server %s(%s) did not attempt to log in but only registered servers are allowed.", long_name.c_str(), short_name.c_str()); return; } @@ -430,7 +430,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) { if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0) { - server_log->Log(log_world, "Server %s(%s) successfully logged in.", + server_log->Log(log_world, "Server %s(%s) successfully logged in.", long_name.c_str(), short_name.c_str()); authorized = true; SetRuntimeID(s_id); @@ -448,7 +448,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) { // this is the first of two cases where we should deny access even if unregistered is allowed server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database.", - long_name.c_str(), short_name.c_str()); + long_name.c_str(), short_name.c_str()); } } else @@ -457,11 +457,11 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) { // this is the second of two cases where we should deny access even if unregistered is allowed server_log->Log(log_world, "Server %s(%s) did not attempt to log in but this server requires a password.", - long_name.c_str(), short_name.c_str()); + long_name.c_str(), short_name.c_str()); } else { - server_log->Log(log_world, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.", + server_log->Log(log_world, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.", long_name.c_str(), short_name.c_str()); authorized = true; SetRuntimeID(s_id); @@ -471,7 +471,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) } else { - server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.", + server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.", long_name.c_str(), short_name.c_str()); if(server.db->CreateWorldRegistration(long_name, short_name, s_id)) { @@ -485,7 +485,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i) in_addr in; in.s_addr = connection->GetrIP(); server.db->UpdateWorldRegistration(GetRuntimeID(), long_name, string(inet_ntoa(in))); - + if(authorized) { server.CM->UpdateServerList(); @@ -503,7 +503,7 @@ void WorldServer::SendClientAuth(unsigned int ip, string account, string key, un { ServerPacket *outapp = new ServerPacket(ServerOP_LSClientAuth, sizeof(ServerLSClientAuth)); ServerLSClientAuth* slsca = (ServerLSClientAuth*)outapp->pBuffer; - + slsca->lsaccount_id = account_id; strncpy(slsca->name, account.c_str(), account.size() > 30 ? 30 : account.size()); strncpy(slsca->key, key.c_str(), 10); diff --git a/loginserver/WorldServer.h b/loginserver/WorldServer.h index f5195f8e1..4ee5b19bb 100644 --- a/loginserver/WorldServer.h +++ b/loginserver/WorldServer.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2010 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 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 + 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. + 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 + 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_WORLDSERVER_H #define EQEMU_WORLDSERVER_H @@ -35,104 +35,104 @@ class WorldServer { public: /** - * Constructor, sets our connection to c. - */ + * Constructor, sets our connection to c. + */ WorldServer(EmuTCPConnection *c); /** - * Destructor, frees our connection if it exists. - */ + * Destructor, frees our connection if it exists. + */ ~WorldServer(); /** - * Resets the basic stats of this server. - */ + * Resets the basic stats of this server. + */ void Reset(); /** - * Does processing of all the connections for this world. - * Returns true except for a fatal error that requires disconnection. - */ + * Does processing of all the connections for this world. + * Returns true except for a fatal error that requires disconnection. + */ bool Process(); /** - * Accesses connection, it is intentional that this is not const (trust me). - */ + * Accesses connection, it is intentional that this is not const (trust me). + */ EmuTCPConnection *GetConnection() { return connection; } - + /** - * Sets the connection to c. - */ + * Sets the connection to c. + */ void SetConnection(EmuTCPConnection *c) { connection = c; } /** - * Gets the runtime id of this server. - */ + * Gets the runtime id of this server. + */ unsigned int GetRuntimeID() const { return runtime_id; } - + /** - * Sets the runtime id of this server. - */ + * Sets the runtime id of this server. + */ void SetRuntimeID(unsigned int id) { runtime_id = id; } /** - * Gets the long name of the server. - */ + * Gets the long name of the server. + */ string GetLongName() const { return long_name; } /** - * Gets the short name of the server. - */ + * Gets the short name of the server. + */ string GetShortName() const { return short_name; } /** - * Gets whether the server is authorized to show up on the server list or not. - */ + * Gets whether the server is authorized to show up on the server list or not. + */ bool IsAuthorized() const { return authorized; } /** - * Gets the local ip of the server. - */ + * Gets the local ip of the server. + */ string GetLocalIP() const { return local_ip; } /** - * Gets the remote ip of the server. - */ + * Gets the remote ip of the server. + */ string GetRemoteIP() const { return remote_ip; } /** - * Gets what kind of server this server is (legends, preferred, normal) - */ + * Gets what kind of server this server is (legends, preferred, normal) + */ unsigned int GetServerListID() const { return server_list_id; } /** - * Gets the status of the server. - */ + * Gets the status of the server. + */ int GetStatus() const { return status; } /** - * Gets the number of zones online on the server. - */ + * Gets the number of zones online on the server. + */ unsigned int GetZonesBooted() const { return zones_booted; } /** - * Gets the number of players on the server. - */ + * Gets the number of players on the server. + */ unsigned int GetPlayersOnline() const { return players_online; } /** - * Takes the info struct we received from world and processes it. - */ + * Takes the info struct we received from world and processes it. + */ void Handle_NewLSInfo(ServerNewLSInfo_Struct* i); /** - * Takes the status struct we received from world and processes it. - */ + * Takes the status struct we received from world and processes it. + */ void Handle_LSStatus(ServerLSStatus_Struct *s); /** - * Informs world that there is a client incoming with the following data. - */ + * Informs world that there is a client incoming with the following data. + */ void SendClientAuth(unsigned int ip, string account, string key, unsigned int account_id); private: diff --git a/queryserv/CMakeLists.txt b/queryserv/CMakeLists.txt index 4e319ddad..dca29b2cf 100644 --- a/queryserv/CMakeLists.txt +++ b/queryserv/CMakeLists.txt @@ -1,18 +1,18 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(qserv_sources - database.cpp - lfguild.cpp - queryserv.cpp - queryservconfig.cpp - worldserver.cpp + database.cpp + lfguild.cpp + queryserv.cpp + queryservconfig.cpp + worldserver.cpp ) SET(qserv_headers - database.h - lfguild.h - queryservconfig.h - worldserver.h + database.h + lfguild.h + queryservconfig.h + worldserver.h ) ADD_EXECUTABLE(queryserv ${qserv_sources} ${qserv_headers}) @@ -22,22 +22,24 @@ ADD_DEFINITIONS(-DQSERV) TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) - - SET_TARGET_PROPERTIES(queryserv PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(queryserv "Ws2_32.lib") + + SET_TARGET_PROPERTIES(queryserv PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + TARGET_LINK_LIBRARIES(queryserv "Ws2_32.lib") ENDIF(MSVC) IF(MINGW) - TARGET_LINK_LIBRARIES(queryserv "WS2_32") + TARGET_LINK_LIBRARIES(queryserv "WS2_32") ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(queryserv "dl") - TARGET_LINK_LIBRARIES(queryserv "z") - TARGET_LINK_LIBRARIES(queryserv "m") - TARGET_LINK_LIBRARIES(queryserv "rt") - TARGET_LINK_LIBRARIES(queryserv "pthread") - ADD_DEFINITIONS(-fPIC) + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(queryserv "dl") + ENDIF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(queryserv "z") + TARGET_LINK_LIBRARIES(queryserv "m") + TARGET_LINK_LIBRARIES(queryserv "rt") + TARGET_LINK_LIBRARIES(queryserv "pthread") + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 4e5f5a95c..1cfd41f44 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -321,3 +319,4 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 } } } + diff --git a/queryserv/database.h b/queryserv/database.h index f38d5db98..f1f364025 100644 --- a/queryserv/database.h +++ b/queryserv/database.h @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -44,7 +42,7 @@ public: 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); ~Database(); - + bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len); void AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type); void LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 Items); @@ -57,7 +55,8 @@ protected: void HandleMysqlError(uint32 errnum); private: void DBInitVars(); - + }; #endif + diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index af44817a9..3de5a30e7 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -39,7 +39,7 @@ bool LFGuildManager::LoadDatabase() MYSQL_RES *result; MYSQL_ROW row; - if (!database.RunQuery(query,MakeAnyLenString(&query, "SELECT `type`,`name`,`comment`, `fromlevel`, `tolevel`, `classes`, `aacount`, `timezone`, `timeposted` FROM `lfguild`"),errbuf,&result)){ + if (!database.RunQuery(query,MakeAnyLenString(&query, "SELECT `type`,`name`,`comment`, `fromlevel`, `tolevel`, `classes`, `aacount`, `timezone`, `timeposted` FROM `lfguild`"),errbuf,&result)){ _log(QUERYSERV__ERROR, "Failed to load LFGuild info from database. %s %s", query, errbuf); safe_delete_array(query); @@ -103,7 +103,7 @@ void LFGuildManager::HandlePacket(ServerPacket *pack) pack->ReadString(Comments); uint32 Toggle = pack->ReadUInt32(); uint32 TimeZone = pack->ReadUInt32(); - + TogglePlayer(FromZoneID, FromInstanceID, From, Class, Level, AAPoints, Comments, Toggle, TimeZone); break; @@ -116,7 +116,7 @@ void LFGuildManager::HandlePacket(ServerPacket *pack) case QSG_LFGuild_UpdateGuildInfo: { char GuildName[33], Comments[257]; - + pack->ReadString(GuildName); pack->ReadString(Comments); @@ -154,8 +154,8 @@ void LFGuildManager::HandlePacket(ServerPacket *pack) default: break; } - - + + } void LFGuildManager::SendPlayerMatches(uint32 FromZoneID, uint32 FromInstanceID, char *From, uint32 FromLevel, uint32 ToLevel, uint32 MinAA, uint32 TimeZone, uint32 Classes) @@ -258,7 +258,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char } if(!database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From), errbuf, 0, 0)) - _log(QUERYSERV__ERROR, "Error removing player from LFGuild table, query was %s, %s", query, errbuf); + _log(QUERYSERV__ERROR, "Error removing player from LFGuild table, query was %s, %s", query, errbuf); safe_delete_array(query); @@ -289,7 +289,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char worldserver->SendPacket(pack); safe_delete(pack); - + } void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char *From, char* GuildName, char *Comments, uint32 FromLevel, uint32 ToLevel, uint32 Classes, uint32 AACount, uint32 Toggle, uint32 TimeZone) @@ -336,7 +336,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char pack->WriteUInt32(TimeZone); pack->WriteUInt32(Now); pack->WriteUInt32(Toggle); - + worldserver->SendPacket(pack); safe_delete(pack); } @@ -396,7 +396,7 @@ void LFGuildManager::SendPlayerStatus(uint32 FromZoneID, uint32 FromInstanceID, pack->WriteUInt32((*it).TimeZone); pack->WriteUInt32((*it).TimePosted); pack->WriteUInt32(1); - + worldserver->SendPacket(pack); safe_delete(pack); break; @@ -433,3 +433,4 @@ void LFGuildManager::SendGuildStatus(uint32 FromZoneID, uint32 FromInstanceID, c } } } + diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index a69a94281..2154f396d 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -38,7 +36,7 @@ volatile bool RunLoops = true; uint32 MailMessagesSent = 0; uint32 ChatMessagesSent = 0; -TimeoutManager timeout_manager; +TimeoutManager timeout_manager; Database database; LFGuildManager lfguildmanager; @@ -58,8 +56,8 @@ void CatchSignal(int sig_num) { } int main() { - RegisterExecutablePlatform(ExePlatformQueryServ); - set_exception_handler(); + RegisterExecutablePlatform(ExePlatformQueryServ); + set_exception_handler(); Timer LFGuildExpireTimer(60000); @@ -131,13 +129,13 @@ int main() { void UpdateWindowTitle(char* iNewTitle) { #ifdef _WINDOWS - char tmp[500]; - if (iNewTitle) { - snprintf(tmp, sizeof(tmp), "QueryServ: %s", iNewTitle); - } - else { - snprintf(tmp, sizeof(tmp), "QueryServ"); - } - SetConsoleTitle(tmp); + char tmp[500]; + if (iNewTitle) { + snprintf(tmp, sizeof(tmp), "QueryServ: %s", iNewTitle); + } + else { + snprintf(tmp, sizeof(tmp), "QueryServ"); + } + SetConsoleTitle(tmp); #endif } diff --git a/queryserv/queryservconfig.cpp b/queryserv/queryservconfig.cpp index 7680648ed..6088806f4 100644 --- a/queryserv/queryservconfig.cpp +++ b/queryserv/queryservconfig.cpp @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -27,3 +25,4 @@ queryservconfig *queryservconfig::_chat_config = nullptr; string queryservconfig::GetByName(const string &var_name) const { return(EQEmuConfig::GetByName(var_name)); } + diff --git a/queryserv/queryservconfig.h b/queryserv/queryservconfig.h index 61830e3da..e4bdcf5ba 100644 --- a/queryserv/queryservconfig.h +++ b/queryserv/queryservconfig.h @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -36,7 +34,7 @@ public: // Produce a const singleton static const queryservconfig *get() { - if (_chat_config == nullptr) + if (_chat_config == nullptr) LoadConfig(); return(_chat_config); } @@ -54,3 +52,4 @@ public: }; #endif + diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index 3efd1bbbb..4486a38fd 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 + 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 + 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/debug.h" #include @@ -58,7 +58,7 @@ void WorldServer::OnConnected() void WorldServer::Process() { WorldConnection::Process(); - + if (!Connected()) return; @@ -140,19 +140,19 @@ void WorldServer::Process() // uint32 SourceZoneID // uint32 SourceInstanceID // char OriginatingCharacterName[0] // Null terminated name of the character this packet came from. This could be just - // // an empty string if it has no meaning in the context of a particular packet. + // // an empty string if it has no meaning in the context of a particular packet. // uint32 Type // // The 'Type' field is a 'sub-opcode'. A value of 0 is used for the LFGuild packets. The next feature to be added // to queryserv would use 1, etc. // - // Obviously, any fields in the packet following the 'Type' will be unique to the particular type of packet. The + // Obviously, any fields in the packet following the 'Type' will be unique to the particular type of packet. The // 'Generic' in the name of this ServerOP code relates to the four header fields. char From[64]; pack->SetReadPosition(8); pack->ReadString(From); uint32 Type = pack->ReadUInt32(); - + switch(Type) { case QSG_LFGuild: @@ -164,7 +164,7 @@ void WorldServer::Process() default: _log(QUERYSERV__ERROR, "Received unhandled ServerOP_QueryServGeneric", Type); break; - } + } break; } diff --git a/queryserv/worldserver.h b/queryserv/worldserver.h index e579b467d..167342248 100644 --- a/queryserv/worldserver.h +++ b/queryserv/worldserver.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 WORLDSERVER_H #define WORLDSERVER_H @@ -23,13 +23,13 @@ class WorldServer : public WorldConnection { -public: - WorldServer(); - virtual ~WorldServer(); - virtual void Process(); - -private: - virtual void OnConnected(); + public: + WorldServer(); + virtual ~WorldServer(); + virtual void Process(); + + private: + virtual void OnConnected(); }; #endif diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt index 902ffb2ff..2c665443c 100644 --- a/shared_memory/CMakeLists.txt +++ b/shared_memory/CMakeLists.txt @@ -1,20 +1,20 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(shared_memory_sources - items.cpp - loot.cpp - main.cpp - npc_faction.cpp - spells.cpp - skill_caps.cpp + items.cpp + loot.cpp + main.cpp + npc_faction.cpp + spells.cpp + skill_caps.cpp ) SET(shared_memory_headers - items.h - loot.h - npc_faction.h - spells.h - skill_caps.h + items.h + loot.h + npc_faction.h + spells.h + skill_caps.h ) ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers}) @@ -22,21 +22,23 @@ ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers}) TARGET_LINK_LIBRARIES(shared_memory Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) - SET_TARGET_PROPERTIES(shared_memory PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(shared_memory "Ws2_32.lib") + SET_TARGET_PROPERTIES(shared_memory PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + TARGET_LINK_LIBRARIES(shared_memory "Ws2_32.lib") ENDIF(MSVC) IF(MINGW) - TARGET_LINK_LIBRARIES(shared_memory "WS2_32") + TARGET_LINK_LIBRARIES(shared_memory "WS2_32") ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(shared_memory "dl") - TARGET_LINK_LIBRARIES(shared_memory "z") - TARGET_LINK_LIBRARIES(shared_memory "m") - TARGET_LINK_LIBRARIES(shared_memory "rt") - TARGET_LINK_LIBRARIES(shared_memory "pthread") - ADD_DEFINITIONS(-fPIC) + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(shared_memory "dl") + ENDIF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(shared_memory "z") + TARGET_LINK_LIBRARIES(shared_memory "m") + TARGET_LINK_LIBRARIES(shared_memory "rt") + TARGET_LINK_LIBRARIES(shared_memory "pthread") + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/shared_memory/items.cpp b/shared_memory/items.cpp index 054434293..432458701 100644 --- a/shared_memory/items.cpp +++ b/shared_memory/items.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 "items.h" @@ -25,21 +25,21 @@ #include "../common/item_struct.h" void LoadItems(SharedDatabase *database) { - EQEmu::IPCMutex mutex("items"); - mutex.Lock(); - - int32 items = -1; - uint32 max_item = 0; - database->GetItemsCount(items, max_item); - if(items == -1) { - EQ_EXCEPT("Shared Memory", "Unable to get any items from the database."); - } - - uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); - EQEmu::MemoryMappedFile mmf("shared/items", size); - mmf.ZeroFile(); - - void *ptr = mmf.Get(); - database->LoadItems(ptr, size, items, max_item); - mutex.Unlock(); + EQEmu::IPCMutex mutex("items"); + mutex.Lock(); + + int32 items = -1; + uint32 max_item = 0; + database->GetItemsCount(items, max_item); + if(items == -1) { + EQ_EXCEPT("Shared Memory", "Unable to get any items from the database."); + } + + uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); + EQEmu::MemoryMappedFile mmf("shared/items", size); + mmf.ZeroFile(); + + void *ptr = mmf.Get(); + database->LoadItems(ptr, size, items, max_item); + mutex.Unlock(); } diff --git a/shared_memory/items.h b/shared_memory/items.h index 6ef0f7f2a..21702eb50 100644 --- a/shared_memory/items.h +++ b/shared_memory/items.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_SHARED_MEMORY_ITEMS_H diff --git a/shared_memory/loot.cpp b/shared_memory/loot.cpp index 385ad04ab..81c0ef5a5 100644 --- a/shared_memory/loot.cpp +++ b/shared_memory/loot.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 "loot.h" @@ -26,36 +26,36 @@ #include "../common/loottable.h" void LoadLoot(SharedDatabase *database) { - EQEmu::IPCMutex mutex("loot"); - mutex.Lock(); - - uint32 loot_table_count, loot_table_max, loot_table_entries_count; - uint32 loot_drop_count, loot_drop_max, loot_drop_entries_count; - database->GetLootTableInfo(loot_table_count, loot_table_max, loot_table_entries_count); - database->GetLootDropInfo(loot_drop_count, loot_drop_max, loot_drop_entries_count); + EQEmu::IPCMutex mutex("loot"); + mutex.Lock(); - uint32 loot_table_size = (3 * sizeof(uint32)) + //header - ((loot_table_max + 1) * sizeof(uint32)) + //offset list - (loot_table_count * sizeof(LootTable_Struct)) + //loot table headers - (loot_table_entries_count * sizeof(LootTableEntries_Struct)); //number of loot table entries + uint32 loot_table_count, loot_table_max, loot_table_entries_count; + uint32 loot_drop_count, loot_drop_max, loot_drop_entries_count; + database->GetLootTableInfo(loot_table_count, loot_table_max, loot_table_entries_count); + database->GetLootDropInfo(loot_drop_count, loot_drop_max, loot_drop_entries_count); - uint32 loot_drop_size = (3 * sizeof(uint32)) + //header - ((loot_drop_max + 1) * sizeof(uint32)) + //offset list - (loot_drop_count * sizeof(LootDrop_Struct)) + //loot table headers - (loot_drop_entries_count * sizeof(LootDropEntries_Struct)); //number of loot table entries + uint32 loot_table_size = (3 * sizeof(uint32)) + //header + ((loot_table_max + 1) * sizeof(uint32)) + //offset list + (loot_table_count * sizeof(LootTable_Struct)) + //loot table headers + (loot_table_entries_count * sizeof(LootTableEntries_Struct)); //number of loot table entries - EQEmu::MemoryMappedFile mmf_loot_table("shared/loot_table", loot_table_size); - EQEmu::MemoryMappedFile mmf_loot_drop("shared/loot_drop", loot_drop_size); - mmf_loot_table.ZeroFile(); - mmf_loot_drop.ZeroFile(); + uint32 loot_drop_size = (3 * sizeof(uint32)) + //header + ((loot_drop_max + 1) * sizeof(uint32)) + //offset list + (loot_drop_count * sizeof(LootDrop_Struct)) + //loot table headers + (loot_drop_entries_count * sizeof(LootDropEntries_Struct)); //number of loot table entries - EQEmu::FixedMemoryVariableHashSet loot_table_hash(reinterpret_cast(mmf_loot_table.Get()), - loot_table_size, loot_table_max); + EQEmu::MemoryMappedFile mmf_loot_table("shared/loot_table", loot_table_size); + EQEmu::MemoryMappedFile mmf_loot_drop("shared/loot_drop", loot_drop_size); + mmf_loot_table.ZeroFile(); + mmf_loot_drop.ZeroFile(); - EQEmu::FixedMemoryVariableHashSet loot_drop_hash(reinterpret_cast(mmf_loot_drop.Get()), - loot_drop_size, loot_drop_max); + EQEmu::FixedMemoryVariableHashSet loot_table_hash(reinterpret_cast(mmf_loot_table.Get()), + loot_table_size, loot_table_max); - database->LoadLootTables(mmf_loot_table.Get(), loot_table_max); - database->LoadLootDrops(mmf_loot_drop.Get(), loot_drop_max); - mutex.Unlock(); + EQEmu::FixedMemoryVariableHashSet loot_drop_hash(reinterpret_cast(mmf_loot_drop.Get()), + loot_drop_size, loot_drop_max); + + database->LoadLootTables(mmf_loot_table.Get(), loot_table_max); + database->LoadLootDrops(mmf_loot_drop.Get(), loot_drop_max); + mutex.Unlock(); } diff --git a/shared_memory/loot.h b/shared_memory/loot.h index 3967add0d..df97ad321 100644 --- a/shared_memory/loot.h +++ b/shared_memory/loot.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_SHARED_MEMORY_LOOT_H diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index f13413d63..52d85668d 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 @@ -31,129 +31,129 @@ #include "spells.h" int main(int argc, char **argv) { - RegisterExecutablePlatform(ExePlatformSharedMemory); - set_exception_handler(); + RegisterExecutablePlatform(ExePlatformSharedMemory); + set_exception_handler(); - LogFile->write(EQEMuLog::Status, "Shared Memory Loader Program"); - if(!EQEmuConfig::LoadConfig()) { - LogFile->write(EQEMuLog::Error, "Unable to load configuration file."); - return 0; - } - - 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; - 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"); + LogFile->write(EQEMuLog::Status, "Shared Memory Loader Program"); + if(!EQEmuConfig::LoadConfig()) { + LogFile->write(EQEMuLog::Error, "Unable to load configuration file."); return 0; } - bool load_all = true; - bool load_items = true; - bool load_factions = true; - bool load_loot = true; - bool load_skill_caps = true; - bool load_spells = true; - if(argc > 1) { - load_all = false; - load_items = false; - load_factions = false; - load_loot = false; - load_skill_caps = false; - load_spells = false; + 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()); + } - for(int i = 1; i < argc; ++i) { - switch(argv[i][0]) { - case 'a': - if(strcasecmp("all", argv[i]) == 0) { - load_all = true; - } - break; + SharedDatabase database; + 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 0; + } - case 'i': - if(strcasecmp("items", argv[i]) == 0) { - load_items = true; - } - break; + bool load_all = true; + bool load_items = true; + bool load_factions = true; + bool load_loot = true; + bool load_skill_caps = true; + bool load_spells = true; + if(argc > 1) { + load_all = false; + load_items = false; + load_factions = false; + load_loot = false; + load_skill_caps = false; + load_spells = false; - case 'f': - if(strcasecmp("factions", argv[i]) == 0) { - load_factions = true; - } - break; + for(int i = 1; i < argc; ++i) { + switch(argv[i][0]) { + case 'a': + if(strcasecmp("all", argv[i]) == 0) { + load_all = true; + } + break; - case 'l': - if(strcasecmp("loot", argv[i]) == 0) { - load_loot = true; - } - break; - - case 's': - if(strcasecmp("skill_caps", argv[i]) == 0) { - load_skill_caps = true; - } else if(strcasecmp("spells", argv[i]) == 0) { - load_spells = true; - } - break; - } - } - } + case 'i': + if(strcasecmp("items", argv[i]) == 0) { + load_items = true; + } + break; - if(load_all || load_items) { - LogFile->write(EQEMuLog::Status, "Loading items..."); - try { - LoadItems(&database); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); - return 0; - } - } + case 'f': + if(strcasecmp("factions", argv[i]) == 0) { + load_factions = true; + } + break; - if(load_all || load_factions) { - LogFile->write(EQEMuLog::Status, "Loading factions..."); - try { - LoadFactions(&database); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); - return 0; - } - } - - if(load_all || load_loot) { - LogFile->write(EQEMuLog::Status, "Loading loot..."); - try { - LoadLoot(&database); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); - return 0; - } - } + case 'l': + if(strcasecmp("loot", argv[i]) == 0) { + load_loot = true; + } + break; - if(load_all || load_skill_caps) { - LogFile->write(EQEMuLog::Status, "Loading skill caps..."); - try { - LoadSkillCaps(&database); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); - return 0; - } - } + case 's': + if(strcasecmp("skill_caps", argv[i]) == 0) { + load_skill_caps = true; + } else if(strcasecmp("spells", argv[i]) == 0) { + load_spells = true; + } + break; + } + } + } - if(load_all || load_spells) { - LogFile->write(EQEMuLog::Status, "Loading spells..."); - try { - LoadSpells(&database); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); - return 0; - } - } + if(load_all || load_items) { + LogFile->write(EQEMuLog::Status, "Loading items..."); + try { + LoadItems(&database); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "%s", ex.what()); + return 0; + } + } - return 0; + if(load_all || load_factions) { + LogFile->write(EQEMuLog::Status, "Loading factions..."); + try { + LoadFactions(&database); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "%s", ex.what()); + return 0; + } + } + + if(load_all || load_loot) { + LogFile->write(EQEMuLog::Status, "Loading loot..."); + try { + LoadLoot(&database); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "%s", ex.what()); + return 0; + } + } + + if(load_all || load_skill_caps) { + LogFile->write(EQEMuLog::Status, "Loading skill caps..."); + try { + LoadSkillCaps(&database); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "%s", ex.what()); + return 0; + } + } + + if(load_all || load_spells) { + LogFile->write(EQEMuLog::Status, "Loading spells..."); + try { + LoadSpells(&database); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "%s", ex.what()); + return 0; + } + } + + return 0; } diff --git a/shared_memory/npc_faction.cpp b/shared_memory/npc_faction.cpp index 6fd18ed70..8a9575497 100644 --- a/shared_memory/npc_faction.cpp +++ b/shared_memory/npc_faction.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 "npc_faction.h" @@ -25,21 +25,21 @@ #include "../common/faction.h" void LoadFactions(SharedDatabase *database) { - EQEmu::IPCMutex mutex("faction"); - mutex.Lock(); - - uint32 lists = 0; - uint32 max_list = 0; - database->GetFactionListInfo(lists, max_list); - if(lists == 0) { - EQ_EXCEPT("Shared Memory", "Unable to get any factions from the database."); - } - - uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(lists, max_list)); - EQEmu::MemoryMappedFile mmf("shared/faction", size); - mmf.ZeroFile(); - - void *ptr = mmf.Get(); - database->LoadNPCFactionLists(ptr, size, lists, max_list); - mutex.Unlock(); + EQEmu::IPCMutex mutex("faction"); + mutex.Lock(); + + uint32 lists = 0; + uint32 max_list = 0; + database->GetFactionListInfo(lists, max_list); + if(lists == 0) { + EQ_EXCEPT("Shared Memory", "Unable to get any factions from the database."); + } + + uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(lists, max_list)); + EQEmu::MemoryMappedFile mmf("shared/faction", size); + mmf.ZeroFile(); + + void *ptr = mmf.Get(); + database->LoadNPCFactionLists(ptr, size, lists, max_list); + mutex.Unlock(); } diff --git a/shared_memory/npc_faction.h b/shared_memory/npc_faction.h index 4ff97a91d..52038dd9b 100644 --- a/shared_memory/npc_faction.h +++ b/shared_memory/npc_faction.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_SHARED_MEMORY_NPC_FACTION_H diff --git a/shared_memory/skill_caps.cpp b/shared_memory/skill_caps.cpp index 2c588a6ea..c8cc0838b 100644 --- a/shared_memory/skill_caps.cpp +++ b/shared_memory/skill_caps.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 "skill_caps.h" @@ -26,17 +26,17 @@ #include "../common/features.h" void LoadSkillCaps(SharedDatabase *database) { - EQEmu::IPCMutex mutex("skill_caps"); - mutex.Lock(); - - uint32 class_count = PLAYER_CLASS_COUNT; + EQEmu::IPCMutex mutex("skill_caps"); + mutex.Lock(); + + uint32 class_count = PLAYER_CLASS_COUNT; uint32 skill_count = HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; - uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); - EQEmu::MemoryMappedFile mmf("shared/skill_caps", size); - mmf.ZeroFile(); - - void *ptr = mmf.Get(); - database->LoadSkillCaps(ptr); - mutex.Unlock(); -} \ No newline at end of file + uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); + EQEmu::MemoryMappedFile mmf("shared/skill_caps", size); + mmf.ZeroFile(); + + void *ptr = mmf.Get(); + database->LoadSkillCaps(ptr); + mutex.Unlock(); +} diff --git a/shared_memory/skill_caps.h b/shared_memory/skill_caps.h index 044f83534..e01dab4f4 100644 --- a/shared_memory/skill_caps.h +++ b/shared_memory/skill_caps.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_SHARED_MEMORY_SKILL_CAPS_H @@ -23,3 +23,4 @@ class SharedDatabase; void LoadSkillCaps(SharedDatabase *database); #endif + diff --git a/shared_memory/spells.cpp b/shared_memory/spells.cpp index cd5f8a0c2..eb8f34777 100644 --- a/shared_memory/spells.cpp +++ b/shared_memory/spells.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 "spells.h" @@ -25,18 +25,19 @@ #include "../common/spdat.h" void LoadSpells(SharedDatabase *database) { - EQEmu::IPCMutex mutex("spells"); - mutex.Lock(); - int records = database->GetMaxSpellID() + 1; - if(records == 0) { - EQ_EXCEPT("Shared Memory", "Unable to get any spells from the database."); - } + EQEmu::IPCMutex mutex("spells"); + mutex.Lock(); + int records = database->GetMaxSpellID() + 1; + if(records == 0) { + EQ_EXCEPT("Shared Memory", "Unable to get any spells from the database."); + } - uint32 size = records * sizeof(SPDat_Spell_Struct); - EQEmu::MemoryMappedFile mmf("shared/spells", size); - mmf.ZeroFile(); + uint32 size = records * sizeof(SPDat_Spell_Struct); + EQEmu::MemoryMappedFile mmf("shared/spells", size); + mmf.ZeroFile(); + + void *ptr = mmf.Get(); + database->LoadSpells(ptr, records); + mutex.Unlock(); +} - void *ptr = mmf.Get(); - database->LoadSpells(ptr, records); - mutex.Unlock(); -} \ No newline at end of file diff --git a/shared_memory/spells.h b/shared_memory/spells.h index 03ef75282..590ee0536 100644 --- a/shared_memory/spells.h +++ b/shared_memory/spells.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_SHARED_MEMORY_SPELLS_H diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5288e78e7..649285b8b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,14 +3,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) ADD_SUBDIRECTORY(cppunit) SET(tests_sources - main.cpp + main.cpp ) SET(tests_headers - fixed_memory_test.h - fixed_memory_variable_test.h - ipc_mutex_test.h - memory_mapped_file_test.h + fixed_memory_test.h + fixed_memory_variable_test.h + ipc_mutex_test.h + memory_mapped_file_test.h ) ADD_EXECUTABLE(tests ${tests_sources} ${tests_headers}) @@ -18,21 +18,21 @@ ADD_EXECUTABLE(tests ${tests_sources} ${tests_headers}) TARGET_LINK_LIBRARIES(tests Common cppunit) IF(MSVC) - SET_TARGET_PROPERTIES(tests PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(tests "Ws2_32.lib") + SET_TARGET_PROPERTIES(tests PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + TARGET_LINK_LIBRARIES(tests "Ws2_32.lib") ENDIF(MSVC) IF(MINGW) - TARGET_LINK_LIBRARIES(tests "WS2_32") + TARGET_LINK_LIBRARIES(tests "WS2_32") ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(tests "dl") - TARGET_LINK_LIBRARIES(tests "z") - TARGET_LINK_LIBRARIES(tests "m") - TARGET_LINK_LIBRARIES(tests "rt") - TARGET_LINK_LIBRARIES(tests "pthread") - ADD_DEFINITIONS(-fPIC) + TARGET_LINK_LIBRARIES(tests "dl") + TARGET_LINK_LIBRARIES(tests "z") + TARGET_LINK_LIBRARIES(tests "m") + TARGET_LINK_LIBRARIES(tests "rt") + TARGET_LINK_LIBRARIES(tests "pthread") + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/tests/cppunit/CMakeLists.txt b/tests/cppunit/CMakeLists.txt index 4ff178523..e60e2134f 100644 --- a/tests/cppunit/CMakeLists.txt +++ b/tests/cppunit/CMakeLists.txt @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(cppunit_sources - collectoroutput.cpp + collectoroutput.cpp compileroutput.cpp htmloutput.cpp missing.cpp @@ -13,7 +13,7 @@ SET(cppunit_sources ) SET(cppunit_headers - cpptest-assert.h + cpptest-assert.h cpptest-collectoroutput.h cpptest-compileroutput.h cpptest-htmloutput.h @@ -23,16 +23,16 @@ SET(cppunit_headers cpptest-textoutput.h cpptest-time.h cpptest.h - missing.h + missing.h utils.h - winconfig.h + winconfig.h ) ADD_LIBRARY(cppunit ${cppunit_sources} ${cppunit_headers}) IF(UNIX) - ADD_DEFINITIONS(-fPIC) + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) SET(LIBRARY_OUTPUT_PATH ../../Bin) diff --git a/tests/cppunit/collectoroutput.cpp b/tests/cppunit/collectoroutput.cpp index 1e2ffc204..260062504 100644 --- a/tests/cppunit/collectoroutput.cpp +++ b/tests/cppunit/collectoroutput.cpp @@ -28,7 +28,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "cpptest-collectoroutput.h" @@ -46,21 +46,21 @@ namespace Test { _tests.reserve(tests); } - + /// Constructs a collector object. /// CollectorOutput::CollectorOutput() : Output(), _total_errors(0) {} - + void CollectorOutput::finished(int tests, const Time& time) { _total_tests = tests; _total_time = time; } - + void CollectorOutput::suite_start(int tests, const string& name) { @@ -70,7 +70,7 @@ namespace Test _cur_suite = &_suites.back(); } } - + void CollectorOutput::suite_end(int tests, const string&, const Time& time) { @@ -80,14 +80,14 @@ namespace Test _total_errors += _cur_suite->_errors; } } - + void CollectorOutput::test_start(const string& name) { _cur_suite->_tests.push_back(TestInfo(name)); _cur_test = &_cur_suite->_tests.back(); } - + void CollectorOutput::test_end(const string&, bool ok, const Time& time) { @@ -95,12 +95,12 @@ namespace Test ++_cur_suite->_errors; _cur_test->_time = time; } - + void CollectorOutput::assertment(const Source& s) { _cur_test->_sources.push_back(s); } - + } // namespace Test diff --git a/tests/cppunit/compileroutput.cpp b/tests/cppunit/compileroutput.cpp index 23eec3986..ef17146f4 100644 --- a/tests/cppunit/compileroutput.cpp +++ b/tests/cppunit/compileroutput.cpp @@ -50,12 +50,12 @@ namespace Test throw Test::CompilerOutput::InvalidFormat(format); pos += mod.size(); return true; - } + } return false; } - + } // anonymous namespace - + /// Constructs a compiler output handler. /// /// \param format Pre-defined compiler output format. @@ -72,10 +72,10 @@ namespace Test "%file:%line: %text", // GCC "%file(%line) : %text" // MSVC }; - + _format = table[format]; } - + /// Constructs a compiler output handler. /// /// \param format %Output format to use. @@ -89,7 +89,7 @@ namespace Test _stream(stream) { int expr(0), file(0), line(0); - + for (string::size_type pos = 0; (pos = _format.find_first_of('%', pos)) != string::npos; ) { @@ -100,34 +100,34 @@ namespace Test else throw InvalidFormat(format); } - + if (!expr && !file && !line) throw InvalidFormat(format); } - + void CompilerOutput::assertment(const Source& s) { string fmt(_format); string::size_type pos; - + fmt.reserve(fmt.size() + 128); - + if ((pos = fmt.find("%file")) != string::npos) fmt.replace(pos, 5, s.file()); - + if ((pos = fmt.find("%text")) != string::npos) fmt.replace(pos, 5, s.message()); - + if ((pos = fmt.find("%line")) != string::npos) { ostringstream ss; ss << s.line(); fmt.replace(pos, 5, ss.str()); } - + _stream << fmt << endl; } - + } // namespace Test diff --git a/tests/cppunit/cpptest-assert.h b/tests/cppunit/cpptest-assert.h index bf90dd842..0e0ceaafe 100644 --- a/tests/cppunit/cpptest-assert.h +++ b/tests/cppunit/cpptest-assert.h @@ -231,7 +231,7 @@ /// \param a First expression to test. /// \param b Second expression to test. /// \param delta Constant. -/// \param msg User message. +/// \param msg User message. /// /// \see TEST_ASSERT_DELTA(a, b, delta) /// @@ -245,7 +245,7 @@ if (!continue_after_failure()) return; \ } \ } - + /// Verify an expression and expects an exception in return. /// An assertment is issued if the exception is not thrown. /// @@ -343,7 +343,7 @@ if (!continue_after_failure()) return; \ } \ } - + /// Verify an expression and expects no exception in return. /// An assertment is issued if any exception is thrown. /// diff --git a/tests/cppunit/cpptest-collectoroutput.h b/tests/cppunit/cpptest-collectoroutput.h index cd9b65e95..c565f04cb 100644 --- a/tests/cppunit/cpptest-collectoroutput.h +++ b/tests/cppunit/cpptest-collectoroutput.h @@ -55,52 +55,52 @@ namespace Test virtual void test_end(const std::string& name, bool ok, const Time& time); virtual void assertment(const Source& s); - + protected: struct OutputSuiteInfo; struct OutputTestInfo; struct OutputErrorTestInfo; - + typedef std::list Sources; - + struct TestInfo { std::string _name; Time _time; - + bool _success : 1; Sources _sources; - + explicit TestInfo(const std::string name); }; - + typedef std::vector Tests; - + struct SuiteInfo { std::string _name; int _errors; Tests _tests; Time _time; - + SuiteInfo(const std::string& name, int tests); }; - + typedef std::list Suites; - + Suites _suites; int _total_errors; int _total_tests; Time _total_time; - + CollectorOutput(); - + private: SuiteInfo* _cur_suite; TestInfo* _cur_test; }; - + } // namespace Test - + #endif // #ifndef CPPTEST_COLLECTOROUTPUT_H diff --git a/tests/cppunit/cpptest-compileroutput.h b/tests/cppunit/cpptest-compileroutput.h index 35a6feb28..2f6cb0926 100644 --- a/tests/cppunit/cpptest-compileroutput.h +++ b/tests/cppunit/cpptest-compileroutput.h @@ -64,14 +64,14 @@ namespace Test InvalidFormat(const std::string& what) : std::logic_error(what) {} }; - + /// Pre-defined compiler output formats. /// enum Format { /// Generic compiler format, which equals: /// %%file:%%line: %%text - /// + /// Generic, /// @@ -79,34 +79,34 @@ namespace Test /// Error cpptest %%file %%line: %%text. /// BCC, - - /// GNU Compiler Collection + + /// GNU Compiler Collection /// (GCC) format, which equals: /// %%file:%%line: %%text /// GCC, - /// Microsoft Visual C++ + /// Microsoft Visual C++ /// (MSVC) format, which equals: /// %%file(%%line) : %%text /// MSVC }; - + explicit CompilerOutput(Format format = Generic, std::ostream& stream = std::cout); - + explicit CompilerOutput(const std::string& format, std::ostream& stream = std::cout); - + virtual void assertment(const Source& s); - + private: std::string _format; std::ostream& _stream; }; } // namespace Test - + #endif // #ifndef CPPTEST_COMPILEROUTPUT_H diff --git a/tests/cppunit/cpptest-htmloutput.h b/tests/cppunit/cpptest-htmloutput.h index 464683f47..1cdf096f0 100644 --- a/tests/cppunit/cpptest-htmloutput.h +++ b/tests/cppunit/cpptest-htmloutput.h @@ -44,9 +44,9 @@ namespace Test class HtmlOutput : public CollectorOutput { public: - void generate(std::ostream& os, bool incl_ok_tests = true, + void generate(std::ostream& os, bool incl_ok_tests = true, const std::string& name = ""); - + private: struct SuiteRow; struct TestRow; @@ -57,8 +57,8 @@ namespace Test friend struct TestSuiteRow; }; - -} // namespace Test - -#endif // #ifndef CPPTEST_HTMLOUTPUT_H + +} // namespace Test + +#endif // #ifndef CPPTEST_HTMLOUTPUT_H diff --git a/tests/cppunit/cpptest-output.h b/tests/cppunit/cpptest-output.h index cfadaecb1..898231bdf 100644 --- a/tests/cppunit/cpptest-output.h +++ b/tests/cppunit/cpptest-output.h @@ -41,7 +41,7 @@ namespace Test { class Source; class Time; - + /// \brief %Test suite output handler. /// /// Abstract base class for all suite output handlers. Derive from this @@ -58,7 +58,7 @@ namespace Test /// Empty destructor. /// virtual ~Output() {} - + /// Called when testing is started. /// /// \param tests Total number of tests in all suites. @@ -67,7 +67,7 @@ namespace Test { CPPTEST_UNUSED(tests); } - + /// Called when testing is finished. /// /// \param tests Total number of tests in all suites. @@ -89,7 +89,7 @@ namespace Test CPPTEST_UNUSED(tests); CPPTEST_UNUSED(name); } - + /// Called when a suite is finished. /// /// \param tests Number of tests in this suite. @@ -103,7 +103,7 @@ namespace Test CPPTEST_UNUSED(name); CPPTEST_UNUSED(time); } - + /// Called when a tests is executed. /// /// \param name Name of the test function. @@ -112,7 +112,7 @@ namespace Test { CPPTEST_UNUSED(name); } - + /// Called when a test if finished, regardless if an assertment was /// issued. /// @@ -127,7 +127,7 @@ namespace Test CPPTEST_UNUSED(ok); CPPTEST_UNUSED(time); } - + /// Called when an assertment is issued. /// /// \param s Assert point information. @@ -141,12 +141,12 @@ namespace Test /// Empty constructor. /// Output() {} - + private: Output(const Output&); Output& operator=(const Output&); }; - + } // namespace Test - + #endif // #ifndef CPPTEST_OUTPUT_H diff --git a/tests/cppunit/cpptest-source.h b/tests/cppunit/cpptest-source.h index 47140ca71..c2eb57f32 100644 --- a/tests/cppunit/cpptest-source.h +++ b/tests/cppunit/cpptest-source.h @@ -34,7 +34,7 @@ namespace Test { class Suite; - + /// \brief Assertment source information. /// /// Contains information about an assertment point. @@ -42,17 +42,17 @@ namespace Test class Source { friend class Suite; - + public: Source(); Source(const char* file, unsigned int line, const char* msg); - + const std::string& file() const; unsigned int line() const; const std::string& message() const; const std::string& suite() const; const std::string& test() const; - + private: unsigned int _line; std::string _file; @@ -60,7 +60,7 @@ namespace Test std::string _suite; std::string _test; }; - + } // namespace Test #endif // #ifndef CPPTEST_SOURCE_H diff --git a/tests/cppunit/cpptest-suite.h b/tests/cppunit/cpptest-suite.h index b42a19fa1..eb6908b7b 100644 --- a/tests/cppunit/cpptest-suite.h +++ b/tests/cppunit/cpptest-suite.h @@ -39,7 +39,7 @@ namespace Test { class Output; - + /// \brief Unit testing suite. /// /// Base class for all suites. Derive from this class to create own @@ -51,52 +51,52 @@ namespace Test /// class Suite { - public: + public: Suite(); virtual ~Suite(); - + void add(Suite* suite); - + bool run(Output& output, bool cont_after_fail = true); - + protected: /// Pointer to a test function. /// typedef void (Suite::*Func)(); - + bool continue_after_failure() const { return _continue; } - + virtual void setup() {} virtual void tear_down() {} - + void register_test(Func func, const std::string& name); void assertment(Source s); - + private: struct DoRun; struct ExecTests; struct SubSuiteTests; struct SuiteTime; struct SubSuiteTime; - + friend struct DoRun; friend struct ExecTests; friend struct SubSuiteTests; friend struct SubSuiteTime; - + struct Data { Func _func; std::string _name; Time _time; - + Data(Func func, const std::string& name) : _func(func), _name(name) {} }; - + typedef std::list Tests; typedef std::list Suites; - + std::string _name; // Suite name const std::string* _cur_test; // Current test func name Suites _suites; // External test suites @@ -105,11 +105,11 @@ namespace Test bool _result : 1; // Test result bool _success : 1; // Set if no test failed bool _continue : 1; // Continue func after failures - + void do_run(Output* os, bool cont_after_fail); int total_tests() const; Time total_time(bool recursive) const; - + // Disable // Suite(const Suite&); @@ -133,7 +133,7 @@ namespace Test /// #define TEST_ADD(func)\ register_test(static_cast(&func), #func); - + } // namespace Test #endif // #ifndef CPPTEST_SUITE_H diff --git a/tests/cppunit/cpptest-textoutput.h b/tests/cppunit/cpptest-textoutput.h index 45ed9f2fc..91b0d7c64 100644 --- a/tests/cppunit/cpptest-textoutput.h +++ b/tests/cppunit/cpptest-textoutput.h @@ -53,15 +53,15 @@ namespace Test /// Terse output mode, which only shows the number of correct tests. /// Terse, - + /// Verbose output mode, which also shows extended assert /// information for each test that failed. /// - Verbose + Verbose }; - + TextOutput(Mode mode, std::ostream& stream = std::cout); - + virtual void finished(int tests, const Time& time); virtual void suite_start(int tests, const std::string& name); virtual void suite_end(int tests, const std::string& name, @@ -69,10 +69,10 @@ namespace Test virtual void test_end(const std::string& name, bool ok, const Time& time); virtual void assertment(const Source& s); - + private: typedef std::list ErrorList; - + Mode _mode; std::ostream& _stream; ErrorList _suite_error_list; @@ -84,5 +84,5 @@ namespace Test }; } // namespace Test - + #endif // #ifndef CPPTEST_TEXTOUTPUT_H diff --git a/tests/cppunit/cpptest-time.h b/tests/cppunit/cpptest-time.h index ee1f282c9..bc7f5b78b 100644 --- a/tests/cppunit/cpptest-time.h +++ b/tests/cppunit/cpptest-time.h @@ -45,22 +45,22 @@ namespace Test public: Time(); Time(unsigned int sec, unsigned int usec); - + unsigned int seconds() const; unsigned int microseconds() const; - + static Time current(); - + friend Time operator+(const Time& t1, const Time& t2); friend Time operator-(const Time& t1, const Time& t2); - + friend std::ostream& operator<<(std::ostream& os, const Time& t); - + private: unsigned int _sec; unsigned int _usec; }; - + } // namespace Test #endif // #ifndef CPPTEST_TIME_H diff --git a/tests/cppunit/htmloutput.cpp b/tests/cppunit/htmloutput.cpp index bdf6fd6a4..8870a33fd 100644 --- a/tests/cppunit/htmloutput.cpp +++ b/tests/cppunit/htmloutput.cpp @@ -31,7 +31,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "cpptest-htmloutput.h" #include "utils.h" @@ -52,7 +52,7 @@ namespace Test idx += replace.size(); } } - + string escape(string value) { @@ -63,7 +63,7 @@ namespace Test strreplace(value, '\'', "'"); return value; } - + void header(ostream& os, string name) { @@ -149,7 +149,7 @@ namespace Test "
\n" "\n"; } - + void footer(ostream& os) { @@ -162,15 +162,15 @@ namespace Test "

\n" "\n\n"; } - + void back_ref(ostream& os, const string& ref, bool prepend_newline = true) { - + os << "

Back to " << escape(ref) << "\n

\n"; } - + void sub_title(ostream& os, const string& title, int size) { @@ -186,43 +186,43 @@ namespace Test h << "h" << size; os << "<" << h.str() << ">" << escape(title) << "\n"; } - + enum ClassTableType { TableClass_Summary, TableClass_Suites, TableClass_Suite, TableClass_Result }; - + void table_header(ostream& os, ClassTableType type, const string &summary = "") { static const char* class_tabletypes[] = { "summary", "suites", "suite", "result" }; - + os << "\n"; } - + void table_footer(ostream& os) { os << "
\n"; } - + void table_tr_header(ostream& os) { os << " \n"; } - + void table_tr_footer(ostream& os) { os << " \n"; } - + enum ClassType { Title, Success, Error }; - + void table_entry(ostream& os, ClassType type, const string& s, int width = 0, const string& link = "") { static const char* class_types[] = { "title", "success", "error" }; - + os << " " << escape(s) << ""; else os << " class=\"tablecell_" << class_types[type] << "\">" << escape(s); - os << "\n"; + os << "\n"; } - + } // anonymous namespace - + // Test suite table // struct HtmlOutput::SuiteRow @@ -259,7 +259,7 @@ namespace Test table_tr_footer(_os); } }; - + // Individual tests tables, tests // struct HtmlOutput::TestRow @@ -276,7 +276,7 @@ namespace Test ti._sources.front().suite() + "_" + ti._name; ClassType type(ti._success ? Success : Error); ostringstream ss; - + table_tr_header(_os); table_entry(_os, type, ti._name, 0, link); ss.str(""), ss << ti._sources.size(); @@ -288,19 +288,19 @@ namespace Test } } }; - + // Individual tests tables, header // struct HtmlOutput::TestSuiteRow { bool _incl_ok_tests; ostream& _os; - TestSuiteRow(ostream& os, bool incl_ok_tests) + TestSuiteRow(ostream& os, bool incl_ok_tests) : _incl_ok_tests(incl_ok_tests), _os(os) {} void operator()(const SuiteInfo& si) { ostringstream ss; - + sub_title(_os, "Suite: " + si._name, 3, si._name); table_header(_os, TableClass_Suite, "Details for suite " + si._name); table_tr_header(_os); @@ -309,13 +309,13 @@ namespace Test table_entry(_os, Title, "Success", 10); table_entry(_os, Title, "Time (s)", 10); table_tr_footer(_os); - for_each(si._tests.begin(), si._tests.end(), + for_each(si._tests.begin(), si._tests.end(), TestRow(_os, _incl_ok_tests)); table_footer(_os); back_ref(_os, "top"); } }; - + // Individual tests result tables // struct HtmlOutput::TestResult @@ -325,9 +325,9 @@ namespace Test void operator()(const Source& s) { const int TitleSize = 15; - + ostringstream ss; - + table_header(_os, TableClass_Result, "Test Failure"); table_tr_header(_os); table_entry(_os, Title, "Test", TitleSize); @@ -345,7 +345,7 @@ namespace Test table_footer(_os); } }; - + // All tests result tables // struct HtmlOutput::TestResultAll @@ -357,14 +357,14 @@ namespace Test if (!ti._success) { const string& suite = ti._sources.front().suite(); - + sub_title(_os, suite + "::" + ti._name, 3, suite + "_" + ti._name); for_each(ti._sources.begin(), ti._sources.end(), TestResult(_os)); back_ref(_os, suite, false); } } }; - + // Individual tests result tables, iterator // struct HtmlOutput::SuiteTestResult @@ -376,12 +376,12 @@ namespace Test for_each(si._tests.begin(), si._tests.end(), TestResultAll(_os)); } }; - + /// Generates the HTML table. This function should only be called after /// run(), when all tests have been executed. /// /// \param os Output stream. - /// \param incl_ok_tests Set if successful tests should be shown; + /// \param incl_ok_tests Set if successful tests should be shown; /// false otherwise. /// \param name Name of generated report. /// @@ -390,9 +390,9 @@ namespace Test { ClassType type(_total_errors > 0 ? Error : Success); ostringstream ss; - + header(os, name); - + // Table: Summary // sub_title(os, "Summary", 2); @@ -415,7 +415,7 @@ namespace Test table_tr_footer(os); table_footer(os); os << "
\n\n"; - + // Table: Test suites // sub_title(os, "Test suites", 2); @@ -430,12 +430,12 @@ namespace Test for_each(_suites.begin(), _suites.end(), SuiteRow(os)); table_footer(os); os << "
\n\n"; - + // Individual tests tables // for_each(_suites.begin(), _suites.end(), TestSuiteRow(os, incl_ok_tests)); os << "
\n\n"; - + // Individual tests result tables // if(_total_errors != 0) @@ -443,11 +443,11 @@ namespace Test sub_title(os, "Test results", 2); for_each(_suites.begin(), _suites.end(), SuiteTestResult(os)); os << "
\n\n"; - } + } // EOF // footer(os); } - + } // namespace Test diff --git a/tests/cppunit/missing.cpp b/tests/cppunit/missing.cpp index 046dff7b0..6dd38d5f7 100644 --- a/tests/cppunit/missing.cpp +++ b/tests/cppunit/missing.cpp @@ -28,7 +28,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "missing.h" @@ -40,7 +40,7 @@ #include #else #include -#endif +#endif #include #include @@ -53,7 +53,7 @@ namespace Test gettimeofday(timeval* tv, void*) { assert(tv); - + #ifdef HAVE_GETTICKCOUNT long now = GetTickCount(); tv->tv_sec = now / 1000; @@ -62,10 +62,10 @@ namespace Test tv->tv_sec = time(0); tv->tv_usec = 0; #endif // #ifdef HAVE_GETTICKCOUNT - + return 0; } - + #endif // #ifndef HAVE_GETTIMEOFDAY #ifndef HAVE_ROUND @@ -74,7 +74,7 @@ namespace Test { return d > 0.0 ? floor(d + 0.5) : ceil(d - 0.5); } -#endif +#endif } // namespace Test diff --git a/tests/cppunit/missing.h b/tests/cppunit/missing.h index 78af19401..016ffb39c 100644 --- a/tests/cppunit/missing.h +++ b/tests/cppunit/missing.h @@ -31,7 +31,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif namespace Test { @@ -42,15 +42,15 @@ namespace Test long tv_sec; long tv_usec; }; - + extern int gettimeofday(timeval* tv, void*); - + #endif // #ifndef HAVE_GETTIMEOFDAY - + #ifndef HAVE_ROUND extern double round(double d); -#endif - +#endif + } // namespace Test #endif // #ifndef CPPTEST_MISSING_H diff --git a/tests/cppunit/source.cpp b/tests/cppunit/source.cpp index b1cebda53..cc4a3609e 100644 --- a/tests/cppunit/source.cpp +++ b/tests/cppunit/source.cpp @@ -36,7 +36,7 @@ namespace Test Source::Source() : _line(0) {} - + /// Constructs a source object. /// /// \param file Name of the file containing the failing function. @@ -48,15 +48,15 @@ namespace Test _file(file ? file : ""), _msg(msg ? msg : "") {} - + /// \return Name of the file containing the failing function. /// const string& - Source::file() const + Source::file() const { return _file; } - + /// \return Line where the function starts. /// unsigned int @@ -64,7 +64,7 @@ namespace Test { return _line; } - + /// \return Descriptive message. /// const string& @@ -72,7 +72,7 @@ namespace Test { return _msg; } - + /// \return Name of the suite, which the test belongs to. /// const string& diff --git a/tests/cppunit/suite.cpp b/tests/cppunit/suite.cpp index f531e6c8f..7f344d06c 100644 --- a/tests/cppunit/suite.cpp +++ b/tests/cppunit/suite.cpp @@ -34,7 +34,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "cpptest-output.h" #include "cpptest-source.h" @@ -55,9 +55,9 @@ namespace Test while (first != last) delete *first++; } - + } // anonymous namespace - + /// Constructs an empty test suite. /// Suite::Suite() @@ -65,14 +65,14 @@ namespace Test _output(0), _success(true) {} - + /// Destroys this suite object. /// Suite::~Suite() { destroy_range(_suites.begin(), _suites.end()); } - + /// Starts the testing. All tests in this suite and embedded suites will /// be executed. /// @@ -90,7 +90,7 @@ namespace Test output.finished(ntests, total_time(true)); return _success; } - + /// \fn void Suite::setup() /// /// Setups a test fixture. This function is called before each test, @@ -100,7 +100,7 @@ namespace Test /// specialized behavior. /// /// \see tear_down() - + /// \fn void Suite::tear_down() /// /// Tears down a test fixture. This function is called after each test, @@ -110,7 +110,7 @@ namespace Test /// specialized behavior. /// /// \see setup() - + /// Adds a suite to this suite. Tests in added suites will be executed /// when run() of the top-level suite is called. /// @@ -121,7 +121,7 @@ namespace Test { _suites.push_back(suite); } - + /// Registers a test function. /// /// \b Note: Do not call this function directly, use the TEST_ADD(func) @@ -136,11 +136,11 @@ namespace Test { string::size_type pos = name.find_first_of(':'); assert(!name.empty() && name[pos + 1] == ':' && name[pos + 2] != '\0'); - + _name.assign(name, 0, pos); _tests.push_back(Data(func, name.substr(pos + 2))); } - + /// Issues an assertment to the output handler. /// /// Do not call this function directly, use one of the available assertment @@ -156,21 +156,21 @@ namespace Test _output->assertment(s); _result = _success = false; } - + // Functor to execute tests for the given suite. // struct Suite::ExecTests { Suite& _suite; - + ExecTests(Suite& s) : _suite(s) {} - + void operator()(Data& data) { _suite._cur_test = &data._name; _suite._result = true; // assume success, assert will set to false _suite._output->test_start(data._name); - + _suite.setup(); Time start(Time::current()); // FIXME Also feedback exception to user @@ -182,7 +182,7 @@ namespace Test } Time end(Time::current()); _suite.tear_down(); - + data._time = end - start; _suite._output->test_end(data._name, _suite._result, data._time); } @@ -194,7 +194,7 @@ namespace Test { bool _continue; Output* _output; - + DoRun(Output* output, bool cont) : _continue(cont), _output(output) {} void operator()(Suite* suite) { suite->do_run(_output, _continue); } }; @@ -206,7 +206,7 @@ namespace Test { _continue = cont_after_fail; _output = os; - + _output->suite_start(_tests.size(), _name); for_each(_tests.begin(), _tests.end(), ExecTests(*this)); _output->suite_end(_tests.size(), _name, total_time(false)); @@ -235,7 +235,7 @@ namespace Test return value + s->total_tests(); } }; - + // Counts all tests in this and all its embedded suites. // int @@ -244,7 +244,7 @@ namespace Test return accumulate(_suites.begin(), _suites.end(), _tests.size(), SubSuiteTests()); } - + // Functor to accumulate execution time for tests. // struct Suite::SuiteTime @@ -254,7 +254,7 @@ namespace Test return time + data._time; } }; - + // Functor to accumulate execution time for suites. // struct Suite::SubSuiteTime @@ -264,7 +264,7 @@ namespace Test return time + s->total_time(true); } }; - + // Counts time accumulated execution time for all tests in this and all // its embedded suites. // @@ -273,9 +273,9 @@ namespace Test { Time time = accumulate(_tests.begin(), _tests.end(), Time(), SuiteTime()); - + return !recursive ? time : accumulate(_suites.begin(), _suites.end(), time, SubSuiteTime()); } - + } // namespace Test diff --git a/tests/cppunit/textoutput.cpp b/tests/cppunit/textoutput.cpp index 792a89439..bb0846927 100644 --- a/tests/cppunit/textoutput.cpp +++ b/tests/cppunit/textoutput.cpp @@ -30,7 +30,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "cpptest-textoutput.h" #include "cpptest-time.h" @@ -55,12 +55,12 @@ namespace Test << "\tFile: " << s.file() << endl << "\tLine: " << s.line() << endl << "\tMessage: " << s.message() << endl << endl; - + } }; - + } // anonymous namespace - + /// Constructs a text output handler. /// /// \param mode Output mode. @@ -71,7 +71,7 @@ namespace Test _stream(stream), _total_errors(0) {} - + void TextOutput::finished(int tests, const Time& time) { @@ -79,7 +79,7 @@ namespace Test << correct(tests, _total_errors) << "% correct" << " in " << time << " seconds" << endl; } - + void TextOutput::suite_start(int tests, const string& name) { @@ -89,13 +89,13 @@ namespace Test _suite_tests = _suite_errors = 0; _suite_total_tests = tests; _suite_error_list.clear(); - + _stream << _suite_name << ": " << "0/" << _suite_total_tests << "\r" << flush; } } - + void TextOutput::suite_end(int tests, const string& name, const Time& time) { @@ -104,15 +104,15 @@ namespace Test _stream << name << ": " << tests << "/" << tests << ", " << correct(tests, _suite_errors) << "% correct" << " in " << time << " seconds" << endl; - + if (_mode == Verbose && _suite_errors) for_each(_suite_error_list.begin(), _suite_error_list.end(), ShowSource(_stream)); - + _total_errors += _suite_errors; } } - + void TextOutput::test_end(const string&, bool ok, const Time&) { @@ -122,11 +122,11 @@ namespace Test if (!ok) ++_suite_errors; } - + void TextOutput::assertment(const Source& s) { _suite_error_list.push_back(s); } - + } // namespace Test diff --git a/tests/cppunit/time.cpp b/tests/cppunit/time.cpp index 4b7a988f5..7ba55a36b 100644 --- a/tests/cppunit/time.cpp +++ b/tests/cppunit/time.cpp @@ -28,7 +28,7 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "missing.h" #include "cpptest-time.h" @@ -48,16 +48,16 @@ namespace Test namespace { const unsigned int UsecPerSec = 1000000; - + } // anonymous namespace - + /// Constructs a time object with zeroed time. /// Time::Time() : _sec(0), _usec(0) {} - + /// Constructs a time object. /// /// \param sec Seconds. @@ -67,7 +67,7 @@ namespace Test : _sec(sec), _usec(usec) {} - + /// \return Seconds. /// unsigned int @@ -75,7 +75,7 @@ namespace Test { return _sec; } - + /// \return Micro-seconds. /// unsigned int @@ -83,7 +83,7 @@ namespace Test { return _usec; } - + /// \return The current time. /// Time @@ -93,7 +93,7 @@ namespace Test gettimeofday(&tv, 0); return Time(tv.tv_sec, tv.tv_usec); } - + /// \relates Time /// /// Computes the time elapsed between two time values. @@ -108,10 +108,10 @@ namespace Test { if (t2._sec > t1._sec || (t2._sec == t1._sec && t2._usec > t1._usec)) return Time(); - + unsigned int sec = t1._sec - t2._sec; unsigned int usec; - + if (t2._usec > t1._usec) { --sec; @@ -119,10 +119,10 @@ namespace Test } else usec = t1._usec - t2._usec; - + return Time(sec, usec); } - + /// \relates Time /// /// Adds two time values. @@ -137,7 +137,7 @@ namespace Test { unsigned int sec = t1._sec + t2._sec; unsigned int usec = t1._usec + t2._usec; - + if (usec > UsecPerSec) { ++sec; @@ -145,7 +145,7 @@ namespace Test } return Time(sec, usec); } - + /// \relates Time /// /// Outputs a time to an output stream. @@ -171,6 +171,6 @@ namespace Test return os; } - + } // namespace Test diff --git a/tests/cppunit/utils.cpp b/tests/cppunit/utils.cpp index ebf850239..f7e545592 100644 --- a/tests/cppunit/utils.cpp +++ b/tests/cppunit/utils.cpp @@ -29,13 +29,13 @@ # include "winconfig.h" #else # include "config.h" -#endif +#endif #include "missing.h" #include "utils.h" namespace Test -{ +{ // Computes the procentage of correct tests. // int diff --git a/tests/cppunit/utils.h b/tests/cppunit/utils.h index 967e0afaf..c3a48e420 100644 --- a/tests/cppunit/utils.h +++ b/tests/cppunit/utils.h @@ -30,7 +30,7 @@ namespace Test { extern int correct(int tests, int errors); - + } // namespace Test #endif // #ifndef CPPTEST_UTILS_H diff --git a/tests/cppunit/winconfig.h b/tests/cppunit/winconfig.h index 6b2858a62..9546ebf5a 100644 --- a/tests/cppunit/winconfig.h +++ b/tests/cppunit/winconfig.h @@ -36,7 +36,7 @@ #if _MSC_VER == 1200 // MS Visual C++ 6.0 #pragma warning (disable: 4786) #endif - + #if _MSC_VER > 1300 // MS Visual C++ .NET 2002 and above #pragma warning (disable: 4267) #endif diff --git a/tests/fixed_memory_test.h b/tests/fixed_memory_test.h index d0463a849..089b8f7c0 100644 --- a/tests/fixed_memory_test.h +++ b/tests/fixed_memory_test.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_TESTS_FIXED_MEMORY_H @@ -24,214 +24,214 @@ #include "../common/Item.h" class FixedMemoryHashTest : public Test::Suite { - typedef void(FixedMemoryHashTest::*TestFunction)(void); + typedef void(FixedMemoryHashTest::*TestFunction)(void); public: - FixedMemoryHashTest() { - size_ = EQEmu::FixedMemoryHashSet::estimated_size(72000, 190000); - data_ = new uint8[size_]; - memset(data_, 0, size_); - TEST_ADD(FixedMemoryHashTest::InitTest); - TEST_ADD(FixedMemoryHashTest::LoadTest); - TEST_ADD(FixedMemoryHashTest::InsertTest); - TEST_ADD(FixedMemoryHashTest::RetrieveTest); - TEST_ADD(FixedMemoryHashTest::OverwriteTest); - TEST_ADD(FixedMemoryHashTest::OverwriteRetrieveTest); - TEST_ADD(FixedMemoryHashTest::InsertAgainTest); - TEST_ADD(FixedMemoryHashTest::RetrieveAgainTest); - TEST_ADD(FixedMemoryHashTest::InsertBeginTest); - TEST_ADD(FixedMemoryHashTest::RetrieveBeginTest); - TEST_ADD(FixedMemoryHashTest::InsertEndTest); - TEST_ADD(FixedMemoryHashTest::RetrieveEndTest); - } - ~FixedMemoryHashTest() { - delete[] data_; - } - - private: - void InitTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_, 72000, 190000); - TEST_ASSERT(!hash.exists(1001)); - TEST_ASSERT(hash.size() == 0); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(hash.empty()); - } + FixedMemoryHashTest() { + size_ = EQEmu::FixedMemoryHashSet::estimated_size(72000, 190000); + data_ = new uint8[size_]; + memset(data_, 0, size_); + TEST_ADD(FixedMemoryHashTest::InitTest); + TEST_ADD(FixedMemoryHashTest::LoadTest); + TEST_ADD(FixedMemoryHashTest::InsertTest); + TEST_ADD(FixedMemoryHashTest::RetrieveTest); + TEST_ADD(FixedMemoryHashTest::OverwriteTest); + TEST_ADD(FixedMemoryHashTest::OverwriteRetrieveTest); + TEST_ADD(FixedMemoryHashTest::InsertAgainTest); + TEST_ADD(FixedMemoryHashTest::RetrieveAgainTest); + TEST_ADD(FixedMemoryHashTest::InsertBeginTest); + TEST_ADD(FixedMemoryHashTest::RetrieveBeginTest); + TEST_ADD(FixedMemoryHashTest::InsertEndTest); + TEST_ADD(FixedMemoryHashTest::RetrieveEndTest); + } + ~FixedMemoryHashTest() { + delete[] data_; + } - void LoadTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - TEST_ASSERT(!hash.exists(1001)); - TEST_ASSERT(hash.size() == 0); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(hash.empty()); - } + private: + void InitTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_, 72000, 190000); + TEST_ASSERT(!hash.exists(1001)); + TEST_ASSERT(hash.size() == 0); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(hash.empty()); + } - void InsertTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; - memset(&item, 0, sizeof(item)); - strcpy(item.Name, "Iron Sword"); - item.ID = 1001; - hash.insert(1001, item); - - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.size() == 1); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - } + void LoadTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + TEST_ASSERT(!hash.exists(1001)); + TEST_ASSERT(hash.size() == 0); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(hash.empty()); + } - void RetrieveTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.size() == 1); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - - Item_Struct item = hash[1001]; - TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); - TEST_ASSERT(item.ID == 1001); - } + void InsertTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + Item_Struct item; + memset(&item, 0, sizeof(item)); + strcpy(item.Name, "Iron Sword"); + item.ID = 1001; + hash.insert(1001, item); - void OverwriteTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; - memset(&item, 0, sizeof(item)); - strcpy(item.Name, "Steel Sword"); - item.ID = 1001; - hash.insert(1001, item); - - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.size() == 1); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - } + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.size() == 1); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); + } - void OverwriteRetrieveTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.size() == 1); - TEST_ASSERT((hash.max_size() == 72000)); - TEST_ASSERT(!hash.empty()); - - Item_Struct item = hash[1001]; - TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); - TEST_ASSERT(item.ID == 1001); - } + void RetrieveTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.size() == 1); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); - void InsertAgainTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; - memset(&item, 0, sizeof(item)); - strcpy(item.Name, "Iron Sword"); - item.ID = 1000; - hash.insert(1000, item); + Item_Struct item = hash[1001]; + TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); + TEST_ASSERT(item.ID == 1001); + } - TEST_ASSERT(hash.exists(1000)); - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.size() == 2); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - } + void OverwriteTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + Item_Struct item; + memset(&item, 0, sizeof(item)); + strcpy(item.Name, "Steel Sword"); + item.ID = 1001; + hash.insert(1001, item); - void RetrieveAgainTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - TEST_ASSERT(hash.exists(1000)); - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.size() == 2); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - - Item_Struct item = hash[1000]; - TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); - TEST_ASSERT(item.ID == 1000); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.size() == 1); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); + } - item = hash[1001]; - TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); - TEST_ASSERT(item.ID == 1001); - } + void OverwriteRetrieveTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.size() == 1); + TEST_ASSERT((hash.max_size() == 72000)); + TEST_ASSERT(!hash.empty()); - void InsertBeginTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; - memset(&item, 0, sizeof(item)); - strcpy(item.Name, "Bronze Sword"); - item.ID = 0; - hash.insert(0, item); + Item_Struct item = hash[1001]; + TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); + TEST_ASSERT(item.ID == 1001); + } - TEST_ASSERT(hash.exists(1000)); - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(hash.size() == 3); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - } + void InsertAgainTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + Item_Struct item; + memset(&item, 0, sizeof(item)); + strcpy(item.Name, "Iron Sword"); + item.ID = 1000; + hash.insert(1000, item); - void RetrieveBeginTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - TEST_ASSERT(hash.exists(1000)); - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(hash.size() == 3); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - - Item_Struct item = hash[1000]; - TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); - TEST_ASSERT(item.ID == 1000); + TEST_ASSERT(hash.exists(1000)); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.size() == 2); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); + } - item = hash[1001]; - TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); - TEST_ASSERT(item.ID == 1001); + void RetrieveAgainTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + TEST_ASSERT(hash.exists(1000)); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.size() == 2); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); - item = hash[0]; - TEST_ASSERT(strcmp(item.Name, "Bronze Sword") == 0); - TEST_ASSERT(item.ID == 0); - } + Item_Struct item = hash[1000]; + TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); + TEST_ASSERT(item.ID == 1000); - void InsertEndTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; - memset(&item, 0, sizeof(item)); - strcpy(item.Name, "Jade Sword"); - item.ID = 190000; - hash.insert(190000, item); + item = hash[1001]; + TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); + TEST_ASSERT(item.ID == 1001); + } - TEST_ASSERT(hash.exists(1000)); - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(hash.exists(190000)); - TEST_ASSERT(hash.size() == 4); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - } + void InsertBeginTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + Item_Struct item; + memset(&item, 0, sizeof(item)); + strcpy(item.Name, "Bronze Sword"); + item.ID = 0; + hash.insert(0, item); - void RetrieveEndTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - TEST_ASSERT(hash.exists(1000)); - TEST_ASSERT(hash.exists(1001)); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(hash.exists(190000)); - TEST_ASSERT(hash.size() == 4); - TEST_ASSERT(hash.max_size() == 72000); - TEST_ASSERT(!hash.empty()); - - Item_Struct item = hash[1000]; - TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); - TEST_ASSERT(item.ID == 1000); + TEST_ASSERT(hash.exists(1000)); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(hash.size() == 3); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); + } - item = hash[1001]; - TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); - TEST_ASSERT(item.ID == 1001); + void RetrieveBeginTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + TEST_ASSERT(hash.exists(1000)); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(hash.size() == 3); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); - item = hash[0]; - TEST_ASSERT(strcmp(item.Name, "Bronze Sword") == 0); - TEST_ASSERT(item.ID == 0); + Item_Struct item = hash[1000]; + TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); + TEST_ASSERT(item.ID == 1000); - item = hash[190000]; - TEST_ASSERT(strcmp(item.Name, "Jade Sword") == 0); - TEST_ASSERT(item.ID == 190000); - } + item = hash[1001]; + TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); + TEST_ASSERT(item.ID == 1001); + + item = hash[0]; + TEST_ASSERT(strcmp(item.Name, "Bronze Sword") == 0); + TEST_ASSERT(item.ID == 0); + } + + void InsertEndTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + Item_Struct item; + memset(&item, 0, sizeof(item)); + strcpy(item.Name, "Jade Sword"); + item.ID = 190000; + hash.insert(190000, item); + + TEST_ASSERT(hash.exists(1000)); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(hash.exists(190000)); + TEST_ASSERT(hash.size() == 4); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); + } + + void RetrieveEndTest() { + EQEmu::FixedMemoryHashSet hash(data_, size_); + TEST_ASSERT(hash.exists(1000)); + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(hash.exists(190000)); + TEST_ASSERT(hash.size() == 4); + TEST_ASSERT(hash.max_size() == 72000); + TEST_ASSERT(!hash.empty()); + + Item_Struct item = hash[1000]; + TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); + TEST_ASSERT(item.ID == 1000); + + item = hash[1001]; + TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); + TEST_ASSERT(item.ID == 1001); + + item = hash[0]; + TEST_ASSERT(strcmp(item.Name, "Bronze Sword") == 0); + TEST_ASSERT(item.ID == 0); + + item = hash[190000]; + TEST_ASSERT(strcmp(item.Name, "Jade Sword") == 0); + TEST_ASSERT(item.ID == 190000); + } private: - uint8 *data_; - size_t size_; + uint8 *data_; + size_t size_; }; #endif diff --git a/tests/fixed_memory_variable_test.h b/tests/fixed_memory_variable_test.h index cd77d29b0..a728093ef 100644 --- a/tests/fixed_memory_variable_test.h +++ b/tests/fixed_memory_variable_test.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_TESTS_FIXED_MEMORY_VARIABLE_H @@ -23,111 +23,111 @@ #include "../common/fixed_memory_variable_hash_set.h" struct test_struct { - char name[512]; + char name[512]; }; class FixedMemoryVariableHashTest : public Test::Suite { - typedef void(FixedMemoryVariableHashTest::*TestFunction)(void); + typedef void(FixedMemoryVariableHashTest::*TestFunction)(void); public: - FixedMemoryVariableHashTest() { - size_ = 1024 + 12 + 2008; - data_ = new uint8[size_]; - memset(data_, 0, size_); - TEST_ADD(FixedMemoryVariableHashTest::InitTest); - TEST_ADD(FixedMemoryVariableHashTest::LoadTest); - TEST_ADD(FixedMemoryVariableHashTest::InsertTest); - TEST_ADD(FixedMemoryVariableHashTest::RetrieveTest); - TEST_ADD(FixedMemoryVariableHashTest::InsertAgainTest); - TEST_ADD(FixedMemoryVariableHashTest::RetrieveAgainTest); - TEST_ADD(FixedMemoryVariableHashTest::InsertAgainFailTest); - TEST_ADD(FixedMemoryVariableHashTest::RetrieveAgainFailTest); - } - ~FixedMemoryVariableHashTest() { - delete[] data_; - } - - private: - void InitTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_, 501); - TEST_ASSERT(!hash.exists(0)); - TEST_ASSERT(!hash.exists(501)); - } + FixedMemoryVariableHashTest() { + size_ = 1024 + 12 + 2008; + data_ = new uint8[size_]; + memset(data_, 0, size_); + TEST_ADD(FixedMemoryVariableHashTest::InitTest); + TEST_ADD(FixedMemoryVariableHashTest::LoadTest); + TEST_ADD(FixedMemoryVariableHashTest::InsertTest); + TEST_ADD(FixedMemoryVariableHashTest::RetrieveTest); + TEST_ADD(FixedMemoryVariableHashTest::InsertAgainTest); + TEST_ADD(FixedMemoryVariableHashTest::RetrieveAgainTest); + TEST_ADD(FixedMemoryVariableHashTest::InsertAgainFailTest); + TEST_ADD(FixedMemoryVariableHashTest::RetrieveAgainFailTest); + } + ~FixedMemoryVariableHashTest() { + delete[] data_; + } - void LoadTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - TEST_ASSERT(!hash.exists(0)); - TEST_ASSERT(!hash.exists(501)); - } + private: + void InitTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_, 501); + TEST_ASSERT(!hash.exists(0)); + TEST_ASSERT(!hash.exists(501)); + } - void InsertTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - test_struct test; - memset(&test, 0, sizeof(test)); - strcpy(test.name, "Bill D."); + void LoadTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + TEST_ASSERT(!hash.exists(0)); + TEST_ASSERT(!hash.exists(501)); + } - hash.insert(0, reinterpret_cast(&test), sizeof(test)); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(!hash.exists(501)); - } - - void RetrieveTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(!hash.exists(501)); - - test_struct test = hash[0]; - TEST_ASSERT(strcmp(test.name, "Bill D.") == 0); - } + void InsertTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + test_struct test; + memset(&test, 0, sizeof(test)); + strcpy(test.name, "Bill D."); - void InsertAgainTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - test_struct test; - memset(&test, 0, sizeof(test)); - strcpy(test.name, "Jimmy P."); + hash.insert(0, reinterpret_cast(&test), sizeof(test)); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(!hash.exists(501)); + } - hash.insert(501, reinterpret_cast(&test), sizeof(test)); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(hash.exists(501)); - } + void RetrieveTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(!hash.exists(501)); - void RetrieveAgainTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(hash.exists(501)); - - test_struct test = hash[501]; - TEST_ASSERT(strcmp(test.name, "Jimmy P.") == 0); - } + test_struct test = hash[0]; + TEST_ASSERT(strcmp(test.name, "Bill D.") == 0); + } - void InsertAgainFailTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - test_struct test; - memset(&test, 0, sizeof(test)); - strcpy(test.name, "Tommy M."); + void InsertAgainTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + test_struct test; + memset(&test, 0, sizeof(test)); + strcpy(test.name, "Jimmy P."); - try { - hash.insert(500, reinterpret_cast(&test), sizeof(test)); - } catch(std::exception&) { } + hash.insert(501, reinterpret_cast(&test), sizeof(test)); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(hash.exists(501)); + } - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(hash.exists(501)); - TEST_ASSERT(!hash.exists(500)); - } + void RetrieveAgainTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(hash.exists(501)); - void RetrieveAgainFailTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - TEST_ASSERT(hash.exists(0)); - TEST_ASSERT(hash.exists(501)); - TEST_ASSERT(!hash.exists(500)); - - try { - test_struct test = hash[500]; - TEST_ASSERT(false); - } catch(std::exception&) { } - } + test_struct test = hash[501]; + TEST_ASSERT(strcmp(test.name, "Jimmy P.") == 0); + } + + void InsertAgainFailTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + test_struct test; + memset(&test, 0, sizeof(test)); + strcpy(test.name, "Tommy M."); + + try { + hash.insert(500, reinterpret_cast(&test), sizeof(test)); + } catch(std::exception&) { } + + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(hash.exists(501)); + TEST_ASSERT(!hash.exists(500)); + } + + void RetrieveAgainFailTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + TEST_ASSERT(hash.exists(0)); + TEST_ASSERT(hash.exists(501)); + TEST_ASSERT(!hash.exists(500)); + + try { + test_struct test = hash[500]; + TEST_ASSERT(false); + } catch(std::exception&) { } + } private: - uint8 *data_; - uint32 size_; + uint8 *data_; + uint32 size_; }; #endif diff --git a/tests/ipc_mutex_test.h b/tests/ipc_mutex_test.h index 1ecd1d11f..69c70ca93 100644 --- a/tests/ipc_mutex_test.h +++ b/tests/ipc_mutex_test.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_TESTS_IPC_MUTEX_H @@ -23,42 +23,42 @@ #include "../common/ipc_mutex.h" class IPCMutexTest : public Test::Suite { - typedef void(IPCMutexTest::*TestFunction)(void); + typedef void(IPCMutexTest::*TestFunction)(void); public: - IPCMutexTest() { - TEST_ADD(IPCMutexTest::LockMutexTest); - TEST_ADD(IPCMutexTest::UnlockMutexTest); - TEST_ADD(IPCMutexTest::DoubleLockMutexTest); - TEST_ADD(IPCMutexTest::DoubleUnlockMutexTest); - } + IPCMutexTest() { + TEST_ADD(IPCMutexTest::LockMutexTest); + TEST_ADD(IPCMutexTest::UnlockMutexTest); + TEST_ADD(IPCMutexTest::DoubleLockMutexTest); + TEST_ADD(IPCMutexTest::DoubleUnlockMutexTest); + } - ~IPCMutexTest() { - } - - private: - void LockMutexTest() { - EQEmu::IPCMutex mutex("TestMutex1"); - TEST_ASSERT(mutex.Lock()); - TEST_ASSERT(mutex.Unlock()); - } + ~IPCMutexTest() { + } - void UnlockMutexTest() { - EQEmu::IPCMutex mutex("TestMutex2"); - TEST_ASSERT(!mutex.Unlock()); - } + private: + void LockMutexTest() { + EQEmu::IPCMutex mutex("TestMutex1"); + TEST_ASSERT(mutex.Lock()); + TEST_ASSERT(mutex.Unlock()); + } - void DoubleLockMutexTest() { - EQEmu::IPCMutex mutex("TestMutex3"); - TEST_ASSERT(mutex.Lock()); - TEST_ASSERT(!mutex.Lock()); - } + void UnlockMutexTest() { + EQEmu::IPCMutex mutex("TestMutex2"); + TEST_ASSERT(!mutex.Unlock()); + } - void DoubleUnlockMutexTest() { - EQEmu::IPCMutex mutex("TestMutex4"); - TEST_ASSERT(mutex.Lock()); - TEST_ASSERT(mutex.Unlock()); - TEST_ASSERT(!mutex.Unlock()); - } + void DoubleLockMutexTest() { + EQEmu::IPCMutex mutex("TestMutex3"); + TEST_ASSERT(mutex.Lock()); + TEST_ASSERT(!mutex.Lock()); + } + + void DoubleUnlockMutexTest() { + EQEmu::IPCMutex mutex("TestMutex4"); + TEST_ASSERT(mutex.Lock()); + TEST_ASSERT(mutex.Unlock()); + TEST_ASSERT(!mutex.Unlock()); + } }; #endif diff --git a/tests/main.cpp b/tests/main.cpp index b43cf2081..d12aa143c 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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 */ @@ -26,17 +26,17 @@ #include "fixed_memory_variable_test.h" int main() { - try { - std::ofstream outfile("test_output.txt"); - std::unique_ptr output(new Test::TextOutput(Test::TextOutput::Verbose, outfile)); - Test::Suite tests; - tests.add(new MemoryMappedFileTest()); - tests.add(new IPCMutexTest()); - tests.add(new FixedMemoryHashTest()); - tests.add(new FixedMemoryVariableHashTest()); - tests.run(*output, true); - } catch(...) { - return -1; - } - return 0; + try { + std::ofstream outfile("test_output.txt"); + std::unique_ptr output(new Test::TextOutput(Test::TextOutput::Verbose, outfile)); + Test::Suite tests; + tests.add(new MemoryMappedFileTest()); + tests.add(new IPCMutexTest()); + tests.add(new FixedMemoryHashTest()); + tests.add(new FixedMemoryVariableHashTest()); + tests.run(*output, true); + } catch(...) { + return -1; + } + return 0; } diff --git a/tests/memory_mapped_file_test.h b/tests/memory_mapped_file_test.h index cccf73162..3ce61d44e 100644 --- a/tests/memory_mapped_file_test.h +++ b/tests/memory_mapped_file_test.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2013 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 + 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 + 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_TESTS_MEMORY_MAPPED_FILE_H @@ -23,38 +23,38 @@ #include "../common/memory_mapped_file.h" class MemoryMappedFileTest : public Test::Suite { - typedef void(MemoryMappedFileTest::*TestFunction)(void); + typedef void(MemoryMappedFileTest::*TestFunction)(void); public: - MemoryMappedFileTest() { - TEST_ADD(MemoryMappedFileTest::LoadAndZeroMMF) - TEST_ADD(MemoryMappedFileTest::LoadExistingMMF) - } + MemoryMappedFileTest() { + TEST_ADD(MemoryMappedFileTest::LoadAndZeroMMF) + TEST_ADD(MemoryMappedFileTest::LoadExistingMMF) + } - ~MemoryMappedFileTest() { - } + ~MemoryMappedFileTest() { + } - private: - void LoadAndZeroMMF() { - EQEmu::MemoryMappedFile mmf("testfile.txt", 512); - mmf.ZeroFile(); - TEST_ASSERT(mmf.Size() == 512); - - unsigned char *data = reinterpret_cast(mmf.Get()); - TEST_ASSERT(data != nullptr); - - *reinterpret_cast(data) = 562; - } - - void LoadExistingMMF() { - EQEmu::MemoryMappedFile mmf("testfile.txt"); - TEST_ASSERT(mmf.Size() == 512); - - unsigned char *data = reinterpret_cast(mmf.Get()); - TEST_ASSERT(data != nullptr); - - uint32 val = *reinterpret_cast(data); - TEST_ASSERT(val == 562); - } + private: + void LoadAndZeroMMF() { + EQEmu::MemoryMappedFile mmf("testfile.txt", 512); + mmf.ZeroFile(); + TEST_ASSERT(mmf.Size() == 512); + + unsigned char *data = reinterpret_cast(mmf.Get()); + TEST_ASSERT(data != nullptr); + + *reinterpret_cast(data) = 562; + } + + void LoadExistingMMF() { + EQEmu::MemoryMappedFile mmf("testfile.txt"); + TEST_ASSERT(mmf.Size() == 512); + + unsigned char *data = reinterpret_cast(mmf.Get()); + TEST_ASSERT(data != nullptr); + + uint32 val = *reinterpret_cast(data); + TEST_ASSERT(val == 562); + } }; #endif diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index 1218541a3..30af23655 100644 --- a/ucs/CMakeLists.txt +++ b/ucs/CMakeLists.txt @@ -1,20 +1,20 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(ucs_sources - chatchannel.cpp - clientlist.cpp - database.cpp - ucs.cpp - ucsconfig.cpp - worldserver.cpp + chatchannel.cpp + clientlist.cpp + database.cpp + ucs.cpp + ucsconfig.cpp + worldserver.cpp ) SET(ucs_headers - chatchannel.h - clientlist.h - database.h - ucsconfig.h - worldserver.h + chatchannel.h + clientlist.h + database.h + ucsconfig.h + worldserver.h ) ADD_EXECUTABLE(ucs ${ucs_sources} ${ucs_headers}) @@ -24,22 +24,25 @@ ADD_DEFINITIONS(-DUCS) TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) - - SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib") + + SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib") ENDIF(MSVC) IF(MINGW) - TARGET_LINK_LIBRARIES(ucs "WS2_32") + TARGET_LINK_LIBRARIES(ucs "WS2_32") ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(ucs "dl") - TARGET_LINK_LIBRARIES(ucs "z") - TARGET_LINK_LIBRARIES(ucs "m") - TARGET_LINK_LIBRARIES(ucs "rt") - TARGET_LINK_LIBRARIES(ucs "pthread") - ADD_DEFINITIONS(-fPIC) + + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(ucs "dl") + ENDIF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(ucs "z") + TARGET_LINK_LIBRARIES(ucs "m") + TARGET_LINK_LIBRARIES(ucs "rt") + TARGET_LINK_LIBRARIES(ucs "pthread") + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index 6167c7e05..140ccdb68 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -28,7 +26,7 @@ extern Database database; extern uint32 ChatMessagesSent; -ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool inPermanent, int inMinimumStatus) : +ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool inPermanent, int inMinimumStatus) : DeleteTimer(0) { Name = inName; @@ -43,8 +41,8 @@ ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool Moderated = false; - _log(UCS__TRACE, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", - Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); + _log(UCS__TRACE, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", + Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -301,7 +299,7 @@ bool ChatChannel::RemoveClient(Client *c) { return false; _log(UCS__TRACE, "Starting delete timer for empty password protected channel %s", Name.c_str()); - + DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); } @@ -399,7 +397,7 @@ void ChatChannel::SendMessageToChannel(string Message, Client* Sender) { if(ChannelClient) { _log(UCS__TRACE, "Sending message to %s from %s", - ChannelClient->GetName().c_str(), Sender->GetName().c_str()); + ChannelClient->GetName().c_str(), Sender->GetName().c_str()); ChannelClient->SendChannelMessage(Name, Message, Sender); } @@ -455,7 +453,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c) if(!c) return nullptr; if((ChannelName.length() > 0) && (isdigit(ChannelName[0]))) { - + c->GeneralChannelMessage("The channel name can not begin with a number."); return nullptr; @@ -465,7 +463,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c) string::size_type Colon = ChannelName.find_first_of(":"); - if(Colon == string::npos) + if(Colon == string::npos) NormalisedName = CapitaliseName(ChannelName); else { NormalisedName = CapitaliseName(ChannelName.substr(0, Colon)); @@ -509,7 +507,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c) } if(RequiredChannel->CheckPassword(Password) || RequiredChannel->IsOwner(c->GetName()) || RequiredChannel->IsModerator(c->GetName()) || - c->IsChannelAdmin()) { + c->IsChannelAdmin()) { RequiredChannel->AddClient(c); @@ -704,3 +702,4 @@ string CapitaliseName(string inString) { return NormalisedName; } + diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 9a857c3cd..4c57190c8 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -83,8 +81,8 @@ vector ParseRecipients(string RecipientString) { // This method parses the Recipient List in the mailto command, which can look like this example: // - // "Baalinor , - // -Friends , + // "Baalinor , + // -Friends , // Guild , SOE.EQ.BTG2.luccerathe, SOE.EQ.BTG2.codsas // // First, it splits it up at commas, so it looks like this: @@ -180,7 +178,7 @@ vector ParseRecipients(string RecipientString) { break; } - RecipientList.push_back(Secret + Recips.substr(CurrentPos, + RecipientList.push_back(Secret + Recips.substr(CurrentPos, Space - CurrentPos)); CurrentPos = Space + 1; } @@ -191,9 +189,9 @@ vector ParseRecipients(string RecipientString) { } } - + (*Iterator) = Secret + (*Iterator); - + Iterator++; } @@ -209,10 +207,10 @@ vector ParseRecipients(string RecipientString) { LastPeriod = (*Iterator).find_last_of("."); - if(LastPeriod != string::npos) { + if(LastPeriod != string::npos) { (*Iterator) = (*Iterator).substr(LastPeriod + 1); - + for(unsigned int i = 0; i < (*Iterator).length(); i++) { if(i == 0) @@ -240,7 +238,7 @@ vector ParseRecipients(string RecipientString) { static void ProcessMailTo(Client *c, string MailMessage) { _log(UCS__TRACE, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); - + vector Recipients; string::size_type FirstQuote = MailMessage.find_first_of("\"", 0); @@ -309,7 +307,7 @@ static void ProcessMailTo(Client *c, string MailMessage) { if(!database.SendMail(Recipients[i], c->MailBoxName(), Subject, Body, RecipientsString)) { _log(UCS__ERROR, "Failed in SendMail(%s, %s, %s, %s)", Recipients[i].c_str(), - c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); + c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); int PacketLength = 10 + Recipients[i].length() + Subject.length(); @@ -335,7 +333,7 @@ static void ProcessMailTo(Client *c, string MailMessage) { Success = false; } } - + if(Success) { // Success EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailDeliveryStatus, 10); @@ -494,7 +492,7 @@ Clientlist::Clientlist(int ChatPort) { Client::Client(EQStream *eqs) { - ClientStream = eqs; + ClientStream = eqs; CurrentMailBox = 0; @@ -561,17 +559,17 @@ void Clientlist::CheckForStaleConnections(Client *c) { for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) { if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) - && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { + && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { _log(UCS__CLIENT, "Removing old connection for %s", c->GetName().c_str()); - struct in_addr in; + struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); _log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in), - ntohs((*Iterator)->ClientStream->GetRemotePort())); - + ntohs((*Iterator)->ClientStream->GetRemotePort())); + safe_delete((*Iterator)); Iterator = ClientChatConnections.erase(Iterator); @@ -585,7 +583,7 @@ void Clientlist::Process() { while((eqs = chatsf->Pop())) { - struct in_addr in; + struct in_addr in; in.s_addr = eqs->GetRemoteIP(); @@ -605,13 +603,13 @@ void Clientlist::Process() { (*Iterator)->AccountUpdate(); if((*Iterator)->ClientStream->CheckClosed()) { - struct in_addr in; + struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); _log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in), - ntohs((*Iterator)->ClientStream->GetRemotePort())); - + ntohs((*Iterator)->ClientStream->GetRemotePort())); + safe_delete((*Iterator)); Iterator = ClientChatConnections.erase(Iterator); @@ -627,7 +625,7 @@ void Clientlist::Process() { bool KeyValid = true; while( KeyValid && !(*Iterator)->GetForceDisconnect() && - (app = (EQApplicationPacket *)(*Iterator)->ClientStream->PopPacket())) { + (app = (EQApplicationPacket *)(*Iterator)->ClientStream->PopPacket())) { _pkt(UCS__PACKETS, app); @@ -698,7 +696,7 @@ void Clientlist::Process() { case OP_Mail: { string CommandString = (const char*)app->pBuffer; - + ProcessOPMailCommand((*Iterator), CommandString); break; @@ -715,13 +713,13 @@ void Clientlist::Process() { } if(!KeyValid || (*Iterator)->GetForceDisconnect()) { - struct in_addr in; + struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); _log(UCS__TRACE, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", - inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()), - KeyValid, (*Iterator)->GetForceDisconnect()); + inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()), + KeyValid, (*Iterator)->GetForceDisconnect()); (*Iterator)->ClientStream->Close(); @@ -762,7 +760,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString) string::size_type Space = CommandString.find_first_of(" "); - if(Space != string::npos) { + if(Space != string::npos) { Command = CommandString.substr(0, Space); @@ -793,7 +791,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString) case CommandListAll: ChannelList->SendAllChannels(c); break; - + case CommandList: c->ProcessChannelList(Parameters); break; @@ -870,12 +868,12 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString) case CommandSelectMailBox: { string::size_type NumStart = Parameters.find_first_of("0123456789"); - c->ChangeMailBox(atoi(Parameters.substr(NumStart).c_str())); + c->ChangeMailBox(atoi(Parameters.substr(NumStart).c_str())); break; } case CommandSetMailForwarding: break; - + case CommandBuddy: RemoveApostrophes(Parameters); ProcessCommandBuddy(c, Parameters); @@ -924,7 +922,7 @@ void Client::SendMailBoxes() { int PacketLength = 10; string s; - + for(int i = 0; i < Count; i++) { s += GetMailPrefix() + Characters[i].Name; @@ -1028,7 +1026,7 @@ void Client::JoinChannels(string ChannelNameList) { if(NumberOfChannels == MAX_JOINED_CHANNELS) { GeneralChannelMessage("You have joined the maximum number of channels. /leave one before trying to join another."); - + break; } @@ -1238,7 +1236,7 @@ void Client::ProcessChannelList(string Input) { ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); - if(RequiredChannel) + if(RequiredChannel) RequiredChannel->SendChannelMembers(this); else GeneralChannelMessage("Channel " + Input + " not found."); @@ -1289,7 +1287,7 @@ void Client::SendChannelList() { safe_delete(outapp); } -void Client::SendChannelMessage(string Message) +void Client::SendChannelMessage(string Message) { string::size_type MessageStart = Message.find_first_of(" "); @@ -1311,7 +1309,7 @@ void Client::SendChannelMessage(string Message) if(ChannelName.compare("Newplayers") != 0) { - if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit)) + if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit)) { CharacterEntry *char_ent = nullptr; for(int x = 0; x < Characters.size(); ++x) @@ -1348,11 +1346,11 @@ void Client::SendChannelMessage(string Message) } } int AllowedMessages = RuleI(Chat, MinimumMessagesPerInterval) + GetKarma(); - AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages; - + AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages; + if(RuleI(Chat, MinStatusToBypassAntiSpam) <= Status) AllowedMessages = 10000; - + AttemptedMessages++; if(AttemptedMessages > AllowedMessages) { @@ -1363,7 +1361,7 @@ void Client::SendChannelMessage(string Message) if(GlobalChatLimiterTimer) { char TimeLeft[256]; - sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.", + sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.", (GlobalChatLimiterTimer->GetRemainingTime() / 1000)); GeneralChannelMessage(TimeLeft); } @@ -1424,7 +1422,7 @@ void Client::SendChannelMessageByNumber(string Message) { if(RequiredChannel->GetName().compare("Newplayers") != 0) { - if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit)) + if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit)) { CharacterEntry *char_ent = nullptr; for(int x = 0; x < Characters.size(); ++x) @@ -1446,8 +1444,8 @@ void Client::SendChannelMessageByNumber(string Message) { } } - _log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), - Message.substr(MessageStart + 1).c_str()); + _log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), + Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) { @@ -1463,7 +1461,7 @@ void Client::SendChannelMessageByNumber(string Message) { } } int AllowedMessages = RuleI(Chat, MinimumMessagesPerInterval) + GetKarma(); - AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages; + AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages; if(RuleI(Chat, MinStatusToBypassAntiSpam) <= Status) AllowedMessages = 10000; @@ -1477,7 +1475,7 @@ void Client::SendChannelMessageByNumber(string Message) { if(GlobalChatLimiterTimer) { char TimeLeft[256]; - sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.", + sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.", (GlobalChatLimiterTimer->GetRemainingTime() / 1000)); GeneralChannelMessage(TimeLeft); } @@ -1544,7 +1542,7 @@ void Client::ToggleAnnounce(string State) string Message = "Announcing now "; - if(Announce) + if(Announce) Message += "on"; else Message += "off"; @@ -1746,7 +1744,7 @@ void Client::SetChannelOwner(string CommandString) { void Client::OPList(string CommandString) { string::size_type ChannelStart = CommandString.find_first_not_of(" "); - + if(ChannelStart == string::npos) { string Message = "Incorrect syntax: /chat oplist "; GeneralChannelMessage(Message); @@ -1969,7 +1967,7 @@ void Client::ChannelGrantModerator(string CommandString) { } else { RequiredChannel->AddModerator(Moderator); - + if(RequiredClient) RequiredClient->GeneralChannelMessage(GetName() + " has made you a moderator of channel " + ChannelName); @@ -2056,7 +2054,7 @@ void Client::ChannelGrantVoice(string CommandString) { } else { RequiredChannel->AddVoice(Voicee); - + if(RequiredClient) RequiredClient->GeneralChannelMessage(GetName() + " has given you voice in channel " + ChannelName); @@ -2139,7 +2137,7 @@ void Client::ChannelKick(string CommandString) { return; } - if(RequiredChannel->IsModerator(Kickee)) { + if(RequiredChannel->IsModerator(Kickee)) { RequiredChannel->RemoveModerator(Kickee); @@ -2256,7 +2254,7 @@ Client *Clientlist::IsCharacterOnline(string CharacterName) { // If the mail is destined for the primary mailbox for this character, or the one they have selected // - if((MailBoxNumber == 0) || (MailBoxNumber == (*Iterator)->GetMailBoxNumber())) + if((MailBoxNumber == 0) || (MailBoxNumber == (*Iterator)->GetMailBoxNumber())) return (*Iterator); } @@ -2280,7 +2278,7 @@ void Client::SendNotification(int MailBoxNumber, string Subject, string From, in char sMessageID[100]; char Sequence[100]; - + sprintf(TimeStamp, "%i", (int)time(nullptr)); sprintf(sMessageID, "%i", MessageID); @@ -2296,8 +2294,8 @@ void Client::SendNotification(int MailBoxNumber, string Subject, string From, in VARSTRUCT_ENCODE_INTSTRING(PacketBuffer, MailBoxNumber); VARSTRUCT_ENCODE_STRING(PacketBuffer, sMessageID); VARSTRUCT_ENCODE_STRING(PacketBuffer, TimeStamp); - VARSTRUCT_ENCODE_STRING(PacketBuffer, "1"); - VARSTRUCT_ENCODE_STRING(PacketBuffer, From.c_str()); + VARSTRUCT_ENCODE_STRING(PacketBuffer, "1"); + VARSTRUCT_ENCODE_STRING(PacketBuffer, From.c_str()); VARSTRUCT_ENCODE_STRING(PacketBuffer, Subject.c_str()); _pkt(UCS__PACKETS, outapp); @@ -2314,13 +2312,13 @@ void Client::ChangeMailBox(int NewMailBox) { SetMailBox(NewMailBox); _log(UCS__TRACE, "New mailbox is %s", MailBoxName().c_str()); - + EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailboxChange, 2); char *buf = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_INTSTRING(buf, NewMailBox); - + _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -2388,13 +2386,13 @@ string Client::MailBoxName() { if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1))) { _log(UCS__ERROR, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", - CurrentMailBox, Characters.size()); + CurrentMailBox, Characters.size()); return ""; } _log(UCS__TRACE, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", - CurrentMailBox, Characters.size()); + CurrentMailBox, Characters.size()); return Characters[CurrentMailBox].Name; @@ -2407,3 +2405,4 @@ int Client::GetCharID() { return Characters[0].CharID; } + diff --git a/ucs/clientlist.h b/ucs/clientlist.h index f118e939c..1876ec58b 100644 --- a/ucs/clientlist.h +++ b/ucs/clientlist.h @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -32,48 +30,50 @@ #define MAX_JOINED_CHANNELS 10 -enum { CommandJoin = 0, CommandLeaveAll, CommandLeave, CommandListAll, CommandList, CommandSet, CommandAnnounce, CommandSetOwner, - CommandOPList, CommandInvite, CommandGrant, CommandModerate, CommandVoice, CommandKick, - CommandPassword, CommandToggleInvites, CommandAFK, CommandUptime, - CommandGetHeaders, CommandGetBody, CommandMailTo, CommandSetMessageStatus, CommandSelectMailBox, - CommandSetMailForwarding, CommandBuddy, CommandIgnorePlayer, - CommandEndOfList }; +enum { + CommandJoin = 0, CommandLeaveAll, CommandLeave, CommandListAll, CommandList, CommandSet, CommandAnnounce, CommandSetOwner, + CommandOPList, CommandInvite, CommandGrant, CommandModerate, CommandVoice, CommandKick, + CommandPassword, CommandToggleInvites, CommandAFK, CommandUptime, + CommandGetHeaders, CommandGetBody, CommandMailTo, CommandSetMessageStatus, CommandSelectMailBox, + CommandSetMailForwarding, CommandBuddy, CommandIgnorePlayer, + CommandEndOfList +}; struct CommandEntry { const char *CommandString; - int CommandCode; + int CommandCode; }; typedef enum { ConnectionTypeUnknown, ConnectionTypeCombined, ConnectionTypeMail, ConnectionTypeChat } ConnectionType; -static const CommandEntry Commands[] = { - { "join", CommandJoin }, - { "leaveall", CommandLeaveAll }, - { "leave", CommandLeave }, - { "listall", CommandListAll }, - { "list", CommandList }, - { "set", CommandSet }, - { "announce", CommandAnnounce }, - { "setowner", CommandSetOwner }, - { "oplist", CommandOPList }, - { "invite", CommandInvite }, - { "grant", CommandGrant }, - { "moderate", CommandModerate }, - { "voice", CommandVoice }, - { "kick", CommandKick }, - { "password", CommandPassword }, - { "toggleinvites", CommandToggleInvites }, - { "afk", CommandAFK }, - { "uptime", CommandUptime }, - { "getheaders", CommandGetHeaders }, - { "getbody", CommandGetBody }, - { "mailto", CommandMailTo }, - { "setmessagestatus", CommandSetMessageStatus }, - { "selectmailbox", CommandSelectMailBox }, - { "setmailforwarding", CommandSetMailForwarding }, - { "buddy", CommandBuddy }, - { "ignoreplayer", CommandIgnorePlayer }, - { "", CommandEndOfList } }; +static const CommandEntry Commands[] = { + { "join", CommandJoin }, + { "leaveall", CommandLeaveAll }, + { "leave", CommandLeave }, + { "listall", CommandListAll }, + { "list", CommandList }, + { "set", CommandSet }, + { "announce", CommandAnnounce }, + { "setowner", CommandSetOwner }, + { "oplist", CommandOPList }, + { "invite", CommandInvite }, + { "grant", CommandGrant }, + { "moderate", CommandModerate }, + { "voice", CommandVoice }, + { "kick", CommandKick }, + { "password", CommandPassword }, + { "toggleinvites", CommandToggleInvites }, + { "afk", CommandAFK }, + { "uptime", CommandUptime }, + { "getheaders", CommandGetHeaders }, + { "getbody", CommandGetBody }, + { "mailto", CommandMailTo }, + { "setmessagestatus", CommandSetMessageStatus }, + { "selectmailbox", CommandSelectMailBox }, + { "setmailforwarding", CommandSetMailForwarding }, + { "buddy", CommandBuddy }, + { "ignoreplayer", CommandIgnorePlayer }, + { "", CommandEndOfList } }; struct CharacterEntry { int CharID; diff --git a/ucs/database.cpp b/ucs/database.cpp index e03339b0b..9f349b82a 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -112,7 +110,7 @@ void Database::GetAccountStatus(Client *c) { MYSQL_ROW row; if (!RunQuery(query,MakeAnyLenString(&query, "select `status`, `hideme`, `karma`, `revoked` from `account` where `id`='%i' limit 1", - c->GetAccountID()),errbuf,&result)){ + c->GetAccountID()),errbuf,&result)){ _log(UCS__ERROR, "Unable to get account status for character %s, error %s", c->GetName().c_str(), errbuf); @@ -153,7 +151,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) { c->ClearCharacters(); if (!RunQuery(query,MakeAnyLenString(&query, "select `id`, `account_id`, `level` from `character_` where `name`='%s' limit 1", - CharacterName),errbuf,&result)) + CharacterName),errbuf,&result)) { _log(UCS__ERROR, "FindAccount query failed: %s", query); safe_delete_array(query); @@ -161,7 +159,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) { } safe_delete_array(query); - if (mysql_num_rows(result) != 1) + if (mysql_num_rows(result) != 1) { _log(UCS__ERROR, "Bad result from query"); mysql_free_result(result); @@ -176,14 +174,14 @@ int Database::FindAccount(const char *CharacterName, Client *c) { _log(UCS__TRACE, "Account ID for %s is %i", CharacterName, AccountID); if (!RunQuery(query,MakeAnyLenString(&query, "select `id`, `name`, `level` from `character_` where `account_id`=%i and `name` !='%s'", - AccountID, CharacterName),errbuf,&result)) + AccountID, CharacterName),errbuf,&result)) { safe_delete_array(query); return AccountID; } safe_delete_array(query); - for(unsigned int i = 0; i < mysql_num_rows(result); i++) + for(unsigned int i = 0; i < mysql_num_rows(result); i++) { row = mysql_fetch_row(result); c->AddCharacter(atoi(row[0]), row[1], atoi(row[2])); @@ -200,7 +198,7 @@ bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey MYSQL_ROW row; if (!RunQuery(query,MakeAnyLenString(&query, "select `mailkey` from `character_` where `name`='%s' limit 1", - CharacterName.c_str()),errbuf,&result)){ + CharacterName.c_str()),errbuf,&result)){ safe_delete_array(query); @@ -214,7 +212,7 @@ bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey row = mysql_fetch_row(result); // The key is the client's IP address (expressed as 8 hex digits) and an 8 hex digit random string generated - // by world. + // by world. // char CombinedKey[17]; @@ -222,7 +220,7 @@ bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey sprintf(CombinedKey, "%08X%s", IPAddress, MailKey.c_str()); else sprintf(CombinedKey, "%s", MailKey.c_str()); - + _log(UCS__TRACE, "DB key is [%s], Client key is [%s]", row[0], CombinedKey); bool Valid = !strcmp(row[0], CombinedKey); @@ -243,7 +241,7 @@ int Database::FindCharacter(const char *CharacterName) { char *SafeCharName = RemoveApostrophes(CharacterName); if (!RunQuery(query,MakeAnyLenString(&query, "select `id` from `character_` where `name`='%s' limit 1", - SafeCharName),errbuf,&result)){ + SafeCharName),errbuf,&result)){ _log(UCS__ERROR, "FindCharacter failed. %s %s", query, errbuf); @@ -350,7 +348,7 @@ void Database::SetChannelPassword(string ChannelName, string Password) { char *query = 0; if(!RunQuery(query, MakeAnyLenString(&query, "UPDATE `chatchannels` set `password`='%s' where `name`='%s'", Password.c_str(), - ChannelName.c_str()), errbuf)) { + ChannelName.c_str()), errbuf)) { _log(UCS__ERROR, "Error updating password in database: %s, %s", query, errbuf); @@ -367,7 +365,7 @@ void Database::SetChannelOwner(string ChannelName, string Owner) { char *query = 0; if(!RunQuery(query, MakeAnyLenString(&query, "UPDATE `chatchannels` set `owner`='%s' where `name`='%s'", Owner.c_str(), - ChannelName.c_str()), errbuf)) { + ChannelName.c_str()), errbuf)) { _log(UCS__ERROR, "Error updating Owner in database: %s, %s", query, errbuf); @@ -393,7 +391,7 @@ void Database::SendHeaders(Client *c) { MYSQL_ROW row; if (!RunQuery(query,MakeAnyLenString(&query, "select `msgid`,`timestamp`,`from`,`subject`, `status` from `mail` " - "where `charid`=%i", CharacterID),errbuf,&result)){ + "where `charid`=%i", CharacterID),errbuf,&result)){ safe_delete_array(query); @@ -407,7 +405,7 @@ void Database::SendHeaders(Client *c) { my_ulonglong NumRows = mysql_num_rows(result); int HeaderCountPacketLength = 0; - + sprintf(Buf, "%i", c->GetMailBoxNumber()); HeaderCountPacketLength += (strlen(Buf) + 1); @@ -497,7 +495,7 @@ void Database::SendBody(Client *c, int MessageNumber) { MYSQL_ROW row; if (!RunQuery(query,MakeAnyLenString(&query, "select `msgid`, `body`, `to` from `mail` " - "where `charid`=%i and `msgid`=%i", CharacterID, MessageNumber), errbuf, &result)){ + "where `charid`=%i and `msgid`=%i", CharacterID, MessageNumber), errbuf, &result)){ safe_delete_array(query); return ; @@ -552,7 +550,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo //printf("Database::SendMail(%s, %s, %s)\n", Recipient.c_str(), From.c_str(), Subject.c_str()); string::size_type LastPeriod = Recipient.find_last_of("."); - + if(LastPeriod == string::npos) CharacterName = Recipient; else @@ -560,7 +558,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo CharacterName[0] = toupper(CharacterName[0]); - for(unsigned int i = 1; i < CharacterName.length(); i++) + for(unsigned int i = 1; i < CharacterName.length(); i++) CharacterName[i] = tolower(CharacterName[i]); CharacterID = FindCharacter(CharacterName.c_str()); @@ -579,14 +577,14 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo DoEscapeString(EscBody, Body.c_str(), Body.length()); const char *MailQuery="INSERT INTO `mail` (`charid`, `timestamp`, `from`, `subject`, `body`, `to`, `status`) " - "VALUES ('%i', %i, '%s', '%s', '%s', '%s', %i)"; + "VALUES ('%i', %i, '%s', '%s', '%s', '%s', %i)"; uint32 LastMsgID; int Now = time(nullptr); // time returns a 64 bit int on Windows at least, which vsnprintf doesn't like. - if(!RunQuery(query, MakeAnyLenString(&query, MailQuery, CharacterID, Now, From.c_str(), EscSubject, EscBody, - RecipientsString.c_str(), 1), errbuf, 0, 0, &LastMsgID)) { + if(!RunQuery(query, MakeAnyLenString(&query, MailQuery, CharacterID, Now, From.c_str(), EscSubject, EscBody, + RecipientsString.c_str(), 1), errbuf, 0, 0, &LastMsgID)) { _log(UCS__ERROR, "SendMail: Query %s failed with error %s", query, errbuf); @@ -601,7 +599,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo safe_delete_array(EscSubject); safe_delete_array(EscBody); - safe_delete_array(query); + safe_delete_array(query); Client *c = CL->IsCharacterOnline(CharacterName); @@ -610,7 +608,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo c->SendNotification(c->GetMailBoxNumber(CharacterName), Subject, FQN, LastMsgID); } - + MailMessagesSent++; return true; @@ -624,7 +622,7 @@ void Database::SetMessageStatus(int MessageNumber, int Status) { char *query = 0; if(Status == 0) - RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `msgid`=%i", MessageNumber), errbuf); + RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `msgid`=%i", MessageNumber), errbuf); else if (!RunQuery(query, MakeAnyLenString(&query, "update `mail` set `status`=%i where `msgid`=%i", Status, MessageNumber), errbuf)) { _log(UCS__ERROR, "Error updating status %s, %s", query, errbuf); @@ -660,9 +658,9 @@ void Database::ExpireMail() { // Expire Trash if(RuleI(Mail, ExpireTrash) >= 0) { - if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=4 and `timestamp` < %i", - time(nullptr) - RuleI(Mail, ExpireTrash)), errbuf, 0, &AffectedRows)) { - _log(UCS__INIT, "Expired %i trash messages.", AffectedRows); + if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=4 and `timestamp` < %i", + time(nullptr) - RuleI(Mail, ExpireTrash)), errbuf, 0, &AffectedRows)) { + _log(UCS__INIT, "Expired %i trash messages.", AffectedRows); } else { _log(UCS__ERROR, "Error expiring trash messages, %s %s", query, errbuf); @@ -671,9 +669,9 @@ void Database::ExpireMail() { } // Expire Read if(RuleI(Mail, ExpireRead) >= 0) { - if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=3 and `timestamp` < %i", - time(nullptr) - RuleI(Mail, ExpireRead)), errbuf, 0, &AffectedRows)) { - _log(UCS__INIT, "Expired %i read messages.", AffectedRows); + if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=3 and `timestamp` < %i", + time(nullptr) - RuleI(Mail, ExpireRead)), errbuf, 0, &AffectedRows)) { + _log(UCS__INIT, "Expired %i read messages.", AffectedRows); } else { _log(UCS__ERROR, "Error expiring read messages, %s %s", query, errbuf); @@ -682,9 +680,9 @@ void Database::ExpireMail() { } // Expire Unread if(RuleI(Mail, ExpireUnread) >= 0) { - if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=1 and `timestamp` < %i", - time(nullptr) - RuleI(Mail, ExpireUnread)), errbuf, 0, &AffectedRows)) { - _log(UCS__INIT, "Expired %i unread messages.", AffectedRows); + if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=1 and `timestamp` < %i", + time(nullptr) - RuleI(Mail, ExpireUnread)), errbuf, 0, &AffectedRows)) { + _log(UCS__INIT, "Expired %i unread messages.", AffectedRows); } else { _log(UCS__ERROR, "Error expiring unread messages, %s %s", query, errbuf); @@ -705,9 +703,9 @@ void Database::AddFriendOrIgnore(int CharID, int Type, string Name) { _log(UCS__ERROR, "Error adding friend/ignore, query was %s : %s", query, errbuf); else _log(UCS__TRACE, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", - CharID, Type, Name.c_str()); + CharID, Type, Name.c_str()); + - safe_delete_array(query); } @@ -722,9 +720,9 @@ void Database::RemoveFriendOrIgnore(int CharID, int Type, string Name) { _log(UCS__ERROR, "Error removing friend/ignore, query was %s", query); else _log(UCS__TRACE, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", - CharID, Type, Name.c_str()); + CharID, Type, Name.c_str()); + - safe_delete_array(query); } @@ -768,3 +766,4 @@ void Database::GetFriendsAndIgnore(int CharID, vector &Friends, vector &Friends, vector &Ignorees); - + protected: void HandleMysqlError(uint32 errnum); private: void DBInitVars(); - + }; #endif + diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index b94a4e6ed..56f274209 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -39,7 +37,7 @@ volatile bool RunLoops = true; uint32 MailMessagesSent = 0; uint32 ChatMessagesSent = 0; -TimeoutManager timeout_manager; +TimeoutManager timeout_manager; Clientlist *CL; @@ -69,8 +67,8 @@ string GetMailPrefix() { } int main() { - RegisterExecutablePlatform(ExePlatformUCS); - set_exception_handler(); + RegisterExecutablePlatform(ExePlatformUCS); + set_exception_handler(); // Check every minute for unused channels we can delete // @@ -134,7 +132,7 @@ int main() { CL = new Clientlist(Config->ChatPort); ChannelList = new ChatChannelList(); - + database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { @@ -178,13 +176,13 @@ int main() { void UpdateWindowTitle(char* iNewTitle) { #ifdef _WINDOWS - char tmp[500]; - if (iNewTitle) { - snprintf(tmp, sizeof(tmp), "UCS: %s", iNewTitle); - } - else { - snprintf(tmp, sizeof(tmp), "UCS"); - } - SetConsoleTitle(tmp); + char tmp[500]; + if (iNewTitle) { + snprintf(tmp, sizeof(tmp), "UCS: %s", iNewTitle); + } + else { + snprintf(tmp, sizeof(tmp), "UCS"); + } + SetConsoleTitle(tmp); #endif } diff --git a/ucs/ucsconfig.cpp b/ucs/ucsconfig.cpp index 6ee149805..59a589a1b 100644 --- a/ucs/ucsconfig.cpp +++ b/ucs/ucsconfig.cpp @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -27,3 +25,4 @@ ucsconfig *ucsconfig::_chat_config = nullptr; string ucsconfig::GetByName(const string &var_name) const { return(EQEmuConfig::GetByName(var_name)); } + diff --git a/ucs/ucsconfig.h b/ucs/ucsconfig.h index 84fdf332d..85f836464 100644 --- a/ucs/ucsconfig.h +++ b/ucs/ucsconfig.h @@ -1,6 +1,4 @@ -/* - EQEMu: Everquest Server Emulator - +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -11,11 +9,11 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -36,7 +34,7 @@ public: // Produce a const singleton static const ucsconfig *get() { - if (_chat_config == nullptr) + if (_chat_config == nullptr) LoadConfig(); return(_chat_config); } @@ -54,3 +52,4 @@ public: }; #endif + diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index a8c5d7c7b..1bd93bfc0 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 + 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 + 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/debug.h" #include @@ -59,7 +59,7 @@ void WorldServer::OnConnected() void WorldServer::Process() { WorldConnection::Process(); - + if (!Connected()) return; @@ -115,16 +115,16 @@ void WorldServer::Process() break; } - case ServerOP_UCSMailMessage: - { - ServerMailMessageHeader_Struct *mail = (ServerMailMessageHeader_Struct*)pack->pBuffer; - database.SendMail(string("SOE.EQ.") + Config->ShortName + string(".") + string(mail->to), - string(mail->from), - mail->subject, - mail->message, - string()); - break; - } + case ServerOP_UCSMailMessage: + { + ServerMailMessageHeader_Struct *mail = (ServerMailMessageHeader_Struct*)pack->pBuffer; + database.SendMail(string("SOE.EQ.") + Config->ShortName + string(".") + string(mail->to), + string(mail->from), + mail->subject, + mail->message, + string()); + break; + } } } diff --git a/ucs/worldserver.h b/ucs/worldserver.h index e579b467d..0b9bebacd 100644 --- a/ucs/worldserver.h +++ b/ucs/worldserver.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* 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 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 + 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. + 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 + 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 WORLDSERVER_H #define WORLDSERVER_H @@ -27,7 +27,7 @@ public: WorldServer(); virtual ~WorldServer(); virtual void Process(); - + private: virtual void OnConnected(); }; diff --git a/utils/EQExtractor2/EQExtractor2/ChangeLog.txt b/utils/EQExtractor2/EQExtractor2/ChangeLog.txt index 2181b9279..8fbdcc089 100644 --- a/utils/EQExtractor2/EQExtractor2/ChangeLog.txt +++ b/utils/EQExtractor2/EQExtractor2/ChangeLog.txt @@ -142,7 +142,7 @@ Derision: Redesigned the UI. Use the menu bar, or the following shortcuts: Ctrl-V View Packets Ctrl-A Dump AA Ctrl-D Show Debug Window (hidden by default. Change in Options). - Ctrl-O Set Options (these settings persist across sessions). + Ctrl-O Set Options (these settings persist across sessions). Derision: Added the ability to disable removal of redundant waypoints. Derision: Added an option to only generate SQL for spawns whose name contains a given string. @@ -153,7 +153,7 @@ Derision: Fixed crash when Debug log was closed rather than just hidden. Derision: Replaced HexDump method with a considerably faster version. ==07/14/2010== -Derision: Renamed PatchTestJune242010Decoder to PatchJuly132010Decoder. +Derision: Renamed PatchTestJune242010Decoder to PatchJuly132010Decoder. Derision: Updated patch_May12-2010.conf with current EQEmu patch_Live.conf. Updated version number to 2.0.5 ==06/26/2010== diff --git a/utils/EQExtractor2/EQExtractor2/EQApplicationLayer.cs b/utils/EQExtractor2/EQExtractor2/EQApplicationLayer.cs index 58537e9be..5a7d9f0db 100644 --- a/utils/EQExtractor2/EQExtractor2/EQApplicationLayer.cs +++ b/utils/EQExtractor2/EQExtractor2/EQApplicationLayer.cs @@ -60,9 +60,9 @@ namespace EQApplicationLayer // Put our supported patch version decoders into the list. PatchList = new List(); - + PatchList.Add(new PatchMay122010Decoder()); - + PatchList.Add(new PatchJuly132010Decoder()); PatchList.Add(new PatchTestSep012010Decoder()); @@ -92,7 +92,7 @@ namespace EQApplicationLayer PatchList.Add(new PatchJuly132012Decoder()); PatchList.Add(new PatchAugust152012Decoder()); - + PatchList.Add(new PatchDecember102012Decoder()); PatchList.Add(new PatchJanuary162013Decoder()); @@ -106,10 +106,10 @@ namespace EQApplicationLayer PatchList.Add(new PatchMarch132013Decoder()); PatchList.Add(new PatchApril152013Decoder()); - + PatchList.Add(new PatchSoD()); - } + } // This is called from the main form to tell us where the application was launched from (where to look for the .conf files) // and also gives us the LogHandler method so we can send debug messages to the main form. @@ -143,7 +143,7 @@ namespace EQApplicationLayer } public string GetDecoderVersion() - { + { // We don't need to check if PatchDecoder is null, because it is always initialised to an instance of the base // PatchSpecficDecoder class return PatchDecoder.GetVersion(); @@ -156,7 +156,7 @@ namespace EQApplicationLayer } public bool DumpPackets(string FileName, bool ShowTimeStamps) - { + { return PatchDecoder.DumpPackets(FileName, ShowTimeStamps); } @@ -187,7 +187,7 @@ namespace EQApplicationLayer else if (TempStatus > Status) Status = TempStatus; } - return Status; + return Status; } // This is called by the main form when all the packets have been processed. It prompts us to pass the packets down @@ -214,7 +214,7 @@ namespace EQApplicationLayer { return PatchDecoder.GetCaptureStartTime(); } - + public string GetZoneName() { return PatchDecoder.GetZoneName(); @@ -255,13 +255,13 @@ namespace EQApplicationLayer SQLOut("DELETE from doors where zone = '" + ZoneName + "' and doorid >= @BaseDoorID and doorid <= @BaseDoorID + " + UpperBound + " and version = " + SpawnVersion + ";"); foreach(Door d in DoorList) - { + { if ((d.OpenType == 57) || (d.OpenType == 58)) - { + { ZonePoint? zp = GetZonePointNumber(d.DoorParam); - + if (zp != null) - { + { d.DestZone = ZoneNumberToName(zp.Value.TargetZoneID); d.DestX = zp.Value.TargetX; d.DestY = zp.Value.TargetY; @@ -276,7 +276,7 @@ namespace EQApplicationLayer SQLOut(DoorQuery); } - } + } public void GenerateSpawnSQL(bool GenerateSpawns, bool GenerateGrids, bool GenerateMerchants, string ZoneName, UInt32 ZoneID, UInt32 SpawnVersion, @@ -325,18 +325,18 @@ namespace EQApplicationLayer NPCSpawnList NPCSL = new NPCSpawnList(); foreach(ZoneEntryStruct Spawn in ZoneSpawns) - { + { if (NPCType.IsMount(Spawn.SpawnName)) continue; if (!IncludeInvisibleMen && (Spawn.Race == 127)) continue; - + Spawn.Findable = (FindableEntities.IndexOf(Spawn.SpawnID) >= 0); - + if (Spawn.IsNPC != 1) continue; - + if (Spawn.PetOwnerID > 0) continue; @@ -346,9 +346,9 @@ namespace EQApplicationLayer bool ColoursInUse = false; for (int ColourSlot = 0; ColourSlot < 9; ++ColourSlot) - { + { if (((Spawn.SlotColour[ColourSlot] & 0x00ffffff) != 0) && UseNPCTypesTint) - ColoursInUse = true; + ColoursInUse = true; } if (Spawn.IsMercenary > 0) @@ -358,7 +358,7 @@ namespace EQApplicationLayer Spawn.BodyType, Spawn.HairColor, Spawn.BeardColor, Spawn.EyeColor1, Spawn.EyeColor2, Spawn.HairStyle, Spawn.Beard, Spawn.DrakkinHeritage, Spawn.DrakkinTattoo, Spawn.DrakkinDetails, Spawn.Deity, Spawn.Class, Spawn.EquipChest2, Spawn.Helm, Spawn.LastName); - + if (ExistingDBID == 0) { @@ -368,7 +368,7 @@ namespace EQApplicationLayer Spawn.Helm, Spawn.LastName, Spawn.Findable, Spawn.MeleeTexture1, Spawn.MeleeTexture2, Spawn.ArmorTintRed, Spawn.ArmorTintGreen, Spawn.ArmorTintBlue, Spawn.SlotColour); NPCTL.AddNPCType(NewNPCType); - + ExistingDBID = NPCTypeDBID++; UInt32 ArmorTintID = 0; @@ -435,17 +435,17 @@ namespace EQApplicationLayer string Spawn2EntryQuery = "INSERT INTO spawn2(`id`, `spawngroupID`, `zone`, `version`, `x`, `y`, `z`, `heading`, `respawntime`, `variance`, `pathgrid`, `_condition`, `cond_value`, `enabled`) VALUES("; Spawn2EntryQuery += "@StartingSpawn2ID + " + Spawn2ID + ", @StartingSpawnGroupID + " + SpawnGroupID + ", '" + ZoneName + "', " + SpawnVersion + ", " + Spawn.XPos + ", " + Spawn.YPos + ", " + Spawn.ZPos + ", "; Spawn2EntryQuery += Spawn.Heading + ", 640, 0, 0, 0, 1, 1);"; - + SpawnGroupID++; SpawnEntryID++; Spawn2ID++; - + if (GenerateSpawns) { SQLOut(SpawnGroupQuery); SQLOut(SpawnEntryQuery); SQLOut(Spawn2EntryQuery); - } + } } if (UpdateExistingNPCTypes) @@ -472,7 +472,7 @@ namespace EQApplicationLayer for (int ColourSlot = 0; ColourSlot < 9; ++ColourSlot) { if (((n.SlotColour[ColourSlot] & 0x00ffffff) != 0) && UseNPCTypesTint) - ColoursInUse = true; + ColoursInUse = true; } if (ColoursInUse) @@ -505,11 +505,11 @@ namespace EQApplicationLayer } if (GenerateGrids) - { + { List AllMovementUpdates = PatchDecoder.GetAllMovementUpdates(); - - foreach (PositionUpdate Update in AllMovementUpdates) - NPCSL.AddWaypoint(Update.SpawnID, Update.p, Update.HighRes); + + foreach (PositionUpdate Update in AllMovementUpdates) + NPCSL.AddWaypoint(Update.SpawnID, Update.p, Update.HighRes); SQLOut("--"); SQLOut("-- Grids"); @@ -520,24 +520,24 @@ namespace EQApplicationLayer foreach (NPCSpawn ns in NPCSL._NPCSpawnList) { if (ns.Waypoints.Count > 1) - { + { bool AllWaypointsTheSame = true; for (int WPNumber = 0; WPNumber < ns.Waypoints.Count; ++WPNumber) - { + { if (WPNumber == 0) continue; if ((ns.Waypoints[WPNumber].x != ns.Waypoints[WPNumber - 1].x) || (ns.Waypoints[WPNumber].y != ns.Waypoints[WPNumber - 1].y) || (ns.Waypoints[WPNumber].z != ns.Waypoints[WPNumber - 1].z)) { - AllWaypointsTheSame = false; + AllWaypointsTheSame = false; } } if (AllWaypointsTheSame) continue; - + int WaypointsInserted = 0; int WPNum = 1; @@ -551,10 +551,10 @@ namespace EQApplicationLayer for (int WPNumber = FirstUsableWaypoint; WPNumber < ns.Waypoints.Count; ++WPNumber) { - Position p = ns.Waypoints[WPNumber]; + Position p = ns.Waypoints[WPNumber]; if (CoalesceWaypoints) - { + { if ((WPNumber > FirstUsableWaypoint) && (WPNumber < (ns.Waypoints.Count - 2))) { Position np = ns.Waypoints[WPNumber + 1]; @@ -579,14 +579,14 @@ namespace EQApplicationLayer } } - // If this is the last waypoint, and we haven't inserted any of the previous ones, then don't bother + // If this is the last waypoint, and we haven't inserted any of the previous ones, then don't bother // with this one either. if ((WPNumber == (ns.Waypoints.Count - 1)) && (WaypointsInserted == 0)) continue; SQLOut("INSERT into grid_entries (`gridid`, `zoneid`, `number`, `x`, `y`, `z`, `heading`, `pause`) VALUES(@StartingGridID + " + GridDBID + ", " + ZoneID + ", " + (WPNum++) + ", " + p.x + ", " + p.y + ", " + p.z + ", " + p.heading + ", " + Pause + ");"); - ++WaypointsInserted; + ++WaypointsInserted; } if (WaypointsInserted > 1) { @@ -598,7 +598,7 @@ namespace EQApplicationLayer SQLOut("UPDATE spawn2 set x = " + ns.Waypoints[1].x + ", y = " + ns.Waypoints[1].y + ", z = " + ns.Waypoints[1].z + ", heading = " + ns.Waypoints[1].heading + " WHERE id = @StartingSpawn2ID + " + ns.Spawn2DBID + ";"); ++GridDBID; - } + } } } } @@ -627,7 +627,7 @@ namespace EQApplicationLayer continue; UInt32 MerchantNPCTypeID = npc.NPCTypeID; - + SQLOut("--"); SQLOut("-- " + npc.Name); SQLOut("-- "); @@ -639,7 +639,7 @@ namespace EQApplicationLayer string Insert = ""; if (mi.Quantity >= 0) - { + { if (!StartOfPlayerSoldItems) { StartOfPlayerSoldItems = true; @@ -662,7 +662,7 @@ namespace EQApplicationLayer SQLOut("UPDATE npc_types SET merchant_id = @StartingMerchantID + " + MerchantDBID + " WHERE id = @StartingNPCTypeID + " + MerchantNPCTypeID + ";"); ++MerchantDBID; - } + } } public void GenerateZonePointSQL(string ZoneName, SQLDestination SQLOut) @@ -671,13 +671,13 @@ namespace EQApplicationLayer { string Insert = String.Format("REPLACE into zone_points(`zone`, `number`, `y`, `x`, `z`, `heading`, `target_y`, `target_x`, `target_z`, `target_heading`, `zoneinst`, `target_zone_id`, `buffer`) VALUES('{0}', {1}, 0, 0, 0, 0, {2}, {3}, {4}, {5}, {6}, {7}, 0);", ZoneName, zp.Number, zp.y, zp.x, zp.z, zp.Heading, zp.Instance, zp.ZoneID); - SQLOut(Insert); + SQLOut(Insert); } } public void GenerateZonePointList() { - ZonePointList = PatchDecoder.GetZonePointList(); + ZonePointList = PatchDecoder.GetZonePointList(); } public ZonePoint? GetZonePointNumber(Int32 Number) @@ -697,7 +697,7 @@ namespace EQApplicationLayer { UInt16 ZoneID = PatchDecoder.GetZoneNumber(); - NewZoneStruct NewZone = PatchDecoder.GetZoneData(); + NewZoneStruct NewZone = PatchDecoder.GetZoneData(); SQLOut("--"); SQLOut("-- Zone Config"); @@ -725,7 +725,7 @@ namespace EQApplicationLayer public bool DumpAAs(string FileName) { return PatchDecoder.DumpAAs(FileName); - } + } public void GenerateObjectSQL(bool DoGroundSpawns, bool DoObjects, UInt32 SpawnVersion, SQLDestination SQLOut) { @@ -794,7 +794,7 @@ namespace EQApplicationLayer case "IT10802_ACTORDEF": return 16; case "IT10803_ACTORDEF": - return 15; + return 15; case "IT10865_ACTORDEF": return 15; case "IT128_ACTORDEF": diff --git a/utils/EQExtractor2/EQExtractor2/EQExtractor2.csproj b/utils/EQExtractor2/EQExtractor2/EQExtractor2.csproj index 542700b6c..7746d68c5 100644 --- a/utils/EQExtractor2/EQExtractor2/EQExtractor2.csproj +++ b/utils/EQExtractor2/EQExtractor2/EQExtractor2.csproj @@ -215,7 +215,7 @@ - diff --git a/utils/EQExtractor2/EQExtractor2/EQPacket.cs b/utils/EQExtractor2/EQExtractor2/EQPacket.cs index 775d42de9..a5c921efc 100644 --- a/utils/EQExtractor2/EQExtractor2/EQPacket.cs +++ b/utils/EQExtractor2/EQExtractor2/EQPacket.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// // This is the netcode for turning SOE protocol packets into EQ Application Packets // using System; @@ -45,20 +45,20 @@ namespace EQPacket public DateTime PacketTime; public bool Locked = false; } - + public class PacketManager { bool DEBUG = false; bool DUMPPACKETS = false; - + private void Debug(string Message) { if (DebugLogger != null) - DebugLogger(Message); + DebugLogger(Message); } public bool ErrorsInStream = false; - + const UInt32 OP_SessionRequest = 0x0001; const UInt32 OP_SessionResponse = 0x0002; const UInt32 OP_Combined = 0x0003; @@ -74,7 +74,7 @@ namespace EQPacket private int[] FragmentedPacketSize = {0, 0}; private int[] FragmentedBytesCollected = {0, 0}; private byte[][] Fragments = new byte [2][]; - + private System.Net.IPAddress ServerIP; private ushort ServerPort = 0; @@ -136,7 +136,7 @@ namespace EQPacket PacketList.Add(Packet); } - + private struct CacheEntry { public int Seq; @@ -152,7 +152,7 @@ namespace EQPacket Payload = inPayload; PacketTime = inPacketTime; SubPacket = inSubPacket; - } + } } private List Cache = new List(); @@ -212,7 +212,7 @@ namespace EQPacket int CacheElement; CacheElement = FindCacheEntry(GetExpectedSeq(PacketDirection.ServerToClient), PacketDirection.ServerToClient); - + while ( CacheElement >= 0) { if (DEBUG) @@ -267,8 +267,8 @@ namespace EQPacket ++ExpectedClientSEQ; else if (Direction == PacketDirection.ServerToClient) ++ExpectedServerSEQ; - } - + } + public void ProcessPacket(System.Net.IPAddress srcIp, System.Net.IPAddress dstIp, ushort srcPort, ushort dstPort, byte[] Payload, DateTime PacketTime, bool SubPacket, bool Cached) { byte Flags = 0x00; @@ -313,7 +313,7 @@ namespace EQPacket ServerIP = dstIp; ServerPort = dstPort; - + Log("-- Locked onto EQ Stream. Client IP " + srcIp + ":" + srcPort + " Server IP " + dstIp + ":" + dstPort); ExpectedClientSEQ = 0; @@ -321,7 +321,7 @@ namespace EQPacket ExpectedServerSEQ = 0; CryptoFlag = 0; - + break; } @@ -395,7 +395,7 @@ namespace EQPacket { if (DEBUG) Debug("0xa5"); - + Uncompressed = new byte[Payload.Length - 5]; Array.Copy(Payload, 3, Uncompressed, 0, Payload.Length - 5); @@ -436,12 +436,12 @@ namespace EQPacket AdvanceSeq(Direction); } } - + break; } else AdvanceSeq(Direction); - + bool Multi = ((Uncompressed[2] == 0x00) && (Uncompressed[3] == 0x19)); @@ -473,11 +473,11 @@ namespace EQPacket ++BufferPosition; OpCodeBytes = 3; } - + AppOpCode += (Uncompressed[BufferPosition++] * 256); - + ProcessAppPacket(srcIp, dstIp, srcPort, dstPort, AppOpCode, Size - OpCodeBytes, Uncompressed, BufferPosition, Direction, PacketTime); - + BufferPosition = BufferPosition + (Size - OpCodeBytes); } } @@ -494,7 +494,7 @@ namespace EQPacket OpCodeBytes = 3; } - AppOpCode += (Uncompressed[BufferPosition++] * 256); + AppOpCode += (Uncompressed[BufferPosition++] * 256); ProcessAppPacket(srcIp, dstIp, srcPort, dstPort, AppOpCode, Uncompressed.Length - (2 + OpCodeBytes), Uncompressed, BufferPosition, Direction, PacketTime); } @@ -539,7 +539,7 @@ namespace EQPacket { Debug("Uncompressed data."); Debug(Utils.HexDump(Uncompressed)); - } + } if (FragmentSeq[(int)Direction] == -1) { @@ -552,7 +552,7 @@ namespace EQPacket Debug("FragmentSeq is " + FragmentSeq[(int)Direction] + " Expecting " + GetExpectedSeq(Direction)); if (FragmentSeq[(int)Direction] != GetExpectedSeq(Direction)) - { + { if (FragmentSeq[(int)Direction] > GetExpectedSeq(Direction)) { if((FragmentSeq[(int)Direction] - GetExpectedSeq(Direction)) < 1000) @@ -569,7 +569,7 @@ namespace EQPacket } } FragmentSeq[(int)Direction] = -1; - + break; } else @@ -636,7 +636,7 @@ namespace EQPacket FragmentSeq[(int)Direction] = -1; } - } + } break; } else @@ -700,7 +700,7 @@ namespace EQPacket AppOpCode += (Fragments[(int)Direction][BufferPosition++] * 256); ProcessAppPacket(srcIp, dstIp, srcPort, dstPort, AppOpCode, Size - OpCodeBytes, Fragments[(int)Direction], BufferPosition, Direction, PacketTime); - + BufferPosition = BufferPosition + (Size - OpCodeBytes); } } @@ -721,7 +721,7 @@ namespace EQPacket byte[] NewPacket = new byte[Fragments[(int)Direction].Length - OpCodeBytes]; Array.Copy(Fragments[(int)Direction], BufferPosition, NewPacket, 0, Fragments[(int)Direction].Length - OpCodeBytes); - + ProcessAppPacket(srcIp, dstIp, srcPort, dstPort, AppOpCode, NewPacket.Length, NewPacket, 0, Direction, PacketTime); } if (DEBUG) @@ -730,7 +730,7 @@ namespace EQPacket FragmentSeq[(int)Direction] = -1; } } - + break; } case OP_OutOfOrderAck: @@ -750,7 +750,7 @@ namespace EQPacket Seq = Payload[3] * 256 + Payload[4]; else Seq = Payload[2] * 256 + Payload[3]; - + string DirectionString; if(Direction == PacketDirection.ClientToServer) @@ -763,7 +763,7 @@ namespace EQPacket Debug("OP_Ack, Seq " + Seq + " " + DirectionString); Debug(Utils.HexDump(Payload)); } - + break; } default: @@ -776,7 +776,7 @@ namespace EQPacket Debug(Utils.HexDump(Payload)); Debug("-------------------"); } - + int AppOpCode; byte[] NewPacket; @@ -791,7 +791,7 @@ namespace EQPacket else { // This packet has a flag byte between the first and second bytes of the opcode, and also a CRC - + Flags = Payload[1]; if (Flags == 0x5a) @@ -837,7 +837,7 @@ namespace EQPacket } if (!Cached && !CacheEmpty()) - ProcessCache(); + ProcessCache(); } public void ProcessAppPacket(System.Net.IPAddress srcIp, System.Net.IPAddress dstIp, ushort srcPort, ushort dstPort, int InOpCode, int BufferSize, byte[] Source, int Offset, PacketDirection Direction, DateTime PacketTime) @@ -854,7 +854,7 @@ namespace EQPacket PermaLocked = true; } Identified = (TempStatus == IdentificationStatus.Yes); - } + } AddPacket(app); } @@ -885,7 +885,7 @@ namespace EQPacket UncompressedSize = Payload.Length - (Offset - 1); } - + zs.Close(); zs.Dispose(); @@ -897,6 +897,6 @@ namespace EQPacket Array.Resize(ref Uncompressed, UncompressedSize); return Uncompressed; - } + } } } diff --git a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.Designer.cs b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.Designer.cs index 6805e5df2..092ea0375 100644 --- a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.Designer.cs @@ -77,9 +77,9 @@ this.groupBox2.SuspendLayout(); this.MiscOptions.SuspendLayout(); this.SuspendLayout(); - // + // // groupBox1 - // + // this.groupBox1.Controls.Add(this.MerchantTextBox); this.groupBox1.Controls.Add(this.MerchantLabel); this.groupBox1.Controls.Add(this.GroundSpawnTextBox); @@ -108,9 +108,9 @@ this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Insert IDs"; - // + // // MerchantTextBox - // + // this.MerchantTextBox.Enabled = false; this.MerchantTextBox.HidePromptOnLeave = true; this.MerchantTextBox.Location = new System.Drawing.Point(107, 302); @@ -119,18 +119,18 @@ this.MerchantTextBox.PromptChar = ' '; this.MerchantTextBox.Size = new System.Drawing.Size(61, 20); this.MerchantTextBox.TabIndex = 34; - // + // // MerchantLabel - // + // this.MerchantLabel.AutoSize = true; this.MerchantLabel.Location = new System.Drawing.Point(14, 306); this.MerchantLabel.Name = "MerchantLabel"; this.MerchantLabel.Size = new System.Drawing.Size(76, 13); this.MerchantLabel.TabIndex = 33; this.MerchantLabel.Text = "Merchant Lists"; - // + // // GroundSpawnTextBox - // + // this.GroundSpawnTextBox.Enabled = false; this.GroundSpawnTextBox.HidePromptOnLeave = true; this.GroundSpawnTextBox.Location = new System.Drawing.Point(107, 274); @@ -139,18 +139,18 @@ this.GroundSpawnTextBox.PromptChar = ' '; this.GroundSpawnTextBox.Size = new System.Drawing.Size(61, 20); this.GroundSpawnTextBox.TabIndex = 32; - // + // // GroundSpawnLabel - // + // this.GroundSpawnLabel.AutoSize = true; this.GroundSpawnLabel.Location = new System.Drawing.Point(7, 278); this.GroundSpawnLabel.Name = "GroundSpawnLabel"; this.GroundSpawnLabel.Size = new System.Drawing.Size(83, 13); this.GroundSpawnLabel.TabIndex = 31; this.GroundSpawnLabel.Text = "Ground Spawns"; - // + // // ObjectTextBox - // + // this.ObjectTextBox.Enabled = false; this.ObjectTextBox.HidePromptOnLeave = true; this.ObjectTextBox.Location = new System.Drawing.Point(107, 246); @@ -159,18 +159,18 @@ this.ObjectTextBox.PromptChar = ' '; this.ObjectTextBox.Size = new System.Drawing.Size(61, 20); this.ObjectTextBox.TabIndex = 30; - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(47, 250); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(43, 13); this.label1.TabIndex = 29; this.label1.Text = "Objects"; - // + // // GridTextBox - // + // this.GridTextBox.Enabled = false; this.GridTextBox.HidePromptOnLeave = true; this.GridTextBox.Location = new System.Drawing.Point(107, 218); @@ -179,18 +179,18 @@ this.GridTextBox.PromptChar = ' '; this.GridTextBox.Size = new System.Drawing.Size(61, 20); this.GridTextBox.TabIndex = 28; - // + // // GridLabel - // + // this.GridLabel.AutoSize = true; this.GridLabel.Location = new System.Drawing.Point(59, 222); this.GridLabel.Name = "GridLabel"; this.GridLabel.Size = new System.Drawing.Size(31, 13); this.GridLabel.TabIndex = 27; this.GridLabel.Text = "Grids"; - // + // // Spawn2TextBox - // + // this.Spawn2TextBox.Enabled = false; this.Spawn2TextBox.HidePromptOnLeave = true; this.Spawn2TextBox.Location = new System.Drawing.Point(107, 190); @@ -199,18 +199,18 @@ this.Spawn2TextBox.PromptChar = ' '; this.Spawn2TextBox.Size = new System.Drawing.Size(61, 20); this.Spawn2TextBox.TabIndex = 26; - // + // // Spawn2Label - // + // this.Spawn2Label.AutoSize = true; this.Spawn2Label.Location = new System.Drawing.Point(44, 194); this.Spawn2Label.Name = "Spawn2Label"; this.Spawn2Label.Size = new System.Drawing.Size(46, 13); this.Spawn2Label.TabIndex = 25; this.Spawn2Label.Text = "Spawn2"; - // + // // SpawnEntryTextBox - // + // this.SpawnEntryTextBox.Enabled = false; this.SpawnEntryTextBox.HidePromptOnLeave = true; this.SpawnEntryTextBox.Location = new System.Drawing.Point(107, 162); @@ -219,18 +219,18 @@ this.SpawnEntryTextBox.PromptChar = ' '; this.SpawnEntryTextBox.Size = new System.Drawing.Size(61, 20); this.SpawnEntryTextBox.TabIndex = 24; - // + // // SpawnEntryLabel - // + // this.SpawnEntryLabel.AutoSize = true; this.SpawnEntryLabel.Location = new System.Drawing.Point(26, 166); this.SpawnEntryLabel.Name = "SpawnEntryLabel"; this.SpawnEntryLabel.Size = new System.Drawing.Size(64, 13); this.SpawnEntryLabel.TabIndex = 23; this.SpawnEntryLabel.Text = "SpawnEntry"; - // + // // SpawnGroupTextBox - // + // this.SpawnGroupTextBox.Enabled = false; this.SpawnGroupTextBox.HidePromptOnLeave = true; this.SpawnGroupTextBox.Location = new System.Drawing.Point(107, 134); @@ -239,18 +239,18 @@ this.SpawnGroupTextBox.PromptChar = ' '; this.SpawnGroupTextBox.Size = new System.Drawing.Size(61, 20); this.SpawnGroupTextBox.TabIndex = 22; - // + // // SpawnGroupLabel - // + // this.SpawnGroupLabel.AutoSize = true; this.SpawnGroupLabel.Location = new System.Drawing.Point(21, 138); this.SpawnGroupLabel.Name = "SpawnGroupLabel"; this.SpawnGroupLabel.Size = new System.Drawing.Size(69, 13); this.SpawnGroupLabel.TabIndex = 21; this.SpawnGroupLabel.Text = "SpawnGroup"; - // + // // NPCTypesTextBox - // + // this.NPCTypesTextBox.Enabled = false; this.NPCTypesTextBox.HidePromptOnLeave = true; this.NPCTypesTextBox.Location = new System.Drawing.Point(107, 106); @@ -259,18 +259,18 @@ this.NPCTypesTextBox.PromptChar = ' '; this.NPCTypesTextBox.Size = new System.Drawing.Size(61, 20); this.NPCTypesTextBox.TabIndex = 20; - // + // // label3 - // + // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(32, 110); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(58, 13); this.label3.TabIndex = 19; this.label3.Text = "NPCTypes"; - // + // // DoorsTextBox - // + // this.DoorsTextBox.Enabled = false; this.DoorsTextBox.HidePromptOnLeave = true; this.DoorsTextBox.Location = new System.Drawing.Point(107, 78); @@ -279,18 +279,18 @@ this.DoorsTextBox.PromptChar = ' '; this.DoorsTextBox.Size = new System.Drawing.Size(61, 20); this.DoorsTextBox.TabIndex = 18; - // + // // DoorsLabel - // + // this.DoorsLabel.AutoSize = true; this.DoorsLabel.Location = new System.Drawing.Point(55, 82); this.DoorsLabel.Name = "DoorsLabel"; this.DoorsLabel.Size = new System.Drawing.Size(35, 13); this.DoorsLabel.TabIndex = 17; this.DoorsLabel.Text = "Doors"; - // + // // VersionSelector - // + // this.VersionSelector.Enabled = false; this.VersionSelector.Location = new System.Drawing.Point(107, 50); this.VersionSelector.Maximum = new decimal(new int[] { @@ -303,27 +303,27 @@ this.VersionSelector.TabIndex = 16; this.VersionSelector.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.VersionSelector.ValueChanged += new System.EventHandler(this.VersionSelector_ValueChanged); - // + // // VersionLabel - // + // this.VersionLabel.AutoSize = true; this.VersionLabel.Location = new System.Drawing.Point(48, 54); this.VersionLabel.Name = "VersionLabel"; this.VersionLabel.Size = new System.Drawing.Size(42, 13); this.VersionLabel.TabIndex = 15; this.VersionLabel.Text = "Version"; - // + // // label4 - // + // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(44, 26); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(46, 13); this.label4.TabIndex = 14; this.label4.Text = "ZoneID:"; - // + // // ZoneIDTextBox - // + // this.ZoneIDTextBox.Enabled = false; this.ZoneIDTextBox.HidePromptOnLeave = true; this.ZoneIDTextBox.Location = new System.Drawing.Point(107, 22); @@ -333,9 +333,9 @@ this.ZoneIDTextBox.Size = new System.Drawing.Size(100, 20); this.ZoneIDTextBox.TabIndex = 13; this.ZoneIDTextBox.Validated += new System.EventHandler(this.ZoneIDTextBox_Validated); - // + // // groupBox2 - // + // this.groupBox2.Controls.Add(this.InvisibleMenCheckBox); this.groupBox2.Controls.Add(this.NPCTypesTintCheckBox); this.groupBox2.Controls.Add(this.UpdateExistingNPCTypesCheckbox); @@ -353,9 +353,9 @@ this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "Include"; - // + // // NPCTypesTintCheckBox - // + // this.NPCTypesTintCheckBox.AutoSize = true; this.NPCTypesTintCheckBox.Location = new System.Drawing.Point(24, 233); this.NPCTypesTintCheckBox.Name = "NPCTypesTintCheckBox"; @@ -365,9 +365,9 @@ this.toolTip1.SetToolTip(this.NPCTypesTintCheckBox, "Uses the npc_types_tint table instead of the tint columns in the npc_types table." + ""); this.NPCTypesTintCheckBox.UseVisualStyleBackColor = true; - // + // // UpdateExistingNPCTypesCheckbox - // + // this.UpdateExistingNPCTypesCheckbox.AutoSize = true; this.UpdateExistingNPCTypesCheckbox.Location = new System.Drawing.Point(24, 210); this.UpdateExistingNPCTypesCheckbox.Name = "UpdateExistingNPCTypesCheckbox"; @@ -376,9 +376,9 @@ this.UpdateExistingNPCTypesCheckbox.Text = "Update existing NPC types"; this.UpdateExistingNPCTypesCheckbox.UseVisualStyleBackColor = true; this.UpdateExistingNPCTypesCheckbox.CheckedChanged += new System.EventHandler(this.UpdateExistingNPCTypesCheckbox_CheckedChanged); - // + // // ZonePointCheckBox - // + // this.ZonePointCheckBox.AutoSize = true; this.ZonePointCheckBox.Checked = true; this.ZonePointCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -388,9 +388,9 @@ this.ZonePointCheckBox.TabIndex = 40; this.ZonePointCheckBox.Text = "Zone Points"; this.ZonePointCheckBox.UseVisualStyleBackColor = true; - // + // // ZoneCheckBox - // + // this.ZoneCheckBox.AutoSize = true; this.ZoneCheckBox.Checked = true; this.ZoneCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -400,9 +400,9 @@ this.ZoneCheckBox.TabIndex = 39; this.ZoneCheckBox.Text = "Zone Config"; this.ZoneCheckBox.UseVisualStyleBackColor = true; - // + // // MerchantCheckBox - // + // this.MerchantCheckBox.AutoSize = true; this.MerchantCheckBox.Checked = true; this.MerchantCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -412,9 +412,9 @@ this.MerchantCheckBox.TabIndex = 38; this.MerchantCheckBox.Text = "Merchant Lists"; this.MerchantCheckBox.UseVisualStyleBackColor = true; - // + // // GroundSpawnCheckBox - // + // this.GroundSpawnCheckBox.AutoSize = true; this.GroundSpawnCheckBox.Checked = true; this.GroundSpawnCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -424,9 +424,9 @@ this.GroundSpawnCheckBox.TabIndex = 9; this.GroundSpawnCheckBox.Text = "Ground Spawns"; this.GroundSpawnCheckBox.UseVisualStyleBackColor = true; - // + // // ObjectCheckBox - // + // this.ObjectCheckBox.AutoSize = true; this.ObjectCheckBox.Checked = true; this.ObjectCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -436,9 +436,9 @@ this.ObjectCheckBox.TabIndex = 8; this.ObjectCheckBox.Text = "Objects"; this.ObjectCheckBox.UseVisualStyleBackColor = true; - // + // // GridCheckBox - // + // this.GridCheckBox.AutoSize = true; this.GridCheckBox.Checked = true; this.GridCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -448,9 +448,9 @@ this.GridCheckBox.TabIndex = 7; this.GridCheckBox.Text = "Grids"; this.GridCheckBox.UseVisualStyleBackColor = true; - // + // // SpawnCheckBox - // + // this.SpawnCheckBox.AutoSize = true; this.SpawnCheckBox.Checked = true; this.SpawnCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -461,9 +461,9 @@ this.SpawnCheckBox.Text = "Spawns"; this.SpawnCheckBox.UseVisualStyleBackColor = true; this.SpawnCheckBox.CheckedChanged += new System.EventHandler(this.SpawnCheckBox_CheckedChanged); - // + // // DoorCheckBox - // + // this.DoorCheckBox.AutoSize = true; this.DoorCheckBox.Checked = true; this.DoorCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -473,14 +473,14 @@ this.DoorCheckBox.TabIndex = 4; this.DoorCheckBox.Text = "Doors"; this.DoorCheckBox.UseVisualStyleBackColor = true; - // + // // SQLFileDialog - // + // this.SQLFileDialog.Filter = "SQL Files (*.sql)|*.sql|Text Files (*.txt)|*.txt|All files (*.*)|*.*"; this.SQLFileDialog.Title = "Generate SQL and Save As"; - // + // // GenerateSQLButton - // + // this.GenerateSQLButton.Location = new System.Drawing.Point(126, 474); this.GenerateSQLButton.Name = "GenerateSQLButton"; this.GenerateSQLButton.Size = new System.Drawing.Size(100, 27); @@ -488,9 +488,9 @@ this.GenerateSQLButton.Text = "Generate SQL"; this.GenerateSQLButton.UseVisualStyleBackColor = true; this.GenerateSQLButton.Click += new System.EventHandler(this.GenerateSQLButton_Click); - // + // // SQLCancelButton - // + // this.SQLCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.SQLCancelButton.Location = new System.Drawing.Point(305, 474); this.SQLCancelButton.Name = "SQLCancelButton"; @@ -499,9 +499,9 @@ this.SQLCancelButton.Text = "Cancel"; this.SQLCancelButton.UseVisualStyleBackColor = true; this.SQLCancelButton.Click += new System.EventHandler(this.SQLCancelButton_Click); - // + // // MiscOptions - // + // this.MiscOptions.Controls.Add(this.SpawnNameFilter); this.MiscOptions.Controls.Add(this.label2); this.MiscOptions.Controls.Add(this.CoalesceWaypoints); @@ -511,25 +511,25 @@ this.MiscOptions.TabIndex = 2; this.MiscOptions.TabStop = false; this.MiscOptions.Text = "Misc. Options"; - // + // // SpawnNameFilter - // + // this.SpawnNameFilter.Location = new System.Drawing.Point(229, 46); this.SpawnNameFilter.Name = "SpawnNameFilter"; this.SpawnNameFilter.Size = new System.Drawing.Size(209, 20); this.SpawnNameFilter.TabIndex = 5; - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(14, 49); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(209, 13); this.label2.TabIndex = 4; this.label2.Text = "Only include spawns that contain the string"; - // + // // CoalesceWaypoints - // + // this.CoalesceWaypoints.AutoSize = true; this.CoalesceWaypoints.Checked = true; this.CoalesceWaypoints.CheckState = System.Windows.Forms.CheckState.Checked; @@ -540,9 +540,9 @@ this.CoalesceWaypoints.Text = "Automatically coalesce waypoints"; this.toolTip1.SetToolTip(this.CoalesceWaypoints, "Remove redundant waypoints from generated SQL"); this.CoalesceWaypoints.UseVisualStyleBackColor = true; - // + // // InvisibleMenCheckBox - // + // this.InvisibleMenCheckBox.AutoSize = true; this.InvisibleMenCheckBox.Location = new System.Drawing.Point(24, 256); this.InvisibleMenCheckBox.Name = "InvisibleMenCheckBox"; @@ -551,9 +551,9 @@ this.InvisibleMenCheckBox.Text = "Include Invisible Men"; this.toolTip1.SetToolTip(this.InvisibleMenCheckBox, "Includes Race 127 NPCs"); this.InvisibleMenCheckBox.UseVisualStyleBackColor = true; - // + // // GenerateSQLForm - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.SQLCancelButton; diff --git a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.cs b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.cs index d937b495f..b282bf9a7 100644 --- a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.cs +++ b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.cs @@ -96,8 +96,8 @@ namespace EQExtractor2 this.DialogResult = DialogResult.Cancel; } - + } - + } diff --git a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.resx b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.resx index 183eb2750..5781a59db 100644 --- a/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.resx +++ b/utils/EQExtractor2/EQExtractor2/GenerateSQLForm.resx @@ -1,17 +1,17 @@  - diff --git a/utils/EQExtractor2/EQExtractor2/InternalTypes.cs b/utils/EQExtractor2/EQExtractor2/InternalTypes.cs index 645aaea00..faa588627 100644 --- a/utils/EQExtractor2/EQExtractor2/InternalTypes.cs +++ b/utils/EQExtractor2/EQExtractor2/InternalTypes.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.Collections.Generic; @@ -21,7 +21,7 @@ namespace EQExtractor2.InternalTypes public UInt32 DropID; public string Name; public UInt16 ZoneID; - public UInt16 InstanceID; + public UInt16 InstanceID; public float Heading; public float y; public float x; @@ -64,7 +64,7 @@ namespace EQExtractor2.InternalTypes public UInt16 ZoneID; public UInt16 InstanceID; public byte FallDamage; - public float FogDensity; + public float FogDensity; } public class ZoneEntryStruct @@ -76,16 +76,16 @@ namespace EQExtractor2.InternalTypes } public string SpawnName; - public UInt32 SpawnID; + public UInt32 SpawnID; public bool Findable; public Byte Level; - public Byte IsNPC; + public Byte IsNPC; public uint Showname; public uint TargetableWithHotkey; - public uint Targetable; + public uint Targetable; public uint ShowHelm; public uint Gender; - public byte OtherData; + public byte OtherData; public string DestructableString1; public string DestructableString2; public string DestructableString3; @@ -120,21 +120,21 @@ namespace EQExtractor2.InternalTypes public UInt32 DrakkinTattoo; public UInt32 DrakkinDetails; public UInt32 Deity; - public byte Class; - public byte EquipChest2; + public byte Class; + public byte EquipChest2; public byte Helm; public string LastName; public UInt32 PetOwnerID; public float YPos; - public float Heading; - public float XPos; - public float ZPos; + public float Heading; + public float XPos; + public float ZPos; public UInt32[] SlotColour; public byte ArmorTintRed; public byte ArmorTintGreen; - public byte ArmorTintBlue; + public byte ArmorTintBlue; public UInt32 MeleeTexture1; - public UInt32 MeleeTexture2; + public UInt32 MeleeTexture2; public UInt32[] Equipment; public string Title; public string Suffix; @@ -383,7 +383,7 @@ namespace EQExtractor2.InternalTypes public UInt16 Instance; public float x; public float y; - public float z; + public float z; public float TargetX; public float TargetY; public float TargetZ; @@ -575,7 +575,7 @@ namespace EQExtractor2.InternalTypes public Position p; - public bool HighRes; + public bool HighRes; } public class ExplorerSpawnRecord @@ -632,7 +632,7 @@ namespace EQExtractor2.InternalTypes public float DestY; public float DestZ; public float DestHeading; - + } class MerchantManager { diff --git a/utils/EQExtractor2/EQExtractor2/LogForm.Designer.cs b/utils/EQExtractor2/EQExtractor2/LogForm.Designer.cs index b1531ee72..be5c03559 100644 --- a/utils/EQExtractor2/EQExtractor2/LogForm.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/LogForm.Designer.cs @@ -30,9 +30,9 @@ { this.ConsoleWindow = new System.Windows.Forms.ListBox(); this.SuspendLayout(); - // + // // ConsoleWindow - // + // this.ConsoleWindow.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); @@ -44,9 +44,9 @@ this.ConsoleWindow.Name = "ConsoleWindow"; this.ConsoleWindow.Size = new System.Drawing.Size(938, 326); this.ConsoleWindow.TabIndex = 35; - // + // // LogForm - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(962, 355); diff --git a/utils/EQExtractor2/EQExtractor2/LogForm.cs b/utils/EQExtractor2/EQExtractor2/LogForm.cs index c836aa1af..9a0cde667 100644 --- a/utils/EQExtractor2/EQExtractor2/LogForm.cs +++ b/utils/EQExtractor2/EQExtractor2/LogForm.cs @@ -21,6 +21,6 @@ namespace EQExtractor2 e.Cancel = true; this.Hide(); } - + } } diff --git a/utils/EQExtractor2/EQExtractor2/LogForm.resx b/utils/EQExtractor2/EQExtractor2/LogForm.resx index 1af7de150..8b2ff64a1 100644 --- a/utils/EQExtractor2/EQExtractor2/LogForm.resx +++ b/utils/EQExtractor2/EQExtractor2/LogForm.resx @@ -1,17 +1,17 @@  - diff --git a/utils/EQExtractor2/EQExtractor2/OpcodeManager.cs b/utils/EQExtractor2/EQExtractor2/OpcodeManager.cs index 21b980190..a862a3119 100644 --- a/utils/EQExtractor2/EQExtractor2/OpcodeManager.cs +++ b/utils/EQExtractor2/EQExtractor2/OpcodeManager.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.IO; @@ -124,8 +124,8 @@ namespace EQExtractor2.OpCodes public void ResetCounts() { - foreach (OpCode oc in OpCodeList) - oc.Count = 0; + foreach (OpCode oc in OpCodeList) + oc.Count = 0; } public void RegisterExplorer(string Name, ExplorerMethod Explorer) @@ -137,7 +137,7 @@ namespace EQExtractor2.OpCodes oc.Explorer = Explorer; return; } - } + } } public void UnRegisterExplorer(string Name) diff --git a/utils/EQExtractor2/EQExtractor2/PacketDotNet.dll b/utils/EQExtractor2/EQExtractor2/PacketDotNet.dll index 560b03fee..4f1a6c42f 100644 Binary files a/utils/EQExtractor2/EQExtractor2/PacketDotNet.dll and b/utils/EQExtractor2/EQExtractor2/PacketDotNet.dll differ diff --git a/utils/EQExtractor2/EQExtractor2/PatchApril15-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchApril15-2013.cs index 9ae389832..153a3304f 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchApril15-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchApril15-2013.cs @@ -14,8 +14,8 @@ namespace EQExtractor2.Patches public PatchApril152013Decoder() { Version = "EQ Client Build Date April 15 2013."; - - PatchConfFileName = "patch_April15-2013.conf"; + + PatchConfFileName = "patch_April15-2013.conf"; SupportsSQLGeneration = true; } @@ -204,7 +204,7 @@ namespace EQExtractor2.Patches UInt32 Position4 = Buffer.ReadUInt32(); UInt32 Position5 = Buffer.ReadUInt32(); - + NewSpawn.YPos = Utils.EQ19ToFloat((Int32)((Position1 >> 12) & 0x7FFFF)); NewSpawn.ZPos = Utils.EQ19ToFloat((Int32)(Position2) & 0x7FFFF); diff --git a/utils/EQExtractor2/EQExtractor2/PatchAug04-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchAug04-2011.cs index df72a7ed1..d291093fa 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchAug04-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchAug04-2011.cs @@ -13,7 +13,7 @@ namespace EQExtractor2.Patches public PatchAug042011Decoder() { Version = "EQ Client Build Date August 04 2011."; - + ExpectedPPLength = 28496; PPZoneIDOffset = 21164; diff --git a/utils/EQExtractor2/EQExtractor2/PatchAugust15-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchAugust15-2012.cs index 9351f0663..d05902add 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchAugust15-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchAugust15-2012.cs @@ -17,7 +17,7 @@ namespace EQExtractor2.Patches ExpectedPPLength = 33904; PPZoneIDOffset = 26572; - + PatchConfFileName = "patch_August15-2012.conf"; } @@ -28,10 +28,10 @@ namespace EQExtractor2.Patches Item NewItem = new Item(); Buffer.SetPosition(30); - NewItem.MerchantSlot = Buffer.ReadByte(); - NewItem.Price = Buffer.ReadUInt32(); + NewItem.MerchantSlot = Buffer.ReadByte(); + NewItem.Price = Buffer.ReadUInt32(); Buffer.SkipBytes(5); - NewItem.Quantity = Buffer.ReadInt32(); + NewItem.Quantity = Buffer.ReadInt32(); Buffer.SetPosition(109); // 109 NewItem.Name = Buffer.ReadString(true); diff --git a/utils/EQExtractor2/EQExtractor2/PatchDec7-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchDec7-2010.cs index 97b109900..416e3abef 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchDec7-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchDec7-2010.cs @@ -15,7 +15,7 @@ namespace EQExtractor2.Patches Version = "EQ Client Build Date December 7 2010."; PatchConfFileName = "patch_Dec7-2010.conf"; - + } override public IdentificationStatus Identify(int OpCode, int Size, PacketDirection Direction) { @@ -31,7 +31,7 @@ namespace EQExtractor2.Patches public override void RegisterExplorers() { - //OpManager.RegisterExplorer("OP_ClientUpdate", ExploreClientUpdate); + //OpManager.RegisterExplorer("OP_ClientUpdate", ExploreClientUpdate); } public void ExploreClientUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) @@ -42,7 +42,7 @@ namespace EQExtractor2.Patches float y = Buffer.ReadSingle(); Buffer.SkipBytes(12); float z = Buffer.ReadSingle(); - + Buffer.SkipBytes(4); UInt32 Temp = Buffer.ReadUInt32(); Temp = Temp & 0x3FFFFF; diff --git a/utils/EQExtractor2/EQExtractor2/PatchDecember10-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchDecember10-2012.cs index 4b9c29479..f6b43f709 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchDecember10-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchDecember10-2012.cs @@ -18,7 +18,7 @@ namespace EQExtractor2.Patches ExpectedPPLength = -1; PPZoneIDOffset = -1; - + PatchConfFileName = "patch_Dec10-2012.conf"; PacketsToMatch = new PacketToMatch[] { @@ -31,7 +31,7 @@ namespace EQExtractor2.Patches } override public IdentificationStatus Identify(int OpCode, int Size, PacketDirection Direction) - { + { if ((OpCode == OpManager.OpCodeNameToNumber(PacketsToMatch[WaitingForPacket].OPCodeName)) && (Direction == PacketsToMatch[WaitingForPacket].Direction)) { @@ -42,7 +42,7 @@ namespace EQExtractor2.Patches return IdentificationStatus.Yes; WaitingForPacket++; - + return IdentificationStatus.Tentative; } @@ -119,8 +119,8 @@ namespace EQExtractor2.Patches ByteStream Buffer = new ByteStream(PlayerProfilePacket[0]); - Buffer.SkipBytes(24); - + Buffer.SkipBytes(24); + UInt32 BindCount = Buffer.ReadUInt32(); for (int i = 0; i < BindCount; ++i) @@ -129,7 +129,7 @@ namespace EQExtractor2.Patches } Buffer.SkipBytes(8); // Deity, intoxication - UInt32 SpellRefreshCount = Buffer.ReadUInt32(); + UInt32 SpellRefreshCount = Buffer.ReadUInt32(); for (int i = 0; i < SpellRefreshCount; ++i) { @@ -137,20 +137,20 @@ namespace EQExtractor2.Patches } UInt32 EquipmentCount = Buffer.ReadUInt32(); - + for (int i = 0; i < EquipmentCount; ++i) { Buffer.SkipBytes(20); } - UInt32 SomethingCount = Buffer.ReadUInt32(); + UInt32 SomethingCount = Buffer.ReadUInt32(); for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(20); } - SomethingCount = Buffer.ReadUInt32(); + SomethingCount = Buffer.ReadUInt32(); for (int i = 0; i < SomethingCount; ++i) { @@ -158,7 +158,7 @@ namespace EQExtractor2.Patches } SomethingCount = Buffer.ReadUInt32(); - + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); @@ -169,25 +169,25 @@ namespace EQExtractor2.Patches UInt32 Points = Buffer.ReadUInt32(); UInt32 Mana = Buffer.ReadUInt32(); UInt32 CurHP = Buffer.ReadUInt32(); - + Buffer.SkipBytes(28); Buffer.SkipBytes(28); UInt32 AACount = Buffer.ReadUInt32(); - + for (int i = 0; i < AACount; ++i) { Buffer.SkipBytes(12); } SomethingCount = Buffer.ReadUInt32(); - + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); } SomethingCount = Buffer.ReadUInt32(); - + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); @@ -305,7 +305,7 @@ namespace EQExtractor2.Patches UInt16 ZoneID = Buffer.ReadUInt16(); return ZoneID; - + } override public List GetSpawns() @@ -335,7 +335,7 @@ namespace EQExtractor2.Patches UInt32 Bitfield = Buffer.ReadUInt32(); NewSpawn.Gender = (Bitfield & 3); - + Byte OtherData = Buffer.ReadByte(); Buffer.SkipBytes(8); // Skip 8 unknown bytes @@ -367,7 +367,7 @@ namespace EQExtractor2.Patches NewSpawn.BodyType = Buffer.ReadUInt32(); else NewSpawn.BodyType = 0; - + for (int j = 1; j < NewSpawn.PropCount; ++j) Buffer.SkipBytes(4); @@ -399,9 +399,9 @@ namespace EQExtractor2.Patches NewSpawn.WalkSpeed = Buffer.ReadSingle(); NewSpawn.RunSpeed = Buffer.ReadSingle(); - + NewSpawn.Race = Buffer.ReadUInt32(); - + Buffer.SkipBytes(1); // Skip Holding NewSpawn.Deity = Buffer.ReadUInt32(); @@ -411,9 +411,9 @@ namespace EQExtractor2.Patches NewSpawn.Class = Buffer.ReadByte(); Buffer.SkipBytes(4); // Skip PVP, Standstate, Light, Flymode - + NewSpawn.LastName = Buffer.ReadString(true); - + Buffer.SkipBytes(6); NewSpawn.PetOwnerID = Buffer.ReadUInt32(); @@ -421,7 +421,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(25); NewSpawn.MeleeTexture1 = 0; - NewSpawn.MeleeTexture2 = 0; + NewSpawn.MeleeTexture2 = 0; if ( (NewSpawn.IsNPC == 0) || NPCType.IsPlayableRace(NewSpawn.Race)) { @@ -501,7 +501,7 @@ namespace EQExtractor2.Patches NewSpawn.Heading = Utils.EQ19ToFloat((Int32)(Position5) & 0x7FFFF); - + if ((OtherData & 16) > 0) @@ -626,7 +626,7 @@ namespace EQExtractor2.Patches DecodeItemPacket(OutputStream, Buffer, Direction); } - + } @@ -669,7 +669,7 @@ namespace EQExtractor2.Patches String Desc = Buffer.ReadString(false); - + OutputStream.WriteLine("Duration: {0}, Unk4: {1:X}, StartTime: {2:X}", Duration, Unk4, StartTime); OutputStream.WriteLine("Desc: {0}", Desc); @@ -765,7 +765,7 @@ namespace EQExtractor2.Patches } OutputStream.WriteLine(""); //OutputStream.WriteLine("Offset is now: {0}", Buffer.GetPosition()); - + } } @@ -803,7 +803,7 @@ namespace EQExtractor2.Patches //float DeltaHeading = Utils.EQ19ToFloat((int)(Word & 0x3FF)); } - + } @@ -843,11 +843,11 @@ namespace EQExtractor2.Patches OutputStream.WriteLine(""); UInt32 BindCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: BindCount = {1}", Buffer.GetPosition() - 4, BindCount); - + for (int i = 0; i < BindCount; ++i) { OutputStream.WriteLine("{0, -5}: Bind: {1} Zone: {2} XYZ: {3},{4},{5} Heading: {6}", - Buffer.GetPosition(), i, Buffer.ReadUInt32(), Buffer.ReadSingle(), Buffer.ReadSingle(),Buffer.ReadSingle(),Buffer.ReadSingle()); + Buffer.GetPosition(), i, Buffer.ReadUInt32(), Buffer.ReadSingle(), Buffer.ReadSingle(),Buffer.ReadSingle(),Buffer.ReadSingle()); } OutputStream.WriteLine(""); @@ -858,10 +858,10 @@ namespace EQExtractor2.Patches //Buffer.SkipBytes(8); // Deity, intoxication UInt32 UnknownCount = Buffer.ReadUInt32(); - + OutputStream.WriteLine("{0, -5}: Unknown Count = {1}", Buffer.GetPosition() - 4, UnknownCount); - + for (int i = 0; i < UnknownCount; ++i) { @@ -872,7 +872,7 @@ namespace EQExtractor2.Patches UInt32 EquipmentCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: EquipmentCount = {1}", Buffer.GetPosition() - 4, EquipmentCount); - + for (int i = 0; i < EquipmentCount; ++i) { OutputStream.Write("{0, -5}: Equip: {1} Values: ", Buffer.GetPosition(), i); @@ -901,7 +901,7 @@ namespace EQExtractor2.Patches UInt32 TintCount = Buffer.ReadUInt32(); - OutputStream.WriteLine("{0, -5}: TintCount = {1}", Buffer.GetPosition() - 4, TintCount); + OutputStream.WriteLine("{0, -5}: TintCount = {1}", Buffer.GetPosition() - 4, TintCount); for (int i = 0; i < TintCount; ++i) { @@ -976,8 +976,8 @@ namespace EQExtractor2.Patches UInt32 AACount = Buffer.ReadUInt32(); - OutputStream.WriteLine("{0, -5}: AA Count = {1}", Buffer.GetPosition() - 4, AACount); - + OutputStream.WriteLine("{0, -5}: AA Count = {1}", Buffer.GetPosition() - 4, AACount); + for (int i = 0; i < AACount; ++i) { @@ -988,25 +988,25 @@ namespace EQExtractor2.Patches UInt32 SkillCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Skill Count = {1}", Buffer.GetPosition() - 4, SkillCount); - + for (int i = 0; i < SkillCount; ++i) { Buffer.SkipBytes(4); } - + UInt32 SomethingCount = Buffer.ReadUInt32(); - OutputStream.WriteLine("{0, -5}: Something Count = {1}", Buffer.GetPosition() - 4, SomethingCount); - + OutputStream.WriteLine("{0, -5}: Something Count = {1}", Buffer.GetPosition() - 4, SomethingCount); + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); } - + UInt32 DisciplineCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Discipline Count = {1}", Buffer.GetPosition() - 4, DisciplineCount); - + for (int i = 0; i < DisciplineCount; ++i) { Buffer.SkipBytes(4); @@ -1014,12 +1014,12 @@ namespace EQExtractor2.Patches UInt32 TimeStampCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: TimeStamp Count = {1}", Buffer.GetPosition() - 4, TimeStampCount); - + for (int i = 0; i < TimeStampCount; ++i) { Buffer.SkipBytes(4); } - + UInt32 RecastCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Recast Count = {1}", Buffer.GetPosition() - 4, RecastCount); @@ -1037,11 +1037,11 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); } - + UInt32 SpellBookSlots = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: SpellBookSlot Count = {1}", Buffer.GetPosition() - 4, SpellBookSlots); - + for (int i = 0; i < SpellBookSlots; ++i) { Buffer.SkipBytes(4); @@ -1050,7 +1050,7 @@ namespace EQExtractor2.Patches UInt32 SpellMemSlots = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Spell Mem Count = {1}", Buffer.GetPosition() - 4, SpellMemSlots); - + for (int i = 0; i < SpellMemSlots; ++i) { Buffer.SkipBytes(4); @@ -1059,18 +1059,18 @@ namespace EQExtractor2.Patches SomethingCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Unknown Count = {1}", Buffer.GetPosition() - 4, SomethingCount); - + for (int i = 0; i < SomethingCount; ++i) { Buffer.SkipBytes(4); } OutputStream.WriteLine("{0, -5}: Unknown = {1}", Buffer.GetPosition(), Buffer.ReadByte()); - + UInt32 BuffCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Buff Count = {1}", Buffer.GetPosition() - 4, BuffCount); - + for (int i = 0; i < BuffCount; ++i) { Buffer.ReadByte(); @@ -1104,7 +1104,7 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("{0, -5}: Unknown = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Thirst? = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Hunger? = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); - + //Buffer.SkipBytes(20); OutputStream.WriteLine("{0, -5}: AA Spent = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); @@ -1118,14 +1118,14 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("{0, -5}: AA Spent Special = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: AA Unspent = {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown", Buffer.GetPosition(), Buffer.ReadUInt16()); - + //Buffer.SkipBytes(30); UInt32 BandolierCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Bandolier Count = {1}", Buffer.GetPosition() - 4, BandolierCount); - + for (int i = 0; i < BandolierCount; ++i) { Buffer.ReadString(false); @@ -1146,11 +1146,11 @@ namespace EQExtractor2.Patches UInt32 PotionCount = Buffer.ReadUInt32(); OutputStream.WriteLine("{0, -5}: Potion Count = {1}", Buffer.GetPosition() - 4, PotionCount); - + for (int i = 0; i < PotionCount; ++i) { Buffer.ReadString(false); - Buffer.SkipBytes(8); + Buffer.SkipBytes(8); } OutputStream.WriteLine("{0, -5}: Unknown {1}", Buffer.GetPosition(), Buffer.ReadInt32()); @@ -1186,7 +1186,7 @@ namespace EQExtractor2.Patches int CurrentPosition = Buffer.GetPosition(); OutputStream.WriteLine("{0, -5}: Name: {1}", Buffer.GetPosition(), Buffer.ReadString(false)); - + Buffer.SetPosition(CurrentPosition + (int)NameLength); UInt32 LastNameLength = Buffer.ReadUInt32(); @@ -1209,10 +1209,10 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("{0, -5}: Language Count = {1}", Buffer.GetPosition() - 4, LanguageCount); for (int i = 0; i < LanguageCount; ++i) - { + { Buffer.SkipBytes(1); } - + OutputStream.WriteLine("{0, -5}: Zone ID {1}", Buffer.GetPosition(), Buffer.ReadUInt16()); OutputStream.WriteLine("{0, -5}: Zone Instance {1}", Buffer.GetPosition(), Buffer.ReadUInt16()); OutputStream.WriteLine("{0, -5}: Y,X,Z {1},{2},{3} Heading: {4}", @@ -1341,7 +1341,7 @@ namespace EQExtractor2.Patches for(int i = 0; i < Unknown6; ++i) OutputStream.WriteLine("{0, -5}: Unknown LDON? {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); - + OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); @@ -1358,7 +1358,7 @@ namespace EQExtractor2.Patches // Air remaining ? OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); - // Next 7 could be PVP stats, + // Next 7 could be PVP stats, OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); @@ -1426,16 +1426,16 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("{0, -5}: Showhelm? {1}", Buffer.GetPosition(), Buffer.ReadByte()); OutputStream.WriteLine("{0, -5}: RestTimer? {1}", Buffer.GetPosition(), Buffer.ReadUInt32()); - + OutputStream.WriteLine("Skipping 1028 bytes starting at offset {0}", Buffer.GetPosition()); Buffer.SkipBytes(1028); - + OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("Pointer is {0} bytes from end.", Buffer.Length() - Buffer.GetPosition()); - + } @@ -1490,12 +1490,12 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("Properties = {0}, Offset now {1}", Properties, Buffer.GetPosition()); UInt32 BodyType = 0; - + if(Properties > 0) BodyType = Buffer.ReadUInt32(); OutputStream.WriteLine("Bodytype = {0}", BodyType); - + if (Properties != 1) OutputStream.WriteLine("XXXX Properties is {0}", Properties); @@ -1552,7 +1552,7 @@ namespace EQExtractor2.Patches { UInt32 Equip3 = Buffer.ReadUInt32(); - UInt32 Equipx = Buffer.ReadUInt32(); + UInt32 Equipx = Buffer.ReadUInt32(); UInt32 Equip2 = Buffer.ReadUInt32(); @@ -1560,13 +1560,13 @@ namespace EQExtractor2.Patches UInt32 Equip0 = Buffer.ReadUInt32(); - OutputStream.WriteLine("Equip slot {0}: 0,1,2,x,3 is {1}, {2}, {3}, {4}, {5}", i, + OutputStream.WriteLine("Equip slot {0}: 0,1,2,x,3 is {1}, {2}, {3}, {4}, {5}", i, Equip0, Equip1, Equip2, Equipx, Equip3); } - - + + } else @@ -1635,7 +1635,7 @@ namespace EQExtractor2.Patches if (Buffer.Length() != Buffer.GetPosition()) OutputStream.WriteLine("PARSE ERROR"); - + diff --git a/utils/EQExtractor2/EQExtractor2/PatchFeb8-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchFeb8-2011.cs index 02c1e4430..5b4054726 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchFeb8-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchFeb8-2011.cs @@ -44,7 +44,7 @@ namespace EQExtractor2.Patches ByteStream Buffer = new ByteStream(PacketBuffer); Item NewItem = new Item(); - + Buffer.SetPosition(30); NewItem.MerchantSlot = Buffer.ReadByte(); // 13 NewItem.Price = Buffer.ReadUInt32(); // 14 diff --git a/utils/EQExtractor2/EQExtractor2/PatchFebruary11-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchFebruary11-2013.cs index 2464e6f2d..9226e5b19 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchFebruary11-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchFebruary11-2013.cs @@ -14,10 +14,10 @@ namespace EQExtractor2.Patches public PatchFebruary112013Decoder() { Version = "EQ Client Build Date February 11 2013."; - + PatchConfFileName = "patch_Feb11-2013.conf"; - PacketsToMatch = new PacketToMatch[] { + PacketsToMatch = new PacketToMatch[] { new PacketToMatch { OPCodeName = "OP_ZoneEntry", Direction = PacketDirection.ClientToServer, RequiredSize = 76, VersionMatched = false }, new PacketToMatch { OPCodeName = "OP_PlayerProfile", Direction = PacketDirection.ServerToClient, RequiredSize = -1, VersionMatched = true }, }; @@ -691,7 +691,7 @@ namespace EQExtractor2.Patches // Air remaining ? OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); - // Next 7 could be PVP stats, + // Next 7 could be PVP stats, OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); OutputStream.WriteLine("{0, -5}: Unknown {1:X}", Buffer.GetPosition(), Buffer.ReadUInt32()); diff --git a/utils/EQExtractor2/EQExtractor2/PatchGeneric.cs b/utils/EQExtractor2/EQExtractor2/PatchGeneric.cs index 5457c0ba2..c714041b5 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchGeneric.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchGeneric.cs @@ -36,7 +36,7 @@ namespace EQExtractor2.Patches { return Version; } - + virtual public bool UnsupportedVersion() { return ExpectedPPLength == 0; @@ -70,7 +70,7 @@ namespace EQExtractor2.Patches { return 0; } - + virtual public MerchantManager GetMerchantData(NPCSpawnList NPCSL) { return null; @@ -128,7 +128,7 @@ namespace EQExtractor2.Patches virtual public PositionUpdate Decode_OP_NPCMoveUpdate(byte[] UpdatePacket) { - PositionUpdate PosUpdate = new PositionUpdate(); + PositionUpdate PosUpdate = new PositionUpdate(); return PosUpdate; } @@ -165,12 +165,12 @@ namespace EQExtractor2.Patches { return ""; } - + virtual public bool DumpAAs(string FileName) { return false; } - + public void GivePackets(PacketManager pm) { Packets = pm; @@ -281,7 +281,7 @@ namespace EQExtractor2.Patches return ""; } - + protected PacketManager Packets; public OpCodeManager OpManager; diff --git a/utils/EQExtractor2/EQExtractor2/PatchJanuary16-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchJanuary16-2013.cs index f43df3233..589ce30fd 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchJanuary16-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchJanuary16-2013.cs @@ -14,8 +14,8 @@ namespace EQExtractor2.Patches public PatchJanuary162013Decoder() { Version = "EQ Client Build Date January 16 2013."; - - PatchConfFileName = "patch_Jan16-2013.conf"; + + PatchConfFileName = "patch_Jan16-2013.conf"; } override public List GetSpawns() @@ -240,7 +240,7 @@ namespace EQExtractor2.Patches { //OpManager.RegisterExplorer("OP_ZoneEntry", ExploreZoneEntry); //OpManager.RegisterExplorer("OP_NPCMoveUpdate", ExploreNPCMoveUpdate); - //OpManager.RegisterExplorer("OP_MobUpdate", ExploreMobUpdate); + //OpManager.RegisterExplorer("OP_MobUpdate", ExploreMobUpdate); } public void ExploreNPCMoveUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) diff --git a/utils/EQExtractor2/EQExtractor2/PatchJuly13-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchJuly13-2010.cs index dcc8eafe6..acfefceb3 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchJuly13-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchJuly13-2010.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.IO; using System.Collections.Generic; @@ -45,7 +45,7 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("Item: {0} at Slot: {1}", Name, Slot); } - + public void ExploreCastSpell(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) { @@ -138,6 +138,6 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("\r\nBuffer position at end is {0}", Buffer.GetPosition()); OutputStream.WriteLine(""); } - + } } diff --git a/utils/EQExtractor2/EQExtractor2/PatchJuly13-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchJuly13-2012.cs index bd037eca7..67b6ec412 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchJuly13-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchJuly13-2012.cs @@ -17,8 +17,8 @@ namespace EQExtractor2.Patches ExpectedPPLength = 33784; PPZoneIDOffset = 26452; - + PatchConfFileName = "patch_July13-2012.conf"; - } + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchJune25-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchJune25-2012.cs index 98f5b0e75..090fde73b 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchJune25-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchJune25-2012.cs @@ -13,8 +13,8 @@ namespace EQExtractor2.Patches public PatchJune252012Decoder() { Version = "EQ Client Build Date June 25 2012."; - + PatchConfFileName = "patch_June25-2012.conf"; - } + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchMar15-2012.cs b/utils/EQExtractor2/EQExtractor2/PatchMar15-2012.cs index 00c65a5b7..e98c2003e 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMar15-2012.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMar15-2012.cs @@ -22,7 +22,7 @@ namespace EQExtractor2.Patches } public override void RegisterExplorers() - { + { //OpManager.RegisterExplorer("OP_ZoneEntry", ExploreZoneEntry); } @@ -32,7 +32,7 @@ namespace EQExtractor2.Patches return; string SpawnName = Buffer.ReadString(true); - + UInt32 SpawnID = Buffer.ReadUInt32(); byte Level = Buffer.ReadByte(); @@ -102,7 +102,7 @@ namespace EQExtractor2.Patches Buffer.ReadByte(); - + } OutputStream.WriteLine("Size starts at offset {0}", Buffer.GetPosition()); @@ -372,7 +372,7 @@ namespace EQExtractor2.Patches NewSpawn.XPos = Utils.EQ19ToFloat((Int32)(Position4 >> 12) & 0x7FFFF); NewSpawn.ZPos = Utils.EQ19ToFloat((Int32)(Position5 & 0x7FFFF)); - + NewSpawn.MeleeTexture1 = 0; NewSpawn.MeleeTexture2 = 0; diff --git a/utils/EQExtractor2/EQExtractor2/PatchMarch13-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchMarch13-2013.cs index a4bac3b81..d70572b2b 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMarch13-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMarch13-2013.cs @@ -14,12 +14,12 @@ namespace EQExtractor2.Patches public PatchMarch132013Decoder() { Version = "EQ Client Build Date March 13 2013."; - - PatchConfFileName = "patch_Mar13-2013.conf"; + + PatchConfFileName = "patch_Mar13-2013.conf"; SupportsSQLGeneration = true; } - + override public List GetDoors() { List DoorList = new List(); diff --git a/utils/EQExtractor2/EQExtractor2/PatchMarch15-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchMarch15-2011.cs index 2ec152125..c189749e9 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMarch15-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMarch15-2011.cs @@ -18,7 +18,7 @@ namespace EQExtractor2.Patches ExpectedPPLength = 28536; - PPZoneIDOffset = 21204; - } + PPZoneIDOffset = 21204; + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchMay12-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchMay12-2010.cs index d31c6d172..20e4253a3 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMay12-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMay12-2010.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.IO; @@ -26,14 +26,14 @@ namespace EQExtractor2.Patches public PatchMay122010Decoder() { Version = "EQ Client Build Date May 12 2010. (Valid up to and including Build Date June 8 2010)"; - + PatchConfFileName = "patch_May12-2010.conf"; - + ExpectedPPLength = 26632; - + PPZoneIDOffset = 19396; } - + override public bool Init(string ConfDirectory, ref string ErrorMessage) { OpManager = new OpCodeManager(); @@ -94,7 +94,7 @@ namespace EQExtractor2.Patches List PlayerProfilePacket = GetPacketsOfType("OP_PlayerProfile", PacketDirection.ServerToClient); if (PlayerProfilePacket.Count == 0) - { + { return 0; } else @@ -107,7 +107,7 @@ namespace EQExtractor2.Patches return BitConverter.ToUInt16(PlayerProfilePacket[0], PPZoneIDOffset); } - + override public List GetDoors() { List DoorList = new List(); @@ -159,7 +159,7 @@ namespace EQExtractor2.Patches DoorParam, DestZone, 0, 0, 0, 0); DoorList.Add(NewDoor); - + } return DoorList; } @@ -221,7 +221,7 @@ namespace EQExtractor2.Patches { ByteStream Buffer = new ByteStream(PacketBuffer); - Item NewItem = new Item(); + Item NewItem = new Item(); NewItem.StackSize = Buffer.ReadUInt32(); Buffer.SkipBytes(4); @@ -233,7 +233,7 @@ namespace EQExtractor2.Patches NewItem.Name = Buffer.ReadString(true); NewItem.Lore = Buffer.ReadString(true); NewItem.IDFile = Buffer.ReadString(true); - NewItem.ID = Buffer.ReadUInt32(); + NewItem.ID = Buffer.ReadUInt32(); return NewItem; } @@ -245,7 +245,7 @@ namespace EQExtractor2.Patches List ZonePointPackets = GetPacketsOfType("OP_SendZonepoints", PacketDirection.ServerToClient); if (ZonePointPackets.Count < 1) - { + { return ZonePointList; } @@ -257,7 +257,7 @@ namespace EQExtractor2.Patches if (Entries == 0) return ZonePointList; - + float x, y, z, Heading; UInt32 Number; @@ -284,14 +284,14 @@ namespace EQExtractor2.Patches ZoneID = Buffer.ReadUInt16(); Instance = Buffer.ReadUInt16(); - + Buffer.SkipBytes(4); // Skip the last UInt32 ZonePoint NewZonePoint = new ZonePoint(Number, ZoneID, Instance, x, y, z, x, y, z, Heading, ZoneID); - ZonePointList.Add(NewZonePoint); + ZonePointList.Add(NewZonePoint); } - + return ZonePointList; } @@ -300,7 +300,7 @@ namespace EQExtractor2.Patches NewZoneStruct NewZone = new NewZoneStruct(); List ZonePackets = GetPacketsOfType("OP_NewZone", PacketDirection.ServerToClient); - + if (ZonePackets.Count < 1) return NewZone; @@ -316,7 +316,7 @@ namespace EQExtractor2.Patches NewZone.LongName = Buffer.ReadFixedLengthString(278, true); - NewZone.Type = Buffer.ReadByte(); + NewZone.Type = Buffer.ReadByte(); NewZone.FogRed = Buffer.ReadBytes(4); @@ -325,7 +325,7 @@ namespace EQExtractor2.Patches NewZone.FogBlue = Buffer.ReadBytes(4); Buffer.SkipBytes(1); // Unknown - + for (int i = 0; i < 4; ++i) NewZone.FogMinClip[i] = Buffer.ReadSingle(); @@ -379,7 +379,7 @@ namespace EQExtractor2.Patches NewZone.FogDensity = Buffer.ReadSingle(); // Everything else after this point in the packet is unknown. - + return NewZone; } @@ -433,7 +433,7 @@ namespace EQExtractor2.Patches // Destructable Objects. Not handled yet // //SQLOut(String.Format("-- OBJECT FOUND SpawnID {0}", SpawnID.ToString("x"))); - + NewSpawn.DestructableString1 = Buffer.ReadString(false); NewSpawn.DestructableString2 = Buffer.ReadString(false); @@ -524,7 +524,7 @@ namespace EQExtractor2.Patches NewSpawn.EquipChest2 = Buffer.ReadByte(); bool UseWorn = (NewSpawn.EquipChest2 == 255); - + Buffer.SkipBytes(2); // 2 Unknown bytes; NewSpawn.Helm = Buffer.ReadByte(); @@ -554,7 +554,7 @@ namespace EQExtractor2.Patches NewSpawn.XPos = Utils.EQ19ToFloat((Int32)(Position4 >> 12) & 0x7FFFF); NewSpawn.ZPos = Utils.EQ19ToFloat((Int32)(Position5 & 0x7FFFF)); - + for (int ColourSlot = 0; ColourSlot < 9; ++ColourSlot) NewSpawn.SlotColour[ColourSlot] = Buffer.ReadUInt32(); @@ -636,9 +636,9 @@ namespace EQExtractor2.Patches List UpdatePackets = GetPacketsOfType("OP_NPCMoveUpdate", PacketDirection.ServerToClient); - foreach (byte[] UpdatePacket in UpdatePackets) + foreach (byte[] UpdatePacket in UpdatePackets) Updates.Add(Decode_OP_NPCMoveUpdate(UpdatePacket)); - + return Updates; } @@ -671,9 +671,9 @@ namespace EQExtractor2.Patches List UpdatePackets = GetPacketsOfType("OP_MobUpdate", PacketDirection.ServerToClient); - foreach (byte[] MobUpdatePacket in UpdatePackets) + foreach (byte[] MobUpdatePacket in UpdatePackets) Updates.Add(Decode_OP_MobUpdate(MobUpdatePacket)); - + return Updates; } @@ -754,7 +754,7 @@ namespace EQExtractor2.Patches List PacketList = Packets.PacketList; UInt32 OP_ClientUpdate = OpManager.OpCodeNameToNumber("OP_ClientUpdate"); - + foreach (EQApplicationPacket UpdatePacket in PacketList) { if ((UpdatePacket.OpCode != OP_ClientUpdate) || (UpdatePacket.Direction != PacketDirection.ClientToServer)) @@ -779,7 +779,7 @@ namespace EQExtractor2.Patches Updates.Add(PosUpdate); - } + } return Updates; } @@ -828,7 +828,7 @@ namespace EQExtractor2.Patches List FindableSpawnList = new List(); List FindablePackets = GetPacketsOfType("OP_SendFindableNPCs", PacketDirection.ServerToClient); - + if (FindablePackets.Count < 1) return FindableSpawnList; @@ -837,7 +837,7 @@ namespace EQExtractor2.Patches if (BitConverter.ToUInt32(Packet, 0) == 0) FindableSpawnList.Add(BitConverter.ToUInt32(Packet, 4)); } - + return FindableSpawnList; } @@ -864,7 +864,7 @@ namespace EQExtractor2.Patches //OpManager.RegisterExplorer("OP_HPUpdate", ExploreHPUpdate); //OpManager.RegisterExplorer("OP_Animation", ExploreAnimation); //OpManager.RegisterExplorer("OP_CharInventory", ExploreCharInventoryPacket); - + } public void ExploreZoneEntry(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) @@ -910,7 +910,7 @@ namespace EQExtractor2.Patches if ((OtherData & 1) > 0) { // Destructable Objects. - + DestructableString1 = Buffer.ReadString(false); DestructableString2 = Buffer.ReadString(false); @@ -956,9 +956,9 @@ namespace EQExtractor2.Patches DestructableUnk9, DestructableByte); } - Buffer.SkipBytes(17); + Buffer.SkipBytes(17); - byte PropCount = Buffer.ReadByte(); + byte PropCount = Buffer.ReadByte(); if (PropCount >= 1) { @@ -991,8 +991,8 @@ namespace EQExtractor2.Patches { UInt32 CurrentHP = Buffer.ReadUInt32(); Int32 MaxHP = Buffer.ReadInt32(); - UInt16 SpawnID = Buffer.ReadUInt16(); - + UInt16 SpawnID = Buffer.ReadUInt16(); + string SpawnName = FindExplorerSpawn(SpawnID); OutputStream.WriteLine("Spawn {0} {1} Current HP: {2} Max HP: {3}", SpawnID, SpawnName, CurrentHP, MaxHP); @@ -1001,7 +1001,7 @@ namespace EQExtractor2.Patches } public void ExploreAnimation(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) - { + { UInt16 SpawnID = Buffer.ReadUInt16(); byte Action = Buffer.ReadByte(); byte Value = Buffer.ReadByte(); @@ -1324,7 +1324,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // clickunk7 Buffer.SkipBytes(30); // Proc Effect Struct Buffer.ReadString(true); // Proc Name - Buffer.SkipBytes(4); // unknown5 + Buffer.SkipBytes(4); // unknown5 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name Buffer.SkipBytes(4); // unknown6 @@ -1336,7 +1336,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name - Buffer.SkipBytes(4); // unknown6 + Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(103); // Item Quaternary Body Struct - 4 (we want to read the SubLength field at the end) //UInt32 SubLengths = Buffer.ReadUInt32(); diff --git a/utils/EQExtractor2/EQExtractor2/PatchMay12-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchMay12-2011.cs index 97f0ac2ac..852eabefc 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMay12-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMay12-2011.cs @@ -18,7 +18,7 @@ namespace EQExtractor2.Patches ExpectedPPLength = 28536; - PPZoneIDOffset = 21204; + PPZoneIDOffset = 21204; } override public PositionUpdate Decode_OP_NPCMoveUpdate(byte[] UpdatePacket) @@ -42,7 +42,7 @@ namespace EQExtractor2.Patches PosUpdate.p.heading = (float)bs.readInt(12) / (float)(1 << 3); PosUpdate.HighRes = true; - + return PosUpdate; } @@ -245,20 +245,20 @@ namespace EQExtractor2.Patches //base.RegisterExplorers(); //OpManager.RegisterExplorer("OP_SpawnDoor", ExploreSpawnDoor); - + } public void ExploreSpawnDoor(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) - { + { uint DoorCount = Buffer.Length() / 96; OutputStream.WriteLine("Door Count: {0}", DoorCount); - + for (int d = 0; d < DoorCount; ++d) { string DoorName = Buffer.ReadFixedLengthString(32, false); - + float YPos = Buffer.ReadSingle(); float XPos = Buffer.ReadSingle(); @@ -288,9 +288,9 @@ namespace EQExtractor2.Patches // Skip past the trailing unknowns in the door struct, moving to the next door in the packet. - Buffer.SkipBytes(28); + Buffer.SkipBytes(28); } - + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchMay24-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchMay24-2011.cs index 280db1333..63049ecd9 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchMay24-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchMay24-2011.cs @@ -13,10 +13,10 @@ namespace EQExtractor2.Patches public PatchMay242011Decoder() { Version = "EQ Client Build Date May 24 2011."; - + ExpectedPPLength = 28856; - PPZoneIDOffset = 21524; - } + PPZoneIDOffset = 21524; + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchNov17-2011.cs b/utils/EQExtractor2/EQExtractor2/PatchNov17-2011.cs index 01218b638..c7e0df132 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchNov17-2011.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchNov17-2011.cs @@ -274,7 +274,7 @@ namespace EQExtractor2.Patches //OpManager.RegisterExplorer("OP_NPCMoveUpdate", ExploreNPCMoveUpdate); //OpManager.RegisterExplorer("OP_MobUpdate", ExploreMobUpdate); - + } public void ExploreNPCMoveUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) @@ -365,7 +365,7 @@ namespace EQExtractor2.Patches UInt32 Cost = Buffer.ReadUInt32(); UInt32 Seq = Buffer.ReadUInt32(); UInt32 CurrentLevel = Buffer.ReadUInt32(); - + UInt32 PreReqSkillCount = Buffer.ReadUInt32(); UInt32 [] PreReqSkills = new UInt32[PreReqSkillCount]; @@ -416,7 +416,7 @@ namespace EQExtractor2.Patches OutputFile.Write("{0} ", PreReqMinPoints[i]); OutputFile.WriteLine(""); - + OutputFile.WriteLine(" Type:\t\t" + Type); OutputFile.WriteLine(" SpellID:\t" + SpellID); OutputFile.WriteLine(" Unknown057:\t" + Unknown057); diff --git a/utils/EQExtractor2/EQExtractor2/PatchSoD.cs b/utils/EQExtractor2/EQExtractor2/PatchSoD.cs index 70c06c4f1..c1bdc2e1c 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchSoD.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchSoD.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// // // IMPORTANT NOTE: This decoder for SoD was developed purely as a cursory test of the multi-patch support and is not guaranteed // to be 100% correct. @@ -721,7 +721,7 @@ namespace EQExtractor2.Patches GroundSpawn.Name = Buffer.ReadFixedLengthString(16, false); - Buffer.SkipBytes(20); + Buffer.SkipBytes(20); GroundSpawn.ObjectType = Buffer.ReadUInt32(); @@ -760,11 +760,11 @@ namespace EQExtractor2.Patches public override void RegisterExplorers() { - OpManager.RegisterExplorer("OP_ZoneEntry", ExploreZoneEntry); + OpManager.RegisterExplorer("OP_ZoneEntry", ExploreZoneEntry); //OpManager.RegisterExplorer("OP_RespawnWindow", ExploreRespawnWindow); //OpManager.RegisterExplorer("OP_ZonePlayerToBind", ExploreZonePlayerToBind); //OpManager.RegisterExplorer("OP_RequestClientZoneChange", ExploreRequestClientZoneChange); - //OpManager.RegisterExplorer("OP_DeleteSpawn", ExploreDeleteSpawn); + //OpManager.RegisterExplorer("OP_DeleteSpawn", ExploreDeleteSpawn); OpManager.RegisterExplorer("OP_HPUpdate", ExploreHPUpdate); } diff --git a/utils/EQExtractor2/EQExtractor2/PatchTestSep1-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchTestSep1-2010.cs index b2a7cd486..7eaf07b7d 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchTestSep1-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchTestSep1-2010.cs @@ -1,7 +1,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; using System.IO; using System.Collections.Generic; @@ -25,15 +25,15 @@ namespace EQExtractor2.Patches { if((OpCode == OpManager.OpCodeNameToNumber("OP_ZoneEntry")) && (Direction == PacketDirection.ClientToServer)) return IdentificationStatus.Yes; - + return IdentificationStatus.No; - } + } override public Item DecodeItemPacket(byte[] PacketBuffer) { ByteStream Buffer = new ByteStream(PacketBuffer); - Item NewItem = new Item(); + Item NewItem = new Item(); NewItem.StackSize = Buffer.ReadUInt32(); // 00 Buffer.SkipBytes(4); @@ -55,12 +55,12 @@ namespace EQExtractor2.Patches public override void RegisterExplorers() { base.RegisterExplorers(); - + //OpManager.RegisterExplorer("OP_CharInventory", ExploreCharInventoryPacket); //OpManager.RegisterExplorer("OP_ItemPacket", ExploreItemPacket); //OpManager.RegisterExplorer("OP_MercenaryPurchaseWindow", ExploreMercenaryPurchaseWindow); } - + public void ExploreCharInventoryPacket(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction) { UInt32 ItemCount = Buffer.ReadUInt32(); @@ -69,7 +69,7 @@ namespace EQExtractor2.Patches for (int i = 0; i < ItemCount; ++i) { - ExploreSubItem(OutputStream, ref Buffer); + ExploreSubItem(OutputStream, ref Buffer); } OutputStream.WriteLine(""); @@ -85,7 +85,7 @@ namespace EQExtractor2.Patches } void ExploreSubItem(StreamWriter OutputStream, ref ByteStream Buffer) - { + { Buffer.SkipBytes(8); byte Area = Buffer.ReadByte(); @@ -118,14 +118,14 @@ namespace EQExtractor2.Patches break; case 8: AreaName = "Merchant"; - break; + break; } OutputStream.WriteLine("Area: {0} {1} Main Slot {2,2} Sub Slot {3,3} Name {4}", Area, AreaName.PadRight(20), MainSlot, SubSlot, Name); Buffer.ReadString(true); // Lore Buffer.ReadString(true); // IDFile - + //Buffer.SkipBytes(236); // Item Body Struct UInt32 ID = Buffer.ReadUInt32(); @@ -229,7 +229,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // clickunk7 Buffer.SkipBytes(30); // Proc Effect Struct Buffer.ReadString(true); // Proc Name - Buffer.SkipBytes(4); // unknown5 + Buffer.SkipBytes(4); // unknown5 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name Buffer.SkipBytes(4); // unknown6 @@ -241,15 +241,15 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name - Buffer.SkipBytes(4); // unknown6 + Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(103); // Item Quaternary Body Struct - 4 (we want to read the SubLength field at the end) UInt32 SubLengths = Buffer.ReadUInt32(); - + for (int i = 0; i < SubLengths; ++i) { Buffer.SkipBytes(4); - ExploreSubItem(OutputStream, ref Buffer); + ExploreSubItem(OutputStream, ref Buffer); } } @@ -291,7 +291,7 @@ namespace EQExtractor2.Patches OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown3); UInt32 Unknown4 = Buffer.ReadUInt32(); OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown4); - + byte Unknown5 = Buffer.ReadByte(); //OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint8, Buffer, {0}); // Unknown", Unknown5); @@ -303,7 +303,7 @@ namespace EQExtractor2.Patches //OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Unknown", Unknown8); UInt32 StanceCount = Buffer.ReadUInt32(); - + OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint32, Buffer, {0}); // Number of Stances for this Merc", StanceCount); UInt32 Unknown10 = Buffer.ReadUInt32(); @@ -311,8 +311,8 @@ namespace EQExtractor2.Patches byte Unknown11 = Buffer.ReadByte(); //OutputStream.WriteLine("VARSTRUCT_ENCODE_TYPE(uint8, Buffer, {0}); // Unknown", Unknown11); - - + + //OutputStream.WriteLine(" Offset: {5} Unknown1: {0} DBStrings: {1} {2} Purchase: {3} Upkeep: {4}\r\n", Unknown1, DBStringID1, DBStringID2, // PurchaseCost, UpkeepCost, Offset); //OutputStream.WriteLine(" Unknowns: {0} {1} {2} {3} {4} {5} {6} {7} {8}\r\n", @@ -336,6 +336,6 @@ namespace EQExtractor2.Patches OutputStream.WriteLine(""); } - + } } diff --git a/utils/EQExtractor2/EQExtractor2/PatchTestSep22-2010.cs b/utils/EQExtractor2/EQExtractor2/PatchTestSep22-2010.cs index 6c5230501..2f53e1363 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchTestSep22-2010.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchTestSep22-2010.cs @@ -314,7 +314,7 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // clickunk7 Buffer.SkipBytes(30); // Proc Effect Struct Buffer.ReadString(true); // Proc Name - Buffer.SkipBytes(4); // unknown5 + Buffer.SkipBytes(4); // unknown5 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name Buffer.SkipBytes(4); // unknown6 @@ -326,15 +326,15 @@ namespace EQExtractor2.Patches Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(30); // Worn Effect Struct Buffer.ReadString(true); // Worn Name - Buffer.SkipBytes(4); // unknown6 + Buffer.SkipBytes(4); // unknown6 Buffer.SkipBytes(103); // Item Quaternary Body Struct - 4 (we want to read the SubLength field at the end) - + Buffer.SkipBytes(57); // HoT OutputStream.WriteLine(" Reading sublengths from offset {0}", Buffer.GetPosition()); UInt32 SubLengths = Buffer.ReadUInt32(); - + for (int i = 0; i < SubLengths; ++i) { diff --git a/utils/EQExtractor2/EQExtractor2/PatchTestServerFebruary5-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchTestServerFebruary5-2013.cs index c705bccd4..1298dd5e4 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchTestServerFebruary5-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchTestServerFebruary5-2013.cs @@ -14,10 +14,10 @@ namespace EQExtractor2.Patches public PatchTestServerFebruary52013Decoder() { Version = "EQ Client Build Date Test Server February 5 2013."; - + PatchConfFileName = "patch_TestServer-Feb5-2013.conf"; SupportsSQLGeneration = false; - } + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/PatchTestServerJanuary16-2013.cs b/utils/EQExtractor2/EQExtractor2/PatchTestServerJanuary16-2013.cs index 41f6a3889..21be591cc 100644 --- a/utils/EQExtractor2/EQExtractor2/PatchTestServerJanuary16-2013.cs +++ b/utils/EQExtractor2/EQExtractor2/PatchTestServerJanuary16-2013.cs @@ -14,10 +14,10 @@ namespace EQExtractor2.Patches public PatchTestServerJanuary162013Decoder() { Version = "EQ Client Build Date Test Server January 16 2013."; - + PatchConfFileName = "patch_TestServer-Jan16-2013.conf"; SupportsSQLGeneration = false; - } + } } } \ No newline at end of file diff --git a/utils/EQExtractor2/EQExtractor2/Properties/AssemblyInfo.cs b/utils/EQExtractor2/EQExtractor2/Properties/AssemblyInfo.cs index 879069892..202a873e5 100644 --- a/utils/EQExtractor2/EQExtractor2/Properties/AssemblyInfo.cs +++ b/utils/EQExtractor2/EQExtractor2/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("EQExtractor2")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] diff --git a/utils/EQExtractor2/EQExtractor2/Properties/Resources.Designer.cs b/utils/EQExtractor2/EQExtractor2/Properties/Resources.Designer.cs index e67b74c43..b78b32960 100644 --- a/utils/EQExtractor2/EQExtractor2/Properties/Resources.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/Properties/Resources.Designer.cs @@ -10,8 +10,8 @@ namespace EQExtractor2.Properties { using System; - - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -23,15 +23,15 @@ namespace EQExtractor2.Properties { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { - + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// @@ -45,7 +45,7 @@ namespace EQExtractor2.Properties { return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. diff --git a/utils/EQExtractor2/EQExtractor2/Properties/Resources.resx b/utils/EQExtractor2/EQExtractor2/Properties/Resources.resx index af7dbebba..9c90483af 100644 --- a/utils/EQExtractor2/EQExtractor2/Properties/Resources.resx +++ b/utils/EQExtractor2/EQExtractor2/Properties/Resources.resx @@ -1,17 +1,17 @@  - diff --git a/utils/EQExtractor2/EQExtractor2/Properties/Settings.Designer.cs b/utils/EQExtractor2/EQExtractor2/Properties/Settings.Designer.cs index 27d78fb48..37d6d4781 100644 --- a/utils/EQExtractor2/EQExtractor2/Properties/Settings.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/Properties/Settings.Designer.cs @@ -9,20 +9,20 @@ //------------------------------------------------------------------------------ namespace EQExtractor2.Properties { - - + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - + public static Settings Default { get { return defaultInstance; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("notepad.exe")] @@ -34,7 +34,7 @@ namespace EQExtractor2.Properties { this["TextFileViewer"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -46,7 +46,7 @@ namespace EQExtractor2.Properties { this["ShowDebugWindowOnStartup"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] diff --git a/utils/EQExtractor2/EQExtractor2/SharpPcap.dll b/utils/EQExtractor2/EQExtractor2/SharpPcap.dll index 38b783bf2..e53fa0198 100644 Binary files a/utils/EQExtractor2/EQExtractor2/SharpPcap.dll and b/utils/EQExtractor2/EQExtractor2/SharpPcap.dll differ diff --git a/utils/EQExtractor2/EQExtractor2/UserOptions.Designer.cs b/utils/EQExtractor2/EQExtractor2/UserOptions.Designer.cs index 372cb8fcd..3d5581f79 100644 --- a/utils/EQExtractor2/EQExtractor2/UserOptions.Designer.cs +++ b/utils/EQExtractor2/EQExtractor2/UserOptions.Designer.cs @@ -39,27 +39,27 @@ this.EQPacketDebugFilename = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(107, 13); this.label1.TabIndex = 0; this.label1.Text = "Packet Dump Viewer"; - // + // // PacketDumpViewerProgram - // + // this.PacketDumpViewerProgram.Location = new System.Drawing.Point(125, 6); this.PacketDumpViewerProgram.Name = "PacketDumpViewerProgram"; this.PacketDumpViewerProgram.Size = new System.Drawing.Size(390, 20); this.PacketDumpViewerProgram.TabIndex = 1; this.toolTip1.SetToolTip(this.PacketDumpViewerProgram, "If not using notepad/wordpad include the full path, e.g. C:\\Program Files (x86)\\N" + "otepad++\\notepad++.exe"); - // + // // ShowDebugWindowOnStartup - // + // this.ShowDebugWindowOnStartup.AutoSize = true; this.ShowDebugWindowOnStartup.Location = new System.Drawing.Point(15, 61); this.ShowDebugWindowOnStartup.Name = "ShowDebugWindowOnStartup"; @@ -67,9 +67,9 @@ this.ShowDebugWindowOnStartup.TabIndex = 2; this.ShowDebugWindowOnStartup.Text = "Show Debug Window On Startup"; this.ShowDebugWindowOnStartup.UseVisualStyleBackColor = true; - // + // // ShowTimeStamps - // + // this.ShowTimeStamps.AutoSize = true; this.ShowTimeStamps.Location = new System.Drawing.Point(15, 84); this.ShowTimeStamps.Name = "ShowTimeStamps"; @@ -77,9 +77,9 @@ this.ShowTimeStamps.TabIndex = 3; this.ShowTimeStamps.Text = "Include Time Stamps In Packet Dump"; this.ShowTimeStamps.UseVisualStyleBackColor = true; - // + // // OptionsOKButton - // + // this.OptionsOKButton.Location = new System.Drawing.Point(125, 122); this.OptionsOKButton.Name = "OptionsOKButton"; this.OptionsOKButton.Size = new System.Drawing.Size(75, 23); @@ -87,9 +87,9 @@ this.OptionsOKButton.Text = "OK"; this.OptionsOKButton.UseVisualStyleBackColor = true; this.OptionsOKButton.Click += new System.EventHandler(this.OptionsOKButton_Click); - // + // // OptionsCancelButton - // + // this.OptionsCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.OptionsCancelButton.Location = new System.Drawing.Point(332, 122); this.OptionsCancelButton.Name = "OptionsCancelButton"; @@ -98,17 +98,17 @@ this.OptionsCancelButton.Text = "Cancel"; this.OptionsCancelButton.UseVisualStyleBackColor = true; this.OptionsCancelButton.Click += new System.EventHandler(this.OptionsCancelButton_Click); - // + // // EQPacketDebugFilename - // + // this.EQPacketDebugFilename.Location = new System.Drawing.Point(125, 32); this.EQPacketDebugFilename.Name = "EQPacketDebugFilename"; this.EQPacketDebugFilename.Size = new System.Drawing.Size(390, 20); this.EQPacketDebugFilename.TabIndex = 7; this.toolTip1.SetToolTip(this.EQPacketDebugFilename, "Output file for low level netcode debugging"); - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 35); this.label2.Name = "label2"; @@ -116,9 +116,9 @@ this.label2.TabIndex = 6; this.label2.Text = "Netcode Debug"; this.toolTip1.SetToolTip(this.label2, "Output file for low level netcode debugging"); - // + // // UserOptions - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.OptionsCancelButton; diff --git a/utils/EQExtractor2/EQExtractor2/UserOptions.resx b/utils/EQExtractor2/EQExtractor2/UserOptions.resx index df8339b68..dcfd08d0f 100644 --- a/utils/EQExtractor2/EQExtractor2/UserOptions.resx +++ b/utils/EQExtractor2/EQExtractor2/UserOptions.resx @@ -1,17 +1,17 @@  - diff --git a/utils/EQExtractor2/EQExtractor2/Utils.cs b/utils/EQExtractor2/EQExtractor2/Utils.cs index 3aeb28028..62a69ccc5 100644 --- a/utils/EQExtractor2/EQExtractor2/Utils.cs +++ b/utils/EQExtractor2/EQExtractor2/Utils.cs @@ -4,7 +4,7 @@ // // ShowEQ Distributed under GPL // http://www.sourceforge.net/projects/seq -// +// // Copyright 2004 Zaphod (dohpaz@users.sourceforge.net). // // ----------------------------------------------------------- @@ -13,7 +13,7 @@ // // Copyright (C) 2001-2010 EQEMu Development Team (http://eqemulator.net). Distributed under GPL version 2. // -// +// using System; @@ -21,7 +21,7 @@ using System.Text; namespace MyUtils { - public class ByteStream + public class ByteStream { public ByteStream(byte[] NewBuffer) { @@ -93,7 +93,7 @@ namespace MyUtils return Slice; } - + public void SkipBytes(int Count) { BufferPointer += Count; @@ -149,7 +149,7 @@ namespace MyUtils int BufferPointer; } - + class BitStream { public BitStream(byte[] Data, UInt32 Length) @@ -182,7 +182,7 @@ namespace MyUtils { // Lead partial is a byte. So just put it in the middle. leadPartialBitCount = 0; - } + } if (leadPartialBitCount > bitCount) { @@ -216,7 +216,7 @@ namespace MyUtils Out = (Out << 8) | m_data[currentByte]; currentByte++; } - + // And the end. if (tailPartialBitCount > 0) { @@ -292,7 +292,7 @@ namespace MyUtils { StringBuilder CleanName = new StringBuilder(); - foreach(char c in Name) + foreach(char c in Name) if(!Char.IsDigit(c)) CleanName.Append(c); @@ -300,15 +300,15 @@ namespace MyUtils } public static float EQ19ToFloat(Int32 EQ19Value) - { + { if ((EQ19Value & 0x40000) > 0) EQ19Value = -(0x7FFFF - EQ19Value + 1); return (float)EQ19Value / (float)(1 << 3); } - + } - + } diff --git a/utils/EQExtractor2/EQExtractor2/log4net.dll b/utils/EQExtractor2/EQExtractor2/log4net.dll index 1bac5d9a0..b184be52e 100644 Binary files a/utils/EQExtractor2/EQExtractor2/log4net.dll and b/utils/EQExtractor2/EQExtractor2/log4net.dll differ diff --git a/utils/EQExtractor2/EQExtractor2/patch_April15-2013.conf b/utils/EQExtractor2/EQExtractor2/patch_April15-2013.conf index 94d57d345..4661c9f03 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_April15-2013.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_April15-2013.conf @@ -650,4 +650,4 @@ OP_RAWOutOfSession=0x0000 # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs -OP_InitialHPUpdate=0x0000 +OP_InitialHPUpdate=0x0000 diff --git a/utils/EQExtractor2/EQExtractor2/patch_Aug04-2011.conf b/utils/EQExtractor2/EQExtractor2/patch_Aug04-2011.conf index cdfc5079a..44893bc82 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Aug04-2011.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Aug04-2011.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x5d32 # OP_ApproveWorld=0x1f87 # OP_LogServer=0x44ae # @@ -49,33 +49,33 @@ OP_FloatListThing=0x33f2 # # Reasons for Disconnect: OP_ZoneUnavail=0x66e4 # This is not the right opcode. Produces a 'Your character is inaccessible' message. OP_WorldClientReady=0x3f24 # -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # OP_ZoneEntry=0x02d6 # OP_ReqNewZone=0x1c36 # OP_NewZone=0x0254 # -OP_ZoneSpawns=0x0000 # +OP_ZoneSpawns=0x0000 # OP_PlayerProfile=0x6022 # OP_TimeOfDay=0x6015 # OP_LevelUpdate=0x0000 # OP_Stamina=0x0000 # OP_RequestClientZoneChange=0x18ea # OP_ZoneChange=0x5bd9 # -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x1a58 # @@ -86,7 +86,7 @@ OP_TaskActivity=0x0000 # OP_CompletedTasks=0x0000 # OP_Weather=0x4658 # OP_SendAATable=0x1d99 # -OP_UpdateAA=0x0000 # +OP_UpdateAA=0x0000 # OP_RespondAA=0x0000 # OP_ReqClientSpawn=0x47e7 # OP_SpawnDoor=0x6cfe # @@ -132,12 +132,12 @@ OP_GuildManageBanker=0x0000 # OP_GuildBank=0x0000 # OP_SetGuildRank=0x0000 # OP_GuildUpdateURLAndChannel=0x0000 # -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x0000 # @@ -317,8 +317,8 @@ OP_VetRewardsAvaliable=0x0000 # OP_VetClaimRequest=0x0000 # OP_VetClaimReply=0x0000 # OP_CrystalCountUpdate=0x0000 # -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # OP_MobUpdate=0x4656 # OP_NPCMoveUpdate=0x38e0 # @@ -349,7 +349,7 @@ OP_ManaUpdate=0x0ff4 # OP_EnduranceUpdate=0x0000 # OP_MobManaUpdate=0x1912 # OP_MobEnduranceUpdate=0x0000 # - + # Looting OP_LootRequest=0x0000 # OP_EndLootRequest=0x0000 # @@ -364,10 +364,10 @@ OP_TraderShop=0x0000 # OP_Trader=0x0000 # OP_TraderBuy=0x0000 # OP_Barter=0x0000 # -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x0000 # @@ -416,10 +416,10 @@ OP_TributeItem=0x0000 # OP_TributeMoney=0x0000 # OP_TributeToggle=0x0000 # OP_TributePointUpdate=0x0000 # -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x0000 # @@ -444,11 +444,11 @@ OP_AdventureLeaderboardReply=0x0000 # OP_GroupDisband=0x0000 # OP_GroupInvite=0x0000 # OP_GroupFollow=0x0000 # -OP_GroupUpdate=0x0000 # -OP_GroupUpdateB=0x0000 # +OP_GroupUpdate=0x0000 # +OP_GroupUpdateB=0x0000 # OP_GroupCancelInvite=0x0000 # OP_GroupAcknowledge=0x0000 # -OP_GroupDelete=0x0000 # +OP_GroupDelete=0x0000 # OP_CancelInvite=0x0000 # OP_GroupFollow2=0x0000 # OP_GroupInvite2=0x0000 # @@ -464,20 +464,20 @@ OP_LFGGetMatchesResponse=0x0000 # OP_LFPGetMatchesRequest=0x0000 # OP_LFPGetMatchesResponse=0x0000 # OP_LFPCommand=0x0000 # -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x0000 # OP_RaidUpdate=0x0000 # -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x0000 # OP_CombatAbility=0x0000 # OP_SenseTraps=0x0000 # OP_PickPocket=0x0000 # -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x0000 # OP_Sneak=0x0000 # OP_Fishing=0x0000 # @@ -495,7 +495,7 @@ OP_AcceptNewTask=0x0000 # OP_TaskHistoryRequest=0x0000 # OP_TaskHistoryReply=0x0000 # OP_CancelTask=0x0000 # -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x0000 # @@ -505,53 +505,53 @@ OP_SetTitle=0x0000 # OP_SetTitleReply=0x0000 # # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -563,47 +563,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_August15-2012.conf b/utils/EQExtractor2/EQExtractor2/patch_August15-2012.conf index 91dce281a..6549d6dfd 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_August15-2012.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_August15-2012.conf @@ -15,327 +15,327 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: -OP_SendLoginInfo=0x0000 # -OP_ApproveWorld=0x0000 # -OP_LogServer=0x0000 # -OP_SendCharInfo=0x0000 # -OP_ExpansionInfo=0x0000 # -OP_GuildsList=0x0000 # -OP_EnterWorld=0x0000 # -OP_PostEnterWorld=0x0000 # -OP_World_Client_CRC1=0x0000 # -OP_World_Client_CRC2=0x0000 # -OP_SendSpellChecksum=0x0000 # -OP_SendSkillCapsChecksum=0x0000 # - -# Character Select Related: -OP_DeleteCharacter=0x0000 # -OP_CharacterCreateRequest=0x0000 # -OP_CharacterCreate=0x0000 # -OP_RandomNameGenerator=0x0000 # -OP_ApproveName=0x0000 # - -OP_MOTD=0x0000 # -OP_SetChatServer=0x0000 # -OP_SetChatServer2=0x0000 # -OP_ZoneServerInfo=0x0000 # -OP_WorldComplete=0x0000 # -OP_WorldUnknown001=0x0000 # -OP_FloatListThing=0x0000 # - -# Reasons for Disconnect: -OP_ZoneUnavail=0x0000 # +# Required to reach Char Select: +OP_SendLoginInfo=0x0000 # +OP_ApproveWorld=0x0000 # +OP_LogServer=0x0000 # +OP_SendCharInfo=0x0000 # +OP_ExpansionInfo=0x0000 # +OP_GuildsList=0x0000 # +OP_EnterWorld=0x0000 # +OP_PostEnterWorld=0x0000 # +OP_World_Client_CRC1=0x0000 # +OP_World_Client_CRC2=0x0000 # +OP_SendSpellChecksum=0x0000 # +OP_SendSkillCapsChecksum=0x0000 # + +# Character Select Related: +OP_DeleteCharacter=0x0000 # +OP_CharacterCreateRequest=0x0000 # +OP_CharacterCreate=0x0000 # +OP_RandomNameGenerator=0x0000 # +OP_ApproveName=0x0000 # + +OP_MOTD=0x0000 # +OP_SetChatServer=0x0000 # +OP_SetChatServer2=0x0000 # +OP_ZoneServerInfo=0x0000 # +OP_WorldComplete=0x0000 # +OP_WorldUnknown001=0x0000 # +OP_FloatListThing=0x0000 # + +# Reasons for Disconnect: +OP_ZoneUnavail=0x0000 # OP_WorldClientReady=0x0000 # Testing VoA 0x3f24 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # - -# Zone in opcodes -OP_AckPacket=0x3594 # -OP_ZoneEntry=0x4938 # -OP_ReqNewZone=0x0000 # -OP_NewZone=0x3401 # -OP_ZoneSpawns=0x0000 # -OP_PlayerProfile=0x078e # -OP_TimeOfDay=0x0000 # -OP_LevelUpdate=0x0000 # -OP_Stamina=0x0000 # -OP_RequestClientZoneChange=0x0000 # -OP_ZoneChange=0x0000 # - -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # - -# Required to fully log in -OP_SpawnAppearance=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # + +# Zone in opcodes +OP_AckPacket=0x3594 # +OP_ZoneEntry=0x4938 # +OP_ReqNewZone=0x0000 # +OP_NewZone=0x3401 # +OP_ZoneSpawns=0x0000 # +OP_PlayerProfile=0x078e # +OP_TimeOfDay=0x0000 # +OP_LevelUpdate=0x0000 # +OP_Stamina=0x0000 # +OP_RequestClientZoneChange=0x0000 # +OP_ZoneChange=0x0000 # + +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # + +# Required to fully log in +OP_SpawnAppearance=0x0000 # OP_ChangeSize=0x0000 # -OP_TributeUpdate=0x0000 # +OP_TributeUpdate=0x0000 # OP_TributeTimer=0x0000 # Testing VoA 0x1525 -OP_TaskDescription=0x0000 # -OP_TaskActivity=0x0000 # -OP_CompletedTasks=0x0000 # -OP_Weather=0x0000 # +OP_TaskDescription=0x0000 # +OP_TaskActivity=0x0000 # +OP_CompletedTasks=0x0000 # +OP_Weather=0x0000 # OP_SendAATable=0x40e8 # Testing VoA 0x6a7e OP_UpdateAA=0x0000 # Testing VoA 0x5363 OP_RespondAA=0x0000 # Testing VoA 0x0643 or maybe 0x7bf6 -OP_ReqClientSpawn=0x0000 # -OP_SpawnDoor=0x0e71 # -OP_GroundSpawn=0x6618 # -OP_SendZonepoints=0x0c54 # -OP_SendAAStats=0x0000 # -OP_WorldObjectsSent=0x0000 # -OP_BlockedBuffs=0x0000 # -OP_RemoveBlockedBuffs=0x0000 # -OP_ClearBlockedBuffs=0x0000 # -OP_SendExpZonein=0x0000 # -OP_SendTributes=0x0000 # -OP_TributeInfo=0x0000 # -OP_SendGuildTributes=0x0000 # -OP_AAExpUpdate=0x0000 # +OP_ReqClientSpawn=0x0000 # +OP_SpawnDoor=0x0e71 # +OP_GroundSpawn=0x6618 # +OP_SendZonepoints=0x0c54 # +OP_SendAAStats=0x0000 # +OP_WorldObjectsSent=0x0000 # +OP_BlockedBuffs=0x0000 # +OP_RemoveBlockedBuffs=0x0000 # +OP_ClearBlockedBuffs=0x0000 # +OP_SendExpZonein=0x0000 # +OP_SendTributes=0x0000 # +OP_TributeInfo=0x0000 # +OP_SendGuildTributes=0x0000 # +OP_AAExpUpdate=0x0000 # OP_ExpUpdate=0x0000 # Testing VoA 0x0555 -OP_HPUpdate=0x0000 # -OP_ManaChange=0x0000 # -OP_TGB=0x0000 # -OP_SpecialMesg=0x0000 # -OP_GuildMemberList=0x0000 # +OP_HPUpdate=0x0000 # +OP_ManaChange=0x0000 # +OP_TGB=0x0000 # +OP_SpecialMesg=0x0000 # +OP_GuildMemberList=0x0000 # OP_GuildMOTD=0x0000 # Testing VoA 0x0a1d OP_CharInventory=0x0000 # Testing VoA 0x6cfe -OP_WearChange=0x0000 # -OP_ClientUpdate=0x0000 # -OP_ClientReady=0x0000 # -OP_SetServerFilter=0x0000 # - -# Guild Opcodes -OP_GetGuildMOTD=0x0000 # -OP_GetGuildMOTDReply=0x0000 # -OP_GuildMemberUpdate=0x0000 # -OP_GuildInvite=0x0000 # -OP_GuildRemove=0x0000 # -OP_GuildPeace=0x0000 # -OP_SetGuildMOTD=0x0000 # -OP_GuildList=0x0000 # -OP_GuildWar=0x0000 # -OP_GuildLeader=0x0000 # -OP_GuildDelete=0x0000 # -OP_GuildInviteAccept=0x0000 # -OP_GuildDemote=0x0000 # -OP_GuildPublicNote=0x0000 # -OP_GuildManageBanker=0x0000 # -OP_GuildBank=0x0000 # -OP_SetGuildRank=0x0000 # -OP_GuildUpdateURLAndChannel=0x0000 # -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -OP_GuildStatus=0x0000 # +OP_WearChange=0x0000 # +OP_ClientUpdate=0x0000 # +OP_ClientReady=0x0000 # +OP_SetServerFilter=0x0000 # + +# Guild Opcodes +OP_GetGuildMOTD=0x0000 # +OP_GetGuildMOTDReply=0x0000 # +OP_GuildMemberUpdate=0x0000 # +OP_GuildInvite=0x0000 # +OP_GuildRemove=0x0000 # +OP_GuildPeace=0x0000 # +OP_SetGuildMOTD=0x0000 # +OP_GuildList=0x0000 # +OP_GuildWar=0x0000 # +OP_GuildLeader=0x0000 # +OP_GuildDelete=0x0000 # +OP_GuildInviteAccept=0x0000 # +OP_GuildDemote=0x0000 # +OP_GuildPublicNote=0x0000 # +OP_GuildManageBanker=0x0000 # +OP_GuildBank=0x0000 # +OP_SetGuildRank=0x0000 # +OP_GuildUpdateURLAndChannel=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +OP_GuildStatus=0x0000 # OP_GuildCreate=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # - -# GM/guide opcodes -OP_GMServers=0x0000 # -OP_GMBecomeNPC=0x0000 # -OP_GMZoneRequest=0x0000 # -OP_GMZoneRequest2=0x0000 # -OP_GMGoto=0x0000 # -OP_GMSearchCorpse=0x0000 # -OP_GMHideMe=0x0000 # -OP_GMDelCorpse=0x0000 # -OP_GMApproval=0x0000 # -OP_GMToggle=0x0000 # -OP_GMSummon=0x0000 # -OP_GMEmoteZone=0x0000 # -OP_GMEmoteWorld=0x0000 # -OP_GMFind=0x0000 # -OP_GMKick=0x0000 # -OP_GMKill=0x0000 # -OP_GMNameChange=0x0000 # -OP_GMLastName=0x0000 # - -OP_InspectAnswer=0x0000 # -OP_BeginCast=0x0000 # -OP_BuffFadeMsg=0x0000 # -OP_ConsentResponse=0x0000 # -OP_MemorizeSpell=0x0000 # -OP_SwapSpell=0x0000 # -OP_CastSpell=0x0000 # -OP_Consider=0x0000 # -OP_FormattedMessage=0x0000 # -OP_SimpleMessage=0x0000 # -OP_Buff=0x0000 # -OP_Illusion=0x0000 # -OP_MoneyOnCorpse=0x0000 # -OP_RandomReply=0x0000 # -OP_DenyResponse=0x0000 # -OP_SkillUpdate=0x0000 # -OP_GMTrainSkillConfirm=0x0000 # -OP_RandomReq=0x0000 # -OP_Death=0x0000 # -OP_Bind_Wound=0x0000 # -OP_GMTraining=0x0000 # -OP_GMEndTraining=0x0000 # -OP_GMTrainSkill=0x0000 # -OP_Animation=0x0000 # -OP_Begging=0x0000 # -OP_Consent=0x0000 # -OP_ConsentDeny=0x0000 # -OP_AutoFire=0x0000 # -OP_PetCommands=0x0000 # -OP_DeleteSpell=0x0000 # -OP_Surname=0x0000 # -OP_ClearSurname=0x0000 # -OP_FaceChange=0x0000 # -OP_SenseHeading=0x0000 # -OP_Action=0x0000 # -OP_ConsiderCorpse=0x0000 # -OP_HideCorpse=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # + +# GM/guide opcodes +OP_GMServers=0x0000 # +OP_GMBecomeNPC=0x0000 # +OP_GMZoneRequest=0x0000 # +OP_GMZoneRequest2=0x0000 # +OP_GMGoto=0x0000 # +OP_GMSearchCorpse=0x0000 # +OP_GMHideMe=0x0000 # +OP_GMDelCorpse=0x0000 # +OP_GMApproval=0x0000 # +OP_GMToggle=0x0000 # +OP_GMSummon=0x0000 # +OP_GMEmoteZone=0x0000 # +OP_GMEmoteWorld=0x0000 # +OP_GMFind=0x0000 # +OP_GMKick=0x0000 # +OP_GMKill=0x0000 # +OP_GMNameChange=0x0000 # +OP_GMLastName=0x0000 # + +OP_InspectAnswer=0x0000 # +OP_BeginCast=0x0000 # +OP_BuffFadeMsg=0x0000 # +OP_ConsentResponse=0x0000 # +OP_MemorizeSpell=0x0000 # +OP_SwapSpell=0x0000 # +OP_CastSpell=0x0000 # +OP_Consider=0x0000 # +OP_FormattedMessage=0x0000 # +OP_SimpleMessage=0x0000 # +OP_Buff=0x0000 # +OP_Illusion=0x0000 # +OP_MoneyOnCorpse=0x0000 # +OP_RandomReply=0x0000 # +OP_DenyResponse=0x0000 # +OP_SkillUpdate=0x0000 # +OP_GMTrainSkillConfirm=0x0000 # +OP_RandomReq=0x0000 # +OP_Death=0x0000 # +OP_Bind_Wound=0x0000 # +OP_GMTraining=0x0000 # +OP_GMEndTraining=0x0000 # +OP_GMTrainSkill=0x0000 # +OP_Animation=0x0000 # +OP_Begging=0x0000 # +OP_Consent=0x0000 # +OP_ConsentDeny=0x0000 # +OP_AutoFire=0x0000 # +OP_PetCommands=0x0000 # +OP_DeleteSpell=0x0000 # +OP_Surname=0x0000 # +OP_ClearSurname=0x0000 # +OP_FaceChange=0x0000 # +OP_SenseHeading=0x0000 # +OP_Action=0x0000 # +OP_ConsiderCorpse=0x0000 # +OP_HideCorpse=0x0000 # OP_CorpseDrag=0x0000 # OP_CorpseDrop=0x0000 # -OP_Bug=0x0000 # -OP_Feedback=0x0000 # -OP_Report=0x0000 # -OP_Damage=0x0000 # -OP_ChannelMessage=0x0000 # -OP_Assist=0x0000 # -OP_AssistGroup=0x0000 # -OP_MoveCoin=0x0000 # -OP_ZonePlayerToBind=0x0000 # -OP_KeyRing=0x0000 # -OP_WhoAllRequest=0x0000 # -OP_WhoAllResponse=0x0000 # -OP_FriendsWho=0x0000 # -OP_ConfirmDelete=0x0000 # -OP_Logout=0x0000 # -OP_Rewind=0x0000 # -OP_TargetCommand=0x0000 # -OP_InspectRequest=0x0000 # -OP_Hide=0x0000 # -OP_Jump=0x0000 # -OP_Camp=0x0000 # -OP_Emote=0x0000 # -OP_SetRunMode=0x0000 # -OP_BankerChange=0x0000 # -OP_TargetMouse=0x0000 # -OP_MobHealth=0x0000 # -OP_InitialMobHealth=0x0000 # -OP_TargetHoTT=0x0000 # -OP_TargetBuffs=0x0000 # -OP_BuffCreate=0x0000 # -OP_BuffRemoveRequest=0x0000 -OP_DeleteSpawn=0x0000 # -OP_AutoAttack=0x0000 # -OP_AutoAttack2=0x0000 # -OP_Consume=0x0000 # -OP_MoveItem=0x0000 # -OP_DeleteItem=0x0000 # -OP_DeleteCharge=0x0000 # -OP_ItemPacket=0x38b0 # -OP_ItemLinkResponse=0x0000 # -OP_ItemLinkClick=0x0000 # -OP_NewSpawn=0x0000 # -OP_Track=0x0000 # -OP_TrackTarget=0x0000 # -OP_TrackUnknown=0x0000 # -OP_ClickDoor=0x0000 # -OP_MoveDoor=0x0000 # -OP_RemoveAllDoors=0x0000 # -OP_EnvDamage=0x0000 # -OP_BoardBoat=0x0000 # -OP_Forage=0x0000 # -OP_LeaveBoat=0x0000 # -OP_ControlBoat=0x0000 # -OP_SafeFallSuccess=0x0000 # -OP_RezzComplete=0x0000 # -OP_RezzRequest=0x0000 # -OP_RezzAnswer=0x0000 # -OP_Shielding=0x0000 # -OP_RequestDuel=0x0000 # -OP_MobRename=0x0000 # -OP_AugmentItem=0x0000 # -OP_WeaponEquip1=0x0000 # -OP_WeaponEquip2=0x0000 # -OP_WeaponUnequip2=0x0000 # -OP_ApplyPoison=0x0000 # -OP_Save=0x0000 # -OP_TestBuff=0x0000 # -OP_CustomTitles=0x0000 # -OP_Split=0x0000 # -OP_YellForHelp=0x0000 # -OP_LoadSpellSet=0x0000 # -OP_Bandolier=0x0000 # -OP_PotionBelt=0x0000 # -OP_DuelResponse=0x0000 # -OP_DuelResponse2=0x0000 # -OP_SaveOnZoneReq=0x0000 # -OP_ReadBook=0x0000 # -OP_Dye=0x0000 # -OP_InterruptCast=0x0000 # -OP_AAAction=0x0000 # -OP_LeadershipExpToggle=0x0000 # -OP_LeadershipExpUpdate=0x0000 # -OP_PurchaseLeadershipAA=0x0000 # -OP_UpdateLeadershipAA=0x0000 # -OP_MarkNPC=0x0000 # -OP_ClearNPCMarks=0x0000 # -OP_DoGroupLeadershipAbility=0x0000 # -OP_GroupLeadershipAAUpdate=0x0000 # -OP_DelegateAbility=0x0000 # -OP_SetGroupTarget=0x0000 # -OP_Charm=0x0000 # -OP_Stun=0x0000 # -OP_SendFindableNPCs=0x6c36 # -OP_FindPersonRequest=0x0000 # -OP_FindPersonReply=0x0000 # -OP_Sound=0x0000 # -OP_PetBuffWindow=0x0000 # -OP_LevelAppearance=0x0000 # -OP_Translocate=0x0000 # -OP_Sacrifice=0x0000 # -OP_PopupResponse=0x0000 # -OP_OnLevelMessage=0x0000 # -OP_AugmentInfo=0x0000 # -OP_Petition=0x0000 # -OP_SomeItemPacketMaybe=0x0000 # -OP_PVPStats=0x0000 # -OP_PVPLeaderBoardRequest=0x0000 # -OP_PVPLeaderBoardReply=0x0000 # -OP_PVPLeaderBoardDetailsRequest=0x0000 # -OP_PVPLeaderBoardDetailsReply=0x0000 # -OP_RestState=0x0000 # -OP_RespawnWindow=0x0000 # -OP_DisciplineTimer=0x0000 # -OP_LDoNButton=0x0000 # -OP_SetStartCity=0x0000 # -OP_VoiceMacroIn=0x0000 # -OP_VoiceMacroOut=0x0000 # -OP_ItemViewUnknown=0x0000 # -OP_VetRewardsAvaliable=0x0000 # -OP_VetClaimRequest=0x0000 # -OP_VetClaimReply=0x0000 # -OP_CrystalCountUpdate=0x0000 # -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # -OP_Action2=0x0000 # -OP_MobUpdate=0x68da # +OP_Bug=0x0000 # +OP_Feedback=0x0000 # +OP_Report=0x0000 # +OP_Damage=0x0000 # +OP_ChannelMessage=0x0000 # +OP_Assist=0x0000 # +OP_AssistGroup=0x0000 # +OP_MoveCoin=0x0000 # +OP_ZonePlayerToBind=0x0000 # +OP_KeyRing=0x0000 # +OP_WhoAllRequest=0x0000 # +OP_WhoAllResponse=0x0000 # +OP_FriendsWho=0x0000 # +OP_ConfirmDelete=0x0000 # +OP_Logout=0x0000 # +OP_Rewind=0x0000 # +OP_TargetCommand=0x0000 # +OP_InspectRequest=0x0000 # +OP_Hide=0x0000 # +OP_Jump=0x0000 # +OP_Camp=0x0000 # +OP_Emote=0x0000 # +OP_SetRunMode=0x0000 # +OP_BankerChange=0x0000 # +OP_TargetMouse=0x0000 # +OP_MobHealth=0x0000 # +OP_InitialMobHealth=0x0000 # +OP_TargetHoTT=0x0000 # +OP_TargetBuffs=0x0000 # +OP_BuffCreate=0x0000 # +OP_BuffRemoveRequest=0x0000 +OP_DeleteSpawn=0x0000 # +OP_AutoAttack=0x0000 # +OP_AutoAttack2=0x0000 # +OP_Consume=0x0000 # +OP_MoveItem=0x0000 # +OP_DeleteItem=0x0000 # +OP_DeleteCharge=0x0000 # +OP_ItemPacket=0x38b0 # +OP_ItemLinkResponse=0x0000 # +OP_ItemLinkClick=0x0000 # +OP_NewSpawn=0x0000 # +OP_Track=0x0000 # +OP_TrackTarget=0x0000 # +OP_TrackUnknown=0x0000 # +OP_ClickDoor=0x0000 # +OP_MoveDoor=0x0000 # +OP_RemoveAllDoors=0x0000 # +OP_EnvDamage=0x0000 # +OP_BoardBoat=0x0000 # +OP_Forage=0x0000 # +OP_LeaveBoat=0x0000 # +OP_ControlBoat=0x0000 # +OP_SafeFallSuccess=0x0000 # +OP_RezzComplete=0x0000 # +OP_RezzRequest=0x0000 # +OP_RezzAnswer=0x0000 # +OP_Shielding=0x0000 # +OP_RequestDuel=0x0000 # +OP_MobRename=0x0000 # +OP_AugmentItem=0x0000 # +OP_WeaponEquip1=0x0000 # +OP_WeaponEquip2=0x0000 # +OP_WeaponUnequip2=0x0000 # +OP_ApplyPoison=0x0000 # +OP_Save=0x0000 # +OP_TestBuff=0x0000 # +OP_CustomTitles=0x0000 # +OP_Split=0x0000 # +OP_YellForHelp=0x0000 # +OP_LoadSpellSet=0x0000 # +OP_Bandolier=0x0000 # +OP_PotionBelt=0x0000 # +OP_DuelResponse=0x0000 # +OP_DuelResponse2=0x0000 # +OP_SaveOnZoneReq=0x0000 # +OP_ReadBook=0x0000 # +OP_Dye=0x0000 # +OP_InterruptCast=0x0000 # +OP_AAAction=0x0000 # +OP_LeadershipExpToggle=0x0000 # +OP_LeadershipExpUpdate=0x0000 # +OP_PurchaseLeadershipAA=0x0000 # +OP_UpdateLeadershipAA=0x0000 # +OP_MarkNPC=0x0000 # +OP_ClearNPCMarks=0x0000 # +OP_DoGroupLeadershipAbility=0x0000 # +OP_GroupLeadershipAAUpdate=0x0000 # +OP_DelegateAbility=0x0000 # +OP_SetGroupTarget=0x0000 # +OP_Charm=0x0000 # +OP_Stun=0x0000 # +OP_SendFindableNPCs=0x6c36 # +OP_FindPersonRequest=0x0000 # +OP_FindPersonReply=0x0000 # +OP_Sound=0x0000 # +OP_PetBuffWindow=0x0000 # +OP_LevelAppearance=0x0000 # +OP_Translocate=0x0000 # +OP_Sacrifice=0x0000 # +OP_PopupResponse=0x0000 # +OP_OnLevelMessage=0x0000 # +OP_AugmentInfo=0x0000 # +OP_Petition=0x0000 # +OP_SomeItemPacketMaybe=0x0000 # +OP_PVPStats=0x0000 # +OP_PVPLeaderBoardRequest=0x0000 # +OP_PVPLeaderBoardReply=0x0000 # +OP_PVPLeaderBoardDetailsRequest=0x0000 # +OP_PVPLeaderBoardDetailsReply=0x0000 # +OP_RestState=0x0000 # +OP_RespawnWindow=0x0000 # +OP_DisciplineTimer=0x0000 # +OP_LDoNButton=0x0000 # +OP_SetStartCity=0x0000 # +OP_VoiceMacroIn=0x0000 # +OP_VoiceMacroOut=0x0000 # +OP_ItemViewUnknown=0x0000 # +OP_VetRewardsAvaliable=0x0000 # +OP_VetClaimRequest=0x0000 # +OP_VetClaimReply=0x0000 # +OP_CrystalCountUpdate=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # +OP_Action2=0x0000 # +OP_MobUpdate=0x68da # OP_NPCMoveUpdate=0x226b # -OP_CameraEffect=0x0000 # -OP_SpellEffect=0x0000 # -OP_RemoveNimbusEffect=0x0000 # +OP_CameraEffect=0x0000 # +OP_SpellEffect=0x0000 # +OP_RemoveNimbusEffect=0x0000 # OP_AltCurrency=0x0000 OP_AltCurrencyMerchantRequest=0x0000 OP_AltCurrencyMerchantReply=0x0000 @@ -367,266 +367,266 @@ OP_DzCompass=0x0000 OP_DzChooseZone=0x0000 # New Opcodes -OP_SpawnPositionUpdate=0x0000 # -OP_ManaUpdate=0x0000 # -OP_EnduranceUpdate=0x0000 # -OP_MobManaUpdate=0x0000 # -OP_MobEnduranceUpdate=0x0000 # - -# Looting -OP_LootRequest=0x0000 # -OP_EndLootRequest=0x0000 # -OP_LootItem=0x0000 # -OP_LootComplete=0x0000 # - -# bazaar trader stuff stuff: -OP_BazaarSearch=0x0000 # -OP_TraderDelItem=0x0000 # -OP_BecomeTrader=0x0000 # -OP_TraderShop=0x0000 # -OP_Trader=0x0000 # -OP_TraderBuy=0x0000 # -OP_Barter=0x0000 # -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # - -# pc/npc trading -OP_TradeRequest=0x0000 # -OP_TradeAcceptClick=0x0000 # -OP_TradeRequestAck=0x0000 # -OP_TradeCoins=0x0000 # -OP_FinishTrade=0x0000 # -OP_CancelTrade=0x0000 # -OP_TradeMoneyUpdate=0x0000 # -OP_MoneyUpdate=0x0000 # -OP_TradeBusy=0x0000 # +OP_SpawnPositionUpdate=0x0000 # +OP_ManaUpdate=0x0000 # +OP_EnduranceUpdate=0x0000 # +OP_MobManaUpdate=0x0000 # +OP_MobEnduranceUpdate=0x0000 # + +# Looting +OP_LootRequest=0x0000 # +OP_EndLootRequest=0x0000 # +OP_LootItem=0x0000 # +OP_LootComplete=0x0000 # + +# bazaar trader stuff stuff: +OP_BazaarSearch=0x0000 # +OP_TraderDelItem=0x0000 # +OP_BecomeTrader=0x0000 # +OP_TraderShop=0x0000 # +OP_Trader=0x0000 # +OP_TraderBuy=0x0000 # +OP_Barter=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # + +# pc/npc trading +OP_TradeRequest=0x0000 # +OP_TradeAcceptClick=0x0000 # +OP_TradeRequestAck=0x0000 # +OP_TradeCoins=0x0000 # +OP_FinishTrade=0x0000 # +OP_CancelTrade=0x0000 # +OP_TradeMoneyUpdate=0x0000 # +OP_MoneyUpdate=0x0000 # +OP_TradeBusy=0x0000 # # Sent after canceling trade or after closing tradeskill object -OP_FinishWindow=0x0000 # -OP_FinishWindow2=0x0000 # +OP_FinishWindow=0x0000 # +OP_FinishWindow2=0x0000 # # Sent on Live for what seems to be item existance verification # Ex. Before Right Click Effect happens from items -OP_ItemVerifyRequest=0x0000 # -OP_ItemVerifyReply=0x0000 # +OP_ItemVerifyRequest=0x0000 # +OP_ItemVerifyReply=0x0000 # # merchant crap -OP_ShopPlayerSell=0x0000 # -OP_ShopRequest=0x5f0d # -OP_ShopEnd=0x537c # -OP_ShopEndConfirm=0x0000 # -OP_ShopPlayerBuy=0x0000 # -OP_ShopDelItem=0x0000 # - -# tradeskill stuff: -OP_ClickObject=0x0000 # -OP_ClickObjectAction=0x0000 # -OP_ClearObject=0x0000 # -OP_RecipeDetails=0x0000 # -OP_RecipesFavorite=0x0000 # -OP_RecipesSearch=0x0000 # -OP_RecipeReply=0x0000 # -OP_RecipeAutoCombine=0x0000 # -OP_TradeSkillCombine=0x0000 # - -# Tribute Packets: -OP_OpenGuildTributeMaster=0x0000 # -OP_OpenTributeMaster=0x0000 # -OP_SelectTribute=0x0000 # -OP_TributeItem=0x0000 # -OP_TributeMoney=0x0000 # -OP_TributeToggle=0x0000 # -OP_TributePointUpdate=0x0000 # -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # - -# Adventure packets: -OP_LeaveAdventure=0x0000 # -OP_AdventureFinish=0x0000 # -OP_AdventureInfoRequest=0x0000 # -OP_AdventureInfo=0x0000 # -OP_AdventureRequest=0x0000 # -OP_AdventureDetails=0x0000 # -OP_AdventureData=0x0000 # -OP_AdventureUpdate=0x0000 # -OP_AdventureMerchantRequest=0x0000 # -OP_AdventureMerchantResponse=0x0000 # -OP_AdventureMerchantPurchase=0x0000 # -OP_AdventureMerchantSell=0x0000 # -OP_AdventurePointsUpdate=0x0000 # -OP_AdventureStatsRequest=0x0000 # -OP_AdventureStatsReply=0x0000 # -OP_AdventureLeaderboardRequest=0x0000 # -OP_AdventureLeaderboardReply=0x0000 # +OP_ShopPlayerSell=0x0000 # +OP_ShopRequest=0x5f0d # +OP_ShopEnd=0x537c # +OP_ShopEndConfirm=0x0000 # +OP_ShopPlayerBuy=0x0000 # +OP_ShopDelItem=0x0000 # + +# tradeskill stuff: +OP_ClickObject=0x0000 # +OP_ClickObjectAction=0x0000 # +OP_ClearObject=0x0000 # +OP_RecipeDetails=0x0000 # +OP_RecipesFavorite=0x0000 # +OP_RecipesSearch=0x0000 # +OP_RecipeReply=0x0000 # +OP_RecipeAutoCombine=0x0000 # +OP_TradeSkillCombine=0x0000 # + +# Tribute Packets: +OP_OpenGuildTributeMaster=0x0000 # +OP_OpenTributeMaster=0x0000 # +OP_SelectTribute=0x0000 # +OP_TributeItem=0x0000 # +OP_TributeMoney=0x0000 # +OP_TributeToggle=0x0000 # +OP_TributePointUpdate=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # + +# Adventure packets: +OP_LeaveAdventure=0x0000 # +OP_AdventureFinish=0x0000 # +OP_AdventureInfoRequest=0x0000 # +OP_AdventureInfo=0x0000 # +OP_AdventureRequest=0x0000 # +OP_AdventureDetails=0x0000 # +OP_AdventureData=0x0000 # +OP_AdventureUpdate=0x0000 # +OP_AdventureMerchantRequest=0x0000 # +OP_AdventureMerchantResponse=0x0000 # +OP_AdventureMerchantPurchase=0x0000 # +OP_AdventureMerchantSell=0x0000 # +OP_AdventurePointsUpdate=0x0000 # +OP_AdventureStatsRequest=0x0000 # +OP_AdventureStatsReply=0x0000 # +OP_AdventureLeaderboardRequest=0x0000 # +OP_AdventureLeaderboardReply=0x0000 # # Group Opcodes -OP_GroupDisband=0x0000 # -OP_GroupInvite=0x0000 # -OP_GroupFollow=0x0000 # -OP_GroupUpdate=0x0000 # -OP_GroupUpdateB=0x0000 # -OP_GroupCancelInvite=0x0000 # -OP_GroupAcknowledge=0x0000 # -OP_GroupDelete=0x0000 # -OP_CancelInvite=0x0000 # -OP_GroupFollow2=0x0000 # -OP_GroupInvite2=0x0000 # -OP_GroupDisbandYou=0x0000 # -OP_GroupDisbandOther=0x0000 # -OP_GroupLeaderChange=0x0000 # -OP_GroupRoles=0x0000 # +OP_GroupDisband=0x0000 # +OP_GroupInvite=0x0000 # +OP_GroupFollow=0x0000 # +OP_GroupUpdate=0x0000 # +OP_GroupUpdateB=0x0000 # +OP_GroupCancelInvite=0x0000 # +OP_GroupAcknowledge=0x0000 # +OP_GroupDelete=0x0000 # +OP_CancelInvite=0x0000 # +OP_GroupFollow2=0x0000 # +OP_GroupInvite2=0x0000 # +OP_GroupDisbandYou=0x0000 # +OP_GroupDisbandOther=0x0000 # +OP_GroupLeaderChange=0x0000 # +OP_GroupRoles=0x0000 # OP_GroupMakeLeader=0x0000 # LFG/LFP Opcodes -OP_LFGCommand=0x0000 # -OP_LFGGetMatchesRequest=0x0000 # -OP_LFGGetMatchesResponse=0x0000 # -OP_LFPGetMatchesRequest=0x0000 # -OP_LFPGetMatchesResponse=0x0000 # -OP_LFPCommand=0x0000 # -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # - -# Raid Opcodes -OP_RaidInvite=0x0000 # -OP_RaidUpdate=0x0000 # Testing VoA 0x0c08 -OP_RaidJoin=0x0000 # - -# Button-push commands -OP_Taunt=0x0000 # -OP_CombatAbility=0x0000 # -OP_SenseTraps=0x0000 # -OP_PickPocket=0x0000 # -OP_DisarmTraps=0x0000 # -OP_Disarm=0x0000 # -OP_Sneak=0x0000 # -OP_Fishing=0x0000 # -OP_InstillDoubt=0x0000 # -OP_FeignDeath=0x0000 # -OP_Mend=0x0000 # -OP_LDoNOpen=0x0000 # - -# Task packets -OP_TaskActivityComplete=0x0000 # -OP_TaskMemberList=0x0000 # -OP_OpenNewTasksWindow=0x0000 # -OP_AvaliableTask=0x0000 # -OP_AcceptNewTask=0x0000 # -OP_TaskHistoryRequest=0x0000 # -OP_TaskHistoryReply=0x0000 # -OP_CancelTask=0x0000 # -OP_DeclineAllTasks=0x0000 # - -# Title opcodes -OP_NewTitlesAvailable=0x0000 # -OP_RequestTitles=0x0000 # -OP_SendTitleList=0x0000 # -OP_SetTitle=0x0000 # -OP_SetTitleReply=0x0000 # - -# mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_LFGCommand=0x0000 # +OP_LFGGetMatchesRequest=0x0000 # +OP_LFGGetMatchesResponse=0x0000 # +OP_LFPGetMatchesRequest=0x0000 # +OP_LFPGetMatchesResponse=0x0000 # +OP_LFPCommand=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# Raid Opcodes +OP_RaidInvite=0x0000 # +OP_RaidUpdate=0x0000 # Testing VoA 0x0c08 +OP_RaidJoin=0x0000 # + +# Button-push commands +OP_Taunt=0x0000 # +OP_CombatAbility=0x0000 # +OP_SenseTraps=0x0000 # +OP_PickPocket=0x0000 # +OP_DisarmTraps=0x0000 # +OP_Disarm=0x0000 # +OP_Sneak=0x0000 # +OP_Fishing=0x0000 # +OP_InstillDoubt=0x0000 # +OP_FeignDeath=0x0000 # +OP_Mend=0x0000 # +OP_LDoNOpen=0x0000 # + +# Task packets +OP_TaskActivityComplete=0x0000 # +OP_TaskMemberList=0x0000 # +OP_OpenNewTasksWindow=0x0000 # +OP_AvaliableTask=0x0000 # +OP_AcceptNewTask=0x0000 # +OP_TaskHistoryRequest=0x0000 # +OP_TaskHistoryReply=0x0000 # +OP_CancelTask=0x0000 # +OP_DeclineAllTasks=0x0000 # + +# Title opcodes +OP_NewTitlesAvailable=0x0000 # +OP_RequestTitles=0x0000 # +OP_SendTitleList=0x0000 # +OP_SetTitle=0x0000 # +OP_SetTitleReply=0x0000 # + +# mail opcodes +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # + +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # - -# discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # + +# discovered opcodes not yet used: +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps #OP_LoginUnknown1=0x0000 # U OP_SendSpellChecksum #OP_LoginUnknown2=0x0000 # U OP_SendSkillCapsChecksum - -# Petition Opcodes + +# Petition Opcodes OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search - -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # - -# Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # - -# raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # + +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # + +# Login opcodes +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # + +# raw opcodes +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_Dec10-2012.conf b/utils/EQExtractor2/EQExtractor2/patch_Dec10-2012.conf index c7d325fee..5dbbda600 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Dec10-2012.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Dec10-2012.conf @@ -648,4 +648,4 @@ OP_RAWOutOfSession=0x0000 # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs -OP_InitialHPUpdate=0x0000 +OP_InitialHPUpdate=0x0000 diff --git a/utils/EQExtractor2/EQExtractor2/patch_Dec7-2010.conf b/utils/EQExtractor2/EQExtractor2/patch_Dec7-2010.conf index 513f5017a..570e31cce 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Dec7-2010.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Dec7-2010.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x6893 # was 0x2683 OP_ApproveWorld=0x115a # was 0x28a7 OP_LogServer=0x701f # was 0x224f @@ -49,15 +49,15 @@ OP_FloatListThing=0x0000 # V # Reasons for Disconnect: OP_ZoneUnavail=0x0000 # C 0x0000 OP_WorldClientReady=0x399b # C 0x0000 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # was 0x3594 @@ -71,11 +71,11 @@ OP_LevelUpdate=0x0000 # V OP_Stamina=0x0000 # V OP_RequestClientZoneChange=0x3fd2 # was 0x4178 OP_ZoneChange=0x0b93 # was 0x4a61 -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x7b64 # V @@ -86,13 +86,13 @@ OP_TaskActivity=0x0000 # C OP_CompletedTasks=0x0000 # C 0x0000 OP_Weather=0x7ce4 # was 0x0ed5 OP_SendAATable=0x466c # -OP_UpdateAA=0x0000 # V +OP_UpdateAA=0x0000 # V OP_RespondAA=0x0000 # C 0x0000 OP_ReqClientSpawn=0x54e8 # was 0x6618 OP_SpawnDoor=0x6cfe # OP_GroundSpawn=0x5f0d # was 0x5f0d OP_SendZonepoints=0x5f51 # was 0x0ff4 -OP_SendAAStats=0x0000 # C +OP_SendAAStats=0x0000 # C OP_WorldObjectsSent=0x7b73 # was 0x7b73 OP_BlockedBuffs=0x664a # was 0x4027 OP_SendExpZonein=0x2c27 # was 0x1436 @@ -132,12 +132,12 @@ OP_GuildManageBanker=0x0000 # C OP_GuildBank=0x0000 # C OP_SetGuildRank=0x0000 # C OP_GuildUpdateURLAndChannel=0x0000 # C -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x0000 # C @@ -317,8 +317,8 @@ OP_VetRewardsAvaliable=0x0000 # C Mispelled? OP_VetClaimRequest=0x0000 # C OP_VetClaimReply=0x0000 # C OP_CrystalCountUpdate=0x0000 # C -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # C OP_Damage? OP_MobUpdate=0x4656 # was 0x4656 OP_NPCMoveUpdate=0x5bad # @@ -349,7 +349,7 @@ OP_ManaUpdate=0x0000 # C OP_EnduranceUpdate=0x0000 # C OP_MobManaUpdate=0x0000 # C OP_MobEnduranceUpdate=0x0000 # C - + # Looting OP_LootRequest=0x0000 # C OP_EndLootRequest=0x0000 # C @@ -364,10 +364,10 @@ OP_TraderShop=0x0000 # C OP_Trader=0x0000 # C OP_TraderBuy=0x0000 # C OP_Barter=0x0000 # C -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x0000 # C @@ -416,10 +416,10 @@ OP_TributeItem=0x0000 # C OP_TributeMoney=0x0000 # C OP_TributeToggle=0x0000 # C OP_TributePointUpdate=0x0000 # C -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x0000 # C @@ -444,11 +444,11 @@ OP_AdventureLeaderboardReply=0x0000 # C OP_GroupDisband=0x0000 # C OP_GroupInvite=0x0000 # C OP_GroupFollow=0x0000 # C -OP_GroupUpdate=0x0000 # C -OP_GroupUpdateB=0x0000 # C +OP_GroupUpdate=0x0000 # C +OP_GroupUpdateB=0x0000 # C OP_GroupCancelInvite=0x0000 # C - Same as OP_CancelInvite? OP_GroupAcknowledge=0x0000 # C -OP_GroupDelete=0x0000 # +OP_GroupDelete=0x0000 # OP_CancelInvite=0x0000 # C OP_GroupFollow2=0x0000 # C OP_GroupInvite2=0x0000 # C @@ -464,20 +464,20 @@ OP_LFGGetMatchesResponse=0x0000 # C OP_LFPGetMatchesRequest=0x0000 # C OP_LFPGetMatchesResponse=0x0000 # C OP_LFPCommand=0x0000 # C -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x0000 # C OP_RaidUpdate=0x0000 # C -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x0000 # C OP_CombatAbility=0x0000 # C OP_SenseTraps=0x0000 # C OP_PickPocket=0x0000 # C -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x0000 # C OP_Sneak=0x0000 # C OP_Fishing=0x0000 # C @@ -495,7 +495,7 @@ OP_AcceptNewTask=0x0000 # C OP_TaskHistoryRequest=0x0000 # C OP_TaskHistoryReply=0x0000 # C OP_CancelTask=0x0000 # C -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x0000 # C @@ -505,53 +505,53 @@ OP_SetTitle=0x0000 # C OP_SetTitleReply=0x0000 # C # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -563,47 +563,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_Feb11-2013.conf b/utils/EQExtractor2/EQExtractor2/patch_Feb11-2013.conf index 5add60724..fa04ec9f8 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Feb11-2013.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Feb11-2013.conf @@ -650,4 +650,4 @@ OP_RAWOutOfSession=0x0000 # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs -OP_InitialHPUpdate=0x0000 +OP_InitialHPUpdate=0x0000 diff --git a/utils/EQExtractor2/EQExtractor2/patch_Feb8-2011.conf b/utils/EQExtractor2/EQExtractor2/patch_Feb8-2011.conf index 00285ef1c..b4f2c3415 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Feb8-2011.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Feb8-2011.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x6893 # was 0x2683 OP_ApproveWorld=0x115a # was 0x28a7 OP_LogServer=0x701f # was 0x224f @@ -49,15 +49,15 @@ OP_FloatListThing=0x0000 # V # Reasons for Disconnect: OP_ZoneUnavail=0x0000 # C 0x0000 OP_WorldClientReady=0x399b # C 0x0000 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # was 0x3594 @@ -71,11 +71,11 @@ OP_LevelUpdate=0x0000 # V OP_Stamina=0x0000 # V OP_RequestClientZoneChange=0x3fd2 # was 0x4178 OP_ZoneChange=0x0b93 # was 0x4a61 -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x7b64 # V @@ -86,13 +86,13 @@ OP_TaskActivity=0x0000 # C OP_CompletedTasks=0x0000 # C 0x0000 OP_Weather=0x7ce4 # was 0x0ed5 OP_SendAATable=0x1b26 # -OP_UpdateAA=0x0000 # V +OP_UpdateAA=0x0000 # V OP_RespondAA=0x0000 # C 0x0000 OP_ReqClientSpawn=0x54e8 # was 0x6618 OP_SpawnDoor=0x4849 # OP_GroundSpawn=0x5f0d # was 0x5f0d OP_SendZonepoints=0x5f51 # was 0x0ff4 -OP_SendAAStats=0x0000 # C +OP_SendAAStats=0x0000 # C OP_WorldObjectsSent=0x7b73 # was 0x7b73 OP_BlockedBuffs=0x664a # was 0x4027 OP_SendExpZonein=0x2c27 # was 0x1436 @@ -132,12 +132,12 @@ OP_GuildManageBanker=0x0000 # C OP_GuildBank=0x0000 # C OP_SetGuildRank=0x0000 # C OP_GuildUpdateURLAndChannel=0x0000 # C -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x0000 # C @@ -317,8 +317,8 @@ OP_VetRewardsAvaliable=0x0000 # C Mispelled? OP_VetClaimRequest=0x0000 # C OP_VetClaimReply=0x0000 # C OP_CrystalCountUpdate=0x0000 # C -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # C OP_Damage? OP_MobUpdate=0x4656 # was 0x4656 OP_NPCMoveUpdate=0x5d24 # @@ -349,7 +349,7 @@ OP_ManaUpdate=0x0000 # C OP_EnduranceUpdate=0x0000 # C OP_MobManaUpdate=0x0000 # C OP_MobEnduranceUpdate=0x0000 # C - + # Looting OP_LootRequest=0x0000 # C OP_EndLootRequest=0x0000 # C @@ -364,10 +364,10 @@ OP_TraderShop=0x0000 # C OP_Trader=0x0000 # C OP_TraderBuy=0x0000 # C OP_Barter=0x0000 # C -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x0000 # C @@ -416,10 +416,10 @@ OP_TributeItem=0x0000 # C OP_TributeMoney=0x0000 # C OP_TributeToggle=0x0000 # C OP_TributePointUpdate=0x0000 # C -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x0000 # C @@ -444,11 +444,11 @@ OP_AdventureLeaderboardReply=0x0000 # C OP_GroupDisband=0x0000 # C OP_GroupInvite=0x0000 # C OP_GroupFollow=0x0000 # C -OP_GroupUpdate=0x0000 # C -OP_GroupUpdateB=0x0000 # C +OP_GroupUpdate=0x0000 # C +OP_GroupUpdateB=0x0000 # C OP_GroupCancelInvite=0x0000 # C - Same as OP_CancelInvite? OP_GroupAcknowledge=0x0000 # C -OP_GroupDelete=0x0000 # +OP_GroupDelete=0x0000 # OP_CancelInvite=0x0000 # C OP_GroupFollow2=0x0000 # C OP_GroupInvite2=0x0000 # C @@ -464,20 +464,20 @@ OP_LFGGetMatchesResponse=0x0000 # C OP_LFPGetMatchesRequest=0x0000 # C OP_LFPGetMatchesResponse=0x0000 # C OP_LFPCommand=0x0000 # C -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x0000 # C OP_RaidUpdate=0x0000 # C -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x0000 # C OP_CombatAbility=0x0000 # C OP_SenseTraps=0x0000 # C OP_PickPocket=0x0000 # C -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x0000 # C OP_Sneak=0x0000 # C OP_Fishing=0x0000 # C @@ -495,7 +495,7 @@ OP_AcceptNewTask=0x0000 # C OP_TaskHistoryRequest=0x0000 # C OP_TaskHistoryReply=0x0000 # C OP_CancelTask=0x0000 # C -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x0000 # C @@ -505,53 +505,53 @@ OP_SetTitle=0x0000 # C OP_SetTitleReply=0x0000 # C # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -563,47 +563,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_July13-2012.conf b/utils/EQExtractor2/EQExtractor2/patch_July13-2012.conf index b6ece368b..5f53a8eaa 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_July13-2012.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_July13-2012.conf @@ -15,327 +15,327 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: -OP_SendLoginInfo=0x4d5c # -OP_ApproveWorld=0x655c # -OP_LogServer=0x1497 # -OP_SendCharInfo=0x7f9e # -OP_ExpansionInfo=0x2c8f # -OP_GuildsList=0x5b0b # -OP_EnterWorld=0x710e # -OP_PostEnterWorld=0x7930 # -OP_World_Client_CRC1=0x7ce4 # -OP_World_Client_CRC2=0x7705 # -OP_SendSpellChecksum=0x0000 # -OP_SendSkillCapsChecksum=0x0000 # - -# Character Select Related: -OP_DeleteCharacter=0x5ca5 # -OP_CharacterCreateRequest=0x4eba # -OP_CharacterCreate=0x3237 # -OP_RandomNameGenerator=0x26aa # -OP_ApproveName=0x3154 # - -OP_MOTD=0x0b80 # -OP_SetChatServer=0x2c38 # -OP_SetChatServer2=0x441c # -OP_ZoneServerInfo=0x16f5 # -OP_WorldComplete=0x6c63 # -OP_WorldUnknown001=0x4274 # -OP_FloatListThing=0x1910 # - -# Reasons for Disconnect: -OP_ZoneUnavail=0x20bc # +# Required to reach Char Select: +OP_SendLoginInfo=0x4d5c # +OP_ApproveWorld=0x655c # +OP_LogServer=0x1497 # +OP_SendCharInfo=0x7f9e # +OP_ExpansionInfo=0x2c8f # +OP_GuildsList=0x5b0b # +OP_EnterWorld=0x710e # +OP_PostEnterWorld=0x7930 # +OP_World_Client_CRC1=0x7ce4 # +OP_World_Client_CRC2=0x7705 # +OP_SendSpellChecksum=0x0000 # +OP_SendSkillCapsChecksum=0x0000 # + +# Character Select Related: +OP_DeleteCharacter=0x5ca5 # +OP_CharacterCreateRequest=0x4eba # +OP_CharacterCreate=0x3237 # +OP_RandomNameGenerator=0x26aa # +OP_ApproveName=0x3154 # + +OP_MOTD=0x0b80 # +OP_SetChatServer=0x2c38 # +OP_SetChatServer2=0x441c # +OP_ZoneServerInfo=0x16f5 # +OP_WorldComplete=0x6c63 # +OP_WorldUnknown001=0x4274 # +OP_FloatListThing=0x1910 # + +# Reasons for Disconnect: +OP_ZoneUnavail=0x20bc # OP_WorldClientReady=0x0b89 # Testing VoA 0x3f24 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # - -# Zone in opcodes -OP_AckPacket=0x3594 # -OP_ZoneEntry=0x6087 # -OP_ReqNewZone=0x0000 # -OP_NewZone=0x51ae # -OP_ZoneSpawns=0x5f5e # -OP_PlayerProfile=0x537c # -OP_TimeOfDay=0x6015 # -OP_LevelUpdate=0x6e1c # -OP_Stamina=0x7686 # -OP_RequestClientZoneChange=0x224f # -OP_ZoneChange=0x28c8 # - -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # - -# Required to fully log in -OP_SpawnAppearance=0x3f55 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # + +# Zone in opcodes +OP_AckPacket=0x3594 # +OP_ZoneEntry=0x6087 # +OP_ReqNewZone=0x0000 # +OP_NewZone=0x51ae # +OP_ZoneSpawns=0x5f5e # +OP_PlayerProfile=0x537c # +OP_TimeOfDay=0x6015 # +OP_LevelUpdate=0x6e1c # +OP_Stamina=0x7686 # +OP_RequestClientZoneChange=0x224f # +OP_ZoneChange=0x28c8 # + +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # + +# Required to fully log in +OP_SpawnAppearance=0x3f55 # OP_ChangeSize=0x0000 # -OP_TributeUpdate=0x0000 # +OP_TributeUpdate=0x0000 # OP_TributeTimer=0x0000 # Testing VoA 0x1525 -OP_TaskDescription=0x2e4f # -OP_TaskActivity=0x512b # -OP_CompletedTasks=0x3141 # -OP_Weather=0x3e50 # +OP_TaskDescription=0x2e4f # +OP_TaskActivity=0x512b # +OP_CompletedTasks=0x3141 # +OP_Weather=0x3e50 # OP_SendAATable=0x6db5 # Testing VoA 0x6a7e OP_UpdateAA=0x5363 # Testing VoA 0x5363 OP_RespondAA=0x7bf6 # Testing VoA 0x0643 or maybe 0x7bf6 -OP_ReqClientSpawn=0x2c27 # -OP_SpawnDoor=0x3604 # -OP_GroundSpawn=0x1436 # -OP_SendZonepoints=0x13da # -OP_SendAAStats=0x4e22 # -OP_WorldObjectsSent=0x7b73 # -OP_BlockedBuffs=0x1681 # -OP_RemoveBlockedBuffs=0x6a86 # -OP_ClearBlockedBuffs=0x7ae1 # -OP_SendExpZonein=0x0f14 # -OP_SendTributes=0x010d # -OP_TributeInfo=0x047c # -OP_SendGuildTributes=0x0000 # -OP_AAExpUpdate=0x1318 # +OP_ReqClientSpawn=0x2c27 # +OP_SpawnDoor=0x3604 # +OP_GroundSpawn=0x1436 # +OP_SendZonepoints=0x13da # +OP_SendAAStats=0x4e22 # +OP_WorldObjectsSent=0x7b73 # +OP_BlockedBuffs=0x1681 # +OP_RemoveBlockedBuffs=0x6a86 # +OP_ClearBlockedBuffs=0x7ae1 # +OP_SendExpZonein=0x0f14 # +OP_SendTributes=0x010d # +OP_TributeInfo=0x047c # +OP_SendGuildTributes=0x0000 # +OP_AAExpUpdate=0x1318 # OP_ExpUpdate=0x221a # Testing VoA 0x0555 -OP_HPUpdate=0x2369 # -OP_ManaChange=0x3887 # -OP_TGB=0x3672 # -OP_SpecialMesg=0x039d # -OP_GuildMemberList=0x51bc # +OP_HPUpdate=0x2369 # +OP_ManaChange=0x3887 # +OP_TGB=0x3672 # +OP_SpecialMesg=0x039d # +OP_GuildMemberList=0x51bc # OP_GuildMOTD=0x0a1d # Testing VoA 0x0a1d OP_CharInventory=0x6cfe # Testing VoA 0x6cfe -OP_WearChange=0x1a58 # -OP_ClientUpdate=0x7062 # -OP_ClientReady=0x1272 # -OP_SetServerFilter=0x053a # - -# Guild Opcodes -OP_GetGuildMOTD=0x3415 # -OP_GetGuildMOTDReply=0x709d # -OP_GuildMemberUpdate=0x589f # -OP_GuildInvite=0x5488 # -OP_GuildRemove=0x47d3 # -OP_GuildPeace=0x1d22 # -OP_SetGuildMOTD=0x5f85 # -OP_GuildList=0x0000 # -OP_GuildWar=0x0598 # -OP_GuildLeader=0x67c8 # -OP_GuildDelete=0x230e # -OP_GuildInviteAccept=0x2b5a # -OP_GuildDemote=0x1899 # -OP_GuildPublicNote=0x2dbd # -OP_GuildManageBanker=0x0000 # -OP_GuildBank=0x0000 # -OP_SetGuildRank=0x4ffe # -OP_GuildUpdateURLAndChannel=0x03d1 # -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -OP_GuildStatus=0x6916 # +OP_WearChange=0x1a58 # +OP_ClientUpdate=0x7062 # +OP_ClientReady=0x1272 # +OP_SetServerFilter=0x053a # + +# Guild Opcodes +OP_GetGuildMOTD=0x3415 # +OP_GetGuildMOTDReply=0x709d # +OP_GuildMemberUpdate=0x589f # +OP_GuildInvite=0x5488 # +OP_GuildRemove=0x47d3 # +OP_GuildPeace=0x1d22 # +OP_SetGuildMOTD=0x5f85 # +OP_GuildList=0x0000 # +OP_GuildWar=0x0598 # +OP_GuildLeader=0x67c8 # +OP_GuildDelete=0x230e # +OP_GuildInviteAccept=0x2b5a # +OP_GuildDemote=0x1899 # +OP_GuildPublicNote=0x2dbd # +OP_GuildManageBanker=0x0000 # +OP_GuildBank=0x0000 # +OP_SetGuildRank=0x4ffe # +OP_GuildUpdateURLAndChannel=0x03d1 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +OP_GuildStatus=0x6916 # OP_GuildCreate=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # - -# GM/guide opcodes -OP_GMServers=0x6989 # -OP_GMBecomeNPC=0x7093 # -OP_GMZoneRequest=0x701f # -OP_GMZoneRequest2=0x01 # -OP_GMGoto=0x15a1 # -OP_GMSearchCorpse=0x2bff # -OP_GMHideMe=0x7e4d # -OP_GMDelCorpse=0x072f # -OP_GMApproval=0x481f # -OP_GMToggle=0x2042 # -OP_GMSummon=0x6e47 # -OP_GMEmoteZone=0x307d # -OP_GMEmoteWorld=0x0c2d # -OP_GMFind=0x6e27 # -OP_GMKick=0x5a56 # -OP_GMKill=0x51fe # -OP_GMNameChange=0x0000 # -OP_GMLastName=0x1055 # - -OP_InspectAnswer=0x0c54 # -OP_BeginCast=0x0d5a # -OP_BuffFadeMsg=0x1b8a # -OP_ConsentResponse=0x35c6 # -OP_MemorizeSpell=0x569e # -OP_SwapSpell=0x28a7 # -OP_CastSpell=0x8543 # -OP_Consider=0x70c6 # -OP_FormattedMessage=0x4675 # -OP_SimpleMessage=0x0698 # -OP_Buff=0x4658 # -OP_Illusion=0x10b7 # -OP_MoneyOnCorpse=0x4074 # -OP_RandomReply=0x07fb # -OP_DenyResponse=0x0370 # -OP_SkillUpdate=0x7f01 # -OP_GMTrainSkillConfirm=0x0000 # -OP_RandomReq=0x303e # -OP_Death=0x6685 # -OP_Bind_Wound=0x7b64 # -OP_GMTraining=0x5960 # -OP_GMEndTraining=0x4a61 # -OP_GMTrainSkill=0x4885 # -OP_Animation=0x0b93 # -OP_Begging=0x0ca5 # -OP_Consent=0x6bb9 # -OP_ConsentDeny=0x6b7f # -OP_AutoFire=0x23fc # -OP_PetCommands=0x7312 # -OP_DeleteSpell=0x0142 # -OP_Surname=0x777c # -OP_ClearSurname=0x0000 # -OP_FaceChange=0x0507 # -OP_SenseHeading=0x1dad # -OP_Action=0x1b85 # -OP_ConsiderCorpse=0x0e94 # -OP_HideCorpse=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # + +# GM/guide opcodes +OP_GMServers=0x6989 # +OP_GMBecomeNPC=0x7093 # +OP_GMZoneRequest=0x701f # +OP_GMZoneRequest2=0x01 # +OP_GMGoto=0x15a1 # +OP_GMSearchCorpse=0x2bff # +OP_GMHideMe=0x7e4d # +OP_GMDelCorpse=0x072f # +OP_GMApproval=0x481f # +OP_GMToggle=0x2042 # +OP_GMSummon=0x6e47 # +OP_GMEmoteZone=0x307d # +OP_GMEmoteWorld=0x0c2d # +OP_GMFind=0x6e27 # +OP_GMKick=0x5a56 # +OP_GMKill=0x51fe # +OP_GMNameChange=0x0000 # +OP_GMLastName=0x1055 # + +OP_InspectAnswer=0x0c54 # +OP_BeginCast=0x0d5a # +OP_BuffFadeMsg=0x1b8a # +OP_ConsentResponse=0x35c6 # +OP_MemorizeSpell=0x569e # +OP_SwapSpell=0x28a7 # +OP_CastSpell=0x8543 # +OP_Consider=0x70c6 # +OP_FormattedMessage=0x4675 # +OP_SimpleMessage=0x0698 # +OP_Buff=0x4658 # +OP_Illusion=0x10b7 # +OP_MoneyOnCorpse=0x4074 # +OP_RandomReply=0x07fb # +OP_DenyResponse=0x0370 # +OP_SkillUpdate=0x7f01 # +OP_GMTrainSkillConfirm=0x0000 # +OP_RandomReq=0x303e # +OP_Death=0x6685 # +OP_Bind_Wound=0x7b64 # +OP_GMTraining=0x5960 # +OP_GMEndTraining=0x4a61 # +OP_GMTrainSkill=0x4885 # +OP_Animation=0x0b93 # +OP_Begging=0x0ca5 # +OP_Consent=0x6bb9 # +OP_ConsentDeny=0x6b7f # +OP_AutoFire=0x23fc # +OP_PetCommands=0x7312 # +OP_DeleteSpell=0x0142 # +OP_Surname=0x777c # +OP_ClearSurname=0x0000 # +OP_FaceChange=0x0507 # +OP_SenseHeading=0x1dad # +OP_Action=0x1b85 # +OP_ConsiderCorpse=0x0e94 # +OP_HideCorpse=0x0000 # OP_CorpseDrag=0x0000 # OP_CorpseDrop=0x0000 # -OP_Bug=0x3365 # -OP_Feedback=0x52b5 # -OP_Report=0x211a # -OP_Damage=0x45d6 # -OP_ChannelMessage=0x2e79 # -OP_Assist=0x5658 # -OP_AssistGroup=0x43bc # -OP_MoveCoin=0x1418 # -OP_ZonePlayerToBind=0x2480 # -OP_KeyRing=0x3b85 # -OP_WhoAllRequest=0x177a # -OP_WhoAllResponse=0x15de # -OP_FriendsWho=0x73d6 # -OP_ConfirmDelete=0x604d # -OP_Logout=0x6275 # -OP_Rewind=0x09e3 # -OP_TargetCommand=0x3088 # -OP_InspectRequest=0x0000 # -OP_Hide=0x2913 # -OP_Jump=0x243b # -OP_Camp=0x3cd6 # -OP_Emote=0x0000 # -OP_SetRunMode=0x59c3 # -OP_BankerChange=0x0000 # -OP_TargetMouse=0x3edc # -OP_MobHealth=0x5cb0 # -OP_InitialMobHealth=0x0000 # -OP_TargetHoTT=0x460e # -OP_TargetBuffs=0x7c24 # -OP_BuffCreate=0x0c98 # -OP_BuffRemoveRequest=0x3567 -OP_DeleteSpawn=0x3164 # -OP_AutoAttack=0x2257 # -OP_AutoAttack2=0x0000 # -OP_Consume=0x2ee2 # -OP_MoveItem=0x2963 # -OP_DeleteItem=0x7547 # -OP_DeleteCharge=0x6a90 # -OP_ItemPacket=0x38b0 # -OP_ItemLinkResponse=0x6948 # -OP_ItemLinkClick=0x3c66 # -OP_NewSpawn=0x016c # -OP_Track=0x2444 # -OP_TrackTarget=0x538f # -OP_TrackUnknown=0x10fa # -OP_ClickDoor=0x48f9 # -OP_MoveDoor=0x231f # -OP_RemoveAllDoors=0x24a3 # -OP_EnvDamage=0x2730 # -OP_BoardBoat=0x50c2 # -OP_Forage=0x3c02 # -OP_LeaveBoat=0x569a # -OP_ControlBoat=0x2641 # -OP_SafeFallSuccess=0x1dc6 # -OP_RezzComplete=0x7108 # -OP_RezzRequest=0x66c5 # -OP_RezzAnswer=0x71eb # -OP_Shielding=0x7598 # -OP_RequestDuel=0x0e71 # -OP_MobRename=0x6884 # -OP_AugmentItem=0x4cc6 # -OP_WeaponEquip1=0x11bc # -OP_WeaponEquip2=0x2121 # -OP_WeaponUnequip2=0x7b87 # -OP_ApplyPoison=0x3582 # -OP_Save=0x47e7 # -OP_TestBuff=0x712b # -OP_CustomTitles=0x6ade # -OP_Split=0x3a18 # -OP_YellForHelp=0x1f87 # -OP_LoadSpellSet=0x440f # -OP_Bandolier=0x3ad1 # -OP_PotionBelt=0x7b7f # -OP_DuelResponse=0x1df9 # -OP_DuelResponse2=0x36f8 # -OP_SaveOnZoneReq=0x5408 # -OP_ReadBook=0x41b5 # -OP_Dye=0x32c6 # -OP_InterruptCast=0x7706 # -OP_AAAction=0x55dd # -OP_LeadershipExpToggle=0x69d0 # -OP_LeadershipExpUpdate=0x3703 # -OP_PurchaseLeadershipAA=0x6e58 # -OP_UpdateLeadershipAA=0x0297 # -OP_MarkNPC=0x6b9e # -OP_ClearNPCMarks=0x074f # -OP_DoGroupLeadershipAbility=0x0000 # -OP_GroupLeadershipAAUpdate=0x0000 # -OP_DelegateAbility=0x105b # -OP_SetGroupTarget=0x42c7 # -OP_Charm=0x17f7 # -OP_Stun=0x41a6 # -OP_SendFindableNPCs=0x50c1 # -OP_FindPersonRequest=0x19a8 # -OP_FindPersonReply=0x7e45 # -OP_Sound=0x2d1d # -OP_PetBuffWindow=0x4895 # -OP_LevelAppearance=0x78b9 # -OP_Translocate=0x42ef # -OP_Sacrifice=0x2dc6 # -OP_PopupResponse=0x0000 # -OP_OnLevelMessage=0x0000 # -OP_AugmentInfo=0x0000 # -OP_Petition=0x31d1 # -OP_SomeItemPacketMaybe=0x1513 # -OP_PVPStats=0x0000 # -OP_PVPLeaderBoardRequest=0x0000 # -OP_PVPLeaderBoardReply=0x0000 # -OP_PVPLeaderBoardDetailsRequest=0x0000 # -OP_PVPLeaderBoardDetailsReply=0x0000 # -OP_RestState=0x0000 # -OP_RespawnWindow=0x435b # -OP_DisciplineTimer=0x74ca # -OP_LDoNButton=0x597d # -OP_SetStartCity=0x179d # -OP_VoiceMacroIn=0x0fce # -OP_VoiceMacroOut=0x1c36 # -OP_ItemViewUnknown=0x0000 # -OP_VetRewardsAvaliable=0x3637 # -OP_VetClaimRequest=0x032b # -OP_VetClaimReply=0x7b6e # -OP_CrystalCountUpdate=0x0000 # -OP_DisciplineUpdate=0x0d8d # -OP_BecomeCorpse=0x0000 # -OP_Action2=0x0000 # -OP_MobUpdate=0x5a05 # +OP_Bug=0x3365 # +OP_Feedback=0x52b5 # +OP_Report=0x211a # +OP_Damage=0x45d6 # +OP_ChannelMessage=0x2e79 # +OP_Assist=0x5658 # +OP_AssistGroup=0x43bc # +OP_MoveCoin=0x1418 # +OP_ZonePlayerToBind=0x2480 # +OP_KeyRing=0x3b85 # +OP_WhoAllRequest=0x177a # +OP_WhoAllResponse=0x15de # +OP_FriendsWho=0x73d6 # +OP_ConfirmDelete=0x604d # +OP_Logout=0x6275 # +OP_Rewind=0x09e3 # +OP_TargetCommand=0x3088 # +OP_InspectRequest=0x0000 # +OP_Hide=0x2913 # +OP_Jump=0x243b # +OP_Camp=0x3cd6 # +OP_Emote=0x0000 # +OP_SetRunMode=0x59c3 # +OP_BankerChange=0x0000 # +OP_TargetMouse=0x3edc # +OP_MobHealth=0x5cb0 # +OP_InitialMobHealth=0x0000 # +OP_TargetHoTT=0x460e # +OP_TargetBuffs=0x7c24 # +OP_BuffCreate=0x0c98 # +OP_BuffRemoveRequest=0x3567 +OP_DeleteSpawn=0x3164 # +OP_AutoAttack=0x2257 # +OP_AutoAttack2=0x0000 # +OP_Consume=0x2ee2 # +OP_MoveItem=0x2963 # +OP_DeleteItem=0x7547 # +OP_DeleteCharge=0x6a90 # +OP_ItemPacket=0x38b0 # +OP_ItemLinkResponse=0x6948 # +OP_ItemLinkClick=0x3c66 # +OP_NewSpawn=0x016c # +OP_Track=0x2444 # +OP_TrackTarget=0x538f # +OP_TrackUnknown=0x10fa # +OP_ClickDoor=0x48f9 # +OP_MoveDoor=0x231f # +OP_RemoveAllDoors=0x24a3 # +OP_EnvDamage=0x2730 # +OP_BoardBoat=0x50c2 # +OP_Forage=0x3c02 # +OP_LeaveBoat=0x569a # +OP_ControlBoat=0x2641 # +OP_SafeFallSuccess=0x1dc6 # +OP_RezzComplete=0x7108 # +OP_RezzRequest=0x66c5 # +OP_RezzAnswer=0x71eb # +OP_Shielding=0x7598 # +OP_RequestDuel=0x0e71 # +OP_MobRename=0x6884 # +OP_AugmentItem=0x4cc6 # +OP_WeaponEquip1=0x11bc # +OP_WeaponEquip2=0x2121 # +OP_WeaponUnequip2=0x7b87 # +OP_ApplyPoison=0x3582 # +OP_Save=0x47e7 # +OP_TestBuff=0x712b # +OP_CustomTitles=0x6ade # +OP_Split=0x3a18 # +OP_YellForHelp=0x1f87 # +OP_LoadSpellSet=0x440f # +OP_Bandolier=0x3ad1 # +OP_PotionBelt=0x7b7f # +OP_DuelResponse=0x1df9 # +OP_DuelResponse2=0x36f8 # +OP_SaveOnZoneReq=0x5408 # +OP_ReadBook=0x41b5 # +OP_Dye=0x32c6 # +OP_InterruptCast=0x7706 # +OP_AAAction=0x55dd # +OP_LeadershipExpToggle=0x69d0 # +OP_LeadershipExpUpdate=0x3703 # +OP_PurchaseLeadershipAA=0x6e58 # +OP_UpdateLeadershipAA=0x0297 # +OP_MarkNPC=0x6b9e # +OP_ClearNPCMarks=0x074f # +OP_DoGroupLeadershipAbility=0x0000 # +OP_GroupLeadershipAAUpdate=0x0000 # +OP_DelegateAbility=0x105b # +OP_SetGroupTarget=0x42c7 # +OP_Charm=0x17f7 # +OP_Stun=0x41a6 # +OP_SendFindableNPCs=0x50c1 # +OP_FindPersonRequest=0x19a8 # +OP_FindPersonReply=0x7e45 # +OP_Sound=0x2d1d # +OP_PetBuffWindow=0x4895 # +OP_LevelAppearance=0x78b9 # +OP_Translocate=0x42ef # +OP_Sacrifice=0x2dc6 # +OP_PopupResponse=0x0000 # +OP_OnLevelMessage=0x0000 # +OP_AugmentInfo=0x0000 # +OP_Petition=0x31d1 # +OP_SomeItemPacketMaybe=0x1513 # +OP_PVPStats=0x0000 # +OP_PVPLeaderBoardRequest=0x0000 # +OP_PVPLeaderBoardReply=0x0000 # +OP_PVPLeaderBoardDetailsRequest=0x0000 # +OP_PVPLeaderBoardDetailsReply=0x0000 # +OP_RestState=0x0000 # +OP_RespawnWindow=0x435b # +OP_DisciplineTimer=0x74ca # +OP_LDoNButton=0x597d # +OP_SetStartCity=0x179d # +OP_VoiceMacroIn=0x0fce # +OP_VoiceMacroOut=0x1c36 # +OP_ItemViewUnknown=0x0000 # +OP_VetRewardsAvaliable=0x3637 # +OP_VetClaimRequest=0x032b # +OP_VetClaimReply=0x7b6e # +OP_CrystalCountUpdate=0x0000 # +OP_DisciplineUpdate=0x0d8d # +OP_BecomeCorpse=0x0000 # +OP_Action2=0x0000 # +OP_MobUpdate=0x5a05 # OP_NPCMoveUpdate=0x5a4c # -OP_CameraEffect=0x6812 # -OP_SpellEffect=0x0989 # -OP_RemoveNimbusEffect=0x0000 # +OP_CameraEffect=0x6812 # +OP_SpellEffect=0x0989 # +OP_RemoveNimbusEffect=0x0000 # OP_AltCurrency=0x2536 OP_AltCurrencyMerchantRequest=0x5aac OP_AltCurrencyMerchantReply=0x17c7 @@ -367,266 +367,266 @@ OP_DzCompass=0x0000 OP_DzChooseZone=0x0000 # New Opcodes -OP_SpawnPositionUpdate=0x0000 # -OP_ManaUpdate=0x7c94 # -OP_EnduranceUpdate=0x5851 # -OP_MobManaUpdate=0x4d27 # -OP_MobEnduranceUpdate=0x190c # - -# Looting -OP_LootRequest=0x1d85 # -OP_EndLootRequest=0x0bc # -OP_LootItem=0x5bd9 # -OP_LootComplete=0x4ca1 # - -# bazaar trader stuff stuff: -OP_BazaarSearch=0x2881 # -OP_TraderDelItem=0x0000 # -OP_BecomeTrader=0x358a # -OP_TraderShop=0x49f4 # -OP_Trader=0x058c # -OP_TraderBuy=0x783c # -OP_Barter=0x766f # -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # - -# pc/npc trading -OP_TradeRequest=0x0c24 # -OP_TradeAcceptClick=0x064a # -OP_TradeRequestAck=0x606a # -OP_TradeCoins=0x0149 # -OP_FinishTrade=0x3ff6 # -OP_CancelTrade=0x527e # -OP_TradeMoneyUpdate=0x1ebb # -OP_MoneyUpdate=0x528f # -OP_TradeBusy=0x2c03 # +OP_SpawnPositionUpdate=0x0000 # +OP_ManaUpdate=0x7c94 # +OP_EnduranceUpdate=0x5851 # +OP_MobManaUpdate=0x4d27 # +OP_MobEnduranceUpdate=0x190c # + +# Looting +OP_LootRequest=0x1d85 # +OP_EndLootRequest=0x0bc # +OP_LootItem=0x5bd9 # +OP_LootComplete=0x4ca1 # + +# bazaar trader stuff stuff: +OP_BazaarSearch=0x2881 # +OP_TraderDelItem=0x0000 # +OP_BecomeTrader=0x358a # +OP_TraderShop=0x49f4 # +OP_Trader=0x058c # +OP_TraderBuy=0x783c # +OP_Barter=0x766f # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # + +# pc/npc trading +OP_TradeRequest=0x0c24 # +OP_TradeAcceptClick=0x064a # +OP_TradeRequestAck=0x606a # +OP_TradeCoins=0x0149 # +OP_FinishTrade=0x3ff6 # +OP_CancelTrade=0x527e # +OP_TradeMoneyUpdate=0x1ebb # +OP_MoneyUpdate=0x528f # +OP_TradeBusy=0x2c03 # # Sent after canceling trade or after closing tradeskill object -OP_FinishWindow=0x3c27 # -OP_FinishWindow2=0x2c6d # +OP_FinishWindow=0x3c27 # +OP_FinishWindow2=0x2c6d # # Sent on Live for what seems to be item existance verification # Ex. Before Right Click Effect happens from items -OP_ItemVerifyRequest=0x0000 # -OP_ItemVerifyReply=0x0000 # +OP_ItemVerifyRequest=0x0000 # +OP_ItemVerifyReply=0x0000 # # merchant crap -OP_ShopPlayerSell=0x0b27 # -OP_ShopRequest=0x33e5 # -OP_ShopEnd=0x2244 # -OP_ShopEndConfirm=0x4762 # -OP_ShopPlayerBuy=0x436a # -OP_ShopDelItem=0x537c # - -# tradeskill stuff: -OP_ClickObject=0x5f0d # -OP_ClickObjectAction=0x29df # -OP_ClearObject=0x38d1 # -OP_RecipeDetails=0x068 # -OP_RecipesFavorite=0x0000 # -OP_RecipesSearch=0x0239 # -OP_RecipeReply=0x1ecf # -OP_RecipeAutoCombine=0x66bf # -OP_TradeSkillCombine=0x4212 # - -# Tribute Packets: -OP_OpenGuildTributeMaster=0x0000 # -OP_OpenTributeMaster=0x3ba3 # -OP_SelectTribute=0x314f # -OP_TributeItem=0x0000 # -OP_TributeMoney=0x1772 # -OP_TributeToggle=0x0000 # -OP_TributePointUpdate=0x0000 # -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # - -# Adventure packets: -OP_LeaveAdventure=0x771f # -OP_AdventureFinish=0x3168 # -OP_AdventureInfoRequest=0x05d8 # -OP_AdventureInfo=0x164b # -OP_AdventureRequest=0x3a75 # -OP_AdventureDetails=0x05 # -OP_AdventureData=0x21df # -OP_AdventureUpdate=0x6129 # -OP_AdventureMerchantRequest=0x0000 # -OP_AdventureMerchantResponse=0x0000 # -OP_AdventureMerchantPurchase=0x0000 # -OP_AdventureMerchantSell=0x0000 # -OP_AdventurePointsUpdate=0x7d05 # -OP_AdventureStatsRequest=0x0000 # -OP_AdventureStatsReply=0x15a7 # -OP_AdventureLeaderboardRequest=0x0000 # -OP_AdventureLeaderboardReply=0x6bfb # +OP_ShopPlayerSell=0x0b27 # +OP_ShopRequest=0x33e5 # +OP_ShopEnd=0x2244 # +OP_ShopEndConfirm=0x4762 # +OP_ShopPlayerBuy=0x436a # +OP_ShopDelItem=0x537c # + +# tradeskill stuff: +OP_ClickObject=0x5f0d # +OP_ClickObjectAction=0x29df # +OP_ClearObject=0x38d1 # +OP_RecipeDetails=0x068 # +OP_RecipesFavorite=0x0000 # +OP_RecipesSearch=0x0239 # +OP_RecipeReply=0x1ecf # +OP_RecipeAutoCombine=0x66bf # +OP_TradeSkillCombine=0x4212 # + +# Tribute Packets: +OP_OpenGuildTributeMaster=0x0000 # +OP_OpenTributeMaster=0x3ba3 # +OP_SelectTribute=0x314f # +OP_TributeItem=0x0000 # +OP_TributeMoney=0x1772 # +OP_TributeToggle=0x0000 # +OP_TributePointUpdate=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # + +# Adventure packets: +OP_LeaveAdventure=0x771f # +OP_AdventureFinish=0x3168 # +OP_AdventureInfoRequest=0x05d8 # +OP_AdventureInfo=0x164b # +OP_AdventureRequest=0x3a75 # +OP_AdventureDetails=0x05 # +OP_AdventureData=0x21df # +OP_AdventureUpdate=0x6129 # +OP_AdventureMerchantRequest=0x0000 # +OP_AdventureMerchantResponse=0x0000 # +OP_AdventureMerchantPurchase=0x0000 # +OP_AdventureMerchantSell=0x0000 # +OP_AdventurePointsUpdate=0x7d05 # +OP_AdventureStatsRequest=0x0000 # +OP_AdventureStatsReply=0x15a7 # +OP_AdventureLeaderboardRequest=0x0000 # +OP_AdventureLeaderboardReply=0x6bfb # # Group Opcodes -OP_GroupDisband=0x4200 # -OP_GroupInvite=0x3288 # -OP_GroupFollow=0x1190 # -OP_GroupUpdate=0x0000 # -OP_GroupUpdateB=0x0000 # -OP_GroupCancelInvite=0x0000 # -OP_GroupAcknowledge=0x0000 # -OP_GroupDelete=0x0000 # -OP_CancelInvite=0x132f # -OP_GroupFollow2=0x3519 # -OP_GroupInvite2=0x083b # -OP_GroupDisbandYou=0x0000 # -OP_GroupDisbandOther=0x0000 # -OP_GroupLeaderChange=0x0000 # -OP_GroupRoles=0x0000 # +OP_GroupDisband=0x4200 # +OP_GroupInvite=0x3288 # +OP_GroupFollow=0x1190 # +OP_GroupUpdate=0x0000 # +OP_GroupUpdateB=0x0000 # +OP_GroupCancelInvite=0x0000 # +OP_GroupAcknowledge=0x0000 # +OP_GroupDelete=0x0000 # +OP_CancelInvite=0x132f # +OP_GroupFollow2=0x3519 # +OP_GroupInvite2=0x083b # +OP_GroupDisbandYou=0x0000 # +OP_GroupDisbandOther=0x0000 # +OP_GroupLeaderChange=0x0000 # +OP_GroupRoles=0x0000 # OP_GroupMakeLeader=0x0000 # LFG/LFP Opcodes -OP_LFGCommand=0x457d # -OP_LFGGetMatchesRequest=0x49e7 # -OP_LFGGetMatchesResponse=0x4817 # -OP_LFPGetMatchesRequest=0x5fc7 # -OP_LFPGetMatchesResponse=0x3d0c # -OP_LFPCommand=0x20c6 # -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # - -# Raid Opcodes -OP_RaidInvite=0x550f # -OP_RaidUpdate=0x0000 # Testing VoA 0x0c08 -OP_RaidJoin=0x0000 # - -# Button-push commands -OP_Taunt=0x732c # -OP_CombatAbility=0x16a5 # -OP_SenseTraps=0x416b # -OP_PickPocket=0x13bd # -OP_DisarmTraps=0x0000 # -OP_Disarm=0x6def # -OP_Sneak=0x6eff # -OP_Fishing=0x0555 # -OP_InstillDoubt=0x4acf # -OP_FeignDeath=0x6145 # -OP_Mend=0x7fbc # -OP_LDoNOpen=0x7c87 # - -# Task packets -OP_TaskActivityComplete=0x0000 # -OP_TaskMemberList=0x0000 # -OP_OpenNewTasksWindow=0x0000 # -OP_AvaliableTask=0x0000 # -OP_AcceptNewTask=0x0000 # -OP_TaskHistoryRequest=0x6d1f # -OP_TaskHistoryReply=0x189b # -OP_CancelTask=0x47ea # -OP_DeclineAllTasks=0x0000 # - -# Title opcodes -OP_NewTitlesAvailable=0x6d95 # -OP_RequestTitles=0x7e3d # -OP_SendTitleList=0x3aef # -OP_SetTitle=0x725b # -OP_SetTitleReply=0x38e8 # - -# mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_LFGCommand=0x457d # +OP_LFGGetMatchesRequest=0x49e7 # +OP_LFGGetMatchesResponse=0x4817 # +OP_LFPGetMatchesRequest=0x5fc7 # +OP_LFPGetMatchesResponse=0x3d0c # +OP_LFPCommand=0x20c6 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# Raid Opcodes +OP_RaidInvite=0x550f # +OP_RaidUpdate=0x0000 # Testing VoA 0x0c08 +OP_RaidJoin=0x0000 # + +# Button-push commands +OP_Taunt=0x732c # +OP_CombatAbility=0x16a5 # +OP_SenseTraps=0x416b # +OP_PickPocket=0x13bd # +OP_DisarmTraps=0x0000 # +OP_Disarm=0x6def # +OP_Sneak=0x6eff # +OP_Fishing=0x0555 # +OP_InstillDoubt=0x4acf # +OP_FeignDeath=0x6145 # +OP_Mend=0x7fbc # +OP_LDoNOpen=0x7c87 # + +# Task packets +OP_TaskActivityComplete=0x0000 # +OP_TaskMemberList=0x0000 # +OP_OpenNewTasksWindow=0x0000 # +OP_AvaliableTask=0x0000 # +OP_AcceptNewTask=0x0000 # +OP_TaskHistoryRequest=0x6d1f # +OP_TaskHistoryReply=0x189b # +OP_CancelTask=0x47ea # +OP_DeclineAllTasks=0x0000 # + +# Title opcodes +OP_NewTitlesAvailable=0x6d95 # +OP_RequestTitles=0x7e3d # +OP_SendTitleList=0x3aef # +OP_SetTitle=0x725b # +OP_SetTitleReply=0x38e8 # + +# mail opcodes +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # + +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # - -# discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # + +# discovered opcodes not yet used: +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps #OP_LoginUnknown1=0x46d3 # U OP_SendSpellChecksum #OP_LoginUnknown2=0x040b # U OP_SendSkillCapsChecksum - -# Petition Opcodes + +# Petition Opcodes OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search - -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # - -# Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # - -# raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # + +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # + +# Login opcodes +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # + +# raw opcodes +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_June25-2012.conf b/utils/EQExtractor2/EQExtractor2/patch_June25-2012.conf index 9a612b14b..3be014ca9 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_June25-2012.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_June25-2012.conf @@ -15,327 +15,327 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: -OP_SendLoginInfo=0x4d5c # -OP_ApproveWorld=0x655c # -OP_LogServer=0x1497 # -OP_SendCharInfo=0x7f9e # -OP_ExpansionInfo=0x2c8f # -OP_GuildsList=0x5b0b # -OP_EnterWorld=0x710e # -OP_PostEnterWorld=0x7930 # -OP_World_Client_CRC1=0x7ce4 # -OP_World_Client_CRC2=0x7705 # -OP_SendSpellChecksum=0x0000 # -OP_SendSkillCapsChecksum=0x0000 # - -# Character Select Related: -OP_DeleteCharacter=0x5ca5 # -OP_CharacterCreateRequest=0x4eba # -OP_CharacterCreate=0x3237 # -OP_RandomNameGenerator=0x26aa # -OP_ApproveName=0x3154 # - -OP_MOTD=0x0b80 # -OP_SetChatServer=0x2c38 # -OP_SetChatServer2=0x441c # -OP_ZoneServerInfo=0x16f5 # -OP_WorldComplete=0x6c63 # -OP_WorldUnknown001=0x4274 # -OP_FloatListThing=0x1910 # - -# Reasons for Disconnect: -OP_ZoneUnavail=0x20bc # +# Required to reach Char Select: +OP_SendLoginInfo=0x4d5c # +OP_ApproveWorld=0x655c # +OP_LogServer=0x1497 # +OP_SendCharInfo=0x7f9e # +OP_ExpansionInfo=0x2c8f # +OP_GuildsList=0x5b0b # +OP_EnterWorld=0x710e # +OP_PostEnterWorld=0x7930 # +OP_World_Client_CRC1=0x7ce4 # +OP_World_Client_CRC2=0x7705 # +OP_SendSpellChecksum=0x0000 # +OP_SendSkillCapsChecksum=0x0000 # + +# Character Select Related: +OP_DeleteCharacter=0x5ca5 # +OP_CharacterCreateRequest=0x4eba # +OP_CharacterCreate=0x3237 # +OP_RandomNameGenerator=0x26aa # +OP_ApproveName=0x3154 # + +OP_MOTD=0x0b80 # +OP_SetChatServer=0x2c38 # +OP_SetChatServer2=0x441c # +OP_ZoneServerInfo=0x16f5 # +OP_WorldComplete=0x6c63 # +OP_WorldUnknown001=0x4274 # +OP_FloatListThing=0x1910 # + +# Reasons for Disconnect: +OP_ZoneUnavail=0x20bc # OP_WorldClientReady=0x0b89 # Testing VoA 0x3f24 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # - -# Zone in opcodes -OP_AckPacket=0x3594 # -OP_ZoneEntry=0x4892 # -OP_ReqNewZone=0x0000 # -OP_NewZone=0x4118 # -OP_ZoneSpawns=0x5f5e # -OP_PlayerProfile=0x6afd # -OP_TimeOfDay=0x6015 # -OP_LevelUpdate=0x6e1c # -OP_Stamina=0x7686 # -OP_RequestClientZoneChange=0x224f # -OP_ZoneChange=0x28c8 # - -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # - -# Required to fully log in -OP_SpawnAppearance=0x3f55 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # + +# Zone in opcodes +OP_AckPacket=0x3594 # +OP_ZoneEntry=0x4892 # +OP_ReqNewZone=0x0000 # +OP_NewZone=0x4118 # +OP_ZoneSpawns=0x5f5e # +OP_PlayerProfile=0x6afd # +OP_TimeOfDay=0x6015 # +OP_LevelUpdate=0x6e1c # +OP_Stamina=0x7686 # +OP_RequestClientZoneChange=0x224f # +OP_ZoneChange=0x28c8 # + +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # + +# Required to fully log in +OP_SpawnAppearance=0x3f55 # OP_ChangeSize=0x0000 # -OP_TributeUpdate=0x0000 # +OP_TributeUpdate=0x0000 # OP_TributeTimer=0x0000 # Testing VoA 0x1525 -OP_TaskDescription=0x2e4f # -OP_TaskActivity=0x512b # -OP_CompletedTasks=0x3141 # -OP_Weather=0x3e50 # +OP_TaskDescription=0x2e4f # +OP_TaskActivity=0x512b # +OP_CompletedTasks=0x3141 # +OP_Weather=0x3e50 # OP_SendAATable=0x0d98 # Testing VoA 0x6a7e OP_UpdateAA=0x5363 # Testing VoA 0x5363 OP_RespondAA=0x7bf6 # Testing VoA 0x0643 or maybe 0x7bf6 -OP_ReqClientSpawn=0x2c27 # -OP_SpawnDoor=0x5a55 # -OP_GroundSpawn=0x5c85 # -OP_SendZonepoints=0x2683 # -OP_SendAAStats=0x4e22 # -OP_WorldObjectsSent=0x7b73 # -OP_BlockedBuffs=0x1681 # -OP_RemoveBlockedBuffs=0x6a86 # -OP_ClearBlockedBuffs=0x7ae1 # -OP_SendExpZonein=0x0f14 # -OP_SendTributes=0x010d # -OP_TributeInfo=0x047c # -OP_SendGuildTributes=0x0000 # -OP_AAExpUpdate=0x1318 # +OP_ReqClientSpawn=0x2c27 # +OP_SpawnDoor=0x5a55 # +OP_GroundSpawn=0x5c85 # +OP_SendZonepoints=0x2683 # +OP_SendAAStats=0x4e22 # +OP_WorldObjectsSent=0x7b73 # +OP_BlockedBuffs=0x1681 # +OP_RemoveBlockedBuffs=0x6a86 # +OP_ClearBlockedBuffs=0x7ae1 # +OP_SendExpZonein=0x0f14 # +OP_SendTributes=0x010d # +OP_TributeInfo=0x047c # +OP_SendGuildTributes=0x0000 # +OP_AAExpUpdate=0x1318 # OP_ExpUpdate=0x221a # Testing VoA 0x0555 -OP_HPUpdate=0x2369 # -OP_ManaChange=0x3887 # -OP_TGB=0x3672 # -OP_SpecialMesg=0x039d # -OP_GuildMemberList=0x51bc # +OP_HPUpdate=0x2369 # +OP_ManaChange=0x3887 # +OP_TGB=0x3672 # +OP_SpecialMesg=0x039d # +OP_GuildMemberList=0x51bc # OP_GuildMOTD=0x0a1d # Testing VoA 0x0a1d OP_CharInventory=0x6cfe # Testing VoA 0x6cfe -OP_WearChange=0x1a58 # -OP_ClientUpdate=0x7062 # -OP_ClientReady=0x1272 # -OP_SetServerFilter=0x053a # - -# Guild Opcodes -OP_GetGuildMOTD=0x3415 # -OP_GetGuildMOTDReply=0x709d # -OP_GuildMemberUpdate=0x589f # -OP_GuildInvite=0x5488 # -OP_GuildRemove=0x47d3 # -OP_GuildPeace=0x1d22 # -OP_SetGuildMOTD=0x5f85 # -OP_GuildList=0x0000 # -OP_GuildWar=0x0598 # -OP_GuildLeader=0x67c8 # -OP_GuildDelete=0x230e # -OP_GuildInviteAccept=0x2b5a # -OP_GuildDemote=0x1899 # -OP_GuildPublicNote=0x2dbd # -OP_GuildManageBanker=0x0000 # -OP_GuildBank=0x0000 # -OP_SetGuildRank=0x4ffe # -OP_GuildUpdateURLAndChannel=0x03d1 # -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -OP_GuildStatus=0x6916 # +OP_WearChange=0x1a58 # +OP_ClientUpdate=0x7062 # +OP_ClientReady=0x1272 # +OP_SetServerFilter=0x053a # + +# Guild Opcodes +OP_GetGuildMOTD=0x3415 # +OP_GetGuildMOTDReply=0x709d # +OP_GuildMemberUpdate=0x589f # +OP_GuildInvite=0x5488 # +OP_GuildRemove=0x47d3 # +OP_GuildPeace=0x1d22 # +OP_SetGuildMOTD=0x5f85 # +OP_GuildList=0x0000 # +OP_GuildWar=0x0598 # +OP_GuildLeader=0x67c8 # +OP_GuildDelete=0x230e # +OP_GuildInviteAccept=0x2b5a # +OP_GuildDemote=0x1899 # +OP_GuildPublicNote=0x2dbd # +OP_GuildManageBanker=0x0000 # +OP_GuildBank=0x0000 # +OP_SetGuildRank=0x4ffe # +OP_GuildUpdateURLAndChannel=0x03d1 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +OP_GuildStatus=0x6916 # OP_GuildCreate=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # - -# GM/guide opcodes -OP_GMServers=0x6989 # -OP_GMBecomeNPC=0x7093 # -OP_GMZoneRequest=0x701f # -OP_GMZoneRequest2=0x01 # -OP_GMGoto=0x15a1 # -OP_GMSearchCorpse=0x2bff # -OP_GMHideMe=0x7e4d # -OP_GMDelCorpse=0x072f # -OP_GMApproval=0x481f # -OP_GMToggle=0x2042 # -OP_GMSummon=0x6e47 # -OP_GMEmoteZone=0x307d # -OP_GMEmoteWorld=0x0c2d # -OP_GMFind=0x6e27 # -OP_GMKick=0x5a56 # -OP_GMKill=0x51fe # -OP_GMNameChange=0x0000 # -OP_GMLastName=0x1055 # - -OP_InspectAnswer=0x0c54 # -OP_BeginCast=0x0d5a # -OP_BuffFadeMsg=0x1b8a # -OP_ConsentResponse=0x35c6 # -OP_MemorizeSpell=0x569e # -OP_SwapSpell=0x28a7 # -OP_CastSpell=0x8543 # -OP_Consider=0x70c6 # -OP_FormattedMessage=0x4675 # -OP_SimpleMessage=0x0698 # -OP_Buff=0x4658 # -OP_Illusion=0x10b7 # -OP_MoneyOnCorpse=0x4074 # -OP_RandomReply=0x07fb # -OP_DenyResponse=0x0370 # -OP_SkillUpdate=0x7f01 # -OP_GMTrainSkillConfirm=0x0000 # -OP_RandomReq=0x303e # -OP_Death=0x6685 # -OP_Bind_Wound=0x7b64 # -OP_GMTraining=0x5960 # -OP_GMEndTraining=0x4a61 # -OP_GMTrainSkill=0x4885 # -OP_Animation=0x0b93 # -OP_Begging=0x0ca5 # -OP_Consent=0x6bb9 # -OP_ConsentDeny=0x6b7f # -OP_AutoFire=0x23fc # -OP_PetCommands=0x7312 # -OP_DeleteSpell=0x0142 # -OP_Surname=0x777c # -OP_ClearSurname=0x0000 # -OP_FaceChange=0x0507 # -OP_SenseHeading=0x1dad # -OP_Action=0x1b85 # -OP_ConsiderCorpse=0x0e94 # -OP_HideCorpse=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # + +# GM/guide opcodes +OP_GMServers=0x6989 # +OP_GMBecomeNPC=0x7093 # +OP_GMZoneRequest=0x701f # +OP_GMZoneRequest2=0x01 # +OP_GMGoto=0x15a1 # +OP_GMSearchCorpse=0x2bff # +OP_GMHideMe=0x7e4d # +OP_GMDelCorpse=0x072f # +OP_GMApproval=0x481f # +OP_GMToggle=0x2042 # +OP_GMSummon=0x6e47 # +OP_GMEmoteZone=0x307d # +OP_GMEmoteWorld=0x0c2d # +OP_GMFind=0x6e27 # +OP_GMKick=0x5a56 # +OP_GMKill=0x51fe # +OP_GMNameChange=0x0000 # +OP_GMLastName=0x1055 # + +OP_InspectAnswer=0x0c54 # +OP_BeginCast=0x0d5a # +OP_BuffFadeMsg=0x1b8a # +OP_ConsentResponse=0x35c6 # +OP_MemorizeSpell=0x569e # +OP_SwapSpell=0x28a7 # +OP_CastSpell=0x8543 # +OP_Consider=0x70c6 # +OP_FormattedMessage=0x4675 # +OP_SimpleMessage=0x0698 # +OP_Buff=0x4658 # +OP_Illusion=0x10b7 # +OP_MoneyOnCorpse=0x4074 # +OP_RandomReply=0x07fb # +OP_DenyResponse=0x0370 # +OP_SkillUpdate=0x7f01 # +OP_GMTrainSkillConfirm=0x0000 # +OP_RandomReq=0x303e # +OP_Death=0x6685 # +OP_Bind_Wound=0x7b64 # +OP_GMTraining=0x5960 # +OP_GMEndTraining=0x4a61 # +OP_GMTrainSkill=0x4885 # +OP_Animation=0x0b93 # +OP_Begging=0x0ca5 # +OP_Consent=0x6bb9 # +OP_ConsentDeny=0x6b7f # +OP_AutoFire=0x23fc # +OP_PetCommands=0x7312 # +OP_DeleteSpell=0x0142 # +OP_Surname=0x777c # +OP_ClearSurname=0x0000 # +OP_FaceChange=0x0507 # +OP_SenseHeading=0x1dad # +OP_Action=0x1b85 # +OP_ConsiderCorpse=0x0e94 # +OP_HideCorpse=0x0000 # OP_CorpseDrag=0x0000 # OP_CorpseDrop=0x0000 # -OP_Bug=0x3365 # -OP_Feedback=0x52b5 # -OP_Report=0x211a # -OP_Damage=0x45d6 # -OP_ChannelMessage=0x2e79 # -OP_Assist=0x5658 # -OP_AssistGroup=0x43bc # -OP_MoveCoin=0x1418 # -OP_ZonePlayerToBind=0x2480 # -OP_KeyRing=0x3b85 # -OP_WhoAllRequest=0x177a # -OP_WhoAllResponse=0x15de # -OP_FriendsWho=0x73d6 # -OP_ConfirmDelete=0x604d # -OP_Logout=0x6275 # -OP_Rewind=0x09e3 # -OP_TargetCommand=0x3088 # -OP_InspectRequest=0x0000 # -OP_Hide=0x2913 # -OP_Jump=0x243b # -OP_Camp=0x3cd6 # -OP_Emote=0x0000 # -OP_SetRunMode=0x59c3 # -OP_BankerChange=0x0000 # -OP_TargetMouse=0x3edc # -OP_MobHealth=0x5cb0 # -OP_InitialMobHealth=0x0000 # -OP_TargetHoTT=0x460e # -OP_TargetBuffs=0x7c24 # -OP_BuffCreate=0x0c98 # -OP_BuffRemoveRequest=0x3567 -OP_DeleteSpawn=0x3164 # -OP_AutoAttack=0x2257 # -OP_AutoAttack2=0x0000 # -OP_Consume=0x2ee2 # -OP_MoveItem=0x2963 # -OP_DeleteItem=0x7547 # -OP_DeleteCharge=0x6a90 # -OP_ItemPacket=0x399b # -OP_ItemLinkResponse=0x6948 # -OP_ItemLinkClick=0x3c66 # -OP_NewSpawn=0x016c # -OP_Track=0x2444 # -OP_TrackTarget=0x538f # -OP_TrackUnknown=0x10fa # -OP_ClickDoor=0x48f9 # -OP_MoveDoor=0x231f # -OP_RemoveAllDoors=0x24a3 # -OP_EnvDamage=0x2730 # -OP_BoardBoat=0x50c2 # -OP_Forage=0x3c02 # -OP_LeaveBoat=0x569a # -OP_ControlBoat=0x2641 # -OP_SafeFallSuccess=0x1dc6 # -OP_RezzComplete=0x7108 # -OP_RezzRequest=0x66c5 # -OP_RezzAnswer=0x71eb # -OP_Shielding=0x7598 # -OP_RequestDuel=0x0e71 # -OP_MobRename=0x6884 # -OP_AugmentItem=0x4cc6 # -OP_WeaponEquip1=0x11bc # -OP_WeaponEquip2=0x2121 # -OP_WeaponUnequip2=0x7b87 # -OP_ApplyPoison=0x3582 # -OP_Save=0x47e7 # -OP_TestBuff=0x712b # -OP_CustomTitles=0x6ade # -OP_Split=0x3a18 # -OP_YellForHelp=0x1f87 # -OP_LoadSpellSet=0x440f # -OP_Bandolier=0x3ad1 # -OP_PotionBelt=0x7b7f # -OP_DuelResponse=0x1df9 # -OP_DuelResponse2=0x36f8 # -OP_SaveOnZoneReq=0x5408 # -OP_ReadBook=0x41b5 # -OP_Dye=0x32c6 # -OP_InterruptCast=0x7706 # -OP_AAAction=0x55dd # -OP_LeadershipExpToggle=0x69d0 # -OP_LeadershipExpUpdate=0x3703 # -OP_PurchaseLeadershipAA=0x6e58 # -OP_UpdateLeadershipAA=0x0297 # -OP_MarkNPC=0x6b9e # -OP_ClearNPCMarks=0x074f # -OP_DoGroupLeadershipAbility=0x0000 # -OP_GroupLeadershipAAUpdate=0x0000 # -OP_DelegateAbility=0x105b # -OP_SetGroupTarget=0x42c7 # -OP_Charm=0x17f7 # -OP_Stun=0x41a6 # -OP_SendFindableNPCs=0x099e # -OP_FindPersonRequest=0x19a8 # -OP_FindPersonReply=0x7e45 # -OP_Sound=0x2d1d # -OP_PetBuffWindow=0x4895 # -OP_LevelAppearance=0x78b9 # -OP_Translocate=0x42ef # -OP_Sacrifice=0x2dc6 # -OP_PopupResponse=0x0000 # -OP_OnLevelMessage=0x0000 # -OP_AugmentInfo=0x0000 # -OP_Petition=0x31d1 # -OP_SomeItemPacketMaybe=0x1513 # -OP_PVPStats=0x0000 # -OP_PVPLeaderBoardRequest=0x0000 # -OP_PVPLeaderBoardReply=0x0000 # -OP_PVPLeaderBoardDetailsRequest=0x0000 # -OP_PVPLeaderBoardDetailsReply=0x0000 # -OP_RestState=0x0000 # -OP_RespawnWindow=0x435b # -OP_DisciplineTimer=0x74ca # -OP_LDoNButton=0x597d # -OP_SetStartCity=0x179d # -OP_VoiceMacroIn=0x0fce # -OP_VoiceMacroOut=0x1c36 # -OP_ItemViewUnknown=0x0000 # -OP_VetRewardsAvaliable=0x3637 # -OP_VetClaimRequest=0x032b # -OP_VetClaimReply=0x7b6e # -OP_CrystalCountUpdate=0x0000 # -OP_DisciplineUpdate=0x0d8d # -OP_BecomeCorpse=0x0000 # -OP_Action2=0x0000 # -OP_MobUpdate=0x4656 # +OP_Bug=0x3365 # +OP_Feedback=0x52b5 # +OP_Report=0x211a # +OP_Damage=0x45d6 # +OP_ChannelMessage=0x2e79 # +OP_Assist=0x5658 # +OP_AssistGroup=0x43bc # +OP_MoveCoin=0x1418 # +OP_ZonePlayerToBind=0x2480 # +OP_KeyRing=0x3b85 # +OP_WhoAllRequest=0x177a # +OP_WhoAllResponse=0x15de # +OP_FriendsWho=0x73d6 # +OP_ConfirmDelete=0x604d # +OP_Logout=0x6275 # +OP_Rewind=0x09e3 # +OP_TargetCommand=0x3088 # +OP_InspectRequest=0x0000 # +OP_Hide=0x2913 # +OP_Jump=0x243b # +OP_Camp=0x3cd6 # +OP_Emote=0x0000 # +OP_SetRunMode=0x59c3 # +OP_BankerChange=0x0000 # +OP_TargetMouse=0x3edc # +OP_MobHealth=0x5cb0 # +OP_InitialMobHealth=0x0000 # +OP_TargetHoTT=0x460e # +OP_TargetBuffs=0x7c24 # +OP_BuffCreate=0x0c98 # +OP_BuffRemoveRequest=0x3567 +OP_DeleteSpawn=0x3164 # +OP_AutoAttack=0x2257 # +OP_AutoAttack2=0x0000 # +OP_Consume=0x2ee2 # +OP_MoveItem=0x2963 # +OP_DeleteItem=0x7547 # +OP_DeleteCharge=0x6a90 # +OP_ItemPacket=0x399b # +OP_ItemLinkResponse=0x6948 # +OP_ItemLinkClick=0x3c66 # +OP_NewSpawn=0x016c # +OP_Track=0x2444 # +OP_TrackTarget=0x538f # +OP_TrackUnknown=0x10fa # +OP_ClickDoor=0x48f9 # +OP_MoveDoor=0x231f # +OP_RemoveAllDoors=0x24a3 # +OP_EnvDamage=0x2730 # +OP_BoardBoat=0x50c2 # +OP_Forage=0x3c02 # +OP_LeaveBoat=0x569a # +OP_ControlBoat=0x2641 # +OP_SafeFallSuccess=0x1dc6 # +OP_RezzComplete=0x7108 # +OP_RezzRequest=0x66c5 # +OP_RezzAnswer=0x71eb # +OP_Shielding=0x7598 # +OP_RequestDuel=0x0e71 # +OP_MobRename=0x6884 # +OP_AugmentItem=0x4cc6 # +OP_WeaponEquip1=0x11bc # +OP_WeaponEquip2=0x2121 # +OP_WeaponUnequip2=0x7b87 # +OP_ApplyPoison=0x3582 # +OP_Save=0x47e7 # +OP_TestBuff=0x712b # +OP_CustomTitles=0x6ade # +OP_Split=0x3a18 # +OP_YellForHelp=0x1f87 # +OP_LoadSpellSet=0x440f # +OP_Bandolier=0x3ad1 # +OP_PotionBelt=0x7b7f # +OP_DuelResponse=0x1df9 # +OP_DuelResponse2=0x36f8 # +OP_SaveOnZoneReq=0x5408 # +OP_ReadBook=0x41b5 # +OP_Dye=0x32c6 # +OP_InterruptCast=0x7706 # +OP_AAAction=0x55dd # +OP_LeadershipExpToggle=0x69d0 # +OP_LeadershipExpUpdate=0x3703 # +OP_PurchaseLeadershipAA=0x6e58 # +OP_UpdateLeadershipAA=0x0297 # +OP_MarkNPC=0x6b9e # +OP_ClearNPCMarks=0x074f # +OP_DoGroupLeadershipAbility=0x0000 # +OP_GroupLeadershipAAUpdate=0x0000 # +OP_DelegateAbility=0x105b # +OP_SetGroupTarget=0x42c7 # +OP_Charm=0x17f7 # +OP_Stun=0x41a6 # +OP_SendFindableNPCs=0x099e # +OP_FindPersonRequest=0x19a8 # +OP_FindPersonReply=0x7e45 # +OP_Sound=0x2d1d # +OP_PetBuffWindow=0x4895 # +OP_LevelAppearance=0x78b9 # +OP_Translocate=0x42ef # +OP_Sacrifice=0x2dc6 # +OP_PopupResponse=0x0000 # +OP_OnLevelMessage=0x0000 # +OP_AugmentInfo=0x0000 # +OP_Petition=0x31d1 # +OP_SomeItemPacketMaybe=0x1513 # +OP_PVPStats=0x0000 # +OP_PVPLeaderBoardRequest=0x0000 # +OP_PVPLeaderBoardReply=0x0000 # +OP_PVPLeaderBoardDetailsRequest=0x0000 # +OP_PVPLeaderBoardDetailsReply=0x0000 # +OP_RestState=0x0000 # +OP_RespawnWindow=0x435b # +OP_DisciplineTimer=0x74ca # +OP_LDoNButton=0x597d # +OP_SetStartCity=0x179d # +OP_VoiceMacroIn=0x0fce # +OP_VoiceMacroOut=0x1c36 # +OP_ItemViewUnknown=0x0000 # +OP_VetRewardsAvaliable=0x3637 # +OP_VetClaimRequest=0x032b # +OP_VetClaimReply=0x7b6e # +OP_CrystalCountUpdate=0x0000 # +OP_DisciplineUpdate=0x0d8d # +OP_BecomeCorpse=0x0000 # +OP_Action2=0x0000 # +OP_MobUpdate=0x4656 # OP_NPCMoveUpdate=0x4f35 # -OP_CameraEffect=0x6812 # -OP_SpellEffect=0x0989 # -OP_RemoveNimbusEffect=0x0000 # +OP_CameraEffect=0x6812 # +OP_SpellEffect=0x0989 # +OP_RemoveNimbusEffect=0x0000 # OP_AltCurrency=0x2536 OP_AltCurrencyMerchantRequest=0x5aac OP_AltCurrencyMerchantReply=0x17c7 @@ -367,266 +367,266 @@ OP_DzCompass=0x0000 OP_DzChooseZone=0x0000 # New Opcodes -OP_SpawnPositionUpdate=0x0000 # -OP_ManaUpdate=0x7c94 # -OP_EnduranceUpdate=0x5851 # -OP_MobManaUpdate=0x4d27 # -OP_MobEnduranceUpdate=0x190c # - -# Looting -OP_LootRequest=0x1d85 # -OP_EndLootRequest=0x0bc # -OP_LootItem=0x5bd9 # -OP_LootComplete=0x4ca1 # - -# bazaar trader stuff stuff: -OP_BazaarSearch=0x2881 # -OP_TraderDelItem=0x0000 # -OP_BecomeTrader=0x358a # -OP_TraderShop=0x49f4 # -OP_Trader=0x058c # -OP_TraderBuy=0x783c # -OP_Barter=0x766f # -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # - -# pc/npc trading -OP_TradeRequest=0x0c24 # -OP_TradeAcceptClick=0x064a # -OP_TradeRequestAck=0x606a # -OP_TradeCoins=0x0149 # -OP_FinishTrade=0x3ff6 # -OP_CancelTrade=0x527e # -OP_TradeMoneyUpdate=0x1ebb # -OP_MoneyUpdate=0x528f # -OP_TradeBusy=0x2c03 # +OP_SpawnPositionUpdate=0x0000 # +OP_ManaUpdate=0x7c94 # +OP_EnduranceUpdate=0x5851 # +OP_MobManaUpdate=0x4d27 # +OP_MobEnduranceUpdate=0x190c # + +# Looting +OP_LootRequest=0x1d85 # +OP_EndLootRequest=0x0bc # +OP_LootItem=0x5bd9 # +OP_LootComplete=0x4ca1 # + +# bazaar trader stuff stuff: +OP_BazaarSearch=0x2881 # +OP_TraderDelItem=0x0000 # +OP_BecomeTrader=0x358a # +OP_TraderShop=0x49f4 # +OP_Trader=0x058c # +OP_TraderBuy=0x783c # +OP_Barter=0x766f # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # + +# pc/npc trading +OP_TradeRequest=0x0c24 # +OP_TradeAcceptClick=0x064a # +OP_TradeRequestAck=0x606a # +OP_TradeCoins=0x0149 # +OP_FinishTrade=0x3ff6 # +OP_CancelTrade=0x527e # +OP_TradeMoneyUpdate=0x1ebb # +OP_MoneyUpdate=0x528f # +OP_TradeBusy=0x2c03 # # Sent after canceling trade or after closing tradeskill object -OP_FinishWindow=0x3c27 # -OP_FinishWindow2=0x2c6d # +OP_FinishWindow=0x3c27 # +OP_FinishWindow2=0x2c6d # # Sent on Live for what seems to be item existance verification # Ex. Before Right Click Effect happens from items -OP_ItemVerifyRequest=0x0000 # -OP_ItemVerifyReply=0x0000 # +OP_ItemVerifyRequest=0x0000 # +OP_ItemVerifyReply=0x0000 # # merchant crap -OP_ShopPlayerSell=0x0b27 # -OP_ShopRequest=0x442a # -OP_ShopEnd=0x078e # -OP_ShopEndConfirm=0x4762 # -OP_ShopPlayerBuy=0x436a # -OP_ShopDelItem=0x537c # - -# tradeskill stuff: -OP_ClickObject=0x5f0d # -OP_ClickObjectAction=0x29df # -OP_ClearObject=0x38d1 # -OP_RecipeDetails=0x068 # -OP_RecipesFavorite=0x0000 # -OP_RecipesSearch=0x0239 # -OP_RecipeReply=0x1ecf # -OP_RecipeAutoCombine=0x66bf # -OP_TradeSkillCombine=0x4212 # - -# Tribute Packets: -OP_OpenGuildTributeMaster=0x0000 # -OP_OpenTributeMaster=0x3ba3 # -OP_SelectTribute=0x314f # -OP_TributeItem=0x0000 # -OP_TributeMoney=0x1772 # -OP_TributeToggle=0x0000 # -OP_TributePointUpdate=0x0000 # -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # - -# Adventure packets: -OP_LeaveAdventure=0x771f # -OP_AdventureFinish=0x3168 # -OP_AdventureInfoRequest=0x05d8 # -OP_AdventureInfo=0x164b # -OP_AdventureRequest=0x3a75 # -OP_AdventureDetails=0x05 # -OP_AdventureData=0x21df # -OP_AdventureUpdate=0x6129 # -OP_AdventureMerchantRequest=0x0000 # -OP_AdventureMerchantResponse=0x0000 # -OP_AdventureMerchantPurchase=0x0000 # -OP_AdventureMerchantSell=0x0000 # -OP_AdventurePointsUpdate=0x7d05 # -OP_AdventureStatsRequest=0x0000 # -OP_AdventureStatsReply=0x15a7 # -OP_AdventureLeaderboardRequest=0x0000 # -OP_AdventureLeaderboardReply=0x6bfb # +OP_ShopPlayerSell=0x0b27 # +OP_ShopRequest=0x442a # +OP_ShopEnd=0x078e # +OP_ShopEndConfirm=0x4762 # +OP_ShopPlayerBuy=0x436a # +OP_ShopDelItem=0x537c # + +# tradeskill stuff: +OP_ClickObject=0x5f0d # +OP_ClickObjectAction=0x29df # +OP_ClearObject=0x38d1 # +OP_RecipeDetails=0x068 # +OP_RecipesFavorite=0x0000 # +OP_RecipesSearch=0x0239 # +OP_RecipeReply=0x1ecf # +OP_RecipeAutoCombine=0x66bf # +OP_TradeSkillCombine=0x4212 # + +# Tribute Packets: +OP_OpenGuildTributeMaster=0x0000 # +OP_OpenTributeMaster=0x3ba3 # +OP_SelectTribute=0x314f # +OP_TributeItem=0x0000 # +OP_TributeMoney=0x1772 # +OP_TributeToggle=0x0000 # +OP_TributePointUpdate=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # + +# Adventure packets: +OP_LeaveAdventure=0x771f # +OP_AdventureFinish=0x3168 # +OP_AdventureInfoRequest=0x05d8 # +OP_AdventureInfo=0x164b # +OP_AdventureRequest=0x3a75 # +OP_AdventureDetails=0x05 # +OP_AdventureData=0x21df # +OP_AdventureUpdate=0x6129 # +OP_AdventureMerchantRequest=0x0000 # +OP_AdventureMerchantResponse=0x0000 # +OP_AdventureMerchantPurchase=0x0000 # +OP_AdventureMerchantSell=0x0000 # +OP_AdventurePointsUpdate=0x7d05 # +OP_AdventureStatsRequest=0x0000 # +OP_AdventureStatsReply=0x15a7 # +OP_AdventureLeaderboardRequest=0x0000 # +OP_AdventureLeaderboardReply=0x6bfb # # Group Opcodes -OP_GroupDisband=0x4200 # -OP_GroupInvite=0x3288 # -OP_GroupFollow=0x1190 # -OP_GroupUpdate=0x0000 # -OP_GroupUpdateB=0x0000 # -OP_GroupCancelInvite=0x0000 # -OP_GroupAcknowledge=0x0000 # -OP_GroupDelete=0x0000 # -OP_CancelInvite=0x132f # -OP_GroupFollow2=0x3519 # -OP_GroupInvite2=0x083b # -OP_GroupDisbandYou=0x0000 # -OP_GroupDisbandOther=0x0000 # -OP_GroupLeaderChange=0x0000 # -OP_GroupRoles=0x0000 # +OP_GroupDisband=0x4200 # +OP_GroupInvite=0x3288 # +OP_GroupFollow=0x1190 # +OP_GroupUpdate=0x0000 # +OP_GroupUpdateB=0x0000 # +OP_GroupCancelInvite=0x0000 # +OP_GroupAcknowledge=0x0000 # +OP_GroupDelete=0x0000 # +OP_CancelInvite=0x132f # +OP_GroupFollow2=0x3519 # +OP_GroupInvite2=0x083b # +OP_GroupDisbandYou=0x0000 # +OP_GroupDisbandOther=0x0000 # +OP_GroupLeaderChange=0x0000 # +OP_GroupRoles=0x0000 # OP_GroupMakeLeader=0x13da # LFG/LFP Opcodes -OP_LFGCommand=0x457d # -OP_LFGGetMatchesRequest=0x49e7 # -OP_LFGGetMatchesResponse=0x4817 # -OP_LFPGetMatchesRequest=0x5fc7 # -OP_LFPGetMatchesResponse=0x3d0c # -OP_LFPCommand=0x20c6 # -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # - -# Raid Opcodes -OP_RaidInvite=0x550f # -OP_RaidUpdate=0x0000 # Testing VoA 0x0c08 -OP_RaidJoin=0x0000 # - -# Button-push commands -OP_Taunt=0x732c # -OP_CombatAbility=0x16a5 # -OP_SenseTraps=0x416b # -OP_PickPocket=0x13bd # -OP_DisarmTraps=0x0000 # -OP_Disarm=0x6def # -OP_Sneak=0x6eff # -OP_Fishing=0x0555 # -OP_InstillDoubt=0x4acf # -OP_FeignDeath=0x6145 # -OP_Mend=0x7fbc # -OP_LDoNOpen=0x7c87 # - -# Task packets -OP_TaskActivityComplete=0x0000 # -OP_TaskMemberList=0x0000 # -OP_OpenNewTasksWindow=0x0000 # -OP_AvaliableTask=0x0000 # -OP_AcceptNewTask=0x0000 # -OP_TaskHistoryRequest=0x6d1f # -OP_TaskHistoryReply=0x189b # -OP_CancelTask=0x47ea # -OP_DeclineAllTasks=0x0000 # - -# Title opcodes -OP_NewTitlesAvailable=0x6d95 # -OP_RequestTitles=0x7e3d # -OP_SendTitleList=0x3aef # -OP_SetTitle=0x725b # -OP_SetTitleReply=0x38e8 # - -# mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_LFGCommand=0x457d # +OP_LFGGetMatchesRequest=0x49e7 # +OP_LFGGetMatchesResponse=0x4817 # +OP_LFPGetMatchesRequest=0x5fc7 # +OP_LFPGetMatchesResponse=0x3d0c # +OP_LFPCommand=0x20c6 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# Raid Opcodes +OP_RaidInvite=0x550f # +OP_RaidUpdate=0x0000 # Testing VoA 0x0c08 +OP_RaidJoin=0x0000 # + +# Button-push commands +OP_Taunt=0x732c # +OP_CombatAbility=0x16a5 # +OP_SenseTraps=0x416b # +OP_PickPocket=0x13bd # +OP_DisarmTraps=0x0000 # +OP_Disarm=0x6def # +OP_Sneak=0x6eff # +OP_Fishing=0x0555 # +OP_InstillDoubt=0x4acf # +OP_FeignDeath=0x6145 # +OP_Mend=0x7fbc # +OP_LDoNOpen=0x7c87 # + +# Task packets +OP_TaskActivityComplete=0x0000 # +OP_TaskMemberList=0x0000 # +OP_OpenNewTasksWindow=0x0000 # +OP_AvaliableTask=0x0000 # +OP_AcceptNewTask=0x0000 # +OP_TaskHistoryRequest=0x6d1f # +OP_TaskHistoryReply=0x189b # +OP_CancelTask=0x47ea # +OP_DeclineAllTasks=0x0000 # + +# Title opcodes +OP_NewTitlesAvailable=0x6d95 # +OP_RequestTitles=0x7e3d # +OP_SendTitleList=0x3aef # +OP_SetTitle=0x725b # +OP_SetTitleReply=0x38e8 # + +# mail opcodes +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # + +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # - -# discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # + +# discovered opcodes not yet used: +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps #OP_LoginUnknown1=0x46d3 # U OP_SendSpellChecksum #OP_LoginUnknown2=0x040b # U OP_SendSkillCapsChecksum - -# Petition Opcodes + +# Petition Opcodes OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search - -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # - -# Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # - -# raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # + +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # + +# Login opcodes +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # + +# raw opcodes +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_Mar13-2013.conf b/utils/EQExtractor2/EQExtractor2/patch_Mar13-2013.conf index 2f206d4ae..25ff533bb 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Mar13-2013.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Mar13-2013.conf @@ -650,4 +650,4 @@ OP_RAWOutOfSession=0x0000 # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs -OP_InitialHPUpdate=0x0000 +OP_InitialHPUpdate=0x0000 diff --git a/utils/EQExtractor2/EQExtractor2/patch_Mar15-2012.conf b/utils/EQExtractor2/EQExtractor2/patch_Mar15-2012.conf index d8ec8a3ea..23248f238 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Mar15-2012.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Mar15-2012.conf @@ -13,327 +13,327 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: -OP_SendLoginInfo=0x4d5c # -OP_ApproveWorld=0x655c # -OP_LogServer=0x1497 # -OP_SendCharInfo=0x7f9e # -OP_ExpansionInfo=0x2c8f # -OP_GuildsList=0x5b0b # -OP_EnterWorld=0x710e # -OP_PostEnterWorld=0x7930 # -OP_World_Client_CRC1=0x7ce4 # -OP_World_Client_CRC2=0x7705 # -OP_SendSpellChecksum=0x0000 # -OP_SendSkillCapsChecksum=0x0000 # - -# Character Select Related: -OP_DeleteCharacter=0x5ca5 # -OP_CharacterCreateRequest=0x4eba # -OP_CharacterCreate=0x3237 # -OP_RandomNameGenerator=0x26aa # -OP_ApproveName=0x3154 # - -OP_MOTD=0x0b80 # -OP_SetChatServer=0x2c38 # -OP_SetChatServer2=0x441c # -OP_ZoneServerInfo=0x16f5 # -OP_WorldComplete=0x6c63 # -OP_WorldUnknown001=0x4274 # -OP_FloatListThing=0x1910 # - -# Reasons for Disconnect: -OP_ZoneUnavail=0x20bc # +# Required to reach Char Select: +OP_SendLoginInfo=0x4d5c # +OP_ApproveWorld=0x655c # +OP_LogServer=0x1497 # +OP_SendCharInfo=0x7f9e # +OP_ExpansionInfo=0x2c8f # +OP_GuildsList=0x5b0b # +OP_EnterWorld=0x710e # +OP_PostEnterWorld=0x7930 # +OP_World_Client_CRC1=0x7ce4 # +OP_World_Client_CRC2=0x7705 # +OP_SendSpellChecksum=0x0000 # +OP_SendSkillCapsChecksum=0x0000 # + +# Character Select Related: +OP_DeleteCharacter=0x5ca5 # +OP_CharacterCreateRequest=0x4eba # +OP_CharacterCreate=0x3237 # +OP_RandomNameGenerator=0x26aa # +OP_ApproveName=0x3154 # + +OP_MOTD=0x0b80 # +OP_SetChatServer=0x2c38 # +OP_SetChatServer2=0x441c # +OP_ZoneServerInfo=0x16f5 # +OP_WorldComplete=0x6c63 # +OP_WorldUnknown001=0x4274 # +OP_FloatListThing=0x1910 # + +# Reasons for Disconnect: +OP_ZoneUnavail=0x20bc # OP_WorldClientReady=0x0b89 # Testing VoA 0x3f24 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # - -# Zone in opcodes -OP_AckPacket=0x3594 # -OP_ZoneEntry=0x5821 # -OP_ReqNewZone=0x4118 # -OP_NewZone=0x43ac # -OP_ZoneSpawns=0x5f5e # -OP_PlayerProfile=0x6afd # -OP_TimeOfDay=0x6015 # -OP_LevelUpdate=0x6e1c # -OP_Stamina=0x7686 # -OP_RequestClientZoneChange=0x224f # -OP_ZoneChange=0x28c8 # - -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # - -# Required to fully log in -OP_SpawnAppearance=0x3f55 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # + +# Zone in opcodes +OP_AckPacket=0x3594 # +OP_ZoneEntry=0x5821 # +OP_ReqNewZone=0x4118 # +OP_NewZone=0x43ac # +OP_ZoneSpawns=0x5f5e # +OP_PlayerProfile=0x6afd # +OP_TimeOfDay=0x6015 # +OP_LevelUpdate=0x6e1c # +OP_Stamina=0x7686 # +OP_RequestClientZoneChange=0x224f # +OP_ZoneChange=0x28c8 # + +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # + +# Required to fully log in +OP_SpawnAppearance=0x3f55 # OP_ChangeSize=0x0000 # -OP_TributeUpdate=0x0000 # +OP_TributeUpdate=0x0000 # OP_TributeTimer=0x0000 # Testing VoA 0x1525 -OP_TaskDescription=0x2e4f # -OP_TaskActivity=0x512b # -OP_CompletedTasks=0x3141 # -OP_Weather=0x3e50 # +OP_TaskDescription=0x2e4f # +OP_TaskActivity=0x512b # +OP_CompletedTasks=0x3141 # +OP_Weather=0x3e50 # OP_SendAATable=0x6a7e # Testing VoA 0x6a7e OP_UpdateAA=0x5363 # Testing VoA 0x5363 OP_RespondAA=0x7bf6 # Testing VoA 0x0643 or maybe 0x7bf6 -OP_ReqClientSpawn=0x2c27 # -OP_SpawnDoor=0x7113 # -OP_GroundSpawn=0x33e5 # -OP_SendZonepoints=0x399f # -OP_SendAAStats=0x4e22 # -OP_WorldObjectsSent=0x7b73 # -OP_BlockedBuffs=0x1681 # -OP_RemoveBlockedBuffs=0x6a86 # -OP_ClearBlockedBuffs=0x7ae1 # -OP_SendExpZonein=0x0f14 # -OP_SendTributes=0x010d # -OP_TributeInfo=0x047c # -OP_SendGuildTributes=0x0000 # -OP_AAExpUpdate=0x1318 # +OP_ReqClientSpawn=0x2c27 # +OP_SpawnDoor=0x7113 # +OP_GroundSpawn=0x33e5 # +OP_SendZonepoints=0x399f # +OP_SendAAStats=0x4e22 # +OP_WorldObjectsSent=0x7b73 # +OP_BlockedBuffs=0x1681 # +OP_RemoveBlockedBuffs=0x6a86 # +OP_ClearBlockedBuffs=0x7ae1 # +OP_SendExpZonein=0x0f14 # +OP_SendTributes=0x010d # +OP_TributeInfo=0x047c # +OP_SendGuildTributes=0x0000 # +OP_AAExpUpdate=0x1318 # OP_ExpUpdate=0x221a # Testing VoA 0x0555 -OP_HPUpdate=0x2369 # -OP_ManaChange=0x3887 # -OP_TGB=0x3672 # -OP_SpecialMesg=0x039d # -OP_GuildMemberList=0x51bc # +OP_HPUpdate=0x2369 # +OP_ManaChange=0x3887 # +OP_TGB=0x3672 # +OP_SpecialMesg=0x039d # +OP_GuildMemberList=0x51bc # OP_GuildMOTD=0x0a1d # Testing VoA 0x0a1d OP_CharInventory=0x6cfe # Testing VoA 0x6cfe -OP_WearChange=0x1a58 # -OP_ClientUpdate=0x7062 # -OP_ClientReady=0x1272 # -OP_SetServerFilter=0x053a # - -# Guild Opcodes -OP_GetGuildMOTD=0x3415 # -OP_GetGuildMOTDReply=0x709d # -OP_GuildMemberUpdate=0x589f # -OP_GuildInvite=0x5488 # -OP_GuildRemove=0x47d3 # -OP_GuildPeace=0x1d22 # -OP_SetGuildMOTD=0x5f85 # -OP_GuildList=0x0000 # -OP_GuildWar=0x0598 # -OP_GuildLeader=0x67c8 # -OP_GuildDelete=0x230e # -OP_GuildInviteAccept=0x2b5a # -OP_GuildDemote=0x1899 # -OP_GuildPublicNote=0x2dbd # -OP_GuildManageBanker=0x0000 # -OP_GuildBank=0x0000 # -OP_SetGuildRank=0x4ffe # -OP_GuildUpdateURLAndChannel=0x03d1 # -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -OP_GuildStatus=0x6916 # +OP_WearChange=0x1a58 # +OP_ClientUpdate=0x7062 # +OP_ClientReady=0x1272 # +OP_SetServerFilter=0x053a # + +# Guild Opcodes +OP_GetGuildMOTD=0x3415 # +OP_GetGuildMOTDReply=0x709d # +OP_GuildMemberUpdate=0x589f # +OP_GuildInvite=0x5488 # +OP_GuildRemove=0x47d3 # +OP_GuildPeace=0x1d22 # +OP_SetGuildMOTD=0x5f85 # +OP_GuildList=0x0000 # +OP_GuildWar=0x0598 # +OP_GuildLeader=0x67c8 # +OP_GuildDelete=0x230e # +OP_GuildInviteAccept=0x2b5a # +OP_GuildDemote=0x1899 # +OP_GuildPublicNote=0x2dbd # +OP_GuildManageBanker=0x0000 # +OP_GuildBank=0x0000 # +OP_SetGuildRank=0x4ffe # +OP_GuildUpdateURLAndChannel=0x03d1 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +OP_GuildStatus=0x6916 # OP_GuildCreate=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # - -# GM/guide opcodes -OP_GMServers=0x6989 # -OP_GMBecomeNPC=0x7093 # -OP_GMZoneRequest=0x701f # -OP_GMZoneRequest2=0x01 # -OP_GMGoto=0x15a1 # -OP_GMSearchCorpse=0x2bff # -OP_GMHideMe=0x7e4d # -OP_GMDelCorpse=0x072f # -OP_GMApproval=0x481f # -OP_GMToggle=0x2042 # -OP_GMSummon=0x6e47 # -OP_GMEmoteZone=0x307d # -OP_GMEmoteWorld=0x0c2d # -OP_GMFind=0x6e27 # -OP_GMKick=0x5a56 # -OP_GMKill=0x51fe # -OP_GMNameChange=0x0000 # -OP_GMLastName=0x1055 # - -OP_InspectAnswer=0x0c54 # -OP_BeginCast=0x0d5a # -OP_BuffFadeMsg=0x1b8a # -OP_ConsentResponse=0x35c6 # -OP_MemorizeSpell=0x569e # -OP_SwapSpell=0x28a7 # -OP_CastSpell=0x8543 # -OP_Consider=0x70c6 # -OP_FormattedMessage=0x4675 # -OP_SimpleMessage=0x0698 # -OP_Buff=0x4658 # -OP_Illusion=0x10b7 # -OP_MoneyOnCorpse=0x4074 # -OP_RandomReply=0x07fb # -OP_DenyResponse=0x0370 # -OP_SkillUpdate=0x7f01 # -OP_GMTrainSkillConfirm=0x0000 # -OP_RandomReq=0x303e # -OP_Death=0x6685 # -OP_Bind_Wound=0x7b64 # -OP_GMTraining=0x5960 # -OP_GMEndTraining=0x4a61 # -OP_GMTrainSkill=0x4885 # -OP_Animation=0x0b93 # -OP_Begging=0x0ca5 # -OP_Consent=0x6bb9 # -OP_ConsentDeny=0x6b7f # -OP_AutoFire=0x23fc # -OP_PetCommands=0x7312 # -OP_DeleteSpell=0x0142 # -OP_Surname=0x777c # -OP_ClearSurname=0x0000 # -OP_FaceChange=0x0507 # -OP_SenseHeading=0x1dad # -OP_Action=0x1b85 # -OP_ConsiderCorpse=0x0e94 # -OP_HideCorpse=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # + +# GM/guide opcodes +OP_GMServers=0x6989 # +OP_GMBecomeNPC=0x7093 # +OP_GMZoneRequest=0x701f # +OP_GMZoneRequest2=0x01 # +OP_GMGoto=0x15a1 # +OP_GMSearchCorpse=0x2bff # +OP_GMHideMe=0x7e4d # +OP_GMDelCorpse=0x072f # +OP_GMApproval=0x481f # +OP_GMToggle=0x2042 # +OP_GMSummon=0x6e47 # +OP_GMEmoteZone=0x307d # +OP_GMEmoteWorld=0x0c2d # +OP_GMFind=0x6e27 # +OP_GMKick=0x5a56 # +OP_GMKill=0x51fe # +OP_GMNameChange=0x0000 # +OP_GMLastName=0x1055 # + +OP_InspectAnswer=0x0c54 # +OP_BeginCast=0x0d5a # +OP_BuffFadeMsg=0x1b8a # +OP_ConsentResponse=0x35c6 # +OP_MemorizeSpell=0x569e # +OP_SwapSpell=0x28a7 # +OP_CastSpell=0x8543 # +OP_Consider=0x70c6 # +OP_FormattedMessage=0x4675 # +OP_SimpleMessage=0x0698 # +OP_Buff=0x4658 # +OP_Illusion=0x10b7 # +OP_MoneyOnCorpse=0x4074 # +OP_RandomReply=0x07fb # +OP_DenyResponse=0x0370 # +OP_SkillUpdate=0x7f01 # +OP_GMTrainSkillConfirm=0x0000 # +OP_RandomReq=0x303e # +OP_Death=0x6685 # +OP_Bind_Wound=0x7b64 # +OP_GMTraining=0x5960 # +OP_GMEndTraining=0x4a61 # +OP_GMTrainSkill=0x4885 # +OP_Animation=0x0b93 # +OP_Begging=0x0ca5 # +OP_Consent=0x6bb9 # +OP_ConsentDeny=0x6b7f # +OP_AutoFire=0x23fc # +OP_PetCommands=0x7312 # +OP_DeleteSpell=0x0142 # +OP_Surname=0x777c # +OP_ClearSurname=0x0000 # +OP_FaceChange=0x0507 # +OP_SenseHeading=0x1dad # +OP_Action=0x1b85 # +OP_ConsiderCorpse=0x0e94 # +OP_HideCorpse=0x0000 # OP_CorpseDrag=0x0000 # OP_CorpseDrop=0x0000 # -OP_Bug=0x3365 # -OP_Feedback=0x52b5 # -OP_Report=0x211a # -OP_Damage=0x45d6 # -OP_ChannelMessage=0x2e79 # -OP_Assist=0x5658 # -OP_AssistGroup=0x43bc # -OP_MoveCoin=0x1418 # -OP_ZonePlayerToBind=0x2480 # -OP_KeyRing=0x3b85 # -OP_WhoAllRequest=0x177a # -OP_WhoAllResponse=0x15de # -OP_FriendsWho=0x73d6 # -OP_ConfirmDelete=0x604d # -OP_Logout=0x6275 # -OP_Rewind=0x09e3 # -OP_TargetCommand=0x3088 # -OP_InspectRequest=0x2683 # -OP_Hide=0x2913 # -OP_Jump=0x243b # -OP_Camp=0x3cd6 # -OP_Emote=0x0000 # -OP_SetRunMode=0x59c3 # -OP_BankerChange=0x0000 # -OP_TargetMouse=0x3edc # -OP_MobHealth=0x5cb0 # -OP_InitialMobHealth=0x0000 # -OP_TargetHoTT=0x460e # -OP_TargetBuffs=0x7c24 # -OP_BuffCreate=0x0c98 # -OP_BuffRemoveRequest=0x3567 -OP_DeleteSpawn=0x3164 # -OP_AutoAttack=0x2257 # -OP_AutoAttack2=0x0000 # -OP_Consume=0x2ee2 # -OP_MoveItem=0x2963 # -OP_DeleteItem=0x7547 # -OP_DeleteCharge=0x6a90 # -OP_ItemPacket=0x2dd3 # -OP_ItemLinkResponse=0x6948 # -OP_ItemLinkClick=0x3c66 # -OP_NewSpawn=0x016c # -OP_Track=0x2444 # -OP_TrackTarget=0x538f # -OP_TrackUnknown=0x10fa # -OP_ClickDoor=0x48f9 # -OP_MoveDoor=0x231f # -OP_RemoveAllDoors=0x24a3 # -OP_EnvDamage=0x2730 # -OP_BoardBoat=0x50c2 # -OP_Forage=0x3c02 # -OP_LeaveBoat=0x569a # -OP_ControlBoat=0x2641 # -OP_SafeFallSuccess=0x1dc6 # -OP_RezzComplete=0x7108 # -OP_RezzRequest=0x66c5 # -OP_RezzAnswer=0x71eb # -OP_Shielding=0x7598 # -OP_RequestDuel=0x0e71 # -OP_MobRename=0x6884 # -OP_AugmentItem=0x4cc6 # -OP_WeaponEquip1=0x11bc # -OP_WeaponEquip2=0x2121 # -OP_WeaponUnequip2=0x7b87 # -OP_ApplyPoison=0x3582 # -OP_Save=0x47e7 # -OP_TestBuff=0x712b # -OP_CustomTitles=0x6ade # -OP_Split=0x3a18 # -OP_YellForHelp=0x1f87 # -OP_LoadSpellSet=0x440f # -OP_Bandolier=0x3ad1 # -OP_PotionBelt=0x7b7f # -OP_DuelResponse=0x1df9 # -OP_DuelResponse2=0x36f8 # -OP_SaveOnZoneReq=0x5408 # -OP_ReadBook=0x41b5 # -OP_Dye=0x32c6 # -OP_InterruptCast=0x7706 # -OP_AAAction=0x55dd # -OP_LeadershipExpToggle=0x69d0 # -OP_LeadershipExpUpdate=0x3703 # -OP_PurchaseLeadershipAA=0x6e58 # -OP_UpdateLeadershipAA=0x0297 # -OP_MarkNPC=0x6b9e # -OP_ClearNPCMarks=0x074f # -OP_DoGroupLeadershipAbility=0x0000 # -OP_GroupLeadershipAAUpdate=0x0000 # -OP_DelegateAbility=0x105b # -OP_SetGroupTarget=0x42c7 # -OP_Charm=0x17f7 # -OP_Stun=0x41a6 # -OP_SendFindableNPCs=0x3015 # -OP_FindPersonRequest=0x19a8 # -OP_FindPersonReply=0x7e45 # -OP_Sound=0x2d1d # -OP_PetBuffWindow=0x4895 # -OP_LevelAppearance=0x78b9 # -OP_Translocate=0x42ef # -OP_Sacrifice=0x2dc6 # -OP_PopupResponse=0x0000 # -OP_OnLevelMessage=0x0000 # -OP_AugmentInfo=0x0000 # -OP_Petition=0x31d1 # -OP_SomeItemPacketMaybe=0x1513 # -OP_PVPStats=0x0000 # -OP_PVPLeaderBoardRequest=0x0000 # -OP_PVPLeaderBoardReply=0x0000 # -OP_PVPLeaderBoardDetailsRequest=0x0000 # -OP_PVPLeaderBoardDetailsReply=0x0000 # -OP_RestState=0x0000 # -OP_RespawnWindow=0x435b # -OP_DisciplineTimer=0x74ca # -OP_LDoNButton=0x597d # -OP_SetStartCity=0x179d # -OP_VoiceMacroIn=0x0fce # -OP_VoiceMacroOut=0x1c36 # -OP_ItemViewUnknown=0x0000 # -OP_VetRewardsAvaliable=0x3637 # -OP_VetClaimRequest=0x032b # -OP_VetClaimReply=0x7b6e # -OP_CrystalCountUpdate=0x0000 # -OP_DisciplineUpdate=0x0d8d # -OP_BecomeCorpse=0x0000 # -OP_Action2=0x0000 # -OP_MobUpdate=0x4656 # +OP_Bug=0x3365 # +OP_Feedback=0x52b5 # +OP_Report=0x211a # +OP_Damage=0x45d6 # +OP_ChannelMessage=0x2e79 # +OP_Assist=0x5658 # +OP_AssistGroup=0x43bc # +OP_MoveCoin=0x1418 # +OP_ZonePlayerToBind=0x2480 # +OP_KeyRing=0x3b85 # +OP_WhoAllRequest=0x177a # +OP_WhoAllResponse=0x15de # +OP_FriendsWho=0x73d6 # +OP_ConfirmDelete=0x604d # +OP_Logout=0x6275 # +OP_Rewind=0x09e3 # +OP_TargetCommand=0x3088 # +OP_InspectRequest=0x2683 # +OP_Hide=0x2913 # +OP_Jump=0x243b # +OP_Camp=0x3cd6 # +OP_Emote=0x0000 # +OP_SetRunMode=0x59c3 # +OP_BankerChange=0x0000 # +OP_TargetMouse=0x3edc # +OP_MobHealth=0x5cb0 # +OP_InitialMobHealth=0x0000 # +OP_TargetHoTT=0x460e # +OP_TargetBuffs=0x7c24 # +OP_BuffCreate=0x0c98 # +OP_BuffRemoveRequest=0x3567 +OP_DeleteSpawn=0x3164 # +OP_AutoAttack=0x2257 # +OP_AutoAttack2=0x0000 # +OP_Consume=0x2ee2 # +OP_MoveItem=0x2963 # +OP_DeleteItem=0x7547 # +OP_DeleteCharge=0x6a90 # +OP_ItemPacket=0x2dd3 # +OP_ItemLinkResponse=0x6948 # +OP_ItemLinkClick=0x3c66 # +OP_NewSpawn=0x016c # +OP_Track=0x2444 # +OP_TrackTarget=0x538f # +OP_TrackUnknown=0x10fa # +OP_ClickDoor=0x48f9 # +OP_MoveDoor=0x231f # +OP_RemoveAllDoors=0x24a3 # +OP_EnvDamage=0x2730 # +OP_BoardBoat=0x50c2 # +OP_Forage=0x3c02 # +OP_LeaveBoat=0x569a # +OP_ControlBoat=0x2641 # +OP_SafeFallSuccess=0x1dc6 # +OP_RezzComplete=0x7108 # +OP_RezzRequest=0x66c5 # +OP_RezzAnswer=0x71eb # +OP_Shielding=0x7598 # +OP_RequestDuel=0x0e71 # +OP_MobRename=0x6884 # +OP_AugmentItem=0x4cc6 # +OP_WeaponEquip1=0x11bc # +OP_WeaponEquip2=0x2121 # +OP_WeaponUnequip2=0x7b87 # +OP_ApplyPoison=0x3582 # +OP_Save=0x47e7 # +OP_TestBuff=0x712b # +OP_CustomTitles=0x6ade # +OP_Split=0x3a18 # +OP_YellForHelp=0x1f87 # +OP_LoadSpellSet=0x440f # +OP_Bandolier=0x3ad1 # +OP_PotionBelt=0x7b7f # +OP_DuelResponse=0x1df9 # +OP_DuelResponse2=0x36f8 # +OP_SaveOnZoneReq=0x5408 # +OP_ReadBook=0x41b5 # +OP_Dye=0x32c6 # +OP_InterruptCast=0x7706 # +OP_AAAction=0x55dd # +OP_LeadershipExpToggle=0x69d0 # +OP_LeadershipExpUpdate=0x3703 # +OP_PurchaseLeadershipAA=0x6e58 # +OP_UpdateLeadershipAA=0x0297 # +OP_MarkNPC=0x6b9e # +OP_ClearNPCMarks=0x074f # +OP_DoGroupLeadershipAbility=0x0000 # +OP_GroupLeadershipAAUpdate=0x0000 # +OP_DelegateAbility=0x105b # +OP_SetGroupTarget=0x42c7 # +OP_Charm=0x17f7 # +OP_Stun=0x41a6 # +OP_SendFindableNPCs=0x3015 # +OP_FindPersonRequest=0x19a8 # +OP_FindPersonReply=0x7e45 # +OP_Sound=0x2d1d # +OP_PetBuffWindow=0x4895 # +OP_LevelAppearance=0x78b9 # +OP_Translocate=0x42ef # +OP_Sacrifice=0x2dc6 # +OP_PopupResponse=0x0000 # +OP_OnLevelMessage=0x0000 # +OP_AugmentInfo=0x0000 # +OP_Petition=0x31d1 # +OP_SomeItemPacketMaybe=0x1513 # +OP_PVPStats=0x0000 # +OP_PVPLeaderBoardRequest=0x0000 # +OP_PVPLeaderBoardReply=0x0000 # +OP_PVPLeaderBoardDetailsRequest=0x0000 # +OP_PVPLeaderBoardDetailsReply=0x0000 # +OP_RestState=0x0000 # +OP_RespawnWindow=0x435b # +OP_DisciplineTimer=0x74ca # +OP_LDoNButton=0x597d # +OP_SetStartCity=0x179d # +OP_VoiceMacroIn=0x0fce # +OP_VoiceMacroOut=0x1c36 # +OP_ItemViewUnknown=0x0000 # +OP_VetRewardsAvaliable=0x3637 # +OP_VetClaimRequest=0x032b # +OP_VetClaimReply=0x7b6e # +OP_CrystalCountUpdate=0x0000 # +OP_DisciplineUpdate=0x0d8d # +OP_BecomeCorpse=0x0000 # +OP_Action2=0x0000 # +OP_MobUpdate=0x4656 # OP_NPCMoveUpdate=0x2339 # -OP_CameraEffect=0x6812 # -OP_SpellEffect=0x0989 # -OP_RemoveNimbusEffect=0x0000 # +OP_CameraEffect=0x6812 # +OP_SpellEffect=0x0989 # +OP_RemoveNimbusEffect=0x0000 # OP_AltCurrency=0x2536 OP_AltCurrencyMerchantRequest=0x5aac OP_AltCurrencyMerchantReply=0x17c7 @@ -365,266 +365,266 @@ OP_DzCompass=0x0000 OP_DzChooseZone=0x0000 # New Opcodes -OP_SpawnPositionUpdate=0x0000 # -OP_ManaUpdate=0x7c94 # -OP_EnduranceUpdate=0x5851 # -OP_MobManaUpdate=0x4d27 # -OP_MobEnduranceUpdate=0x190c # - -# Looting -OP_LootRequest=0x1d85 # -OP_EndLootRequest=0x0bc # -OP_LootItem=0x5bd9 # -OP_LootComplete=0x4ca1 # - -# bazaar trader stuff stuff: -OP_BazaarSearch=0x2881 # -OP_TraderDelItem=0x0000 # -OP_BecomeTrader=0x358a # -OP_TraderShop=0x49f4 # -OP_Trader=0x058c # -OP_TraderBuy=0x783c # -OP_Barter=0x766f # -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # - -# pc/npc trading -OP_TradeRequest=0x0c24 # -OP_TradeAcceptClick=0x064a # -OP_TradeRequestAck=0x606a # -OP_TradeCoins=0x0149 # -OP_FinishTrade=0x3ff6 # -OP_CancelTrade=0x527e # -OP_TradeMoneyUpdate=0x1ebb # -OP_MoneyUpdate=0x528f # -OP_TradeBusy=0x2c03 # +OP_SpawnPositionUpdate=0x0000 # +OP_ManaUpdate=0x7c94 # +OP_EnduranceUpdate=0x5851 # +OP_MobManaUpdate=0x4d27 # +OP_MobEnduranceUpdate=0x190c # + +# Looting +OP_LootRequest=0x1d85 # +OP_EndLootRequest=0x0bc # +OP_LootItem=0x5bd9 # +OP_LootComplete=0x4ca1 # + +# bazaar trader stuff stuff: +OP_BazaarSearch=0x2881 # +OP_TraderDelItem=0x0000 # +OP_BecomeTrader=0x358a # +OP_TraderShop=0x49f4 # +OP_Trader=0x058c # +OP_TraderBuy=0x783c # +OP_Barter=0x766f # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # + +# pc/npc trading +OP_TradeRequest=0x0c24 # +OP_TradeAcceptClick=0x064a # +OP_TradeRequestAck=0x606a # +OP_TradeCoins=0x0149 # +OP_FinishTrade=0x3ff6 # +OP_CancelTrade=0x527e # +OP_TradeMoneyUpdate=0x1ebb # +OP_MoneyUpdate=0x528f # +OP_TradeBusy=0x2c03 # # Sent after canceling trade or after closing tradeskill object -OP_FinishWindow=0x3c27 # -OP_FinishWindow2=0x2c6d # +OP_FinishWindow=0x3c27 # +OP_FinishWindow2=0x2c6d # # Sent on Live for what seems to be item existance verification # Ex. Before Right Click Effect happens from items -OP_ItemVerifyRequest=0x0000 # -OP_ItemVerifyReply=0x0000 # +OP_ItemVerifyRequest=0x0000 # +OP_ItemVerifyReply=0x0000 # # merchant crap -OP_ShopPlayerSell=0x0b27 # -OP_ShopRequest=0x4194 # -OP_ShopEnd=0x078e # -OP_ShopEndConfirm=0x4762 # -OP_ShopPlayerBuy=0x436a # -OP_ShopDelItem=0x537c # - -# tradeskill stuff: -OP_ClickObject=0x5f0d # -OP_ClickObjectAction=0x29df # -OP_ClearObject=0x38d1 # -OP_RecipeDetails=0x068 # -OP_RecipesFavorite=0x0000 # -OP_RecipesSearch=0x0239 # -OP_RecipeReply=0x1ecf # -OP_RecipeAutoCombine=0x66bf # -OP_TradeSkillCombine=0x4212 # - -# Tribute Packets: -OP_OpenGuildTributeMaster=0x0000 # -OP_OpenTributeMaster=0x3ba3 # -OP_SelectTribute=0x314f # -OP_TributeItem=0x0000 # -OP_TributeMoney=0x1772 # -OP_TributeToggle=0x0000 # -OP_TributePointUpdate=0x0000 # -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # - -# Adventure packets: -OP_LeaveAdventure=0x771f # -OP_AdventureFinish=0x3168 # -OP_AdventureInfoRequest=0x05d8 # -OP_AdventureInfo=0x164b # -OP_AdventureRequest=0x3a75 # -OP_AdventureDetails=0x05 # -OP_AdventureData=0x21df # -OP_AdventureUpdate=0x6129 # -OP_AdventureMerchantRequest=0x0000 # -OP_AdventureMerchantResponse=0x0000 # -OP_AdventureMerchantPurchase=0x0000 # -OP_AdventureMerchantSell=0x0000 # -OP_AdventurePointsUpdate=0x7d05 # -OP_AdventureStatsRequest=0x0000 # -OP_AdventureStatsReply=0x15a7 # -OP_AdventureLeaderboardRequest=0x0000 # -OP_AdventureLeaderboardReply=0x6bfb # +OP_ShopPlayerSell=0x0b27 # +OP_ShopRequest=0x4194 # +OP_ShopEnd=0x078e # +OP_ShopEndConfirm=0x4762 # +OP_ShopPlayerBuy=0x436a # +OP_ShopDelItem=0x537c # + +# tradeskill stuff: +OP_ClickObject=0x5f0d # +OP_ClickObjectAction=0x29df # +OP_ClearObject=0x38d1 # +OP_RecipeDetails=0x068 # +OP_RecipesFavorite=0x0000 # +OP_RecipesSearch=0x0239 # +OP_RecipeReply=0x1ecf # +OP_RecipeAutoCombine=0x66bf # +OP_TradeSkillCombine=0x4212 # + +# Tribute Packets: +OP_OpenGuildTributeMaster=0x0000 # +OP_OpenTributeMaster=0x3ba3 # +OP_SelectTribute=0x314f # +OP_TributeItem=0x0000 # +OP_TributeMoney=0x1772 # +OP_TributeToggle=0x0000 # +OP_TributePointUpdate=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # + +# Adventure packets: +OP_LeaveAdventure=0x771f # +OP_AdventureFinish=0x3168 # +OP_AdventureInfoRequest=0x05d8 # +OP_AdventureInfo=0x164b # +OP_AdventureRequest=0x3a75 # +OP_AdventureDetails=0x05 # +OP_AdventureData=0x21df # +OP_AdventureUpdate=0x6129 # +OP_AdventureMerchantRequest=0x0000 # +OP_AdventureMerchantResponse=0x0000 # +OP_AdventureMerchantPurchase=0x0000 # +OP_AdventureMerchantSell=0x0000 # +OP_AdventurePointsUpdate=0x7d05 # +OP_AdventureStatsRequest=0x0000 # +OP_AdventureStatsReply=0x15a7 # +OP_AdventureLeaderboardRequest=0x0000 # +OP_AdventureLeaderboardReply=0x6bfb # # Group Opcodes -OP_GroupDisband=0x4200 # -OP_GroupInvite=0x3288 # -OP_GroupFollow=0x1190 # -OP_GroupUpdate=0x0000 # -OP_GroupUpdateB=0x0000 # -OP_GroupCancelInvite=0x0000 # -OP_GroupAcknowledge=0x0000 # -OP_GroupDelete=0x0000 # -OP_CancelInvite=0x132f # -OP_GroupFollow2=0x3519 # -OP_GroupInvite2=0x083b # -OP_GroupDisbandYou=0x0000 # -OP_GroupDisbandOther=0x0000 # -OP_GroupLeaderChange=0x0000 # -OP_GroupRoles=0x0000 # +OP_GroupDisband=0x4200 # +OP_GroupInvite=0x3288 # +OP_GroupFollow=0x1190 # +OP_GroupUpdate=0x0000 # +OP_GroupUpdateB=0x0000 # +OP_GroupCancelInvite=0x0000 # +OP_GroupAcknowledge=0x0000 # +OP_GroupDelete=0x0000 # +OP_CancelInvite=0x132f # +OP_GroupFollow2=0x3519 # +OP_GroupInvite2=0x083b # +OP_GroupDisbandYou=0x0000 # +OP_GroupDisbandOther=0x0000 # +OP_GroupLeaderChange=0x0000 # +OP_GroupRoles=0x0000 # OP_GroupMakeLeader=0x13da # LFG/LFP Opcodes -OP_LFGCommand=0x457d # -OP_LFGGetMatchesRequest=0x49e7 # -OP_LFGGetMatchesResponse=0x4817 # -OP_LFPGetMatchesRequest=0x5fc7 # -OP_LFPGetMatchesResponse=0x3d0c # -OP_LFPCommand=0x20c6 # -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # - -# Raid Opcodes -OP_RaidInvite=0x550f # -OP_RaidUpdate=0x0000 # Testing VoA 0x0c08 -OP_RaidJoin=0x0000 # - -# Button-push commands -OP_Taunt=0x732c # -OP_CombatAbility=0x16a5 # -OP_SenseTraps=0x416b # -OP_PickPocket=0x13bd # -OP_DisarmTraps=0x0000 # -OP_Disarm=0x6def # -OP_Sneak=0x6eff # -OP_Fishing=0x0555 # -OP_InstillDoubt=0x4acf # -OP_FeignDeath=0x6145 # -OP_Mend=0x7fbc # -OP_LDoNOpen=0x7c87 # - -# Task packets -OP_TaskActivityComplete=0x0000 # -OP_TaskMemberList=0x0000 # -OP_OpenNewTasksWindow=0x0000 # -OP_AvaliableTask=0x0000 # -OP_AcceptNewTask=0x0000 # -OP_TaskHistoryRequest=0x6d1f # -OP_TaskHistoryReply=0x189b # -OP_CancelTask=0x47ea # -OP_DeclineAllTasks=0x0000 # - -# Title opcodes -OP_NewTitlesAvailable=0x6d95 # -OP_RequestTitles=0x7e3d # -OP_SendTitleList=0x3aef # -OP_SetTitle=0x725b # -OP_SetTitleReply=0x38e8 # - -# mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_LFGCommand=0x457d # +OP_LFGGetMatchesRequest=0x49e7 # +OP_LFGGetMatchesResponse=0x4817 # +OP_LFPGetMatchesRequest=0x5fc7 # +OP_LFPGetMatchesResponse=0x3d0c # +OP_LFPCommand=0x20c6 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# Raid Opcodes +OP_RaidInvite=0x550f # +OP_RaidUpdate=0x0000 # Testing VoA 0x0c08 +OP_RaidJoin=0x0000 # + +# Button-push commands +OP_Taunt=0x732c # +OP_CombatAbility=0x16a5 # +OP_SenseTraps=0x416b # +OP_PickPocket=0x13bd # +OP_DisarmTraps=0x0000 # +OP_Disarm=0x6def # +OP_Sneak=0x6eff # +OP_Fishing=0x0555 # +OP_InstillDoubt=0x4acf # +OP_FeignDeath=0x6145 # +OP_Mend=0x7fbc # +OP_LDoNOpen=0x7c87 # + +# Task packets +OP_TaskActivityComplete=0x0000 # +OP_TaskMemberList=0x0000 # +OP_OpenNewTasksWindow=0x0000 # +OP_AvaliableTask=0x0000 # +OP_AcceptNewTask=0x0000 # +OP_TaskHistoryRequest=0x6d1f # +OP_TaskHistoryReply=0x189b # +OP_CancelTask=0x47ea # +OP_DeclineAllTasks=0x0000 # + +# Title opcodes +OP_NewTitlesAvailable=0x6d95 # +OP_RequestTitles=0x7e3d # +OP_SendTitleList=0x3aef # +OP_SetTitle=0x725b # +OP_SetTitleReply=0x38e8 # + +# mail opcodes +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # + +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # - -# discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # + +# discovered opcodes not yet used: +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps #OP_LoginUnknown1=0x46d3 # U OP_SendSpellChecksum #OP_LoginUnknown2=0x040b # U OP_SendSkillCapsChecksum - -# Petition Opcodes + +# Petition Opcodes OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search - -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # - -# Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # - -# raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # + +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # + +# Login opcodes +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # + +# raw opcodes +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_March15-2011.conf b/utils/EQExtractor2/EQExtractor2/patch_March15-2011.conf index b065333b0..b693f0619 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_March15-2011.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_March15-2011.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x6893 # was 0x2683 OP_ApproveWorld=0x115a # was 0x28a7 OP_LogServer=0x701f # was 0x224f @@ -49,15 +49,15 @@ OP_FloatListThing=0x0000 # V # Reasons for Disconnect: OP_ZoneUnavail=0x0000 # C 0x0000 OP_WorldClientReady=0x399b # C 0x0000 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # was 0x3594 @@ -71,11 +71,11 @@ OP_LevelUpdate=0x0000 # V OP_Stamina=0x0000 # V OP_RequestClientZoneChange=0x3fd2 # was 0x4178 OP_ZoneChange=0x0b93 # was 0x4a61 -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x7b64 # V @@ -86,13 +86,13 @@ OP_TaskActivity=0x0000 # C OP_CompletedTasks=0x0000 # C 0x0000 OP_Weather=0x7ce4 # was 0x0ed5 OP_SendAATable=0x1b26 # -OP_UpdateAA=0x0000 # V +OP_UpdateAA=0x0000 # V OP_RespondAA=0x0000 # C 0x0000 OP_ReqClientSpawn=0x54e8 # was 0x6618 OP_SpawnDoor=0x4849 # OP_GroundSpawn=0x5f0d # was 0x5f0d OP_SendZonepoints=0x5f51 # was 0x0ff4 -OP_SendAAStats=0x0000 # C +OP_SendAAStats=0x0000 # C OP_WorldObjectsSent=0x7b73 # was 0x7b73 OP_BlockedBuffs=0x664a # was 0x4027 OP_SendExpZonein=0x2c27 # was 0x1436 @@ -132,12 +132,12 @@ OP_GuildManageBanker=0x0000 # C OP_GuildBank=0x0000 # C OP_SetGuildRank=0x0000 # C OP_GuildUpdateURLAndChannel=0x0000 # C -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x0000 # C @@ -317,8 +317,8 @@ OP_VetRewardsAvaliable=0x0000 # C Mispelled? OP_VetClaimRequest=0x0000 # C OP_VetClaimReply=0x0000 # C OP_CrystalCountUpdate=0x0000 # C -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # C OP_Damage? OP_MobUpdate=0x4656 # was 0x4656 OP_NPCMoveUpdate=0x3278 # @@ -349,7 +349,7 @@ OP_ManaUpdate=0x0000 # C OP_EnduranceUpdate=0x0000 # C OP_MobManaUpdate=0x0000 # C OP_MobEnduranceUpdate=0x0000 # C - + # Looting OP_LootRequest=0x0000 # C OP_EndLootRequest=0x0000 # C @@ -364,10 +364,10 @@ OP_TraderShop=0x0000 # C OP_Trader=0x0000 # C OP_TraderBuy=0x0000 # C OP_Barter=0x0000 # C -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x0000 # C @@ -416,10 +416,10 @@ OP_TributeItem=0x0000 # C OP_TributeMoney=0x0000 # C OP_TributeToggle=0x0000 # C OP_TributePointUpdate=0x0000 # C -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x0000 # C @@ -444,11 +444,11 @@ OP_AdventureLeaderboardReply=0x0000 # C OP_GroupDisband=0x0000 # C OP_GroupInvite=0x0000 # C OP_GroupFollow=0x0000 # C -OP_GroupUpdate=0x0000 # C -OP_GroupUpdateB=0x0000 # C +OP_GroupUpdate=0x0000 # C +OP_GroupUpdateB=0x0000 # C OP_GroupCancelInvite=0x0000 # C - Same as OP_CancelInvite? OP_GroupAcknowledge=0x0000 # C -OP_GroupDelete=0x0000 # +OP_GroupDelete=0x0000 # OP_CancelInvite=0x0000 # C OP_GroupFollow2=0x0000 # C OP_GroupInvite2=0x0000 # C @@ -464,20 +464,20 @@ OP_LFGGetMatchesResponse=0x0000 # C OP_LFPGetMatchesRequest=0x0000 # C OP_LFPGetMatchesResponse=0x0000 # C OP_LFPCommand=0x0000 # C -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x0000 # C OP_RaidUpdate=0x0000 # C -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x0000 # C OP_CombatAbility=0x0000 # C OP_SenseTraps=0x0000 # C OP_PickPocket=0x0000 # C -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x0000 # C OP_Sneak=0x0000 # C OP_Fishing=0x0000 # C @@ -495,7 +495,7 @@ OP_AcceptNewTask=0x0000 # C OP_TaskHistoryRequest=0x0000 # C OP_TaskHistoryReply=0x0000 # C OP_CancelTask=0x0000 # C -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x0000 # C @@ -505,53 +505,53 @@ OP_SetTitle=0x0000 # C OP_SetTitleReply=0x0000 # C # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -563,47 +563,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_May12-2010.conf b/utils/EQExtractor2/EQExtractor2/patch_May12-2010.conf index 17ba0744b..dacd2248f 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_May12-2010.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_May12-2010.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x13da # V OP_ApproveWorld=0x86c7 # C OP_LogServer=0x6f79 # C @@ -49,15 +49,15 @@ OP_FloatListThing=0x61ba # V # Reasons for Disconnect: OP_ZoneUnavail=0x3288 # C 0x1190 OP_WorldClientReady=0x7d05 # C 0x4786 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # V @@ -72,11 +72,11 @@ OP_Stamina=0x3d86 # V OP_RequestClientZoneChange=0x18ea # C OP_ZoneChange=0x6d37 # C -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x3e17 # V @@ -86,14 +86,14 @@ OP_TaskDescription=0x156c # C OP_TaskActivity=0x31f3 # C OP_CompletedTasks=0x82d7 # C 0x6d27 OP_Weather=0x4658 # V -OP_SendAATable=0x6ef9 # V -OP_UpdateAA=0x7bf6 # V +OP_SendAATable=0x6ef9 # V +OP_UpdateAA=0x7bf6 # V OP_RespondAA=0x1fbd # C 0x2bad OP_ReqClientSpawn=0x69cd # V OP_SpawnDoor=0x6f2b # V OP_GroundSpawn=0x5c85 # V OP_SendZonepoints=0x2370 # V -OP_SendAAStats=0x78b9 # C +OP_SendAAStats=0x78b9 # C OP_WorldObjectsSent=0x7b73 # V OP_BlockedBuffs=0x05d5 # V OP_SendExpZonein=0x47e7 # V @@ -133,12 +133,12 @@ OP_GuildManageBanker=0x1e4c # C OP_GuildBank=0x0d8a # C OP_SetGuildRank=0x4ffe # C OP_GuildUpdateURLAndChannel=0x5232 # C -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x6989 # C @@ -317,8 +317,8 @@ OP_VetRewardsAvaliable=0x0baa # C Mispelled? OP_VetClaimRequest=0x34f8 # C OP_VetClaimReply=0x6a5d # C OP_CrystalCountUpdate=0x3fc8 # C -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # C OP_Damage? OP_MobUpdate=0x4656 # Same as OP_SpawnPositionUpdate OP_NPCMoveUpdate=0x0f3e # @@ -349,7 +349,7 @@ OP_ManaUpdate=0x0433 # C OP_EnduranceUpdate=0x6b76 # C OP_MobManaUpdate=0x7901 # C OP_MobEnduranceUpdate=0x6c5f # C - + # Looting OP_LootRequest=0x6ad7 # C OP_EndLootRequest=0x6546 # C @@ -364,10 +364,10 @@ OP_TraderShop=0x2881 # C OP_Trader=0x0c08 # C OP_TraderBuy=0x3672 # C OP_Barter=0x6db5 # C -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x7113 # C @@ -416,10 +416,10 @@ OP_TributeItem=0x0b89 # C OP_TributeMoney=0x314f # C OP_TributeToggle=0x6dc3 # C OP_TributePointUpdate=0x15a7 # C -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x3ed4 # C @@ -444,11 +444,11 @@ OP_AdventureLeaderboardReply=0x4423 # C OP_GroupDisband=0x54e8 # C OP_GroupInvite=0x4f60 # C OP_GroupFollow=0x7f2b # C -OP_GroupUpdate=0x5331 # C -OP_GroupUpdateB=0x0786 # C +OP_GroupUpdate=0x5331 # C +OP_GroupUpdateB=0x0786 # C OP_GroupCancelInvite=0x2736 # C - Same as OP_CancelInvite? OP_GroupAcknowledge=0x3e22 # C -OP_GroupDelete=0x58e6 # +OP_GroupDelete=0x58e6 # OP_CancelInvite=0x2736 # C OP_GroupFollow2=0x6c16 # C OP_GroupInvite2=0x5251 # C @@ -464,20 +464,20 @@ OP_LFGGetMatchesResponse=0x7a16 # C OP_LFPGetMatchesRequest=0x189e # C OP_LFPGetMatchesResponse=0x589f # C OP_LFPCommand=0x7429 # C -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x60b5 # C OP_RaidUpdate=0x4d8b # C -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x30e2 # C OP_CombatAbility=0x36f8 # C OP_SenseTraps=0x7e45 # C OP_PickPocket=0x5821 # C -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x6def # C OP_Sneak=0x1d22 # C OP_Fishing=0x7093 # C @@ -495,7 +495,7 @@ OP_AcceptNewTask=0x17d5 # C OP_TaskHistoryRequest=0x547c # C OP_TaskHistoryReply=0x4524 # C OP_CancelTask=0x3bf5 # C -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x4b49 # C @@ -505,53 +505,53 @@ OP_SetTitle=0x675c # C OP_SetTitleReply=0x75f5 # C # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -563,49 +563,49 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0001 # -OP_Login=0x0002 # -OP_ServerListRequest=0x0004 # -OP_PlayEverquestRequest=0x000d # -OP_PlayEverquestResponse=0x0021 # -OP_ChatMessage=0x0016 # -OP_LoginAccepted=0x0017 # -OP_ServerListResponse=0x0018 # -OP_Poll=0x0029 # -OP_EnterChat=0x000f # -OP_PollResponse=0x0011 # +OP_SessionReady=0x0001 # +OP_Login=0x0002 # +OP_ServerListRequest=0x0004 # +OP_PlayEverquestRequest=0x000d # +OP_PlayEverquestResponse=0x0021 # +OP_ChatMessage=0x0016 # +OP_LoginAccepted=0x0017 # +OP_ServerListResponse=0x0018 # +OP_Poll=0x0029 # +OP_EnterChat=0x000f # +OP_PollResponse=0x0011 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_May12-2011.conf b/utils/EQExtractor2/EQExtractor2/patch_May12-2011.conf index fb5949d88..572967ead 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_May12-2011.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_May12-2011.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x6893 # was 0x2683 OP_ApproveWorld=0x115a # was 0x28a7 OP_LogServer=0x701f # was 0x224f @@ -49,15 +49,15 @@ OP_FloatListThing=0x0000 # V # Reasons for Disconnect: OP_ZoneUnavail=0x0000 # C 0x0000 OP_WorldClientReady=0x399b # C 0x0000 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # was 0x3594 @@ -71,11 +71,11 @@ OP_LevelUpdate=0x0000 # V OP_Stamina=0x0000 # V OP_RequestClientZoneChange=0x3fd2 # was 0x4178 OP_ZoneChange=0x0b93 # was 0x4a61 -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x7b64 # V @@ -86,13 +86,13 @@ OP_TaskActivity=0x0000 # C OP_CompletedTasks=0x0000 # C 0x0000 OP_Weather=0x7ce4 # was 0x0ed5 OP_SendAATable=0x1d99 # -OP_UpdateAA=0x0000 # V +OP_UpdateAA=0x0000 # V OP_RespondAA=0x0000 # C 0x0000 OP_ReqClientSpawn=0x54e8 # was 0x6618 OP_SpawnDoor=0x6cfe # OP_GroundSpawn=0x442a # was 0x5f0d OP_SendZonepoints=0x5851 # was 0x0ff4 -OP_SendAAStats=0x0000 # C +OP_SendAAStats=0x0000 # C OP_WorldObjectsSent=0x7b73 # was 0x7b73 OP_BlockedBuffs=0x664a # was 0x4027 OP_SendExpZonein=0x2c27 # was 0x1436 @@ -132,12 +132,12 @@ OP_GuildManageBanker=0x0000 # C OP_GuildBank=0x0000 # C OP_SetGuildRank=0x0000 # C OP_GuildUpdateURLAndChannel=0x0000 # C -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x0000 # C @@ -317,8 +317,8 @@ OP_VetRewardsAvaliable=0x0000 # C Mispelled? OP_VetClaimRequest=0x0000 # C OP_VetClaimReply=0x0000 # C OP_CrystalCountUpdate=0x0000 # C -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # C OP_Damage? OP_MobUpdate=0x4656 # was 0x4656 OP_NPCMoveUpdate=0x38e0 # @@ -349,7 +349,7 @@ OP_ManaUpdate=0x0000 # C OP_EnduranceUpdate=0x0000 # C OP_MobManaUpdate=0x0000 # C OP_MobEnduranceUpdate=0x0000 # C - + # Looting OP_LootRequest=0x0000 # C OP_EndLootRequest=0x0000 # C @@ -364,10 +364,10 @@ OP_TraderShop=0x0000 # C OP_Trader=0x0000 # C OP_TraderBuy=0x0000 # C OP_Barter=0x0000 # C -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x0000 # C @@ -416,10 +416,10 @@ OP_TributeItem=0x0000 # C OP_TributeMoney=0x0000 # C OP_TributeToggle=0x0000 # C OP_TributePointUpdate=0x0000 # C -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x0000 # C @@ -444,11 +444,11 @@ OP_AdventureLeaderboardReply=0x0000 # C OP_GroupDisband=0x0000 # C OP_GroupInvite=0x0000 # C OP_GroupFollow=0x0000 # C -OP_GroupUpdate=0x0000 # C -OP_GroupUpdateB=0x0000 # C +OP_GroupUpdate=0x0000 # C +OP_GroupUpdateB=0x0000 # C OP_GroupCancelInvite=0x0000 # C - Same as OP_CancelInvite? OP_GroupAcknowledge=0x0000 # C -OP_GroupDelete=0x0000 # +OP_GroupDelete=0x0000 # OP_CancelInvite=0x0000 # C OP_GroupFollow2=0x0000 # C OP_GroupInvite2=0x0000 # C @@ -464,20 +464,20 @@ OP_LFGGetMatchesResponse=0x0000 # C OP_LFPGetMatchesRequest=0x0000 # C OP_LFPGetMatchesResponse=0x0000 # C OP_LFPCommand=0x0000 # C -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x0000 # C OP_RaidUpdate=0x0000 # C -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x0000 # C OP_CombatAbility=0x0000 # C OP_SenseTraps=0x0000 # C OP_PickPocket=0x0000 # C -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x0000 # C OP_Sneak=0x0000 # C OP_Fishing=0x0000 # C @@ -495,7 +495,7 @@ OP_AcceptNewTask=0x0000 # C OP_TaskHistoryRequest=0x0000 # C OP_TaskHistoryReply=0x0000 # C OP_CancelTask=0x0000 # C -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x0000 # C @@ -505,53 +505,53 @@ OP_SetTitle=0x0000 # C OP_SetTitleReply=0x0000 # C # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -563,47 +563,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_Nov17-2011.conf b/utils/EQExtractor2/EQExtractor2/patch_Nov17-2011.conf index f9ea38350..91dc487ba 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Nov17-2011.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Nov17-2011.conf @@ -4,11 +4,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x4d5c #c OP_ApproveWorld=0x655c #c OP_LogServer=0x1497 #c @@ -40,33 +40,33 @@ OP_FloatListThing=0x45d7 # # Reasons for Disconnect: OP_ZoneUnavail=0x66e4 # This is not the right opcode. Produces a 'Your character is inaccessible' message. OP_WorldClientReady=0x3f24 # -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # OP_ZoneEntry=0x5821 # OP_ReqNewZone=0x1c36 # OP_NewZone=0x4118 # -OP_ZoneSpawns=0x0000 # +OP_ZoneSpawns=0x0000 # OP_PlayerProfile=0x6afd #c OP_TimeOfDay=0x6015 # OP_LevelUpdate=0x0000 # OP_Stamina=0x0000 # OP_RequestClientZoneChange=0x18ea # OP_ZoneChange=0x0000 # -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x3f55 #c @@ -77,7 +77,7 @@ OP_TaskActivity=0x0000 # OP_CompletedTasks=0x6d1f #c OP_Weather=0x4658 # OP_SendAATable=0x72f3 # -OP_UpdateAA=0x0000 # +OP_UpdateAA=0x0000 # OP_RespondAA=0x0000 # OP_ReqClientSpawn=0x47e7 # OP_SpawnDoor=0x0e24 # @@ -123,12 +123,12 @@ OP_GuildManageBanker=0x0000 # OP_GuildBank=0x0000 # OP_SetGuildRank=0x0000 # OP_GuildUpdateURLAndChannel=0x0000 # -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x0000 # @@ -308,8 +308,8 @@ OP_VetRewardsAvaliable=0x0000 # OP_VetClaimRequest=0x0000 # OP_VetClaimReply=0x0000 # OP_CrystalCountUpdate=0x0000 # -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # OP_MobUpdate=0x4656 # OP_NPCMoveUpdate=0x2339 # @@ -340,7 +340,7 @@ OP_ManaUpdate=0x7c94 #c OP_EnduranceUpdate=0x5851 #c OP_MobManaUpdate=0x190c #c OP_MobEnduranceUpdate=0x4d27 #c - + # Looting OP_LootRequest=0x0000 # OP_EndLootRequest=0x0000 # @@ -355,10 +355,10 @@ OP_TraderShop=0x0000 # OP_Trader=0x0000 # OP_TraderBuy=0x0000 # OP_Barter=0x0000 # -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x0000 # @@ -407,10 +407,10 @@ OP_TributeItem=0x0000 # OP_TributeMoney=0x0000 # OP_TributeToggle=0x0000 # OP_TributePointUpdate=0x0000 # -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x0000 # @@ -435,11 +435,11 @@ OP_AdventureLeaderboardReply=0x0000 # OP_GroupDisband=0x0000 # OP_GroupInvite=0x3671 #c OP_GroupFollow=0x0000 # -OP_GroupUpdate=0x4b82 #c -OP_GroupUpdateB=0x44c2 #c +OP_GroupUpdate=0x4b82 #c +OP_GroupUpdateB=0x44c2 #c OP_GroupCancelInvite=0x0000 # OP_GroupAcknowledge=0x0000 # -OP_GroupDelete=0x0000 # +OP_GroupDelete=0x0000 # OP_CancelInvite=0x0000 # OP_GroupFollow2=0x0000 # OP_GroupInvite2=0x0000 # @@ -455,20 +455,20 @@ OP_LFGGetMatchesResponse=0x0000 # OP_LFPGetMatchesRequest=0x0000 # OP_LFPGetMatchesResponse=0x0000 # OP_LFPCommand=0x0000 # -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x0000 # OP_RaidUpdate=0x0c08 # -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x0000 # OP_CombatAbility=0x0000 # OP_SenseTraps=0x0000 # OP_PickPocket=0x0000 # -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x0000 # OP_Sneak=0x0000 # OP_Fishing=0x0000 # @@ -486,7 +486,7 @@ OP_AcceptNewTask=0x0000 # OP_TaskHistoryRequest=0x0000 # OP_TaskHistoryReply=0x0000 # OP_CancelTask=0x0000 # -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x0000 # @@ -496,53 +496,53 @@ OP_SetTitle=0x0000 # OP_SetTitleReply=0x0000 # # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -554,47 +554,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_Sep01-2010.conf b/utils/EQExtractor2/EQExtractor2/patch_Sep01-2010.conf index c6585d394..5cb16815b 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Sep01-2010.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Sep01-2010.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x2683 # V OP_ApproveWorld=0x28a7 # C OP_LogServer=0x224f # C @@ -49,15 +49,15 @@ OP_FloatListThing=0x0000 # V # Reasons for Disconnect: OP_ZoneUnavail=0x0000 # C 0x0000 OP_WorldClientReady=0x399b # C 0x0000 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # V @@ -72,11 +72,11 @@ OP_Stamina=0x0000 # V OP_RequestClientZoneChange=0x4178 # C OP_ZoneChange=0x4a61 # C -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x0000 # V @@ -86,14 +86,14 @@ OP_TaskDescription=0x0000 # C OP_TaskActivity=0x0000 # C OP_CompletedTasks=0x0000 # C 0x0000 OP_Weather=0x0ed5 # V -OP_SendAATable=0x6dc3 # V -OP_UpdateAA=0x0000 # V +OP_SendAATable=0x6dc3 # V +OP_UpdateAA=0x0000 # V OP_RespondAA=0x0000 # C 0x0000 OP_ReqClientSpawn=0x6618 # V OP_SpawnDoor=0x47ae # V OP_GroundSpawn=0x5f0d # V OP_SendZonepoints=0x0ff4 # V -OP_SendAAStats=0x0000 # C +OP_SendAAStats=0x0000 # C OP_WorldObjectsSent=0x7b73 # V OP_BlockedBuffs=0x4027 # V OP_SendExpZonein=0x1436 # V @@ -133,12 +133,12 @@ OP_GuildManageBanker=0x0000 # C OP_GuildBank=0x0000 # C OP_SetGuildRank=0x0000 # C OP_GuildUpdateURLAndChannel=0x0000 # C -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x0000 # C @@ -317,8 +317,8 @@ OP_VetRewardsAvaliable=0x0000 # C Mispelled? OP_VetClaimRequest=0x0000 # C OP_VetClaimReply=0x0000 # C OP_CrystalCountUpdate=0x0000 # C -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # C OP_Damage? OP_MobUpdate=0x4656 # Same as OP_SpawnPositionUpdate OP_NPCMoveUpdate=0x7adb # @@ -349,7 +349,7 @@ OP_ManaUpdate=0x0000 # C OP_EnduranceUpdate=0x0000 # C OP_MobManaUpdate=0x0000 # C OP_MobEnduranceUpdate=0x0000 # C - + # Looting OP_LootRequest=0x0000 # C OP_EndLootRequest=0x0000 # C @@ -364,10 +364,10 @@ OP_TraderShop=0x0000 # C OP_Trader=0x0000 # C OP_TraderBuy=0x0000 # C OP_Barter=0x0000 # C -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x0000 # C @@ -416,10 +416,10 @@ OP_TributeItem=0x0000 # C OP_TributeMoney=0x0000 # C OP_TributeToggle=0x0000 # C OP_TributePointUpdate=0x0000 # C -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x0000 # C @@ -444,11 +444,11 @@ OP_AdventureLeaderboardReply=0x0000 # C OP_GroupDisband=0x0000 # C OP_GroupInvite=0x0000 # C OP_GroupFollow=0x0000 # C -OP_GroupUpdate=0x0000 # C -OP_GroupUpdateB=0x0000 # C +OP_GroupUpdate=0x0000 # C +OP_GroupUpdateB=0x0000 # C OP_GroupCancelInvite=0x0000 # C - Same as OP_CancelInvite? OP_GroupAcknowledge=0x0000 # C -OP_GroupDelete=0x0000 # +OP_GroupDelete=0x0000 # OP_CancelInvite=0x0000 # C OP_GroupFollow2=0x0000 # C OP_GroupInvite2=0x0000 # C @@ -464,20 +464,20 @@ OP_LFGGetMatchesResponse=0x0000 # C OP_LFPGetMatchesRequest=0x0000 # C OP_LFPGetMatchesResponse=0x0000 # C OP_LFPCommand=0x0000 # C -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x0000 # C OP_RaidUpdate=0x0000 # C -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x0000 # C OP_CombatAbility=0x0000 # C OP_SenseTraps=0x0000 # C OP_PickPocket=0x0000 # C -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x0000 # C OP_Sneak=0x0000 # C OP_Fishing=0x0000 # C @@ -495,7 +495,7 @@ OP_AcceptNewTask=0x0000 # C OP_TaskHistoryRequest=0x0000 # C OP_TaskHistoryReply=0x0000 # C OP_CancelTask=0x0000 # C -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x0000 # C @@ -505,53 +505,53 @@ OP_SetTitle=0x0000 # C OP_SetTitleReply=0x0000 # C # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -563,47 +563,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_Sep22-2010.conf b/utils/EQExtractor2/EQExtractor2/patch_Sep22-2010.conf index 09188221d..feb6eaf12 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_Sep22-2010.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_Sep22-2010.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x6893 # was 0x2683 OP_ApproveWorld=0x115a # was 0x28a7 OP_LogServer=0x701f # was 0x224f @@ -49,15 +49,15 @@ OP_FloatListThing=0x0000 # V # Reasons for Disconnect: OP_ZoneUnavail=0x0000 # C 0x0000 OP_WorldClientReady=0x399b # C 0x0000 -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # was 0x3594 @@ -72,11 +72,11 @@ OP_Stamina=0x0000 # V OP_RequestClientZoneChange=0x3fd2 # was 0x4178 OP_ZoneChange=0x0b93 # was 0x4a61 -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x7b64 # V @@ -87,13 +87,13 @@ OP_TaskActivity=0x0000 # C OP_CompletedTasks=0x0000 # C 0x0000 OP_Weather=0x7ce4 # was 0x0ed5 OP_SendAATable=0x1bd4 # was 0x6dc3 -OP_UpdateAA=0x0000 # V +OP_UpdateAA=0x0000 # V OP_RespondAA=0x0000 # C 0x0000 OP_ReqClientSpawn=0x54e8 # was 0x6618 OP_SpawnDoor=0x465e # was 0x47ae Need an Encode OP_GroundSpawn=0x5f0d # was 0x5f0d OP_SendZonepoints=0x5f51 # was 0x0ff4 -OP_SendAAStats=0x0000 # C +OP_SendAAStats=0x0000 # C OP_WorldObjectsSent=0x7b73 # was 0x7b73 OP_BlockedBuffs=0x664a # was 0x4027 OP_SendExpZonein=0x2c27 # was 0x1436 @@ -133,12 +133,12 @@ OP_GuildManageBanker=0x0000 # C OP_GuildBank=0x0000 # C OP_SetGuildRank=0x0000 # C OP_GuildUpdateURLAndChannel=0x0000 # C -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x0000 # C @@ -317,8 +317,8 @@ OP_VetRewardsAvaliable=0x0000 # C Mispelled? OP_VetClaimRequest=0x0000 # C OP_VetClaimReply=0x0000 # C OP_CrystalCountUpdate=0x0000 # C -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_Action2=0x0000 # C OP_Damage? OP_MobUpdate=0x4656 # was 0x4656 OP_NPCMoveUpdate=0x38f9 # was 0x7adb @@ -349,7 +349,7 @@ OP_ManaUpdate=0x0000 # C OP_EnduranceUpdate=0x0000 # C OP_MobManaUpdate=0x0000 # C OP_MobEnduranceUpdate=0x0000 # C - + # Looting OP_LootRequest=0x0000 # C OP_EndLootRequest=0x0000 # C @@ -364,10 +364,10 @@ OP_TraderShop=0x0000 # C OP_Trader=0x0000 # C OP_TraderBuy=0x0000 # C OP_Barter=0x0000 # C -OP_ShopItem=0x0000 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # -OP_TraderItemUpdate=0x0000 # +OP_ShopItem=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # +OP_TraderItemUpdate=0x0000 # # pc/npc trading OP_TradeRequest=0x0000 # C @@ -418,10 +418,10 @@ OP_TributeItem=0x0000 # C OP_TributeMoney=0x0000 # C OP_TributeToggle=0x0000 # C OP_TributePointUpdate=0x0000 # C -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x0000 # C @@ -446,11 +446,11 @@ OP_AdventureLeaderboardReply=0x0000 # C OP_GroupDisband=0x0000 # C OP_GroupInvite=0x0000 # C OP_GroupFollow=0x0000 # C -OP_GroupUpdate=0x0000 # C -OP_GroupUpdateB=0x0000 # C +OP_GroupUpdate=0x0000 # C +OP_GroupUpdateB=0x0000 # C OP_GroupCancelInvite=0x0000 # C - Same as OP_CancelInvite? OP_GroupAcknowledge=0x0000 # C -OP_GroupDelete=0x0000 # +OP_GroupDelete=0x0000 # OP_CancelInvite=0x0000 # C OP_GroupFollow2=0x0000 # C OP_GroupInvite2=0x0000 # C @@ -466,20 +466,20 @@ OP_LFGGetMatchesResponse=0x0000 # C OP_LFPGetMatchesRequest=0x0000 # C OP_LFPGetMatchesResponse=0x0000 # C OP_LFPCommand=0x0000 # C -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x0000 # C OP_RaidUpdate=0x0000 # C -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x0000 # C OP_CombatAbility=0x0000 # C OP_SenseTraps=0x0000 # C OP_PickPocket=0x0000 # C -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x0000 # C OP_Sneak=0x0000 # C OP_Fishing=0x0000 # C @@ -497,7 +497,7 @@ OP_AcceptNewTask=0x0000 # C OP_TaskHistoryRequest=0x0000 # C OP_TaskHistoryReply=0x0000 # C OP_CancelTask=0x0000 # C -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # # Title opcodes OP_NewTitlesAvailable=0x0000 # C @@ -507,53 +507,53 @@ OP_SetTitle=0x0000 # C OP_SetTitleReply=0x0000 # C # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -565,47 +565,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0000 # -OP_Login=0x0000 # -OP_ServerListRequest=0x0000 # -OP_PlayEverquestRequest=0x0000 # -OP_PlayEverquestResponse=0x0000 # -OP_ChatMessage=0x0000 # -OP_LoginAccepted=0x0000 # -OP_ServerListResponse=0x0000 # -OP_Poll=0x0000 # -OP_EnterChat=0x0000 # -OP_PollResponse=0x0000 # +OP_SessionReady=0x0000 # +OP_Login=0x0000 # +OP_ServerListRequest=0x0000 # +OP_PlayEverquestRequest=0x0000 # +OP_PlayEverquestResponse=0x0000 # +OP_ChatMessage=0x0000 # +OP_LoginAccepted=0x0000 # +OP_ServerListResponse=0x0000 # +OP_Poll=0x0000 # +OP_EnterChat=0x0000 # +OP_PollResponse=0x0000 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/patch_SoD.conf b/utils/EQExtractor2/EQExtractor2/patch_SoD.conf index c428c0a76..3ae82376b 100644 --- a/utils/EQExtractor2/EQExtractor2/patch_SoD.conf +++ b/utils/EQExtractor2/EQExtractor2/patch_SoD.conf @@ -13,11 +13,11 @@ OP_Unknown=0x0000 OP_ExploreUnknown=0x0000 # used for unknown explorer # V = Verified correct -# C = Most likely correct +# C = Most likely correct # U = Unsure, but should be correct or close # world packets -# Required to reach Char Select: +# Required to reach Char Select: OP_SendLoginInfo=0x0ff4 # C OP_ApproveWorld=0x701f # C OP_LogServer=0x4762 # C @@ -49,15 +49,15 @@ OP_FloatListThing=0x10b5 # C # Reasons for Disconnect: OP_ZoneUnavail=0x7930 # C OP_WorldClientReady=0x1a84 # C -OP_CharacterStillInZone=0x0000 # -OP_WorldChecksumFailure=0x0000 # -OP_WorldLoginFailed=0x0000 # -OP_WorldLogout=0x0000 # -OP_WorldLevelTooHigh=0x0000 # -OP_CharInacessable=0x0000 # -OP_UserCompInfo=0x0000 # -# OP_SendExeChecksum=0x0000 # -# OP_SendBaseDataChecksum=0x0000 # +OP_CharacterStillInZone=0x0000 # +OP_WorldChecksumFailure=0x0000 # +OP_WorldLoginFailed=0x0000 # +OP_WorldLogout=0x0000 # +OP_WorldLevelTooHigh=0x0000 # +OP_CharInacessable=0x0000 # +OP_UserCompInfo=0x0000 # +# OP_SendExeChecksum=0x0000 # +# OP_SendBaseDataChecksum=0x0000 # # Zone in opcodes OP_AckPacket=0x3594 # C @@ -69,15 +69,15 @@ OP_PlayerProfile=0x6022 # C OP_TimeOfDay=0x6015 # C OP_LevelUpdate=0x6a99 # C OP_Stamina=0x3e50 # C -OP_LockoutTimerInfo=0x0000 # -OP_ZoneServerReady=0x0000 # +OP_LockoutTimerInfo=0x0000 # +OP_ZoneServerReady=0x0000 # OP_RequestClientZoneChange=0x4885 # C OP_ZoneChange=0x051b # C -OP_ZoneInUnknown=0x0000 # -OP_LogoutReply=0x0000 # -OP_PreLogoutReply=0x0000 # +OP_ZoneInUnknown=0x0000 # +OP_LogoutReply=0x0000 # +OP_PreLogoutReply=0x0000 # # Required to fully log in OP_SpawnAppearance=0x10b7 # C @@ -87,14 +87,14 @@ OP_TaskDescription=0x7b77 # C OP_TaskActivity=0x0525 # C OP_CompletedTasks=0x5412 # C OP_Weather=0x2641 # C -OP_SendAATable=0x322f # C -OP_UpdateAA=0x466c # C -OP_RespondAA=0x0142 # C +OP_SendAATable=0x322f # C +OP_UpdateAA=0x466c # C +OP_RespondAA=0x0142 # C OP_ReqClientSpawn=0x1436 # C OP_SpawnDoor=0x102f # C OP_GroundSpawn=0x33e5 # C OP_SendZonepoints=0x5821 # C -OP_SendAAStats=0x57a3 # C +OP_SendAAStats=0x57a3 # C OP_WorldObjectsSent=0x7b73 # C OP_BlockedBuffs=0x0baa # C OP_SendExpZonein=0x69cd # C @@ -134,12 +134,12 @@ OP_GuildManageBanker=0x11bc # C OP_GuildBank=0x0fce # C OP_SetGuildRank=0x4ffe # C OP_GuildUpdateURLAndChannel=0x5422 -OP_GuildMemberLevelUpdate=0x0000 # -OP_ZoneGuildList=0x0000 # -OP_GetGuildsList=0x0000 # -# OP_GuildManageRemove=0x0000 # -# OP_GuildManageAdd=0x0000 # -# OP_GuildManageStatus=0x0000 # +OP_GuildMemberLevelUpdate=0x0000 # +OP_ZoneGuildList=0x0000 # +OP_GetGuildsList=0x0000 # +# OP_GuildManageRemove=0x0000 # +# OP_GuildManageAdd=0x0000 # +# OP_GuildManageStatus=0x0000 # # GM/guide opcodes OP_GMServers=0x6989 # C @@ -319,18 +319,18 @@ OP_VetRewardsAvaliable=0x4e4e # C OP_VetClaimRequest=0x771f # C OP_VetClaimReply=0x2f95 # C OP_CrystalCountUpdate=0x2d0e # C -OP_DisciplineUpdate=0x0000 # -OP_BecomeCorpse=0x0000 # +OP_DisciplineUpdate=0x0000 # +OP_BecomeCorpse=0x0000 # OP_MobUpdate=0x4656 # Unused? OP_NPCMoveUpdate=0x22a7 # # New Opcodes -OP_SpawnPositionUpdate=0x4656 # +OP_SpawnPositionUpdate=0x4656 # OP_ManaUpdate=0x4b61 # -OP_EnduranceUpdate=0x02d6 # +OP_EnduranceUpdate=0x02d6 # OP_MobManaUpdate=0x2ac1 # OP_MobEnduranceUpdate=0x6c5f # - + # Looting OP_LootRequest=0x2701 # C @@ -343,13 +343,13 @@ OP_BazaarSearch=0x4675 # C OP_TraderDelItem=0x63c8 # C OP_BecomeTrader=0x528f # C OP_TraderShop=0x7598 # C -OP_TraderItemUpdate=0x0000 # +OP_TraderItemUpdate=0x0000 # OP_Trader=0x7092 # C -OP_ShopItem=0x0000 # +OP_ShopItem=0x0000 # OP_TraderBuy=0x053a # C OP_Barter=0x4b49 # -OP_BazaarInspect=0x0000 # -OP_Bazaar=0x0000 # +OP_BazaarInspect=0x0000 # +OP_Bazaar=0x0000 # OP_MarketPlace1=0x367b OP_MarketPlace2=0x0e1d @@ -400,10 +400,10 @@ OP_TributeItem=0x416b # C OP_TributeMoney=0x0b89 # C OP_TributeToggle=0x45b3 # C OP_TributePointUpdate=0x7d05 # C -OP_TributeNPC=0x0000 # -OP_GuildTributeInfo=0x0000 # -OP_OpenTributeReply=0x0000 # -# OP_GuildTributeStatus=0x0000 # +OP_TributeNPC=0x0000 # +OP_GuildTributeInfo=0x0000 # +OP_OpenTributeReply=0x0000 # +# OP_GuildTributeStatus=0x0000 # # Adventure packets: OP_LeaveAdventure=0x2ab6 # C @@ -432,7 +432,7 @@ OP_GroupUpdate=0x21be OP_GroupUpdateB=0x7351 OP_GroupCancelInvite=0x5251 # C - Same as OP_CancelInvite? OP_GroupAcknowledge=0x3e22 # C -OP_GroupDelete=0x58e6 # +OP_GroupDelete=0x58e6 # OP_CancelInvite=0x5251 # C OP_GroupFollow2=0x2736 # C OP_GroupInvite2=0x548c # C @@ -447,20 +447,20 @@ OP_LFGGetMatchesResponse=0x7d90 # C OP_LFPGetMatchesRequest=0x0479 # C OP_LFPGetMatchesResponse=0x16f5 # C OP_LFPCommand=0x710e # C -OP_LFGAppearance=0x0000 # -OP_LFGResponse=0x0000 # +OP_LFGAppearance=0x0000 # +OP_LFGResponse=0x0000 # # Raid Opcodes OP_RaidInvite=0x3b52 # C OP_RaidUpdate=0x32c6 # C -OP_RaidJoin=0x0000 # +OP_RaidJoin=0x0000 # # Button-push commands OP_Taunt=0x1418 # C OP_CombatAbility=0x24c5 # C OP_SenseTraps=0x1e04 # C OP_PickPocket=0x25f0 # C -OP_DisarmTraps=0x0000 # +OP_DisarmTraps=0x0000 # OP_Disarm=0x6def # C OP_Sneak=0x03e7 # C OP_Fishing=0x7093 # C @@ -478,7 +478,7 @@ OP_AcceptNewTask=0x5832 # C OP_TaskHistoryRequest=0x29d7 # C OP_TaskHistoryReply=0x3d2a # C OP_CancelTask=0x726b # C -OP_DeclineAllTasks=0x0000 # +OP_DeclineAllTasks=0x0000 # OP_Shroud=0x6d1f OP_ShroudRemove=0x17f6 OP_ShroudUnknown1=0x169a @@ -496,53 +496,53 @@ OP_SetTitle=0x698a # C OP_SetTitleReply=0x4d3e # C # mail opcodes -OP_Command=0x0000 # -OP_MailboxHeader=0x0000 # -OP_MailHeader=0x0000 # -OP_MailBody=0x0000 # -OP_NewMail=0x0000 # -OP_SentConfirm=0x0000 # +OP_Command=0x0000 # +OP_MailboxHeader=0x0000 # +OP_MailHeader=0x0000 # +OP_MailBody=0x0000 # +OP_NewMail=0x0000 # +OP_SentConfirm=0x0000 # -# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # +# # # # # # # # # # # Below this point should not be needed # # # # # # # # # # # # This section are all unknown in Titanium -OP_ForceFindPerson=0x0000 # -OP_LocInfo=0x0000 # -OP_ReloadUI=0x0000 # -OP_ItemName=0x0000 # -OP_ItemLinkText=0x0000 # -OP_MultiLineMsg=0x0000 # -OP_MendHPUpdate=0x0000 # -OP_TargetReject=0x0000 # -OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # -OP_ApproveZone=0x0000 # -OP_ZoneComplete=0x0000 # -OP_ClientError=0x0000 # -OP_DumpName=0x0000 # -OP_Heartbeat=0x0000 # -OP_CrashDump=0x0000 # -OP_LoginComplete=0x0000 # +OP_ForceFindPerson=0x0000 # +OP_LocInfo=0x0000 # +OP_ReloadUI=0x0000 # +OP_ItemName=0x0000 # +OP_ItemLinkText=0x0000 # +OP_MultiLineMsg=0x0000 # +OP_MendHPUpdate=0x0000 # +OP_TargetReject=0x0000 # +OP_SafePoint=0x0000 # +OP_IncreaseStats=0x0000 # +OP_ApproveZone=0x0000 # +OP_ZoneComplete=0x0000 # +OP_ClientError=0x0000 # +OP_DumpName=0x0000 # +OP_Heartbeat=0x0000 # +OP_CrashDump=0x0000 # +OP_LoginComplete=0x0000 # # discovered opcodes not yet used: -OP_PickLockSuccess=0x0000 # -OP_PlayMP3=0x0000 # -OP_ReclaimCrystals=0x0000 # -OP_DynamicWall=0x0000 # -OP_OpenDiscordMerchant=0x0000 # -OP_DiscordMerchantInventory=0x0000 # -OP_GiveMoney=0x0000 # -OP_RequestKnowledgeBase=0x0000 # -OP_KnowledgeBase=0x0000 # +OP_PickLockSuccess=0x0000 # +OP_PlayMP3=0x0000 # +OP_ReclaimCrystals=0x0000 # +OP_DynamicWall=0x0000 # +OP_OpenDiscordMerchant=0x0000 # +OP_DiscordMerchantInventory=0x0000 # +OP_GiveMoney=0x0000 # +OP_RequestKnowledgeBase=0x0000 # +OP_KnowledgeBase=0x0000 # OP_SlashAdventure=0x0000 # /adventure -OP_BecomePVPPrompt=0x0000 # +OP_BecomePVPPrompt=0x0000 # OP_MoveLogRequest=0x0000 # gone I think OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # +OP_AnnoyingZoneUnknown=0x0000 # OP_Some6ByteHPUpdate=0x0000 # seems to happen when you target group members -OP_QueryResponseThing=0x0000 # +OP_QueryResponseThing=0x0000 # # realityincarnate: these are just here to stop annoying several thousand byte packet dumps @@ -554,47 +554,47 @@ OP_PetitionSearch=0x0000 # search term for petition OP_PetitionSearchResults=0x0000 # (list of?) matches from search OP_PetitionSearchText=0x0000 # text results of search -OP_PetitionUpdate=0x0000 # -OP_PetitionCheckout=0x0000 # -OP_PetitionCheckIn=0x0000 # -OP_PetitionQue=0x0000 # -OP_PetitionUnCheckout=0x0000 # -OP_PetitionDelete=0x0000 # -OP_DeletePetition=0x0000 # -OP_PetitionResolve=0x0000 # -OP_PDeletePetition=0x0000 # -OP_PetitionBug=0x0000 # -OP_PetitionRefresh=0x0000 # -OP_PetitionCheckout2=0x0000 # -OP_PetitionViewPetition=0x0000 # +OP_PetitionUpdate=0x0000 # +OP_PetitionCheckout=0x0000 # +OP_PetitionCheckIn=0x0000 # +OP_PetitionQue=0x0000 # +OP_PetitionUnCheckout=0x0000 # +OP_PetitionDelete=0x0000 # +OP_DeletePetition=0x0000 # +OP_PetitionResolve=0x0000 # +OP_PDeletePetition=0x0000 # +OP_PetitionBug=0x0000 # +OP_PetitionRefresh=0x0000 # +OP_PetitionCheckout2=0x0000 # +OP_PetitionViewPetition=0x0000 # # Login opcodes -OP_SessionReady=0x0001 # -OP_Login=0x0002 # -OP_ServerListRequest=0x0004 # -OP_PlayEverquestRequest=0x000d # -OP_PlayEverquestResponse=0x0021 # -OP_ChatMessage=0x0016 # -OP_LoginAccepted=0x0017 # -OP_ServerListResponse=0x0018 # -OP_Poll=0x0029 # -OP_EnterChat=0x000f # -OP_PollResponse=0x0011 # +OP_SessionReady=0x0001 # +OP_Login=0x0002 # +OP_ServerListRequest=0x0004 # +OP_PlayEverquestRequest=0x000d # +OP_PlayEverquestResponse=0x0021 # +OP_ChatMessage=0x0016 # +OP_LoginAccepted=0x0017 # +OP_ServerListResponse=0x0018 # +OP_Poll=0x0029 # +OP_EnterChat=0x000f # +OP_PollResponse=0x0011 # # raw opcodes -OP_RAWSessionRequest=0x0000 # -OP_RAWSessionResponse=0x0000 # -OP_RAWCombined=0x0000 # -OP_RAWSessionDisconnect=0x0000 # -OP_RAWKeepAlive=0x0000 # -OP_RAWSessionStatRequest=0x0000 # -OP_RAWSessionStatResponse=0x0000 # -OP_RAWPacket=0x0000 # -OP_RAWFragment=0x0000 # -OP_RAWOutOfOrderAck=0x0000 # -OP_RAWAck=0x0000 # -OP_RAWAppCombined=0x0000 # -OP_RAWOutOfSession=0x0000 # +OP_RAWSessionRequest=0x0000 # +OP_RAWSessionResponse=0x0000 # +OP_RAWCombined=0x0000 # +OP_RAWSessionDisconnect=0x0000 # +OP_RAWKeepAlive=0x0000 # +OP_RAWSessionStatRequest=0x0000 # +OP_RAWSessionStatResponse=0x0000 # +OP_RAWPacket=0x0000 # +OP_RAWFragment=0x0000 # +OP_RAWOutOfOrderAck=0x0000 # +OP_RAWAck=0x0000 # +OP_RAWAppCombined=0x0000 # +OP_RAWOutOfSession=0x0000 # # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs diff --git a/utils/EQExtractor2/EQExtractor2/zlib.net.dll b/utils/EQExtractor2/EQExtractor2/zlib.net.dll index c156f8e7c..b06daff46 100644 Binary files a/utils/EQExtractor2/EQExtractor2/zlib.net.dll and b/utils/EQExtractor2/EQExtractor2/zlib.net.dll differ diff --git a/utils/TaskMaster/ErrorLog.cpp b/utils/TaskMaster/ErrorLog.cpp index 26fccb017..0543d270a 100644 --- a/utils/TaskMaster/ErrorLog.cpp +++ b/utils/TaskMaster/ErrorLog.cpp @@ -9,7 +9,7 @@ EQEmuErrorLog::EQEmuErrorLog() mErrorLog = NULL; mErrorLog = fopen(LOG_FILE_NAME, "w"); if(!mErrorLog) { - Log(eqEmuLogConsole,"Opening of %s for writing failed, debug output will be tied to console only.", LOG_FILE_NAME); + Log(eqEmuLogConsole,"Opening of %s for writing failed, debug output will be tied to console only.", LOG_FILE_NAME); } else Log(eqEmuLogBoth, "EQEmuErrorLog Init Successful."); @@ -26,11 +26,11 @@ EQEmuErrorLog::EQEmuErrorLog() } EQEmuErrorLog::~EQEmuErrorLog() -{ +{ Log(eqEmuLogBoth, "EQEmuErrorLog Shutdown."); - if(mErrorLog) { - fclose(mErrorLog); - mErrorLog = NULL; + if(mErrorLog) { + fclose(mErrorLog); + mErrorLog = NULL; } } @@ -47,7 +47,7 @@ void EQEmuErrorLog::Log(unsigned int mOutputType, const char *msg, ...) struct tm *mTime; time(&mClock); mTime = localtime(&mClock); - + if(mOutputType & eqEmuLogConsole){ printf("[Debug] [%02d.%02d.%02d - %02d:%02d:%02d] %s\n", mTime->tm_mon+1, mTime->tm_mday, mTime->tm_year%100, mTime->tm_hour, mTime->tm_min, mTime->tm_sec, buffer); } @@ -65,7 +65,7 @@ void EQEmuErrorLog::Log(unsigned int mOutputType, const char *msg, ...) fprintf(mErrorLogSQL, "%s;\n\n", buffer); } } - + if(buffer) delete[] buffer; } \ No newline at end of file diff --git a/utils/TaskMaster/ErrorLog.h b/utils/TaskMaster/ErrorLog.h index 2d1ada0c4..615c7a44d 100644 --- a/utils/TaskMaster/ErrorLog.h +++ b/utils/TaskMaster/ErrorLog.h @@ -13,12 +13,12 @@ enum{ }; //log file output -#define LOG_FILE_NAME "debug.txt" +#define LOG_FILE_NAME "debug.txt" #define SQL_LOG_FILE_NAME "sql_log.sql" //max single log length //same as a client:message() max len -#define MAX_LOG_LEN 4096 +#define MAX_LOG_LEN 4096 //much simplified logging function, similar to the one used on the server (Tho much simpler) class EQEmuErrorLog { diff --git a/utils/TaskMaster/activities.cpp b/utils/TaskMaster/activities.cpp index fac68536b..4f2d211f4 100644 --- a/utils/TaskMaster/activities.cpp +++ b/utils/TaskMaster/activities.cpp @@ -5,7 +5,7 @@ #include "utility.h" #include "base.h" #include "ErrorLog.h" - + using namespace std; void MainFrame::ActivitiesListBoxSimpleSelect(wxCommandEvent& event) @@ -129,7 +129,7 @@ void MainFrame::NewActivity(wxCommandEvent& event) char * mActQuery = 0; MakeAnyLenString(&mActQuery, "INSERT INTO `activities` (`taskid`,`activityid`,`step`,`activitytype`,`text1`,`text2`,`text3`,`goalid`,`goalmethod`,`goalcount`,`delivertonpc`,`zoneid`,`optional`) VALUES (%u,%u,%u,%u,'%s','%s','%s',%u,%u,%u,%u,%u,%u)", newAct.id, newAct.activityId, newAct.step, newAct.activityType, newAct.text1, newAct.text2, newAct.text3, newAct.goalid, newAct.goalmethod, newAct.goalcount, newAct.deliverToNpc, newAct.zoneid, newAct.optional ); - + mErrorLog->Log(eqEmuLogSQL, "%s", mActQuery); if (mysql_query(mMysql, mActQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); @@ -161,7 +161,7 @@ void MainFrame::DeleteActivity(wxCommandEvent& event) eqtask_activity_id *selAct = (eqtask_activity_id*)ActivitiesSelectionList->GetClientData(ActivitiesSelectionList->GetSelection()); unsigned int aid = selAct->activityid; - unsigned int tid = selAct->id; + unsigned int tid = selAct->id; if(selAct) { diff --git a/utils/TaskMaster/base.cpp b/utils/TaskMaster/base.cpp index af119a961..b9b118962 100644 --- a/utils/TaskMaster/base.cpp +++ b/utils/TaskMaster/base.cpp @@ -113,7 +113,7 @@ MainFrame::MainFrame(const wxString& title, BoxSizer1 = new wxBoxSizer(wxHORIZONTAL); mErrorLog->Log(eqEmuLogBoth, "Creating Item List Box."); - ItemSelectionList = new wxListBox(this, LIST_Click, wxDefaultPosition, wxSize( -1,-1 ), 0, NULL, 0); + ItemSelectionList = new wxListBox(this, LIST_Click, wxDefaultPosition, wxSize( -1,-1 ), 0, NULL, 0); mErrorLog->Log(eqEmuLogBoth, "Adding Item List Box to Sizer."); BoxSizer1->Add(ItemSelectionList, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5); @@ -228,7 +228,7 @@ MainFrame::MainFrame(const wxString& title, mActText1 = new wxTextCtrl(MainPanel2, -1, wxT(""), wxPoint(185,0), wxSize(180,20), wxTE_DONTWRAP); mActText1->SetMaxLength(64); mActText1->Disable(); - + mActText2Label = new wxStaticText(MainPanel2, -1, "Text 2:", wxPoint(105,22), wxDefaultSize); mActText2 = new wxTextCtrl(MainPanel2, -1, wxT(""), wxPoint(185,20), wxSize(180,20), wxTE_DONTWRAP); mActText2->SetMaxLength(64); @@ -392,7 +392,7 @@ MainFrame::MainFrame(const wxString& title, mErrorLog->Log(eqEmuLogBoth, "Adding Notebook to Sizer."); BoxSizer1->Add(MainNotebookBack, 1, wxALIGN_TOP|wxEXPAND, 5); - + mErrorLog->Log(eqEmuLogBoth, "Setting Frame Sizer."); this->SetSizer(BoxSizer1); mErrorLog->Log(eqEmuLogBoth, "Calculating Frame Layout."); @@ -444,22 +444,22 @@ void MainFrame::Connect(wxCommandEvent& WXUNUSED(event)) mErrorLog->Log(eqEmuLogBoth, "Failed to load tasks, exiting."); Close(TRUE); return; - } + } if(!LoadGoals()){ mysql_close(mMysql); mErrorLog->Log(eqEmuLogBoth, "Failed to load goals, exiting."); Close(TRUE); return; - } + } if(!LoadActivities()){ mysql_close(mMysql); mErrorLog->Log(eqEmuLogBoth, "Failed to load activities, exiting."); Close(TRUE); return; - } - + } + if(!LoadItems()){ mysql_close(mMysql); mErrorLog->Log(eqEmuLogBoth, "Failed to load items, exiting."); @@ -510,7 +510,7 @@ void MainFrame::ListBoxDoubleClick(wxCommandEvent& event) Iter = taskList.begin(); Iter += openedIndex; eqtask mTask = *Iter; - + wxString mStr; mStr.Printf("%s", mTask.title); mTaskName->Clear(); diff --git a/utils/TaskMaster/base.h b/utils/TaskMaster/base.h index 58bb1100b..c6365088c 100644 --- a/utils/TaskMaster/base.h +++ b/utils/TaskMaster/base.h @@ -223,7 +223,7 @@ public: enum { - TEXT_Main = wxID_HIGHEST + 1, + TEXT_Main = wxID_HIGHEST + 1, MENU_Connect, MENU_Quit, MENU_NewTask, @@ -252,4 +252,4 @@ enum LIST_Click_Proximity, }; -#endif \ No newline at end of file +#endif \ No newline at end of file diff --git a/utils/TaskMaster/base_utility.cpp b/utils/TaskMaster/base_utility.cpp index 181419b0e..96dcf9e3a 100644 --- a/utils/TaskMaster/base_utility.cpp +++ b/utils/TaskMaster/base_utility.cpp @@ -12,7 +12,7 @@ using namespace std; bool MainFrame::GetDatabaseSettings(){ FILE *mFile = NULL; mFile = fopen("db.txt", "r"); - + //very little error checking //we don't make sure the values in the file are valid //or all there just that the file exists so: @@ -81,7 +81,7 @@ bool MainFrame::LoadItems(){ itemsLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Items", itemsLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for item load."); @@ -143,7 +143,7 @@ bool MainFrame::LoadZones() zonesLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Zones", zonesLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for zone load."); @@ -181,7 +181,7 @@ bool MainFrame::LoadTasks() wxString str; str.Printf("%d:%s", newT.id, newT.title); ItemSelectionList->Append(str); - + if(newT.id > highestIndex) highestIndex = newT.id; @@ -200,7 +200,7 @@ bool MainFrame::LoadTasks() tasksLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Tasks", tasksLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for task load."); @@ -232,7 +232,7 @@ bool MainFrame::LoadGoals() goalsLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Goals", goalsLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for goal load."); @@ -276,7 +276,7 @@ bool MainFrame::LoadActivities() activitiesLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Activities", activitiesLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for activity load."); @@ -315,7 +315,7 @@ bool MainFrame::LoadProximity() proximitiesLoaded++; } mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Proximities", proximitiesLoaded); - mysql_free_result(res); + mysql_free_result(res); } else{ mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for proximity load."); diff --git a/utils/TaskMaster/goals.cpp b/utils/TaskMaster/goals.cpp index 2f78d6529..64c35e419 100644 --- a/utils/TaskMaster/goals.cpp +++ b/utils/TaskMaster/goals.cpp @@ -67,7 +67,7 @@ void MainFrame::PopulateGoalValues(unsigned int goalid) if((*Iter).id == goalid){ int *i = new int; *i = (*Iter).value; - + wxString curStr; curStr.Clear(); curStr.Printf("%u", (*Iter).value); @@ -333,7 +333,7 @@ void MainFrame::ChangeGoalValue(wxCommandEvent& event) mErrorLog->Log(eqEmuLogBoth, "Modify goal value failed, goal values not active"); return; } - + if(GoalsValuesList->GetSelection() == wxNOT_FOUND) { mErrorLog->Log(eqEmuLogBoth, "Modify goal value failed, no selection found"); diff --git a/utils/TaskMaster/proximity.cpp b/utils/TaskMaster/proximity.cpp index f4491b1e2..0ed3820d9 100644 --- a/utils/TaskMaster/proximity.cpp +++ b/utils/TaskMaster/proximity.cpp @@ -32,7 +32,7 @@ void MainFrame::PopulateProximity() prox->exploreid = eqt.exploreid; prox->zoneid = eqt.zoneid; - + wxString zoneName; zoneName.Printf("Unknown Zone"); vector::iterator ZoneIter; @@ -115,7 +115,7 @@ void MainFrame::NewProximity(wxCommandEvent& event) mErrorLog->Log(eqEmuLogBoth, "New proximity failed, not connected to db"); return; } - + int newID = wxGetNumberFromUser("", "Explore ID:", "Explore ID", 0, 0, 9999999); int newZoneID = wxGetNumberFromUser("", "Zone ID:", "Zone ID", 0, 0, 9999999); @@ -280,7 +280,7 @@ void MainFrame::SaveProximity(wxCommandEvent& event) inStr.Clear(); inStr = mProxMinx->GetValue(); - toSave.minx = atof(inStr.mb_str()); + toSave.minx = atof(inStr.mb_str()); inStr.Clear(); inStr = mProxMaxx->GetValue(); @@ -368,9 +368,9 @@ void MainFrame::SaveProximity(wxCommandEvent& event) if(canUpdate){ char * mQuery = 0; - MakeAnyLenString(&mQuery, "UPDATE proximities SET minx=%.4f, maxx=%.4f, miny=%.4f, maxy=%.4f, minz=%.4f, maxz=%.4f) WHERE zoneid=%u AND exploreid=%u", + MakeAnyLenString(&mQuery, "UPDATE proximities SET minx=%.4f, maxx=%.4f, miny=%.4f, maxy=%.4f, minz=%.4f, maxz=%.4f) WHERE zoneid=%u AND exploreid=%u", toSave.minx, toSave.maxx, toSave.miny, toSave.maxy, toSave.minz, toSave.maxz, toSave.zoneid, toSave.exploreid); - + mErrorLog->Log(eqEmuLogSQL, "%s", mQuery); if (mysql_query(mMysql, mQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); @@ -389,7 +389,7 @@ void MainFrame::SaveProximity(wxCommandEvent& event) MakeAnyLenString(&mQuery, "INSERT INTO `proximities` (`zoneid`,`exploreid`,`minx`,`maxx`,`miny`,`maxy`,`minz`,`maxz`) VALUES (%u,%u,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f)" , toSave.zoneid, toSave.exploreid, toSave.minx, toSave.maxx, toSave.miny, toSave.maxy, toSave.minz, toSave.maxz); - + mErrorLog->Log(eqEmuLogSQL, "%s", mQuery); if (mysql_query(mMysql, mQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); diff --git a/utils/TaskMaster/tasks.cpp b/utils/TaskMaster/tasks.cpp index 4929ad26a..48aa44080 100644 --- a/utils/TaskMaster/tasks.cpp +++ b/utils/TaskMaster/tasks.cpp @@ -250,7 +250,7 @@ void MainFrame::SaveTask(wxCommandEvent& event) getStr = mRewardXP->GetValue(); ourTask.xpreward = atoi(getStr.mb_str()); getStr.Clear(); - + int * i = (int*)mStartZone->GetClientData(mStartZone->GetSelection()); ourTask.startzone = *i; @@ -261,7 +261,7 @@ void MainFrame::SaveTask(wxCommandEvent& event) char * mQuery = 0; MakeAnyLenString(&mQuery, "UPDATE tasks SET duration=%u, title='%s', description='%s', reward='%s', rewardid=%u, cashreward=%u, xpreward=%i, rewardmethod=%u, startzone=%u, minlevel=%u, maxlevel=%u, repeatable=%u WHERE id=%u", ourTask.duration, MakeStringSQLSafe(ourTask.title).mb_str(), MakeStringSQLSafe(ourTask.desc).mb_str(), MakeStringSQLSafe(ourTask.reward).mb_str(), ourTask.rewardid, ourTask.cashreward, ourTask.xpreward, ourTask.rewardmethod, ourTask.startzone, ourTask.level_min, ourTask.level_max, ourTask.repeatable, ourTask.id); - + mErrorLog->Log(eqEmuLogSQL, "%s", mQuery); if (mysql_query(mMysql, mQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); @@ -278,7 +278,7 @@ void MainFrame::SaveTask(wxCommandEvent& event) MakeAnyLenString(&mQuery, "INSERT INTO `tasks` (`id`,`duration`,`title`,`description`,`reward`,`rewardid`,`cashreward`,`xpreward`,`rewardmethod`,`startzone`, `minlevel`, `maxlevel`) VALUES (%u,%u,'%s','%s','%s',%u,%u,%u,%u,%u,%u,%u)", ourTask.id, ourTask.duration, MakeStringSQLSafe(ourTask.title).mb_str(), MakeStringSQLSafe(ourTask.desc).mb_str(), MakeStringSQLSafe(ourTask.reward).mb_str(), ourTask.rewardid, ourTask.cashreward, ourTask.xpreward, ourTask.rewardmethod, ourTask.startzone, ourTask.level_min, ourTask.level_max); - + mErrorLog->Log(eqEmuLogSQL, "%s", mQuery); if (mysql_query(mMysql, mQuery)) { mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql)); diff --git a/utils/azone2/CMakeLists.txt b/utils/azone2/CMakeLists.txt index e6576fd90..3567df948 100644 --- a/utils/azone2/CMakeLists.txt +++ b/utils/azone2/CMakeLists.txt @@ -106,14 +106,14 @@ IF(MSVC) SET(glmodelviewer_sources GLModelViewer.cpp ) - + SET(glmodelviewer_headers GLModelViewer.h ) - + ADD_EXECUTABLE(glmodelviewer WIN32 ${glmodelviewer_sources} ${glmodelviewer_headers}) TARGET_LINK_LIBRARIES(glmodelviewer azone_common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} "opengl32.lib" "GLU32.lib" "Ws2_32.lib") SET_TARGET_PROPERTIES(glmodelviewer PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - + SET(EXECUTABLE_OUTPUT_PATH ../../Bin) ENDIF(MSVC) diff --git a/utils/azone2/GLModelViewer.cpp b/utils/azone2/GLModelViewer.cpp index 4c44d5257..7ce2c0b70 100644 --- a/utils/azone2/GLModelViewer.cpp +++ b/utils/azone2/GLModelViewer.cpp @@ -30,7 +30,7 @@ typedef struct _vertex{ float x; float y; float z; - + }VERTEX; void DrawEQModel(FileLoader *fileloader, int modnum); @@ -43,10 +43,10 @@ HGLRC hRC=NULL; HWND hWnd=NULL; HINSTANCE hInstance; -bool keys[256]; +bool keys[256]; char ch; bool active=true; -GLuint base; +GLuint base; int modelnum = 1; // The Number of the model we are currently displaying. float angle = 0; // used to rotate the model. Updated by a timer @@ -62,72 +62,72 @@ GLvoid BuildFont(GLvoid) font = CreateFont(-24, 0, 0, 0, FW_BOLD, false, false, false, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, - FF_DONTCARE|DEFAULT_PITCH, "Courier New"); + FF_DONTCARE|DEFAULT_PITCH, "Courier New"); - oldfont = (HFONT)SelectObject(hDC, font); - wglUseFontBitmaps(hDC, 32, 96, base); - SelectObject(hDC, oldfont); - DeleteObject(font); + oldfont = (HFONT)SelectObject(hDC, font); + wglUseFontBitmaps(hDC, 32, 96, base); + SelectObject(hDC, oldfont); + DeleteObject(font); } -GLvoid KillFont(GLvoid) +GLvoid KillFont(GLvoid) { - glDeleteLists(base, 96); + glDeleteLists(base, 96); } GLvoid glPrint(const char *fmt, ...) { char text[256]; - va_list ap; + va_list ap; - if (fmt == NULL) return; + if (fmt == NULL) return; - va_start(ap, fmt); - vsprintf(text, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(text, fmt, ap); + va_end(ap); - glPushAttrib(GL_LIST_BIT); - glListBase(base - 32); + glPushAttrib(GL_LIST_BIT); + glListBase(base - 32); glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); - glPopAttrib(); + glPopAttrib(); } GLvoid ReSizeGLScene(GLsizei width, GLsizei height) { - if (height==0)height=1; + if (height==0)height=1; - glViewport(0,0,width,height); + glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); - glLoadIdentity(); + glLoadIdentity(); gluPerspective(60.0f,(GLfloat)width/(GLfloat)height,0.1f,12000.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); } -int InitGL(GLvoid) +int InitGL(GLvoid) { - glShadeModel(GL_SMOOTH); + glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.5f); - glClearDepth(1.0f); + glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); BuildFont(); - return true; + return true; } -int DrawGLScene(char *ZoneFileName) +int DrawGLScene(char *ZoneFileName) { char textBuffer[100]; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glLoadIdentity(); + glLoadIdentity(); if(mfileloader->model_data.models[modelnum]) DrawEQModel(mfileloader, modelnum); glLoadIdentity(); - glTranslatef(0.0f,0.0f,-1.2f); + glTranslatef(0.0f,0.0f,-1.2f); glColor3f(100.0f,0.0f,0.0f); glRasterPos2f(-1.15f,0.56f); @@ -139,17 +139,17 @@ int DrawGLScene(char *ZoneFileName) else sprintf(textBuffer," %s: Model Number %4d. Not Viewable (probably zone mesh).", ZoneFileName, modelnum); - glPrint(textBuffer); + glPrint(textBuffer); sprintf(textBuffer," Use the + and - keys to cycle through models."); glRasterPos2f(-1.15f,0.50f); - glPrint(textBuffer); + glPrint(textBuffer); - - return true; + + return true; } GLvoid KillGLWindow(GLvoid) { - if (hRC) { + if (hRC) { if (!wglMakeCurrent(NULL,NULL)) { MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } @@ -157,107 +157,107 @@ GLvoid KillGLWindow(GLvoid) { if (!wglDeleteContext(hRC)) { MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } - hRC=NULL; + hRC=NULL; } if (hDC && !ReleaseDC(hWnd,hDC)) { MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); - hDC=NULL; + hDC=NULL; } if (hWnd && !DestroyWindow(hWnd)) { MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); - hWnd=NULL; + hWnd=NULL; } if (!UnregisterClass("OpenGL",hInstance)) { MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); - hInstance=NULL; + hInstance=NULL; } KillFont(); } - + BOOL CreateGLWindow(char* title, int width, int height, int bits) { GLuint PixelFormat; - WNDCLASS wc; + WNDCLASS wc; DWORD dwExStyle; DWORD dwStyle; RECT WindowRect; WindowRect.left=(long)0; - WindowRect.right=(long)width; - WindowRect.top=(long)0; - WindowRect.bottom=(long)height; + WindowRect.right=(long)width; + WindowRect.top=(long)0; + WindowRect.bottom=(long)height; - hInstance = GetModuleHandle(NULL); + hInstance = GetModuleHandle(NULL); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; - wc.lpfnWndProc = (WNDPROC) WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; + wc.lpfnWndProc = (WNDPROC) WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); + wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; wc.lpszClassName = "OpenGL"; if (!RegisterClass(&wc)) { MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } - + dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; - dwStyle=WS_OVERLAPPEDWINDOW; + dwStyle=WS_OVERLAPPEDWINDOW; AdjustWindowRectEx(&WindowRect, dwStyle, false, dwExStyle); if (!(hWnd=CreateWindowEx(dwExStyle, "OpenGL", title, dwStyle|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, 0, 0, WindowRect.right-WindowRect.left, WindowRect.bottom-WindowRect.top, NULL, NULL, hInstance, NULL))) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } static PIXELFORMATDESCRIPTOR pfd= { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, bits, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, - 0, 0, 0, 0 + 0, 0, 0, 0 }; - + if (!(hDC=GetDC(hWnd))) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; } if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } if(!SetPixelFormat(hDC,PixelFormat,&pfd)) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } if (!(hRC=wglCreateContext(hDC))) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return false; + return false; } if(!wglMakeCurrent(hDC,hRC)) { - KillGLWindow(); + KillGLWindow(); MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; } ShowWindow(hWnd,SW_SHOW); - SetForegroundWindow(hWnd); - SetFocus(hWnd); + SetForegroundWindow(hWnd); + SetFocus(hWnd); ReSizeGLScene(width, height); if (!InitGL()) { @@ -268,17 +268,17 @@ BOOL CreateGLWindow(char* title, int width, int height, int bits) { SetTimer(hWnd, 1, 50, (TIMERPROC) NULL); - return true; + return true; } LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { - case WM_ACTIVATE: - if (!HIWORD(wParam)) active=true; + case WM_ACTIVATE: + if (!HIWORD(wParam)) active=true; else active=false; - - return 0; + + return 0; case WM_SYSCOMMAND: switch (wParam) { case SC_SCREENSAVE: @@ -288,19 +288,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { break; case WM_CLOSE: PostQuitMessage(0); - return 0; + return 0; case WM_KEYDOWN: keys[wParam] = true; - return 0; + return 0; case WM_CHAR: ch = wParam; return 0; - case WM_KEYUP: - keys[wParam] = false; - return 0; - case WM_SIZE: - ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); - return 0; + case WM_KEYUP: + keys[wParam] = false; + return 0; + case WM_SIZE: + ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); + return 0; case WM_TIMER: angle = angle + 1; if(angle>359) angle = 0; @@ -327,7 +327,7 @@ void ScaleVertex(VERTEX &v, float XScale, float YScale, float ZScale) { void DrawEQModel(FileLoader *fileloader, int modnum) { - + Polygon *poly; Vertex *verts[3]; VERTEX v1, v2, v3; @@ -363,16 +363,16 @@ void DrawEQModel(FileLoader *fileloader, int modnum) { if(maxz-minz>maxDimension) maxDimension = maxz-minz; // Hack for very small models (e.g. spoons) - if(maxDimension>1) - glTranslatef(-1.5f,0.0f,-(maxDimension*2)); + if(maxDimension>1) + glTranslatef(-1.5f,0.0f,-(maxDimension*2)); else - glTranslatef(-1.5f,0.0f,-10); + glTranslatef(-1.5f,0.0f,-10); // angle is updated by a timer every 50ms. glRotatef(angle, 1, 0, 0); glRotatef(angle, 0, 1, 0); glRotatef(angle, 0, 0, 1); - + glBegin(GL_TRIANGLES); for(int i = 0; i < model->poly_count; ++i) { @@ -398,23 +398,23 @@ void DrawEQModel(FileLoader *fileloader, int modnum) { ScaleVertex(v2, 10, 10, 10); ScaleVertex(v3, 10, 10, 10); } - + // Assign a kind of random colour to each polygon //glColor3b((i%50)+50,(i*5)%200,(i*10)%200); float col = (float)(100 + ((i*10) % 150)) /250 * 1.0f; glColor3f(col, col, col); - + glVertex3f(v1.x, v1.z, v1.y); glVertex3f(v2.x, v2.z, v2.y); glVertex3f(v3.x, v3.z, v3.y); - + } glEnd(); } bool ProcessZoneFile(const char *shortname) { - + char bufs[96]; Archive *archive; @@ -427,7 +427,7 @@ bool ProcessZoneFile(const char *shortname) { archive = new PFSLoader(); fff = fopen(bufs, "rb"); - if(fff != NULL) + if(fff != NULL) FileType = S3D; else { sprintf(bufs, "%s.eqg", shortname); @@ -443,15 +443,15 @@ bool ProcessZoneFile(const char *shortname) { if(archive->Open(fff) == 0) { MessageBox(NULL,"Unable to open container file","ERROR",MB_OK|MB_ICONEXCLAMATION); - + return(false); } switch(FileType) { - case S3D: + case S3D: mfileloader = new WLDLoader(); if(mfileloader->Open(NULL, (char *) shortname, archive) == 0) { - + MessageBox(NULL,"Error reading WLD from container file","ERROR",MB_OK|MB_ICONEXCLAMATION); return(false); } @@ -485,11 +485,11 @@ bool ProcessZoneFile(const char *shortname) { int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; BOOL done=false; - FILE *fp; + FILE *fp; - for(int i=0;i<256;i++) + for(int i=0;i<256;i++) keys[i] = false; - + char* buf = (char *) new char[strlen(lpCmdLine) + 1] ; char *pTmp = buf; @@ -501,48 +501,48 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } strcpy(buf,lpCmdLine); - + if(!ProcessZoneFile(buf)) return 0; - + if (!CreateGLWindow("EQ Model Viewer",1280,768,16)) - return 0; - + return 0; + while(!done) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { - if (msg.message==WM_QUIT) - done=true; + if (msg.message==WM_QUIT) + done=true; else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { - if ((active && !DrawGLScene(buf)) || keys[VK_ESCAPE]) - done=true; + if ((active && !DrawGLScene(buf)) || keys[VK_ESCAPE]) + done=true; else - SwapBuffers(hDC); + SwapBuffers(hDC); // Use + and - to cycle through the models - if (toupper(ch)=='+') { - if(modelnum+1 < mfileloader->model_data.model_count) + if (toupper(ch)=='+') { + if(modelnum+1 < mfileloader->model_data.model_count) modelnum++; else modelnum=0; angle = 0; } - if (toupper(ch)=='-') { + if (toupper(ch)=='-') { if(modelnum>0) modelnum--; else modelnum = mfileloader->model_data.model_count - 1; - angle = 0; + angle = 0; } ch = 0; } } KillGLWindow(); - return (msg.wParam); + return (msg.wParam); } diff --git a/utils/azone2/awater.cpp b/utils/azone2/awater.cpp index ee15a02da..940c27596 100644 --- a/utils/azone2/awater.cpp +++ b/utils/azone2/awater.cpp @@ -10,22 +10,22 @@ Father Nitwit's Zone to map conversion program. Copyright (C) 2004 Father Nitwit (eqemu@8ass.com) - + This thing uses code from freaku, so whatever license that comes under is relavent, if you care. - + the rest of it is GPL, even though I hate the GPL. 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 @@ -76,7 +76,7 @@ long BSPCountNodes(BSP_Node *tree, long node_number); int main(int argc, char *argv[]) { long DefaultRegionType=RegionTypeWater; - + if((argc < 2) || (argc > 3) || #ifndef WIN32 @@ -90,9 +90,9 @@ int main(int argc, char *argv[]) { printf("\nIf -dl is omitted, untagged special regions will be marked as water\n"); return(1); } - + char bufm[250]; - + if(argc==3) DefaultRegionType=RegionTypeLava; sprintf(bufm, "%s.wtr", argv[argc-1]); @@ -110,15 +110,15 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { char bufs[96]; Archive *archive; WLDLoader *fileloader; - long WaterOrLavaCount = 0; - + long WaterOrLavaCount = 0; + //TODO: clean up a LOT of memory that the freaku code does not - + sprintf(bufs, "%s.s3d", shortname); archive = new PFSLoader(); - + FILE *s3df = fopen(bufs, "rb"); if(s3df == nullptr) { // One day we may try EQG, but not today. @@ -131,8 +131,8 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { } printf("Loading %s...\n", bufs); - fileloader = new WLDLoader(); - + fileloader = new WLDLoader(); + if(fileloader->Open(nullptr, (char *) shortname, archive) == 0) { printf("Error reading WLD from %s\n", bufs); return(false); @@ -152,7 +152,7 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { case RegionTypeUnsupported: { printf("Unsupported\n"); break; } case RegionTypeUntagged: { printf("Untagged. We will set it to "); - if(DefaultRegionType==RegionTypeWater) { + if(DefaultRegionType==RegionTypeWater) { printf("Water\n"); } else printf("Lava\n"); data29->region_type = DefaultRegionType; @@ -172,7 +172,7 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { } - + if(tree==nullptr) { printf("No BSP Tree. Bailing out\n"); return(false); @@ -184,12 +184,12 @@ bool BuildWaterMap(const char *shortname, long DefaultRegionType) { // Now we mark each leaf in the BSP tree that is in a 'special area' with what type the area is // Water, Lava, Zoneline etc - + for(int i=0; ifragcount; i++) { if(fileloader->frags[i]->type == 0x29) { data29 = (struct_Data29 *) fileloader->frags[i]->frag; for(long j=0; jregion_count; j++) { - BSPMarkRegion(tree, 1,data29->region_array[j]+1, data29->region_type); + BSPMarkRegion(tree, 1,data29->region_array[j]+1, data29->region_type); } } } @@ -268,7 +268,7 @@ long BSPCountNodes(BSP_Node *tree, long node_number) { return(NodesInRightBranch + NodesInLeftBranch + 1); } - + long BSPFindRegion(BSP_Node *tree, long node_number, long region) { //printf("Find Region %ld in node %ld\n", region, node_number); @@ -281,7 +281,7 @@ long BSPFindRegion(BSP_Node *tree, long node_number, long region) { if(tree[node_number-1].region==region) return node_number; } - + long retnode ; if(tree[node_number-1].left!=0) { retnode = BSPFindRegion(tree, tree[node_number-1].left, region); @@ -303,15 +303,15 @@ long BSPFindNode(BSP_Node *tree, long node_number, float x, float y, float z) { printf("BSP Find Node, currently in Node %ld\n", node_number); // Are we at a leaf - + if((tree[node_number-1].left==0)&& (tree[node_number-1].right==0)) { return tree[node_number-1].region; } - + // No, so determine which side of the split plane we are on // - + distance = (x * tree[node_number-1].normal[0]) + (y * tree[node_number-1].normal[1]) + (z * tree[node_number-1].normal[2]) + @@ -341,7 +341,7 @@ long BSPFindNode(BSP_Node *tree, long node_number, float x, float y, float z) { } - + long BSPMarkRegion(BSP_Node *tree, long node_number, long region, int region_type) { //printf("Find Region %ld in node %ld\n", region, node_number); if(node_number<1) { @@ -369,7 +369,7 @@ long BSPMarkRegion(BSP_Node *tree, long node_number, long region, int region_typ return 0; } - + diff --git a/utils/azone2/azone.h b/utils/azone2/azone.h index 641676194..3021b118a 100644 --- a/utils/azone2/azone.h +++ b/utils/azone2/azone.h @@ -38,7 +38,7 @@ using namespace std; unsigned shorts are adequate because, worst case even in a zone that is 6000x6000 with a small node size of 30x30, there are only 40000 nodes. - + quadrent definitions: quad 1 (nodes[0]): x>=0, y>=0 @@ -48,7 +48,7 @@ using namespace std; x<0, y<0 quad 4 (nodes[3]): x>=0, y<0 - + */ #define MAX_POLY_VTX 24 //arbitrary, im too lazy to figure it out //cut a triangle at most 6 times.... @@ -65,12 +65,12 @@ public: GPoint(); GPoint(VERTEX &v); GPoint(float x, float y, float z); - + inline void operator()(float nx, float ny, float nz) { x = nx; y = ny; z = nz; } - + GPoint cross(const GPoint &them) const; float dot3(const GPoint &them) const; - + float x; float y; float z; @@ -83,13 +83,13 @@ public: GVector(); GVector(const GPoint &them); GVector(float x, float y, float z, float w = 1.0f); - + inline void operator()(float nx, float ny, float nz, float nw) { x = nx; y = ny; z = nz; W = nw; } float dot4(const GVector &them) const; float dot4(const GPoint &them) const; void normalize(); float length(); - + float W; }; @@ -104,7 +104,7 @@ class QTBuilder { public: QTBuilder(); ~QTBuilder(); - + bool build(const char *shortname); bool build_eqg(const char *shortname); void AddPlaceable(FileLoader *fileloader, char *ZoneFileName, bool ListPlaceable=false); @@ -113,28 +113,28 @@ public: void ScaleVertex(VERTEX &v, float XScale, float YScale, float ZScale); void TranslateVertex(VERTEX &v, float XOffset, float YOffset, float ZOffset); bool writeMap(const char *file); - + bool FaceInNode(const QTNode *q, const FACE *f); protected: - + void AddFace(VERTEX &v1, VERTEX &v2, VERTEX &v3); - + int ClipPolygon(POLYGON *poly, GVector *plane); - + //dynamic during load // vector _VertexList; vector _FaceList; - + //static once loaded // unsigned long vertexCount; unsigned long faceCount; // VERTEX * vertexBlock; FACE * faceBlock; - + VERTEX tempvtx[MAX_POLY_VTX]; - + QTNode *_root; - + static void NormalizeN(FACE *p); #ifdef COUNT_MACTHES @@ -151,28 +151,28 @@ class QTNode { public: QTNode(QTBuilder *builder, float Tminx, float Tmaxx, float Tminy, float Tmaxy); ~QTNode(); - + void clearNodes(); - + void doSplit(); void divideYourself(int depth); - + void buildVertexes(); // bool writeFile(FILE *out); - + unsigned long countNodes() const; unsigned long countFacelists() const; - + void fillBlocks(nodeHeader *heads, unsigned long *flist, unsigned long &hindex, unsigned long &findex); - + float minx; float miny; float maxx; float maxy; unsigned long nfaces; vector faces; - + /* quadrent definitions: quad 1 (node1): @@ -190,7 +190,7 @@ public: QTNode *node4; GPoint v[8]; bool final; - + protected: QTBuilder *builder; }; diff --git a/utils/azone2/dat.cpp b/utils/azone2/dat.cpp index 0dad16ffa..c89bd4d11 100644 --- a/utils/azone2/dat.cpp +++ b/utils/azone2/dat.cpp @@ -98,14 +98,14 @@ string GetToken(uchar *&Buffer, int &Position) ++Position; } ++Position; - //printf("Returning %s\n", Token.c_str()); + //printf("Returning %s\n", Token.c_str()); return Token; } int AddModelName(Content_3D *C3D, string ModelName) { vector::iterator Iterator; - + for(unsigned int i = 0; i < C3D->ModelNames.size(); ++i) { #ifndef WIN32 @@ -116,8 +116,8 @@ int AddModelName(Content_3D *C3D, string ModelName) return i; } - - + + C3D->ModelNames.push_back(ModelName); return C3D->ModelNames.size() - 1; @@ -171,7 +171,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { if(filename != zone_name) delete[] filename; - + buf_start = buffer; //TODO: Find out what these three unknowns are @@ -341,10 +341,10 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { this->model_data.zone_model = new Zone_Model; zm = this->model_data.zone_model; - + zm->vert_count = QuadCount * TileCount * 4; zm->poly_count = QuadCount * 2 * TileCount; - + zm->verts = new Vertex *[zm->vert_count]; zm->polys = new Polygon *[zm->poly_count]; @@ -360,7 +360,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { for(int TileNumber = 0; TileNumber < TileCount; ++TileNumber) { - + int TileLNG = VARSTRUCT_DECODE_TYPE(uint32, buffer); int TileLAT = VARSTRUCT_DECODE_TYPE(uint32, buffer); int TileUNK = VARSTRUCT_DECODE_TYPE(uint32, buffer); @@ -449,7 +449,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { int LayerCount = VARSTRUCT_DECODE_TYPE(uint32, buffer); VARSTRUCT_DECODE_STRING(s, buffer); - + int OverlayCount = 0; for(int Layer = 1; Layer < LayerCount; ++Layer) @@ -462,10 +462,10 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { { uint8 Byte = VARSTRUCT_DECODE_TYPE(uint8, buffer); } - + ++OverlayCount; - } + } int Count1 = VARSTRUCT_DECODE_TYPE(uint32, buffer); #ifdef DEBUGDAT @@ -517,7 +517,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { printf("Model: %s LOC: %8.3f, %8.3f, %8.3f, ROT: %8.3f, %8.3f, %8.3f\n", ModelName, x, y, z, RotX, RotY, RotZ); #endif ObjectGroupEntry NewObjectGroup; - + NewObjectGroup.FromTOG = false; NewObjectGroup.y = y; @@ -534,18 +534,18 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { // of another tile, which means based on the data for the tile we are processing, we should be unable to // calculate the Z value for that object. // - // By hand editing an .EQG, it was discovered that what the client appears to do is calculate the Z value + // By hand editing an .EQG, it was discovered that what the client appears to do is calculate the Z value // for these objects by adjusting the x/y offsets by +/- (QuadsPerTile * UnitsPerVert) until the offsets // are within this tiles boundaries and using the corresponding height values. // - // For example, if a model has an offset of -157.5, -157.5 and QPT * UPV = 160, then the height value used + // For example, if a model has an offset of -157.5, -157.5 and QPT * UPV = 160, then the height value used // would be the height at +2.5, +2.5 in this tile. // // This doesn't make a great deal of sense, but it is how the EQ graphics engine appears to do things. // // These 'Adjusted' x/y offsets are used only for determing the ground Z for the object. The actual placement // of the object relative to the terrain uses the unadjusted offsets. - // + // // For the record, as of SoF, this applies to the following zones and objects: // // arcstone: Model translations adjusted from -14.000, 219.000 to 146.000, 59.000 @@ -737,7 +737,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { float ZAdjust = VARSTRUCT_DECODE_TYPE(float, buffer); #ifdef DEBUGDAT - printf("ZAdjust %8.3f\n", ZAdjust); + printf("ZAdjust %8.3f\n", ZAdjust); #endif char TogFileName[255]; @@ -764,7 +764,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { NewObjectGroup.TileY = TileXStart; NewObjectGroup.TileZ = 0; - + NewObjectGroup.RotX = RotX; NewObjectGroup.RotY = RotY; NewObjectGroup.RotZ = RotZ; @@ -821,7 +821,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { NewObjectGroup.SubObjects.push_back(model_data.PlaceableList.size()-1); } if(Token == "*END_OBJECTGROUP") - { + { #ifdef DEBUGDAT printf("Pushing back new ObjectGroup\n"); printf(" Position : %8.3f, %8.3f, %8.3f\n", NewObjectGroup.x, NewObjectGroup.y, NewObjectGroup.z); @@ -867,7 +867,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { float QuadVertex2X = QuadVertex1X + (QuadsPerTile * UnitsPerVertX); float QuadVertex2Y = QuadVertex1Y; float QuadVertex2Z = QuadVertex1Z; - + float QuadVertex3X = QuadVertex2X; float QuadVertex3Y = QuadVertex1Y + (QuadsPerTile * UnitsPerVertY); float QuadVertex3Z = QuadVertex1Z; @@ -875,7 +875,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { float QuadVertex4X = QuadVertex1X; float QuadVertex4Y = QuadVertex3Y; float QuadVertex4Z = QuadVertex1Z; - + ++VertexNumber; @@ -903,7 +903,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { zm->polys[PolyNumber]->v1 = VertexNumber; zm->polys[PolyNumber]->v2 = VertexNumber - 3; zm->polys[PolyNumber]->v3 = VertexNumber - 2; - zm->polys[PolyNumber]->tex = -1; + zm->polys[PolyNumber]->tex = -1; } else { @@ -915,7 +915,7 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { { if((Quad % QuadsPerTile) == 0) ++RowNumber; - + // Other common values for this Byte are 0x80, 0x82. Setting them all to zero has no obvious visual // effect. if(Bytes[Quad] & 0x01) // Indicates Quad should not be included because an object will overlay it. @@ -924,47 +924,47 @@ int DATLoader::Open(char *base_path, char *zone_name, Archive *archive) { float QuadVertex1X = TileXStart + (RowNumber * UnitsPerVertX); float QuadVertex1Y = TileYStart + (Quad % QuadsPerTile) * UnitsPerVertY; float QuadVertex1Z = Floats[Quad + RowNumber]; - + float QuadVertex2X = QuadVertex1X + UnitsPerVertX; float QuadVertex2Y = QuadVertex1Y; float QuadVertex2Z = Floats[Quad + RowNumber + QuadsPerTile + 1]; - + float QuadVertex3X = QuadVertex1X + UnitsPerVertX; float QuadVertex3Y = QuadVertex1Y + UnitsPerVertY; float QuadVertex3Z = Floats[Quad + RowNumber + QuadsPerTile + 2]; - + float QuadVertex4X = QuadVertex1X; float QuadVertex4Y = QuadVertex1Y + UnitsPerVertY; float QuadVertex4Z = Floats[Quad + RowNumber + 1]; - + ++VertexNumber; - + zm->verts[VertexNumber++] = new Vertex(QuadVertex1Y, QuadVertex1X, QuadVertex1Z); - + zm->verts[VertexNumber++] = new Vertex(QuadVertex2Y, QuadVertex2X, QuadVertex2Z); - + zm->verts[VertexNumber++] = new Vertex(QuadVertex3Y, QuadVertex3X, QuadVertex3Z); - + zm->verts[VertexNumber] = new Vertex(QuadVertex4Y, QuadVertex4X, QuadVertex4Z); - + PolyNumber++; - + zm->polys[PolyNumber] = new Polygon; - + zm->polys[PolyNumber]->v1 = VertexNumber; zm->polys[PolyNumber]->v2 = VertexNumber - 2; zm->polys[PolyNumber]->v3 = VertexNumber - 1; zm->polys[PolyNumber]->tex = -1; - + PolyNumber++; - + zm->polys[PolyNumber] = new Polygon; - + zm->polys[PolyNumber]->v1 = VertexNumber; zm->polys[PolyNumber]->v2 = VertexNumber - 3; zm->polys[PolyNumber]->v3 = VertexNumber - 2; - zm->polys[PolyNumber]->tex = -1; - + zm->polys[PolyNumber]->tex = -1; + } } zm->vert_count = VertexNumber + 1; @@ -995,7 +995,7 @@ int DATLoader::Close() { for(i = 0; i < zm->poly_count; ++i) delete zm->polys[i]; - + delete[] zm->verts; delete[] zm->polys; diff --git a/utils/azone2/global.hpp b/utils/azone2/global.hpp index 968ac4825..9f099ddea 100644 --- a/utils/azone2/global.hpp +++ b/utils/azone2/global.hpp @@ -9,12 +9,8 @@ #include #endif -#ifndef nullptr -#define nullptr 0 -#endif - -typedef unsigned long uint32; -typedef long int32; +typedef unsigned int uint32; +typedef int int32; typedef unsigned short uint16; typedef short int16; diff --git a/utils/azone2/listobj.cpp b/utils/azone2/listobj.cpp index 687355e69..f69e5b7de 100644 --- a/utils/azone2/listobj.cpp +++ b/utils/azone2/listobj.cpp @@ -1,18 +1,18 @@ /* - List Placeable Objects in an S3D or EQG. + List Placeable Objects in an S3D or EQG. By Derision, based on OpenEQ File Loaders by Daeken et al. 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 @@ -48,29 +48,29 @@ enum EQFileType { S3D, EQG, UNKNOWN }; int main(int argc, char *argv[]) { printf("LISTOBJ: List Placeable Objects in .S3D or .EQG zone files.\n"); - + if(argc != 2) { printf("Usage: %s (zone short name)\n", argv[0]); return(1); } - + return(ProcessZoneFile(argv[1])); } bool ProcessZoneFile(const char *shortname) { - + char bufs[96]; Archive *archive; FileLoader *fileloader; Zone_Model *zm; FILE *fff; EQFileType FileType = UNKNOWN; - + sprintf(bufs, "%s.s3d", shortname); archive = new PFSLoader(); fff = fopen(bufs, "rb"); - if(fff != nullptr) + if(fff != nullptr) FileType = S3D; else { sprintf(bufs, "%s.eqg", shortname); @@ -92,7 +92,7 @@ bool ProcessZoneFile(const char *shortname) { bool V4Zone = false; switch(FileType) { - case S3D: + case S3D: fileloader = new WLDLoader(); if(fileloader->Open(nullptr, (char *) shortname, archive) == 0) { printf("Error reading WLD from %s\n", bufs); @@ -118,7 +118,7 @@ bool ProcessZoneFile(const char *shortname) { zm = fileloader->model_data.zone_model; - + if(!V4Zone) ListPlaceable(fileloader, bufs); else @@ -137,11 +137,11 @@ void ListPlaceable(FileLoader *fileloader, char *ZoneFileName) { fileloader->model_data.placeable[i]->x, fileloader->model_data.placeable[i]->z, fileloader->model_data.placeable[i]->model, - fileloader->model_data.models[fileloader->model_data.placeable[i]->model]->name); + fileloader->model_data.models[fileloader->model_data.placeable[i]->model]->name); } } - + void ListPlaceableV4(FileLoader *fileloader, char *ZoneFileName) { @@ -175,7 +175,7 @@ void ListPlaceableV4(FileLoader *fileloader, char *ZoneFileName) list::iterator ModelIterator; ModelIterator = (*Iterator).SubObjects.begin(); - + while(ModelIterator != (*Iterator).SubObjects.end()) { int SubModel = (*ModelIterator); diff --git a/utils/azone2/pfs.cpp b/utils/azone2/pfs.cpp index c58816d5e..05cd8d31e 100644 --- a/utils/azone2/pfs.cpp +++ b/utils/azone2/pfs.cpp @@ -46,12 +46,12 @@ inline void decompress(char *p, char *p2, int len, int uLen) { d_stream.zalloc = (alloc_func)0; d_stream.zfree = (free_func)0; d_stream.opaque = (voidpf)0; - + d_stream.next_in = (Bytef *) p; d_stream.avail_in = len; d_stream.next_out = (Bytef *) p2; d_stream.avail_out = uLen; - + inflateInit(&d_stream); status = inflate(&d_stream, Z_NO_FLUSH); inflateEnd(&d_stream); @@ -107,7 +107,7 @@ int PFSLoader::Open(FILE *fp) fseek(fp, s3d_header.offset, SEEK_SET); fread(&s3d_dir_header, sizeof(struct_directory_header), 1, fp); - + this->count = s3d_dir_header.count - 1; this->filenames = new char *[s3d_dir_header.count]; this->files = new uint32[s3d_dir_header.count - 1]; @@ -206,7 +206,7 @@ const char *PFSLoader::FindExtension(const char *ext) { int i; int elen = strlen(ext); - + for(i = 0; i < this->count; ++i) { int flen = strlen(this->filenames[i]); if(flen <= elen) @@ -234,7 +234,7 @@ int PFSLoader::GetFile(char *name, uchar **buf, int *len) { fread(&s3d_dir, sizeof(struct_directory), 1, this->fp); fseek(this->fp, s3d_dir.offset, SEEK_SET); *buf = new uchar[s3d_dir.size]; - + inf = 0; while(inf < (int)s3d_dir.size) { fread(&s3d_data, sizeof(struct_data_block), 1, this->fp); diff --git a/utils/azone2/ter.cpp b/utils/azone2/ter.cpp index c2e021e4f..bc5dd4f07 100644 --- a/utils/azone2/ter.cpp +++ b/utils/azone2/ter.cpp @@ -105,17 +105,17 @@ int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) { this->model_data.zone_model = new Zone_Model; zm = this->model_data.zone_model; - + zm->vert_count = thdr->vert_count; zm->poly_count = thdr->tri_count; - + zm->verts = new Vertex *[zm->vert_count]; zm->polys = new Polygon *[zm->poly_count]; this->model_data.plac_count = 0; this->model_data.model_count = 0; - - buffer = ter_orig + thdr->list_len + sizeof(ter_header); + + buffer = ter_orig + thdr->list_len + sizeof(ter_header); if(thdr->magic[3] == 'M') buffer = buffer + 4; #ifdef DEBUGTER printf("Starting offset is %8X\n", buffer-ter_orig); @@ -158,7 +158,7 @@ int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) { } - + j = 0; for(i = 0; i < (unsigned int)zm->poly_count; ++i) { ttri = (ter_triangle *) buffer; @@ -167,7 +167,7 @@ int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) { continue; } zm->polys[j] = new Polygon; -/* +/* zm->polys[j]->v1 = ttri->v1; zm->polys[j]->v2 = ttri->v2; zm->polys[j]->v3 = ttri->v3; @@ -201,15 +201,15 @@ int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) { #endif zm->polys[j]->tex = ttri->group; } - + ++j; buffer += sizeof(ter_triangle); } - + zm->poly_count = j; - + zm->tex_count = 0; - + delete[] mlist; delete [] ter_orig; diff --git a/utils/azone2/types.h b/utils/azone2/types.h index f3d6c3016..af02137af 100644 --- a/utils/azone2/types.h +++ b/utils/azone2/types.h @@ -1,8 +1,8 @@ #ifndef __EQCLIENT_TYPES_H_ #define __EQCLIENT_TYPES_H_ -typedef unsigned long uint32; -typedef long int32; +typedef unsigned int uint32; +typedef int int32; typedef unsigned short uint16; typedef short int16; diff --git a/utils/azone2/wld.cpp b/utils/azone2/wld.cpp index 0fddac191..45471738c 100644 --- a/utils/azone2/wld.cpp +++ b/utils/azone2/wld.cpp @@ -150,11 +150,11 @@ FRAG_CONSTRUCTOR(Data21) { } - + } FRAG_CONSTRUCTOR(Data22) { - + int pos; uchar *data6area ; @@ -190,7 +190,7 @@ FRAG_CONSTRUCTOR(Data22) { Frag36Ref = *((long *) (data6area+20)); //printf("Frag 36 reference?: %ld\n", *((long *) (data6area+20))); } - + @@ -198,7 +198,7 @@ FRAG_CONSTRUCTOR(Data22) { } FRAG_CONSTRUCTOR(Data29) { - + long a,flags, numregions, lenstr; struct_Data29 *data29 = (struct_Data29 *) malloc(sizeof(struct_Data29)); @@ -213,7 +213,7 @@ FRAG_CONSTRUCTOR(Data29) { else if(!strncmp((char *) &wld->sHash[-frag_name], "VWA", 3)) data29->region_type = 7; // VWater ? this->frag = (void *) data29; - + flags = *buf; numregions = *((long *)(buf+4)); data29->region_count = numregions ; @@ -277,7 +277,7 @@ FRAG_CONSTRUCTOR(Data30) { this->frag = (void *) tex; return; } - + tex = (Texture *) wld->frags[ref - 1]->frag; if(data->params1 & (1 << 1) || data->params1 & (1 << 2) || data->params1 & (1 << 3) || data->params1 & (1 << 4)) @@ -313,7 +313,7 @@ FRAG_CONSTRUCTOR(Data36) { VertexNormal *vn; Vert *v; - + TexRef *tr; @@ -393,7 +393,7 @@ FRAG_CONSTRUCTOR(Data36) { for(i = 0; i < header->normalsCount; ++i) { - + if(ivertexCount) { vn = (VertexNormal *) buf; vert = model->verts[i]; @@ -419,7 +419,7 @@ FRAG_CONSTRUCTOR(Data36) { // in the WLD loader in the stock azone, and has the effect of screwing up the normals, // Changed to keep things consistent with prior versions. poly->v1 = p->v1; - poly->v2 = p->v2; + poly->v2 = p->v2; poly->v3 = p->v3; #ifdef DEBUGWLD2 printf("Frag36: Polygon: %5d Vertices: %5d, %5d, %5d\n", i, poly->v1, poly->v2, poly->v3); @@ -502,7 +502,7 @@ int WLDLoader::Open(char *base_path, char *zone_name, Archive *archive) { return 0; buffer += sizeof(struct_wld_header); - + this->sHash = buffer; decode(this->sHash, header->stringHashSize); buffer += header->stringHashSize; @@ -535,7 +535,7 @@ int WLDLoader::Open(char *base_path, char *zone_name, Archive *archive) { case 0x30: FRAGMENT(Data30); break; case 0x31: FRAGMENT(Data31); break; case 0x36: FRAGMENT(Data36); break; - + default: this->frags[i] = new Fragment; break; } @@ -545,7 +545,7 @@ int WLDLoader::Open(char *base_path, char *zone_name, Archive *archive) { buffer += frag->size - 4; } - + if(!strcmp(&zone_name[strlen(zone_name) - 4], "_obj")) { @@ -585,12 +585,12 @@ int WLDLoader::Open(char *base_path, char *zone_name, Archive *archive) { } - + zm->verts = new Vertex *[zm->vert_count]; zm->polys = new Polygon *[zm->poly_count]; - + vc = pc = 0; - + for(i = 0; i < this->fragcount; ++i) { if(this->frags[i]->type != 0x36) continue; @@ -714,7 +714,7 @@ int WLDLoader::Close() { for(j = 0; j < zm->tex_count; ++j) delete zm->tex[j]; delete[] zm->tex; - + delete[] zm->verts; delete[] zm->polys; } diff --git a/utils/azone2/wld.hpp b/utils/azone2/wld.hpp index b6760ea8a..4665be754 100644 --- a/utils/azone2/wld.hpp +++ b/utils/azone2/wld.hpp @@ -33,7 +33,7 @@ class WLDLoader : public FileLoader { public: WLDLoader(); ~WLDLoader(); - + virtual int Open(char *base_path, char *zone_name, Archive *archive); virtual int Close(); diff --git a/utils/azone2/zon.cpp b/utils/azone2/zon.cpp index 82e5812b4..efa275cf7 100644 --- a/utils/azone2/zon.cpp +++ b/utils/azone2/zon.cpp @@ -154,7 +154,7 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { // Derision: 23/06/08 // dranikcatacombsa.eqg has a couple of model names with a left parenthesis where there should // be an underscore. E.g. OBP_DZ_Lbanner0)_00.MOD instead of OBP_DZ_Lbanner0__00.MOD - // This is the only zone I have seen this in, but is the reason for the follow code to replace + // This is the only zone I have seen this in, but is the reason for the follow code to replace // the parenthesis with an underscore. // for(unsigned int i=0; ilist_len + hdr->NumberOfModels * 4; this->model_data.plac_count = hdr->obj_count - 1; @@ -187,8 +187,8 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { #ifdef DEBUGPLAC printf(" Placeable count is %d\n", this->model_data.plac_count); #endif - this->model_data.placeable = new Placeable *[this->model_data.plac_count]; - + this->model_data.placeable = new Placeable *[this->model_data.plac_count]; + plac = (zon_placeable *) buffer; base[0] = plac->x; base[1] = plac->y; @@ -250,7 +250,7 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { long UnknownSize = *((long *)(buffer)); buffer = buffer + 4 + (UnknownSize * 4); } - + } @@ -272,7 +272,7 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { } // printf("Attempting to open MOD file %s\n", model_names[j]); fflush(stdout); if(model_loaders[j].Open(nullptr, model_names[j], archive)) { - + this->model_data.models[j] = new Model; this->model_data.models[j]->vert_count = model_loaders[j].model_data.zone_model->vert_count; this->model_data.models[j]->poly_count = model_loaders[j].model_data.zone_model->poly_count; @@ -282,10 +282,10 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { this->model_data.models[j]->tex = model_loaders[j].model_data.zone_model->tex; this->model_data.models[j]->name = new char[strlen(model_names[j])+1]; strcpy(this->model_data.models[j]->name, model_names[j]); - + tex_tmp = 1; // I think this is looking to see if the placeable model textures already exist in the zone model. - // + // for(i = 0; i < this->model_data.models[j]->tex_count; ++i) { tex_tmp = 1; // Derision for(k = 0; k < this->model_data.zone_model->tex_count; ++k) { @@ -310,7 +310,7 @@ int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) { continue; } for(l = 0; l < this->model_data.models[k]->tex_count; ++l) { - if(this->model_data.models[k]->tex[l]->filenames[0] == this->model_data.models[j]->tex[i]->filenames[0] || + if(this->model_data.models[k]->tex[l]->filenames[0] == this->model_data.models[j]->tex[i]->filenames[0] || (this->model_data.models[k]->tex[l]->filenames[0] && this->model_data.models[j]->tex[i]->filenames[0] && !strcmp(this->model_data.models[k]->tex[l]->filenames[0], this->model_data.models[j]->tex[i]->filenames[0]))) { diff --git a/utils/azone2/zon.hpp b/utils/azone2/zon.hpp index 876bdfc4e..f7198ffa7 100644 --- a/utils/azone2/zon.hpp +++ b/utils/azone2/zon.hpp @@ -35,7 +35,7 @@ class ZonLoader : public FileLoader { public: ZonLoader(); ~ZonLoader(); - + virtual int Open(char *base_path, char *zone_name, Archive *archive); virtual int Close(); diff --git a/utils/azone2/zonv4.cpp b/utils/azone2/zonv4.cpp index 40abc53d3..c2e0b32af 100644 --- a/utils/azone2/zonv4.cpp +++ b/utils/azone2/zonv4.cpp @@ -26,7 +26,7 @@ Zonv4Loader::~Zonv4Loader() int Zonv4Loader::Open(char *base_path, char *zone_name, Archive *archive) { - + uchar *buffer; int position; int buf_len; diff --git a/utils/azone2/zonv4.hpp b/utils/azone2/zonv4.hpp index c97b3bbd5..cbfd4ef18 100644 --- a/utils/azone2/zonv4.hpp +++ b/utils/azone2/zonv4.hpp @@ -31,7 +31,7 @@ class Zonv4Loader : public FileLoader { public: Zonv4Loader(); ~Zonv4Loader(); - + virtual int Open(char *base_path, char *zone_name, Archive *archive); virtual int Close(); diff --git a/utils/defaults/eqemu_config.xml.full b/utils/defaults/eqemu_config.xml.full index 859dafa33..9f1de78cd 100644 --- a/utils/defaults/eqemu_config.xml.full +++ b/utils/defaults/eqemu_config.xml.full @@ -25,7 +25,7 @@ some long random string - + diff --git a/utils/defaults/mime.types b/utils/defaults/mime.types index e0ef69119..9cf771941 100644 --- a/utils/defaults/mime.types +++ b/utils/defaults/mime.types @@ -3,24 +3,24 @@ # http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/extension-map.html # for more details -application/postscript ai eps ps -application/rtf rtf -application/x-tex tex -application/x-texinfo texinfo texi -application/x-troff t tr roff -audio/basic au snd +application/postscript ai eps ps +application/rtf rtf +application/x-tex tex +application/x-texinfo texinfo texi +application/x-troff t tr roff +audio/basic au snd audio/x-aiff aif aiff aifc -audio/x-wav wav -image/gif gif -image/ief ief +audio/x-wav wav +image/gif gif +image/ief ief image/jpeg jpeg jpg jpe -image/tiff tiff tif -image/x-xwindowdump xwd -text/html html +image/tiff tiff tif +image/x-xwindowdump xwd +text/html html text/plain txt c cc h -video/mpeg mpeg mpg mpe -video/quicktime qt mov -video/x-msvideo avi +video/mpeg mpeg mpg mpe +video/quicktime qt mov +video/x-msvideo avi video/x-sgi-movie movie text/css css image/png png diff --git a/utils/defaults/plugins/check_handin.pl b/utils/defaults/plugins/check_handin.pl index 57da2fd73..13cad9b91 100644 --- a/utils/defaults/plugins/check_handin.pl +++ b/utils/defaults/plugins/check_handin.pl @@ -34,7 +34,7 @@ sub check_mq_handin { return 1; } -sub return_items { +sub return_items { my $hashref = plugin::var('$itemcount'); my $client = plugin::val('$client'); my $items_returned = 0; @@ -45,7 +45,7 @@ sub return_items { 2 => [ plugin::val('$item3'), plugin::val('$item3_charges'), plugin::val('$item3_attuned') ], 3 => [ plugin::val('$item4'), plugin::val('$item4_charges'), plugin::val('$item4_attuned') ], ); - + foreach my $k (keys(%{$hashref})) { next if($k == 0); diff --git a/utils/defaults/templates/TreeMenu.css b/utils/defaults/templates/TreeMenu.css index 974be6379..b5c3055f8 100644 --- a/utils/defaults/templates/TreeMenu.css +++ b/utils/defaults/templates/TreeMenu.css @@ -28,17 +28,17 @@ font-style: normal; } -/* Since all menu items are links, the following can be equally important - * to your menu appearance. +/* Since all menu items are links, the following can be equally important + * to your menu appearance. * The main thing you may want to change are the A:link and A:visited colors. */ -*.tmenu0text A:link,*.tmenu1text A:link,*.tmenu2text A:link,*.tmenu3text A:link +*.tmenu0text A:link,*.tmenu1text A:link,*.tmenu2text A:link,*.tmenu3text A:link { text-decoration:none; color:#505080 } -*.tmenu0text A:visited,*.tmenu1text A:visited,*.tmenu2text A:visited,*.tmenu3text A:visited +*.tmenu0text A:visited,*.tmenu1text A:visited,*.tmenu2text A:visited,*.tmenu3text A:visited { text-decoration:none; color:#505080 } -*.tmenu0text A:active,*.tmenu1text A:active,*.tmenu2text A:active,*.tmenu3text A:active +*.tmenu0text A:active,*.tmenu1text A:active,*.tmenu2text A:active,*.tmenu3text A:active { text-decoration:none; color:#805050 } -*.tmenu0text A:hover,*.tmenu1text A:hover,*.tmenu2text A:hover,*.tmenu3text A:hover +*.tmenu0text A:hover,*.tmenu1text A:hover,*.tmenu2text A:hover,*.tmenu3text A:hover { text-decoration:underline; color:#FF0000 } @@ -51,7 +51,7 @@ } /* .tmenuSelected is used with linkSelectKey to highlight selected items */ -.tmenuSelected { +.tmenuSelected { background-color: yellow; } *.tmenuSelected A:link { text-decoration:none; color:#2020ff } diff --git a/utils/defaults/templates/TreeMenu.js b/utils/defaults/templates/TreeMenu.js index 90171c157..3f29ff5d0 100644 --- a/utils/defaults/templates/TreeMenu.js +++ b/utils/defaults/templates/TreeMenu.js @@ -12,7 +12,7 @@ // | notice, this list of conditions and the following disclaimer. | // | o Redistributions in binary form must reproduce the above copyright | // | notice, this list of conditions and the following disclaimer in the | -// | documentation and/or other materials provided with the distribution.| +// | documentation and/or other materials provided with the distribution.| // | o The names of the authors may not be used to endorse or promote | // | products derived from this software without specific prior written | // | permission. | @@ -51,7 +51,7 @@ this.imgWidth = 20; this.imgHeight = 20; this.n = new Array(); - + this.branches = new Array(); this.branchStatus = new Array(); this.layerRelations = new Array(); @@ -79,10 +79,10 @@ newNode.lineImageWidth = this.imgWidth; newNode.lineImageHeight = this.imgHeight; this.n[newIndex] = newNode; - + return this.n[newIndex]; } - + TreeMenu.prototype.SetImageSize = function(w, h) { this.imgWidth = w; this.imgHeight = h; @@ -96,15 +96,15 @@ var plustop = new Image; plustop.src = this.iconpath + '/plustop.gif'; var plusbottom = new Image; plusbottom.src = this.iconpath + '/plusbottom.gif'; var plus = new Image; plus.src = this.iconpath + '/plus.gif'; - + var minustop = new Image; minustop.src = this.iconpath + '/minustop.gif'; var minusbottom = new Image; minusbottom.src = this.iconpath + '/minusbottom.gif'; var minus = new Image; minus.src = this.iconpath + '/minus.gif'; - + var branchtop = new Image; branchtop.src = this.iconpath + '/branchtop.gif'; var branchbottom = new Image; branchbottom.src = this.iconpath + '/branchbottom.gif'; var branch = new Image; branch.src = this.iconpath + '/branch.gif'; - + var linebottom = new Image; linebottom.src = this.iconpath + '/linebottom.gif'; var line = new Image; line.src = this.iconpath + '/line.gif'; } @@ -122,7 +122,7 @@ var modifier = ''; var layerID = ''; var parentLayerID = ''; - + /** * Parse any optional arguments */ @@ -132,19 +132,19 @@ var expanded = arguments[3] ? arguments[3] : false; var visibility = arguments[4] ? arguments[4] : 'inline'; var parentLayerID = arguments[5] ? arguments[5] : null; - + var currentlevel = level.length; - + for (var i=0; i', this.iconpath, nodes[i].icon, nodes[i].iconImageWidth, nodes[i].iconImageHeight) : ''; - - + + /** * Build the html to write to the document * IMPORTANT: @@ -210,14 +210,14 @@ var imgTag = this.stringFormat('', this.iconpath, gifname, modifier, layerID, onMDown, nodes[i].lineImageWidth, nodes[i].lineImageHeight); var linkStart = nodes[i].link ? this.stringFormat('', nodes[i].link, this.linkTarget) : ''; var linkEnd = nodes[i].link ? '' : ''; - + // cc 2002-11-12 All these are additions var selectedStart = nodes[i].selected ? "" : ''; var selectedEnd = nodes[i].selected ? '' : ''; var nobrStart = this.brOK ? '' : ''; var nobrEnd = this.brOK ? '' : ''; - + // cc 2002-11-12 modified output = this.stringFormat('{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}
', layerTag, @@ -229,7 +229,7 @@ nodes[i].title, linkEnd, selectedEnd, nobrEnd); - + /** * Write out the HTML. Uses document.write for speed over layers and * innerHTML. This however means no dynamic adding/removing nodes on @@ -249,15 +249,15 @@ */ if (parentLayerID == null && nodes.length == 1) { var newPrepend = ''; - + } else if (i < (nodes.length - 1)) { // cc 2002-11-12 Both lines, added image size parameters. var newPrepend = prepend + this.stringFormat('', this.iconpath, nodes[i].lineImageWidth, nodes[i].lineImageHeight); - + } else { var newPrepend = prepend + this.stringFormat('', this.iconpath, nodes[i].lineImageWidth, nodes[i].lineImageHeight); } - + this.drawMenu(nodes[i].n, level, newPrepend, @@ -276,26 +276,26 @@ { var currentDisplay = this.getLayer(layerID).style.display; var newDisplay = (this.branchStatus[layerID] && currentDisplay == 'inline') ? 'none' : 'inline' - + for (var i=0; iquery($q); - if ($res2) { + if ($res2) { my $row5=$res2->fetch_row_hash; print <<"CHAR"; @@ -95,7 +95,7 @@ CHAR print "Account Name query error."; } } - print ""; + print ""; } else { print "IP Address query error."; } @@ -104,9 +104,9 @@ CHAR my $acctE = $EQDB->escape_string($acct); my $q; $q="select id,charname,sharedplat,status,revoked from account where name='$acctE'"; - + my $res=$EQDB->query($q); - if ($res) { + if ($res) { my $row=$res->fetch_row_hash; print <<"HTML"; @@ -139,17 +139,17 @@ HTML CHAR } - print "
$row2->{zonename} delete, - move acct, + move acct, move zone
"; + print ""; } else { print "Char query error."; } - + $q="SELECT ip,count FROM account_ip WHERE accid=$row->{id}"; my $res3=$EQDB->query($q); if($res3) { @@ -166,7 +166,7 @@ HTML $row3->{ip} $row3->{count} - + CHAR } print ""; @@ -185,7 +185,7 @@ HTML } else { print "Query error."; } - + print "Actions: ban/unban, set status, set world password, delete chars, move chars, delete account and chars"; } diff --git a/utils/defaults/templates/accounts.html b/utils/defaults/templates/accounts.html index 7166e0d91..e89e4e276 100644 --- a/utils/defaults/templates/accounts.html +++ b/utils/defaults/templates/accounts.html @@ -18,7 +18,7 @@ $type = $request->get("type", ""); ?>
Account Search:
- > Account Name   + > Account Name   > Character Name
@@ -41,8 +41,8 @@ if ($query) { } my $res=$EQDB->query($q); - if ($res) { - + if ($res) { + print "\n"; print "\t\n"; if ($type eq "char") { diff --git a/utils/defaults/templates/bugs.html b/utils/defaults/templates/bugs.html index 063bd6d10..7ceb7db64 100644 --- a/utils/defaults/templates/bugs.html +++ b/utils/defaults/templates/bugs.html @@ -12,7 +12,7 @@ my $id = $request->get("id", "0"); $EQW->ResolveBug($id); } - + $offset = $request->get("offset", "0"); $count = $EQW->CountBugs(); @bugs = $EQW->ListBugs($offset); diff --git a/utils/defaults/templates/commands.html b/utils/defaults/templates/commands.html index 441434e91..abfef6636 100644 --- a/utils/defaults/templates/commands.html +++ b/utils/defaults/templates/commands.html @@ -37,7 +37,7 @@ if (defined($gets->{"update.x"})) { my $i=0; $q="select * from commands order by command"; my $res=$EQDB->query($q); - if ($res) { + if ($res) { print "
\n"; printf "\t\t\n"; printf "\t\t\n"; diff --git a/utils/defaults/templates/guild.html b/utils/defaults/templates/guild.html index 53423433f..c420837b5 100644 --- a/utils/defaults/templates/guild.html +++ b/utils/defaults/templates/guild.html @@ -14,7 +14,7 @@ my $gid = $request->getInt("id", 0); if($gid > 0) { my $act = $request->get("action", ""); - + #note: delete action should be done on the actions.html page, so we can redirect elsewhere. if($act eq "makeleader") { my $char = $request->getInt("char", 0); @@ -39,9 +39,9 @@ if($gid > 0) { print "Invalid char in remove member.
"; } } - - - + + + my $q = "SELECT g.id,g.name,g.leader,g.motd,g.motd_setter,g.tribute,c.name AS lname FROM guilds AS g LEFT JOIN character_ AS c ON g.leader=c.id WHERE g.id=$gid"; my $res=$EQDB->query($q); my $row; @@ -61,7 +61,7 @@ HTML ."LEFT JOIN character_ AS c ON g.char_id=c.id " ."LEFT JOIN guild_ranks AS gr ON g.rank=gr.rank AND g.guild_id=gr.guild_id " ."WHERE g.guild_id=$gid"; - + my $res2 = $EQDB->query($q); if($res2) { print <<"HTML"; @@ -93,7 +93,7 @@ HTML CHAR diff --git a/utils/defaults/templates/guilds.html b/utils/defaults/templates/guilds.html index a2392553e..d04606eed 100644 --- a/utils/defaults/templates/guilds.html +++ b/utils/defaults/templates/guilds.html @@ -11,7 +11,7 @@

Guild List



diff --git a/utils/defaults/templates/launcher.html b/utils/defaults/templates/launcher.html index ba6cf48e5..baa8408f6 100644 --- a/utils/defaults/templates/launcher.html +++ b/utils/defaults/templates/launcher.html @@ -114,9 +114,9 @@ if($act eq "Boot") { ?>
@@ -153,7 +153,7 @@ if($act eq "Boot") { ListZones(); - + for my $zone (sort @zones) { my $z = $config->GetZoneDetails($zone); if(!$z) { @@ -161,7 +161,7 @@ if($act eq "Boot") { } elsif($z->{error}) { $zone->{name} = "ERROR: $z->{error}"; } - + print "\n"; print "\t"; if($z->{up}) { diff --git a/utils/defaults/templates/launchers.html b/utils/defaults/templates/launchers.html index 69d6b5fa0..997b51c9f 100644 --- a/utils/defaults/templates/launchers.html +++ b/utils/defaults/templates/launchers.html @@ -9,7 +9,7 @@ ListLaunchers(); - + ?>

Launchers

@@ -51,7 +51,7 @@ print "You have ".($#list+1)." launchers. (@list)"; Add Launcher: Name: -Dynamic Count: +Dynamic Count: diff --git a/utils/defaults/templates/main.css b/utils/defaults/templates/main.css index 1549282c2..8d7db8811 100644 --- a/utils/defaults/templates/main.css +++ b/utils/defaults/templates/main.css @@ -45,26 +45,26 @@ table { border-collapse:collapse; } th { - margin:2px; + margin:2px; padding: 2px; border:1px solid #2b6874; - background-color:#2b6874; - color:#dddddd; + background-color:#2b6874; + color:#dddddd; font-weight:bold; } td { - margin:2px; + margin:2px; padding: 2px; - border:1px solid #2b6874; - background-color:#12282F; - color:#aaaaaa; + border:1px solid #2b6874; + background-color:#12282F; + color:#aaaaaa; } .headtbl { border: 0px; - margin: 0px; - padding: 0px; + margin: 0px; + padding: 0px; background-color: #091315; } diff --git a/utils/defaults/templates/rule.html b/utils/defaults/templates/rule.html index da72cc324..8738d021a 100644 --- a/utils/defaults/templates/rule.html +++ b/utils/defaults/templates/rule.html @@ -25,11 +25,11 @@ print "\t\n"; print "\t\t\n"; print "\t\t\n"; - + my $q2 = "SELECT COUNT(ruleset_id) AS num_rules FROM rule_values WHERE ruleset_id = '$row->{ruleset_id}'"; my $res2 = $EQDB->query($q2); my $row2 = $res2->fetch_row_hash; - + print "\t\t\n"; #print "\t\t\n"; print "\t\n"; diff --git a/utils/defaults/templates/rules.html b/utils/defaults/templates/rules.html index 20ea10565..7a81935c3 100644 --- a/utils/defaults/templates/rules.html +++ b/utils/defaults/templates/rules.html @@ -35,14 +35,14 @@ if ($ruleset_id !~ m/^[0-9]+$/) {$ruleset_id = 1;} #this should default any non-numeric values (particularly blank ones), also making it free from injections my $rule_type = $request->get("rule_type", "All"); #not safe from injection as-is if ($rule_type !~ m/^\w+$/i) {$rule_type = "All";} #this should make it safe from injection, but may cause issues if we start using non-alphanumeric characters in the first part of the rule_name - + #now, we'll put together a list of the rule categories that we can filter by print "
\n\t"; - + if ($rule_type eq "All") {print "";} print "All"; if ($rule_type eq "All") {print "";} - + my $q = "SELECT DISTINCT(SUBSTRING(rule_name, 1, LOCATE(':', rule_name) - 1)) AS rule_type FROM rule_values WHERE ruleset_id = '$ruleset_id' ORDER BY rule_type ASC"; my $res = $EQDB->query($q); if ($res) { @@ -73,7 +73,7 @@ #print "\t\t
\n"; #print "\t\t\n"; #print "\t\n"; - + #lastly, output any matching rules my $w2 = "WHERE ruleset_id = '$ruleset_id'"; if ($rule_type ne "All") { diff --git a/utils/defaults/templates/top.html b/utils/defaults/templates/top.html index b744adba7..6a062c8bf 100644 --- a/utils/defaults/templates/top.html +++ b/utils/defaults/templates/top.html @@ -9,7 +9,7 @@
CommandAccess$tline/$row2->{total_tribute} $row2->{public_note} - Remove - + Remove - Make Leader
$z->{name}
{ruleset_id}\">$row->{name}{ruleset_id}\">$row->{ruleset_id}$row2->{num_rules}
- + diff --git a/utils/defaults/templates/variables.html b/utils/defaults/templates/variables.html index a5f59f83e..06a3df246 100644 --- a/utils/defaults/templates/variables.html +++ b/utils/defaults/templates/variables.html @@ -36,7 +36,7 @@ if (defined($gets->{"update.x"})) { my $i=0; $q="select * from variables order by varname"; my $res=$EQDB->query($q); - if ($res) { + if ($res) { print "
\n"; printf "\t\t\n"; printf "\t\t\n"; diff --git a/utils/defaults/updated_templates/actions/bug_action.html b/utils/defaults/updated_templates/actions/bug_action.html index 8cfea78f1..9dcd1e492 100644 --- a/utils/defaults/updated_templates/actions/bug_action.html +++ b/utils/defaults/updated_templates/actions/bug_action.html @@ -1,7 +1,7 @@ get("action", "none"); my $bug_id = $request->get("bug_id", "-1"); - + if($action eq "resolve") { if($bug_id != -1) { $EQW->ResolveBug($bug_id); diff --git a/utils/defaults/updated_templates/actions/console_action.html b/utils/defaults/updated_templates/actions/console_action.html index 6213b6d0f..4a41b6164 100644 --- a/utils/defaults/updated_templates/actions/console_action.html +++ b/utils/defaults/updated_templates/actions/console_action.html @@ -17,7 +17,7 @@ print "}"; return; } - + print "{"; print "\"status\" : 1,"; print "\"message\" : \"\""; diff --git a/utils/defaults/updated_templates/actions/launcher_action.html b/utils/defaults/updated_templates/actions/launcher_action.html index b4a925d9b..87698c561 100644 --- a/utils/defaults/updated_templates/actions/launcher_action.html +++ b/utils/defaults/updated_templates/actions/launcher_action.html @@ -7,8 +7,8 @@ print "\"message\" : \"Missing launcher name in Remove action\""; print "}"; return; - } - + } + if($action eq "add") { my $dynamic_count = $request->get("dynamic_count", "0"); if($dynamic_count < 0 || $dynamic_count > 254) { @@ -40,7 +40,7 @@ print "}"; return; } - + if($port < 0 || $port > 65535) { print "{"; print "\"status\" : 0, "; @@ -48,14 +48,14 @@ print "}"; return; } - + if(!$config->BootStaticZone($zone, $port)) { print "{"; print "\"status\" : 0, "; print "\"message\" : \"Failed to boot '$zone' on launcher $launcher_name with port $port. Invalid zone?\""; print "}"; return; - } + } } elsif($action eq "change_dynamic_count") { my $dynamic_count = $request->get("dynamic_count", "0"); $config->SetDynamicCount($dynamic_count); @@ -73,7 +73,7 @@ print "\"status\" : 0, "; print "\"message\" : \"Failed to remove '$zone' on launcher $launcher_name. Invalid zone?\""; print "}"; - return; + return; } } } elsif($action eq "reboot_all") { @@ -98,7 +98,7 @@ return; } else { $config->RestartZone($zone); - } + } } elsif($action eq "start_zone") { my $zone = $request->get("zone", "none"); if($zone eq "none" || $zone eq "") { @@ -122,7 +122,7 @@ $config->StopZone($zone); } } - + print "{"; print "\"status\" : 1"; print "}"; diff --git a/utils/defaults/updated_templates/actions/world_action.html b/utils/defaults/updated_templates/actions/world_action.html index 6d50b239b..acdd15890 100644 --- a/utils/defaults/updated_templates/actions/world_action.html +++ b/utils/defaults/updated_templates/actions/world_action.html @@ -7,7 +7,7 @@ } elsif($act eq "lsreconnect") { $EQW->LSReconnect(); } - + print "{"; if($EQW->LSConnected()) { print "\"connected\" : \"1\","; diff --git a/utils/defaults/updated_templates/actions/zone_action.html b/utils/defaults/updated_templates/actions/zone_action.html index 5813cfb2f..7a520a15e 100644 --- a/utils/defaults/updated_templates/actions/zone_action.html +++ b/utils/defaults/updated_templates/actions/zone_action.html @@ -9,7 +9,7 @@ } elsif($act eq "killall") { } elsif($act eq "restartall") { } - + print "{"; print "\"status\" : 1"; print "}"; diff --git a/utils/defaults/updated_templates/bugs.html b/utils/defaults/updated_templates/bugs.html index 5f2dc9703..aa1866c9b 100644 --- a/utils/defaults/updated_templates/bugs.html +++ b/utils/defaults/updated_templates/bugs.html @@ -10,13 +10,13 @@ function GetStatusIdx() { return idx++; } - + var offset = 0; function StatusTic() { $.getJSON("data/bug_data.html?offset="+offset+"&idx="+GetStatusIdx(), function(data) { var elm = document.getElementById("open_bugs_count"); - + var cur_offset = offset / 50; var sep = (data.total_bug_count / 50); var app = ""; @@ -31,7 +31,7 @@ } } elm.innerHTML = app; - + $("#bug_table").empty(); var app_html = ""; app_html += ""; @@ -41,7 +41,7 @@ app_html += ""; app_html += ""; $("#bug_table").append(app_html); - for(var i = 0; i < data.bug_count; i++) { + for(var i = 0; i < data.bug_count; i++) { app_html = ""; var mod = i % 2; if(mod == 1) { @@ -49,7 +49,7 @@ } else { app_html += ""; } - + var bug_text = data.bugs[i].bug; bug_text = bug_text.replace("\r", ""); bug_text = bug_text.replace("\n", "
"); @@ -59,16 +59,16 @@ app_html += ""; app_html += ""; app_html += ""; - $("#bug_table").append(app_html); + $("#bug_table").append(app_html); } }); } - + function OpenBugs(off) { offset = off; StatusTic(); } - + function ResolveBug(id) { $.getJSON("actions/bug_action.html?action=resolve&bug_id="+id+"&idx="+GetStatusIdx(), function(data) { @@ -76,11 +76,11 @@ alert(data.message); return; } - + StatusTic(); }); } - + $(document).ready(function() { setInterval("StatusTic()", 15000); }); @@ -103,7 +103,7 @@ for(my $i = 0; $i < $sep; ++$i) { my $cur = 50 * $i; my $name = $i + 1; - + if($i == $cur_offset) { print "$name "; } @@ -128,13 +128,13 @@ if(!$bug) { next; } - + if($i % 2 == 1) { print ""; } else { print ""; } - + my $bug_val = $bug->{bug}; $bug_val =~ s/\r//g; $bug_val =~ s/\n/
/g; diff --git a/utils/defaults/updated_templates/bugview.html b/utils/defaults/updated_templates/bugview.html index b41ee29c9..3dcac45ee 100644 --- a/utils/defaults/updated_templates/bugview.html +++ b/utils/defaults/updated_templates/bugview.html @@ -10,13 +10,13 @@ function GetStatusIdx() { return idx++; } - + var offset = 0; function StatusTic() { $.getJSON("data/bug_data.html?offset="+offset+"&idx="+GetStatusIdx(), function(data) { var elm = document.getElementById("open_bugs_count"); - + var cur_offset = offset / 50; var sep = (data.total_bug_count / 50); var app = ""; @@ -31,7 +31,7 @@ } } elm.innerHTML = app; - + $("#bug_table").empty(); var app_html = ""; app_html += ""; @@ -40,7 +40,7 @@ app_html += ""; app_html += ""; $("#bug_table").append(app_html); - for(var i = 0; i < data.bug_count; i++) { + for(var i = 0; i < data.bug_count; i++) { app_html = ""; var mod = i % 2; if(mod == 1) { @@ -48,7 +48,7 @@ } else { app_html += ""; } - + var bug_text = data.bugs[i].bug; bug_text = bug_text.replace("\r", ""); bug_text = bug_text.replace("\n", "
"); @@ -57,16 +57,16 @@ app_html += ""; app_html += ""; app_html += ""; - $("#bug_table").append(app_html); + $("#bug_table").append(app_html); } }); } - + function OpenBugs(off) { offset = off; StatusTic(); } - + $(document).ready(function() { setInterval("StatusTic()", 6000); }); @@ -89,7 +89,7 @@ for(my $i = 0; $i < $sep; ++$i) { my $cur = 50 * $i; my $name = $i + 1; - + if($i == $cur_offset) { print "$name "; } @@ -113,13 +113,13 @@ if(!$bug) { next; } - + if($i % 2 == 1) { print ""; } else { print ""; } - + my $bug_val = $bug->{bug}; $bug_val =~ s/\r//g; $bug_val =~ s/\n/
/g; diff --git a/utils/defaults/updated_templates/console.html b/utils/defaults/updated_templates/console.html index e0bb46256..b1a31490e 100644 --- a/utils/defaults/updated_templates/console.html +++ b/utils/defaults/updated_templates/console.html @@ -8,38 +8,38 @@ diff --git a/utils/defaults/updated_templates/data/bug_data.html b/utils/defaults/updated_templates/data/bug_data.html index 52cb5a4a9..100ce2717 100644 --- a/utils/defaults/updated_templates/data/bug_data.html +++ b/utils/defaults/updated_templates/data/bug_data.html @@ -4,14 +4,14 @@ my $bug_count = @bugs; my $total_bug_count = $EQW->CountBugs(); print "{"; - print "\"total_bug_count\" : $total_bug_count,"; + print "\"total_bug_count\" : $total_bug_count,"; print "\"bug_count\" : $bug_count,"; print "\"bugs\" : "; print "["; my $i = 0; for my $bugkey (@bugs) { my $bug = $EQW->GetBugDetails($bugkey); - + my $bug_val = $bug->{bug}; $bug_val =~ s/\\/\\\\/g; $bug_val =~ s/\//\\\//g; @@ -32,7 +32,7 @@ print "\"x\" : \"$bug->{x}\","; print "\"y\" : \"$bug->{y}\","; print "\"z\" : \"$bug->{z}\""; - + print "}"; if($i != $bug_count - 1) { print ","; diff --git a/utils/defaults/updated_templates/data/console_data.html b/utils/defaults/updated_templates/data/console_data.html index 99a3271ff..a96973603 100644 --- a/utils/defaults/updated_templates/data/console_data.html +++ b/utils/defaults/updated_templates/data/console_data.html @@ -4,7 +4,7 @@ print "\"message_count\" : $message_count,"; print "\"messages\" : "; print "["; - for(my $i = 0; $i < $message_count; $i++) + for(my $i = 0; $i < $message_count; $i++) { print "{"; my $msg = $EQW->GetConsoleMessage($i); @@ -19,7 +19,7 @@ $message =~ s/\x0C/\\b/g; $message =~ s/[\x00-\x1F]/\./g; $message =~ s/[\x7F-\xFF]/\./g; - + print "\"message\" : \"$message\""; print "}"; if($i != $message_count - 1) { diff --git a/utils/defaults/updated_templates/data/launcher_data.html b/utils/defaults/updated_templates/data/launcher_data.html index 9ce4d548b..2ead600e4 100644 --- a/utils/defaults/updated_templates/data/launcher_data.html +++ b/utils/defaults/updated_templates/data/launcher_data.html @@ -2,7 +2,7 @@ $launcher_name = $request->get("launcher", "none"); if($launcher_name eq "none") { - @launchers = sort $EQW->ListLaunchers(); + @launchers = sort $EQW->ListLaunchers(); my $launcher_count = @launchers; print "{"; print "\"launcher_count\" : $launcher_count,"; @@ -22,14 +22,14 @@ } print "\"connected\" : ". $conn; print "}"; - + if($i != $launcher_count - 1) { print ","; } $i++; } - print "]"; + print "]"; print "}"; } else { my $l = $EQW->GetLauncher($lname); @@ -56,13 +56,13 @@ print "\"starts\" : $z->{starts},"; print "\"port\" : $z->{port}"; print "}"; - + if($i != $zone_count - 1) { print ", "; } $i++; } - + print "]"; print "}"; } diff --git a/utils/defaults/updated_templates/data/player_data.html b/utils/defaults/updated_templates/data/player_data.html index 9220792c4..17e72b40f 100644 --- a/utils/defaults/updated_templates/data/player_data.html +++ b/utils/defaults/updated_templates/data/player_data.html @@ -7,11 +7,11 @@ print "\"player_count\" : $player_count,"; print "\"players\" : "; print "["; - + my $i = 0; for my $player (@players) { my $pd = $EQW->GetPlayerDetails($player); - + print "{"; print "\"character\" : \"$pd->{character}\","; print "\"account\" : \"$pd->{account}\","; @@ -29,13 +29,13 @@ print "\"status\" : \"$pd->{status}\","; print "\"client_version\" : \"$pd->{client_version}\""; print "}"; - + if($i != $player_count - 1) { print ","; } $i++; } - + print "]"; print "}"; diff --git a/utils/defaults/updated_templates/data/world_status.html b/utils/defaults/updated_templates/data/world_status.html index 47551445c..e31a2bc3b 100644 --- a/utils/defaults/updated_templates/data/world_status.html +++ b/utils/defaults/updated_templates/data/world_status.html @@ -1,4 +1,4 @@ -LSConnected()) { print "\"connected\" : \"1\","; diff --git a/utils/defaults/updated_templates/data/zone_data.html b/utils/defaults/updated_templates/data/zone_data.html index 11b27ed29..3ccfdd07d 100644 --- a/utils/defaults/updated_templates/data/zone_data.html +++ b/utils/defaults/updated_templates/data/zone_data.html @@ -19,9 +19,9 @@ for(my $i = 0; $i < $zone_count; $i++) { print "\"long_name\" : \"$zone->{long_name}\","; print "\"port\" : $zone->{port},"; print "\"player_count\" : $zone->{player_count},"; - print "\"instance_id\" : $zone->{instance_id}"; + print "\"instance_id\" : $zone->{instance_id}"; print "}"; - + if($i != $zone_count - 1) { print ","; } diff --git a/utils/defaults/updated_templates/images/loading.gif b/utils/defaults/updated_templates/images/loading.gif index d0bce1542..cd5899c6c 100644 Binary files a/utils/defaults/updated_templates/images/loading.gif and b/utils/defaults/updated_templates/images/loading.gif differ diff --git a/utils/defaults/updated_templates/index.html b/utils/defaults/updated_templates/index.html index 619674448..a21b40d6e 100644 --- a/utils/defaults/updated_templates/index.html +++ b/utils/defaults/updated_templates/index.html @@ -8,34 +8,34 @@ "; } else { $locked_str = "World is NOT locked. Lock World.
"; } - + print "
"; print "$locked_str"; - print "
"; + print ""; ?> diff --git a/utils/defaults/updated_templates/launcher.html b/utils/defaults/updated_templates/launcher.html index 0cc2c3121..ff6b25a3f 100644 --- a/utils/defaults/updated_templates/launcher.html +++ b/utils/defaults/updated_templates/launcher.html @@ -13,7 +13,7 @@ function GetStatusIdx() { return idx++; } - + function StatusTic() { $.getJSON("data/launcher_data.html?launcher="++"&idx="+GetStatusIdx(), function(data) { @@ -57,23 +57,23 @@ } app_html += ""; app_html += ""; - $("#launcher_table").append(app_html); + $("#launcher_table").append(app_html); } - }); + }); } - + function ShowAddLauncher() { $("#add_launcher_link").hide(); $("#min_add_launcher_link").show(); $("#add_launcher_table").fadeIn("slow"); } - + function HideAddLauncher() { $("#add_launcher_link").show(); $("#min_add_launcher_link").hide(); $("#add_launcher_table").fadeOut("slow"); } - + function BootZone() { var elm = document.getElementById("short_name_field"); var bzone = elm.value; @@ -81,23 +81,23 @@ elm = document.getElementById("port_field"); var bport = elm.value; elm.value = "0"; - + elm = document.getElementById("boot_button_img"); elm.style.display = "inline"; - + elm = document.getElementById("boot_button"); elm.className = "styled_button_disabled"; $('#boot_button').unbind('click'); - + $.getJSON("actions/launcher_action.html?action=boot&launcher_name="++"&zone="+bzone+"&port="+bport+"&idx="+GetStatusIdx(), function(data) { $('#boot_button').bind('click', BootZone); elm = document.getElementById("boot_button"); elm.className = "styled_button"; - + elm = document.getElementById("boot_button_img"); elm.style.display = "none"; - + if(data.status == 0) { alert(data.message); } else { @@ -105,38 +105,38 @@ } }); } - + function ChangeDynamicCount() { var elm = document.getElementById("dynamic_count_field"); var dcount = elm.value; - + elm = document.getElementById("dynamic_count_button_img"); elm.style.display = "inline"; - + elm = document.getElementById("dynamic_count_button"); elm.className = "styled_button_disabled"; $('#dynamic_count_button').unbind('click'); - + $.getJSON("actions/launcher_action.html?action=change_dynamic_count&launcher_name="++"&dynamic_count="+dcount+"&idx="+GetStatusIdx(), function(data) { $('#dynamic_count_button').bind('click', ChangeDynamicCount); elm = document.getElementById("dynamic_count_button"); elm.className = "styled_button"; - + elm = document.getElementById("dynamic_count_button_img"); elm.style.display = "none"; - + if(data.status == 0) { alert(data.message); } else { StatusTic(); } - }); + }); } - + function RemoveZone(zone_name) { $.getJSON("actions/launcher_action.html?action=remove_zone&launcher_name="++"&zone="+zone_name+"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -144,10 +144,10 @@ } }); } - + function RebootAll() { $.getJSON("actions/launcher_action.html?action=reboot_all&launcher_name="++"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -155,10 +155,10 @@ } }); } - + function StopAll() { $.getJSON("actions/launcher_action.html?action=stop_all&launcher_name="++"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -166,10 +166,10 @@ } }); } - + function StartAll() { $.getJSON("actions/launcher_action.html?action=start_all&launcher_name="++"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -177,21 +177,21 @@ } }); } - + function RestartZone(zone) { $.getJSON("actions/launcher_action.html?action=restart_zone&launcher_name="++"&zone="+zone+"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { StatusTic(); } - }); + }); } - + function StartZone(zone) { $.getJSON("actions/launcher_action.html?action=start_zone&launcher_name="++"&zone="+zone+"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -199,10 +199,10 @@ } }); } - + function StopZone(zone) { $.getJSON("actions/launcher_action.html?action=stop_zone&launcher_name="++"&zone="+zone+"&idx="+GetStatusIdx(), - function(data) { + function(data) { if(data.status == 0) { alert(data.message); } else { @@ -210,14 +210,14 @@ } }); } - + $(document).ready(function() { setInterval("StatusTic()", 4000); $('#boot_button').bind('click', BootZone); $('#dynamic_count_button').bind('click', ChangeDynamicCount); }); --> - +
@@ -230,8 +230,8 @@ } ?>
@@ -255,7 +255,7 @@
VariableDescription
ActionsDescripton
"+data.bugs[i].target+""+bug_text+"
ReporterDescripton
"+data.bugs[i].target+""+bug_text+"
- + @@ -266,7 +266,7 @@ ListZones(); - + for my $zone (sort @zones) { my $z = $config->GetZoneDetails($zone); if(!$z) { @@ -274,7 +274,7 @@ } elsif($z->{error}) { $zone->{name} = "ERROR: $z->{error}"; } - + print "\n"; print "\t"; if($z->{up}) { @@ -307,7 +307,7 @@ print "\n"; } ?> -
Zone Name
$z->{name}
+