diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b2bfd03b..3867d10ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,96 +15,96 @@ 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) + #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) + #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) + #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) + #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) + #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) + #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) #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 +116,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 +142,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 8027ef9a0..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_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_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_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_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,13 +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 - ) + MySQL_LIBRARY_DEBUG + MySQL_LIBRARY_RELEASE + MySQL_INCLUDE_DIR + ) diff --git a/common/BasePacket.cpp b/common/BasePacket.cpp index 838e6454b..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 free software; you can redistribute it and/or modify + it 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 "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); } } @@ -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 2d4e88ec6..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 free software; you can redistribute it and/or modify + it 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 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)); @@ -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 401ff4ad1..9e79dc470 100644 --- a/common/CRC16.cpp +++ b/common/CRC16.cpp @@ -2,13 +2,14 @@ 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 29a3425e0..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 free software; you can redistribute it and/or modify + it 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" @@ -31,14 +31,14 @@ 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); } diff --git a/common/Condition.h b/common/Condition.h index e66b28551..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 free software; you can redistribute it and/or modify + it 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 __CONDITION_H #define __CONDITION_H diff --git a/common/EQDB.cpp b/common/EQDB.cpp index d729eaee7..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 free software; you can redistribute it and/or modify + it 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 "EQDB.h" @@ -73,6 +73,3 @@ Const_char *EQDB::escape_string(Const_char *from) { return(m_escapeBuffer.c_str()); } - - - diff --git a/common/EQDB.h b/common/EQDB.h index 700ca5584..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 free software; you can redistribute it and/or modify + it 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 EQDB_H_ #define EQDB_H_ diff --git a/common/EQDBRes.cpp b/common/EQDBRes.cpp index ed6bb6ba2..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 free software; you can redistribute it and/or modify + it 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 "EQDBRes.h" @@ -49,3 +49,4 @@ map EQDBRes::fetch_row_hash() { return rowhash; } + diff --git a/common/EQDBRes.h b/common/EQDBRes.h index 19f9ee685..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 free software; you can redistribute it and/or modify + it 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 EQDBRes_H_ #define EQDBRes_H_ diff --git a/common/EQEMuError.cpp b/common/EQEMuError.cpp index 04836c4dc..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 free software; you can redistribute it and/or modify + it 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 #include diff --git a/common/EQEMuError.h b/common/EQEMuError.h index edd0fdaf5..ffc5d69ed 100644 --- a/common/EQEMuError.h +++ b/common/EQEMuError.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 EQEMuError_H #define EQEMuError_H diff --git a/common/EQEmuConfig.cpp b/common/EQEmuConfig.cpp index dded129cc..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 free software; you can redistribute it and/or modify + it 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 "EQEmuConfig.h" @@ -446,27 +446,3 @@ void EQEmuConfig::Dump() const // cout << "DynamicCount = " << DynamicCount << endl; } - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/EQEmuConfig.h b/common/EQEmuConfig.h index 08ea3bfec..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 free software; you can redistribute it and/or modify + it 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 __EQEmuConfig_H #define __EQEmuConfig_H diff --git a/common/EQNetwork.cpp b/common/EQNetwork.cpp index 0aa3db4c2..8cdb200fe 100644 --- a/common/EQNetwork.cpp +++ b/common/EQNetwork.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 */ /* * 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]; + uchar buffer[1518]; - int status; - struct sockaddr_in from; - unsigned int fromlen; + int status; + struct sockaddr_in from; + unsigned int fromlen; - from.sin_family = AF_INET; - fromlen = sizeof(from); + from.sin_family = AF_INET; + fromlen = sizeof(from); while (1) { #ifdef WIN32 @@ -285,7 +285,7 @@ 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; 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 452aefe94..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,8 +35,8 @@ 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) { } @@ -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); @@ -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 74fe871af..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 @@ -103,13 +103,13 @@ class EQApplicationPacket : public EQPacket { friend class EQStream; public: EQApplicationPacket() : EQPacket(OP_Unknown,nullptr,0) - { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } + { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } EQApplicationPacket(const EmuOpcode op) : EQPacket(op,nullptr,0) - { app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; } + { 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; } + { 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; } + { 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; } diff --git a/common/EQStream.cpp b/common/EQStream.cpp index 1593d3ec5..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 @@ -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); @@ -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); @@ -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 @@ -686,7 +686,7 @@ deque::iterator sitr; 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()) { @@ -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 { @@ -1448,6 +1448,3 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { return(res); } - - - diff --git a/common/EQStream.h b/common/EQStream.h index 73d0c4265..09bd604eb 100644 --- a/common/EQStream.h +++ b/common/EQStream.h @@ -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 @@ -167,7 +167,7 @@ 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. @@ -264,9 +264,9 @@ class EQStream : public EQStreamInterface { 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, @@ -277,5 +277,5 @@ class EQStream : public EQStreamInterface { }; - #endif + diff --git a/common/EQStreamFactory.cpp b/common/EQStreamFactory.cpp index c91d5da77..c5e37b690 100644 --- a/common/EQStreamFactory.cpp +++ b/common/EQStreamFactory.cpp @@ -56,7 +56,7 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) } EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout) - : Timeoutable(5000), stream_timeout(timeout) + : Timeoutable(5000), stream_timeout(timeout) { StreamType=type; Port=port; @@ -314,7 +314,6 @@ Timer DecayTimer(20); (*cur)->ReleaseFromUse(); } - Sleep(10); MStreams.lock(); @@ -328,20 +327,3 @@ Timer DecayTimer(20); } } - - - - - - - - - - - - - - - - - diff --git a/common/EQStreamFactory.h b/common/EQStreamFactory.h index 82cdaa7b9..66911bc3f 100644 --- a/common/EQStreamFactory.h +++ b/common/EQStreamFactory.h @@ -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 a04a0bfb9..7d5fa2449 100644 --- a/common/EQStreamIdent.cpp +++ b/common/EQStreamIdent.cpp @@ -1,4 +1,3 @@ - #include "debug.h" #include "EQStreamIdent.h" #include "EQStreamProxy.h" @@ -158,42 +157,8 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() { } 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 6ab734fb5..855838c86 100644 --- a/common/EQStreamIdent.h +++ b/common/EQStreamIdent.h @@ -30,7 +30,7 @@ protected: class Patch { public: std::string name; - EQStream::Signature signature; + EQStream::Signature signature; OpcodeManager ** opcodes; const StructStrategy *structs; }; diff --git a/common/EQStreamLocator.h b/common/EQStreamLocator.h index 1724e77c6..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 @@ -170,6 +170,4 @@ protected: map streams; }; - - #endif diff --git a/common/EQStreamProxy.cpp b/common/EQStreamProxy.cpp index 2791ad4e3..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); diff --git a/common/EQStreamProxy.h b/common/EQStreamProxy.h index 68681899d..cecdf9f38 100644 --- a/common/EQStreamProxy.h +++ b/common/EQStreamProxy.h @@ -35,21 +35,12 @@ public: 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. }; - - - - - - - - #endif /*EQSTREAMPROXY_H_*/ - diff --git a/common/EmuTCPConnection.cpp b/common/EmuTCPConnection.cpp index e696efee2..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; @@ -97,9 +77,9 @@ EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_s //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) { @@ -473,7 +452,6 @@ void EmuTCPConnection::ClearBuffers() { timeout_timer.Start(); } - void EmuTCPConnection::SendNetErrorPacket(const char* reason) { #if TCPC_DEBUG >= 1 struct in_addr in; @@ -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) { @@ -842,14 +820,3 @@ bool EmuTCPConnection::RecvData(char* errbuf) { return(true); } - - - - - - - - - - - diff --git a/common/EmuTCPConnection.h b/common/EmuTCPConnection.h index 1c64c2196..ff7dd8995 100644 --- a/common/EmuTCPConnection.h +++ b/common/EmuTCPConnection.h @@ -49,7 +49,7 @@ public: 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; } 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 74fa9579a..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 @@ -172,12 +172,12 @@ ItemInst::ItemInst(const ItemInst& copy) 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 @@ -316,9 +316,9 @@ 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; @@ -579,64 +579,64 @@ ItemInst* Inventory::GetItem(int16 slot_id) const } 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 @@ -857,7 +857,7 @@ 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(); @@ -940,17 +940,17 @@ 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; } @@ -963,7 +963,7 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) // 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) { @@ -1700,10 +1700,10 @@ EvoItemInst::EvoItemInst(const EvoItemInst ©) { 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; @@ -1742,10 +1742,10 @@ EvoItemInst::EvoItemInst(const ItemInst &basecopy) { } } - 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; @@ -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 7a677edf6..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, @@ -113,7 +113,7 @@ public: 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: ///////////////////////// @@ -199,10 +199,10 @@ public: 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 @@ -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,13 +348,13 @@ 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); } @@ -379,8 +379,8 @@ 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; @@ -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 { diff --git a/common/MaxSkill.cpp b/common/MaxSkill.cpp index 3b914b611..d24ffbc91 100644 --- a/common/MaxSkill.cpp +++ b/common/MaxSkill.cpp @@ -643,9 +643,8 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { // 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 ROGUE: case ROGUEGM: { @@ -1894,7 +1893,7 @@ uint8 MaxSkillTable(uint16 skillid, uint16 race, uint16 eqclass, uint16 level) { 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; diff --git a/common/MiscFunctions.cpp b/common/MiscFunctions.cpp index a08fd1f3d..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 @@ -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) + // 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 + 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; + 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 @@ -556,7 +556,7 @@ char *CleanMobName(const char *in, char *out) 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 037ffbefc..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,7 +32,7 @@ // 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_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; } @@ -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 df481a68b..5e06d08c9 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" 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 584dece69..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 free software; you can redistribute it and/or modify + it 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 "ProcLauncher.h" @@ -145,7 +145,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { // 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.bInheritHandle = TRUE; //we want this handle to be inherited by the child. saAttr.lpSecurityDescriptor = nullptr; logOut = CreateFile( it->logFile.c_str(), //lpFileName @@ -178,15 +178,15 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { } 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 + 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); @@ -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 dcdc25191..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 free software; you can redistribute it and/or modify + it 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 PROCLAUNCHER_H_ #define PROCLAUNCHER_H_ @@ -65,25 +65,18 @@ public: 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); @@ -96,29 +89,5 @@ private: #endif }; - - - - - - - - #endif /*PROCLAUNCHER_H_*/ - - - - - - - - - - - - - - - - diff --git a/common/TCPConnection.cpp b/common/TCPConnection.cpp index a1a96ac09..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 @@ -539,7 +539,7 @@ bool TCPConnection::Process() { 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; @@ -585,7 +585,7 @@ bool TCPConnection::Process() { 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; @@ -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)) { @@ -943,7 +943,3 @@ bool TCPConnection::RunLoop() { return ret; } - - - - diff --git a/common/TCPConnection.h b/common/TCPConnection.h index 1078d58db..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 @@ -177,5 +177,3 @@ private: #endif - - diff --git a/common/TCPServer.cpp b/common/TCPServer.cpp index 5abb591b7..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; @@ -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; + SOCKET tmpsock; + struct sockaddr_in from; + struct in_addr in; + unsigned int fromlen; + unsigned short port; - from.sin_family = AF_INET; - fromlen = sizeof(from); + from.sin_family = AF_INET; + fromlen = sizeof(from); LockMutex lock(&MSock); if (!sock) return; @@ -230,4 +224,3 @@ bool BaseTCPServer::IsOpen() { return ret; } - diff --git a/common/XMLParser.cpp b/common/XMLParser.cpp index 0b56b6b47..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 free software; you can redistribute it and/or modify + it 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 "XMLParser.h" @@ -49,15 +49,15 @@ bool XMLParser::ParseFile(const char *file, const char *root_ele) { 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 { diff --git a/common/XMLParser.h b/common/XMLParser.h index 54f7d09ee..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 free software; you can redistribute it and/or modify + it 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 XMLParser_H #define XMLParser_H @@ -29,8 +29,8 @@ 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); @@ -54,6 +54,3 @@ protected: #endif - - - diff --git a/common/bodytypes.h b/common/bodytypes.h index 5975ed54d..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 @@ -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 5e56b1e9b..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 free software; you can redistribute it and/or modify + it 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 BREAKDOWNS_H_ #define BREAKDOWNS_H_ diff --git a/common/classes.cpp b/common/classes.cpp index 98ad290c3..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 6b9803b6d..b70609379 100644 --- a/common/classes.h +++ b/common/classes.h @@ -1,41 +1,41 @@ -/* 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 diff --git a/common/common_profile.h b/common/common_profile.h index 2ecc37020..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 diff --git a/common/crash.cpp b/common/crash.cpp index 6d8e92a8b..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; - } + 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); - } + if(EXCEPTION_STACK_OVERFLOW != ExceptionInfo->ExceptionRecord->ExceptionCode) + { + EQEmuStackWalker sw; sw.ShowCallstack(GetCurrentThread(), ExceptionInfo->ContextRecord); + } - return EXCEPTION_EXECUTE_HANDLER; + 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 b28d2cd83..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; - } + for(uint32 i=start_at; i> 8; + data = CRC32Table[data]; + check = check ^ data; + } - memcpy(in_data, (char*)&check, 4); + memcpy(in_data, (char*)&check, 4); } uint32 CRC32::Update(const uint8* buf, uint32 bufsize, uint32 crc32var) { diff --git a/common/database.cpp b/common/database.cpp index 0fdf402b3..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,50 +202,50 @@ 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 @@ -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"); @@ -1381,15 +1381,15 @@ const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) { } 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,8 +1401,8 @@ 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; @@ -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,8 +2253,8 @@ 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), @@ -2279,8 +2279,8 @@ 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", @@ -3126,7 +3126,7 @@ 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) + 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; @@ -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 fd05a7033..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 @@ -79,7 +79,7 @@ EventLogDetails_Struct eld[255]; // 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; @@ -108,8 +108,8 @@ public: ~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,22 +172,22 @@ 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, 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); @@ -196,8 +196,8 @@ public: 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); @@ -205,20 +205,20 @@ public: 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(); @@ -226,14 +226,14 @@ public: 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); diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 57e754b31..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,7 +184,7 @@ bool DBcore::Open(uint32* errnum, char* errbuf) { if (GetStatus() == Error) { mysql_close(&mysql); mysql_init(&mysql); // Initialize structure again - } + } if (!pHost) return false; /* diff --git a/common/dbmemshare.cpp b/common/dbmemshare.cpp index 4b7fc3cd4..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)) { @@ -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 d621d2854..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_t aclock; + struct tm *newtime; - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ + time( &aclock ); /* Get time in seconds */ + newtime = localtime( &aclock ); /* Convert time to struct */ - if (dofile) + 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_t aclock; + struct tm *newtime; - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ + 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_t aclock; + struct tm *newtime; - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ + time( &aclock ); /* Get time in seconds */ + newtime = localtime( &aclock ); /* Convert time to struct */ - if (dofile) + 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 43a4a9833..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,7 +103,7 @@ public: Debug, Quest, Commands, - Crash, + Crash, MaxLogID }; diff --git a/common/deity.h b/common/deity.h index bb9e1bf1d..f7a44f5a3 100644 --- a/common/deity.h +++ b/common/deity.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 DEITY_H #define DEITY_H diff --git a/common/emu_opcodes.cpp b/common/emu_opcodes.cpp index 90dea14f6..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" @@ -25,7 +25,7 @@ const char *OpcodeNames[_maxEmuOpcode+1] = { //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/eq_constants.h b/common/eq_constants.h index 5faf66fdc..bc0c16857 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.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_CONSTANTS_H #define EQ_CONSTANTS_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 }; @@ -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 diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 9b4a15f80..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*/ }; @@ -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 @@ -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; @@ -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; // @@ -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 { @@ -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 @@ -4201,8 +4199,8 @@ struct RespawnWindow_Struct { */ 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; @@ -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; @@ -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 }; @@ -5080,3 +5078,4 @@ typedef std::list ItemList; #pragma pack() #endif + diff --git a/common/eqemu_exception.cpp b/common/eqemu_exception.cpp index c247e1a0a..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 free software; you can redistribute it and/or modify + it 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 "eqemu_exception.h" 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 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 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_; - } + 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_; - } + 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 2ccd75be0..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 free software; you can redistribute it and/or modify + it 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_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: + //! 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); + //! 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); + //! Copy Constructor + Exception(const Exception& e); - //! Move Constructor + //! Move Constructor #ifdef EQEMU_RVALUE_MOVE - Exception(const Exception&& e); + Exception(const Exception&& e); #endif - //! Destructor - ~Exception() throw() { } + //! Destructor + ~Exception() throw() { } - //! Assignment Operator - void operator=(const Exception& e); + //! Assignment Operator + void operator=(const Exception& e); - //! 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 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 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 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 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_; } + //! 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 @@ -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; @@ -273,8 +273,3 @@ void EQTime::ToString(TimeOfDay_Struct *t, string &str) { str = buf; } - - - - - diff --git a/common/errmsg.h b/common/errmsg.h index 03863ec61..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 +/* 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 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. + 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 */ + 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 */ +/* 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 b66ada553..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" @@ -50,8 +50,3 @@ bool SetExtendedProfile(ExtendedProfile_Struct *to, char *old, unsigned int len) return(false); } - - - - - diff --git a/common/extprofile.h b/common/extprofile.h index 183f98206..74e9a89c3 100644 --- a/common/extprofile.h +++ b/common/extprofile.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 EXTENDED_PROFILE_H #define EXTENDED_PROFILE_H 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 ae41a9286..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 @@ -29,12 +29,12 @@ enum FACTION_VALUE { FACTION_KINDLY = 3, FACTION_AMIABLE = 4, - FACTION_INDIFFERENT = 5, + FACTION_INDIFFERENT = 5, - FACTION_APPREHENSIVE = 6, - FACTION_DUBIOUS = 7, - FACTION_THREATENLY = 8, - FACTION_SCOWLS = 9 + FACTION_APPREHENSIVE = 6, + FACTION_DUBIOUS = 7, + FACTION_THREATENLY = 8, + FACTION_SCOWLS = 9 }; struct NPCFactionList { @@ -57,7 +57,7 @@ struct FactionMods struct Faction { int32 id; - std::map mods; + std::map mods; int16 base; char name[50]; }; @@ -65,10 +65,10 @@ struct Faction { typedef std::map faction_map; struct NPCFaction { - uint32 factionID; - int32 value_mod; - int8 npc_value; - uint8 temp; + uint32 factionID; + int32 value_mod; + int8 npc_value; + uint8 temp; }; const char *FactionValueToString(FACTION_VALUE fv); diff --git a/common/features.h b/common/features.h index 938cb9cf7..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 @@ -228,7 +228,7 @@ enum { //some random constants #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 f2235e953..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 free software; you can redistribute it and/or modify + it 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_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; - } + //! 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; - } + //! Returns whether the set is empty (has 0 elements) or not + bool empty() const { + return current_elements_ == 0; + } - //! Returns the number of unique elements in the set currently - size_type size() const { - return current_elements_; - } + //! Returns the number of unique elements in the set currently + size_type size() const { + return current_elements_; + } - //! Returns the maximum number of elements one can insert into the set. - size_type max_size() const { - return max_elements_; - } + //! Returns the maximum number of elements one can insert into the set. + size_type max_size() const { + return max_elements_; + } - //! Returns the maximum key one can use with the set. - key_type max_key() const { - return offset_count_ > 0 ? (offset_count_ - 1) : 0; - } + //! 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"); - } + /*! + 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"); + } - 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."); - } + /*! + 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]]; + } - /*! - 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; - } + /*! + 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) { - return false; - } + if(offsets_[i] == 0xFFFFFFFFU) { + return false; + } - return true; - } + return true; + } - /*! - 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."); - } + /*! + 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) { - elements_[offsets_[i]] = v; - } else { - if(current_elements_ >= max_elements_) { - EQ_EXCEPT("Fixed Memory Hash Set", "Insert pointer out of range."); - } + 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."); + } - offsets_[i] = current_elements_; - memcpy(&elements_[current_elements_], &v, sizeof(value_type)); - ++current_elements_; - *reinterpret_cast(data_ + (sizeof(key_type) * 2)) = current_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; - } + //! 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_; - }; + 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 67cbb441e..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 free software; you can redistribute it and/or modify + it 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_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) = remaining_size_; + ptr += sizeof(key_type); - *reinterpret_cast(ptr) = 0; - current_offset_ = 0; - ptr += sizeof(key_type); + *reinterpret_cast(ptr) = 0; + current_offset_ = 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 - */ - FixedMemoryVariableHashSet(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 + */ + FixedMemoryVariableHashSet(byte *data, size_type size) { + data_ = data; + size_ = size; - byte *ptr = data; - offset_count_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); + byte *ptr = data; + offset_count_ = *reinterpret_cast(ptr); + ptr += sizeof(key_type); - remaining_size_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); + remaining_size_ = *reinterpret_cast(ptr); + ptr += sizeof(key_type); - current_offset_ = *reinterpret_cast(ptr); - ptr += sizeof(key_type); + current_offset_ = *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 - 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_) - { - } + //! 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 + //! 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; - } + //! 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_; - } + //! Returns the number of bytes in the set currently + size_type size() const { + return size_ - remaining_size_; + } - //! 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 maximum number of bytes one can insert into the set. + size_type max_size() const { + return size_ - (sizeof(key_type) * 2); + } - //! Returns the maximum key one can use with the set. - key_type max_key() const { - return offset_count_ > 0 ? (offset_count_ - 1) : 0; - } + //! 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"); - } + /*! + 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"); + } - 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"); - } + /*! + 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]]); + } - /*! - 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; - } + /*! + 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) { - return false; - } + if(offsets_[i] == 0xFFFFFFFFU) { + return false; + } - return true; - } + return true; + } - /*! - 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."); - } + /*! + 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(size > remaining_size_) { + EQ_EXCEPT("Fixed Memory Hash Set", "Not enough room in hash set to insert this value."); + } - 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); + 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_; + remaining_size_ -= size; + *reinterpret_cast(data_ + sizeof(key_type)) = remaining_size_; - current_offset_ += size; - *reinterpret_cast(data_ + (sizeof(key_type) * 2)) = current_offset_; - } - } + 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_; - }; + 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 a5b29ce3e..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" @@ -316,8 +316,8 @@ uint32 BaseGuildManager::_GetFreeGuildID() { } 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. @@ -953,22 +953,22 @@ 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) @@ -1320,9 +1320,9 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) 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); @@ -1341,10 +1341,10 @@ 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; @@ -1445,7 +1445,7 @@ bool Database::LoadGuilds(GuildRanks_Struct* guilds) { 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,9 +1459,9 @@ 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)) { diff --git a/common/guilds.cpp b/common/guilds.cpp index 3e15c3307..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 free software; you can redistribute it and/or modify + it 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" @@ -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,8 +59,8 @@ 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; @@ -83,7 +83,7 @@ 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)) { @@ -103,7 +103,7 @@ 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)) { @@ -126,7 +126,7 @@ bool Database::SetGuild(uint32 charid, uint32 guild_id, uint8 guildrank) { bool Database::DeleteGuild(uint32 guild_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; char *query2 = 0; uint32 affected_rows = 0; @@ -152,7 +152,7 @@ bool Database::DeleteGuild(uint32 guild_id) 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)) ; @@ -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]; @@ -217,9 +217,9 @@ bool Database::EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* 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); @@ -241,9 +241,9 @@ bool Database::GetGuildNameByID(uint32 guild_id, char * name) { 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); @@ -267,7 +267,7 @@ uint32 Database::GetGuildIDbyLeader(uint32 leader) 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)) { @@ -288,7 +288,7 @@ bool Database::SetGuildLeader(uint32 guild_id, uint32 leader) 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; @@ -318,9 +318,9 @@ bool Database::SetGuildMOTD(uint32 guild_id, const char* motd) { 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 41e1f1731..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 free software; you can redistribute it and/or modify + it 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 _MUTEX_H_ @@ -23,43 +23,43 @@ 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); + //! 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(); + //! Destructor + ~IPCMutex(); - //! Lock the mutex - /*! - Same basic function as P(): for(;;) { if(S > 0) { S -= 1; break; } } - */ - bool Lock(); + //! 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&); + //! 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_; - }; + 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 a5b4e5f5b..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 7f004407d..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 @@ -29,84 +29,84 @@ 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 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 class LinkedListIterator { private: - LinkedList& list; - ListElement* current_element; - direction dir; + LinkedList& list; + ListElement* current_element; + direction dir; public: - LinkedListIterator(LinkedList& l,direction d = FORWARD) : list(l), dir(d) {}; + LinkedListIterator(LinkedList& l,direction d = FORWARD) : list(l), dir(d) {}; - void Advance(); - const TYPE& GetData(); + void Advance(); + const TYPE& GetData(); bool IsFirst() { if (current_element->GetPrev() == 0) @@ -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,8 +280,8 @@ void LinkedListIterator::Reset() { if (!(&list)) { - current_element=0; - return; + current_element=0; + return; } if (dir == FORWARD) @@ -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); + ListElement* new_element = new ListElement(data); - if (first == 0) - { - first = new_element; - } - else - { - new_element->SetPrev(first->GetLast()); - first->SetLastNext(new_element); - } - count++; + 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 16e365558..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 free software; you can redistribute it and/or modify + it 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 "logsys.h" @@ -109,7 +109,7 @@ bool load_log_settings(const char *filename) { 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); @@ -155,6 +155,3 @@ bool load_log_settings(const char *filename) { return(true); } - - - diff --git a/common/logsys.h b/common/logsys.h index beb6856d7..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 free software; you can redistribute it and/or modify + it 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 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 31f8621da..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 free software; you can redistribute it and/or modify + it 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" @@ -37,7 +37,3 @@ void log_messageVA(LogType type, const char *fmt, va_list args) { LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args); } - - - - diff --git a/common/logtypes.h b/common/logtypes.h index 2dfa7c61e..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 free software; you can redistribute it and/or modify + it 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 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 b91d42389..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 @@ -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/memory_mapped_file.cpp b/common/memory_mapped_file.cpp index c12eafeaf..1754f34ba 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 free software; you can redistribute it and/or modify + it 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 "memory_mapped_file.h" @@ -32,160 +32,160 @@ 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; + 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); + 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."); - } + 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()); + 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."); - } + 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)); + 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."); - } + 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; + 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); + //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); #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); + 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."); - } + 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()); + 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."); - } + 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)); + 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."); - } + 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() { + MemoryMappedFile::~MemoryMappedFile() { #ifdef _WINDOWS - if(imp_->mapped_object_) { - CloseHandle(imp_->mapped_object_); - } + 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_); - } + if(memory_) { + size_t total_size = size_ + sizeof(shared_memory_struct); + munmap(reinterpret_cast(memory_), total_size); + close(imp_->fd_); + } #endif - delete imp_; - } + delete imp_; + } - void MemoryMappedFile::ZeroFile() { - memset(reinterpret_cast(memory_), 0, sizeof(shared_memory_struct)); - memset(memory_->data, 0, size_); - memory_->size = size_; - } + 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 8ab588f34..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 free software; you can redistribute it and/or modify + it 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_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); + //! 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); + //! 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); - //! Destructor - ~MemoryMappedFile(); + //! Destructor + ~MemoryMappedFile(); - //! Get Data Operator - inline void *operator->() const { return memory_->data; } + //! Get Data Operator + inline void *operator->() const { return memory_->data; } - //! Get Data Function - inline void *Get() const { return memory_->data; } + //! Get Data Function + inline void *Get() const { return memory_->data; } - //! Get Size Function - inline uint32 Size() const { return memory_->size; } + //! 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&); + //! 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&); + //! 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. + 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. - }; + 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/opcodemgr.cpp b/common/opcodemgr.cpp index 71bf97b7c..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 free software; you can redistribute it and/or modify + it 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 @@ -180,7 +180,6 @@ bool RegularOpcodeManager::ReloadOpcodes(const char *filename, bool report_error return(ret); } - uint16 RegularOpcodeManager::EmuToEQ(const EmuOpcode emu_op) { //opcode is checked for validity in GetEQOpcode uint16 res; @@ -221,7 +220,6 @@ void RegularOpcodeManager::SetOpcode(EmuOpcode emu_op, uint16 eq_op) { 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); } @@ -254,7 +251,6 @@ EmptyOpcodeManager::EmptyOpcodeManager() : MutableOpcodeManager() { } - bool EmptyOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) { return(true); } @@ -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 14e6fde7a..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 free software; you can redistribute it and/or modify + it 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 OPCODE_MANAGER_H @@ -58,8 +58,8 @@ 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); @@ -162,15 +162,3 @@ protected: #endif - - - - - - - - - - - - diff --git a/common/packet_dump.cpp b/common/packet_dump.cpp index 1b6a9710d..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 @@ -59,8 +59,8 @@ void DumpPacketHex(const uchar* buf, uint32 size, uint32 cols, uint32 skip) { 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 @@ -43,13 +43,13 @@ void EncryptProfilePacket(uchar* pBuffer, uint32 size) { 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) { @@ -66,13 +66,13 @@ void EncryptZoneSpawnPacket(uchar* pBuffer, uint32 size) { 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,28 +100,28 @@ 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; + 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) { + 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); @@ -144,15 +144,15 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou z_stream zstream; memset(&zstream, 0, sizeof(zstream)); - int zerror; + 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; + 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); @@ -173,26 +173,26 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint #ifdef REUSE_ZLIB static bool inited = false; static z_stream zstream; - int zerror; + 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; + 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 ); @@ -237,8 +237,8 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint 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 ); 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/perl_EQDB.cpp b/common/perl_EQDB.cpp index 086a27c73..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,7 +32,7 @@ typedef const char Const_char; #include "../common/useperl.h" #include "EQDB.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif diff --git a/common/perl_EQDBRes.cpp b/common/perl_EQDBRes.cpp index 835bea2c8..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; 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 10ae404d2..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 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 1220daa92..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 @@ -47,7 +47,7 @@ enum { //values for pTimerType 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 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 c6779385a..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 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. + 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 */ + 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 15826d49a..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 free software; you can redistribute it and/or modify + it 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 "rdtsc.h" @@ -166,7 +166,3 @@ void RDTSC_Collector::reset() { _count = 0; } - - - - diff --git a/common/rdtsc.h b/common/rdtsc.h index d73fbaec8..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 free software; you can redistribute it and/or modify + it 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 RDTSC_H #define RDTSC_H @@ -83,5 +83,4 @@ protected: 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 266b75570..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 free software; you can redistribute it and/or modify + it 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 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) \ @@ -76,12 +76,12 @@ 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; @@ -89,12 +89,12 @@ public: 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); } @@ -115,14 +115,14 @@ public: 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 @@ -152,3 +152,4 @@ private: }; #endif /*RULESYS_H_*/ + diff --git a/common/ruletypes.h b/common/ruletypes.h index 204763b2b..f615f42a0 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -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) @@ -326,7 +326,7 @@ RULE_INT ( Combat, MinRangedAttackDist, 25) //Minimum Distance to use Ranged Att 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 3031813b6..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 diff --git a/common/serverinfo.cpp b/common/serverinfo.cpp index 6a4840f45..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 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 b78dfada9..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; @@ -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 { @@ -585,8 +585,8 @@ struct ServerWhoAll_Struct { struct ServerFriendsWho_Struct { uint32 FromID; - char FromName[64]; - char FriendsString[1]; + 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 { @@ -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 a5107215f..87420550c 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1,4 +1,3 @@ - #include "shareddb.h" #include #include @@ -22,33 +21,33 @@ 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) + 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; @@ -99,7 +98,7 @@ uint8 SharedDatabase::GetGMSpeed(uint32 account_id) 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; @@ -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,7 +165,7 @@ 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 @@ -203,7 +202,7 @@ 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 }; @@ -246,14 +245,14 @@ 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]); @@ -290,7 +289,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s " 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)(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); @@ -350,7 +349,7 @@ int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) 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; @@ -410,10 +409,10 @@ 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) { @@ -451,33 +450,33 @@ 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); - } - } - } - } + 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); + put_slot_id = inv->PutItem(slot_id, *inst); safe_delete(inst); // Save ptr to item in inventory @@ -513,14 +512,14 @@ 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))) { int16 slot_id = atoi(row[0]); @@ -542,31 +541,31 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { ItemInst* inst = CreateBaseItem(item, charges); - if(row[10]) { - std::string data_str(row[10]); - std::string id; - std::string value; - bool use_id = true; + 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); - } - } - } - } + 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); @@ -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]); @@ -652,31 +651,31 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) 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; + 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); - } - } - } - } + 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); @@ -719,10 +718,10 @@ 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)) { @@ -740,275 +739,275 @@ 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)); + 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]); + 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; - } + try { + hash.insert(item.ID, item); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "Database::LoadItems: %s", ex.what()); + break; + } } mysql_free_result(result); @@ -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,133 +1083,133 @@ 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; - } + if(faction_hash) { + return true; + } - try { - EQEmu::IPCMutex mutex("faction"); - mutex.Lock(); - faction_mmf = new EQEmu::MemoryMappedFile("shared/faction"); + try { + EQEmu::IPCMutex mutex("faction"); + mutex.Lock(); + faction_mmf = new EQEmu::MemoryMappedFile("shared/faction"); - 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)); + 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)); - if(faction_mmf->Size() != size) { - EQ_EXCEPT("SharedDatabase", "Couldn't load npc factions because faction_mmf->Size() != size"); - } + if(faction_mmf->Size() != size) { + EQ_EXCEPT("SharedDatabase", "Couldn't load npc factions because faction_mmf->Size() != size"); + } - 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; - } + 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; + 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; @@ -1272,7 +1271,7 @@ bool SharedDatabase::SetPlayerProfile(uint32 account_id, uint32 charid, PlayerPr if (!ret) { LogFile->write(EQEMuLog::Error, "SetPlayerProfile query '%s' %s", query, errbuf); - } + } safe_delete_array(query); return ret; @@ -1280,7 +1279,7 @@ bool SharedDatabase::SetPlayerProfile(uint32 account_id, uint32 charid, PlayerPr // 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; @@ -1295,7 +1294,7 @@ uint32 SharedDatabase::SetPlayerProfile_MQ(char** query, uint32 account_id, uint 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)); } @@ -1357,7 +1356,7 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) int32 SharedDatabase::DeleteStalePlayerCorpses() { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if(RuleB(Zone, EnableShadowrest)) @@ -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 @@ -1402,9 +1401,9 @@ int32 SharedDatabase::DeleteStalePlayerBackups() { 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(); @@ -1425,146 +1424,146 @@ bool SharedDatabase::GetCommandSettings(map &commands) { } 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; + 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); + "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; + 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; + 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; - } + if(Class_ > class_count || static_cast(Skill) > skill_count || Level > level_count) { + return 0; + } - uint8 ret = 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)); + if(ret > GetSkillCap(Class_, Skill, Level)) + ret = static_cast(GetSkillCap(Class_, Skill, Level)); - return ret; + 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,9 +1596,9 @@ 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"), errbuf, &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, + 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]); + 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]); + 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].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].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< 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]); + 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]); + 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]); + 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]); + 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]); + 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].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]); + 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].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].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].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); + 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 { + 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))); - } + 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])); - } + 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(current_entry > 128) { + continue; + } - if(!row[4]) { - 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->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))); - } + ++(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); - } + 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,7 +1981,7 @@ 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; @@ -2017,7 +2016,7 @@ 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; diff --git a/common/shareddb.h b/common/shareddb.h index fe20bdee1..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 - */ + * 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); + //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); + //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 4e0a6c1c6..4cf4ab1a6 100644 --- a/common/spdat.cpp +++ b/common/spdat.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 */ @@ -22,11 +22,11 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) 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. @@ -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)) { @@ -475,7 +475,7 @@ bool IsValidSpell(uint32 spellid) { return ( - SPDAT_RECORDS > 0 && + SPDAT_RECORDS > 0 && spellid != 0 && spellid != 1 && spellid != 0xFFFFFFFF && @@ -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) @@ -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) @@ -936,55 +936,55 @@ 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) diff --git a/common/spdat.h b/common/spdat.h index 43efe3182..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 { @@ -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, @@ -293,7 +293,7 @@ typedef enum { //#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) @@ -384,7 +384,7 @@ typedef enum { #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_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 @@ -450,7 +450,7 @@ 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_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 @@ -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) @@ -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 @@ -623,14 +623,14 @@ 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 @@ -650,54 +650,54 @@ 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; +/* 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 +/* 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; +/* 162 */ int bonushate; /* 163 */ -/* 166 */ int EndurCost; -/* 167 */ int8 EndurTimerIndex; -/* 168 */ //int IsDisciplineBuff; //Will goto the combat window when cast +/* 166 */ int EndurCost; +/* 167 */ int8 EndurTimerIndex; +/* 168 */ //int IsDisciplineBuff; //Will goto the combat window when cast /* 169 */ -/* 173 */ int HateAdded; -/* 174 */ int EndurUpkeep; +/* 173 */ int HateAdded; +/* 174 */ int EndurUpkeep; /* 175 */ -/* 176 */ int numhits; -/* 177 */ int pvpresistbase; -/* 178 */ int pvpresistcalc; -/* 179 */ int pvpresistcap; -/* 180 */ int spell_category; +/* 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; +/* 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 }; diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index 99120f029..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" diff --git a/common/timeoutmgr.h b/common/timeoutmgr.h index 50d9369f8..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 diff --git a/common/timer.cpp b/common/timer.cpp index 616581bdd..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) { + 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 */ @@ -107,36 +107,36 @@ void Timer::Enable() { /* This function set the timer and restart it */ void Timer::Start(uint32 set_timer_time, bool ChangeResetTimer) { - start_time = current_time; + 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; } @@ -159,36 +159,37 @@ 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 258ee992c..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,7 +72,7 @@ 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; #else @@ -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 8087e4204..3c0bf8f1c 100644 --- a/common/useperl.h +++ b/common/useperl.h @@ -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 */ +#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 633d9d0e4..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 free software; you can redistribute it and/or modify + it 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" @@ -94,8 +94,3 @@ void WorldConnection::Disconnect() { tcpc.Disconnect(); } - - - - - diff --git a/common/worldconn.h b/common/worldconn.h index c4fa4ad17..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 free software; you can redistribute it and/or modify + it 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 WORLDCONNECTION_H @@ -30,7 +30,7 @@ class ServerPacket; class WorldConnection { public: WorldConnection(EmuTCPConnection::ePacketMode mode, const char *password = ""); - virtual ~WorldConnection(); + virtual ~WorldConnection(); virtual void Process(); bool SendPacket(ServerPacket* pack); diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt index 663f2e674..7c0995411 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}) @@ -17,21 +17,21 @@ TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${M 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) + 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) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/eqlaunch/ZoneLaunch.cpp b/eqlaunch/ZoneLaunch.cpp index 3e7efba77..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 free software; you can redistribute it and/or modify + it 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 */ @@ -34,16 +34,16 @@ void ZoneLaunch::InitStartTimer() { } ZoneLaunch::ZoneLaunch(WorldServer *world, const char *launcher_name, - const char *zone_name, const EQEmuConfig *config) +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(); @@ -250,38 +250,3 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche SendStatus(); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eqlaunch/ZoneLaunch.h b/eqlaunch/ZoneLaunch.h index 0f684af0e..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 free software; you can redistribute it and/or modify + it 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 ZONELAUNCH_H_ #define ZONELAUNCH_H_ @@ -75,13 +75,4 @@ private: static Timer s_startTimer; }; - - - - - - - - - #endif /*ZONELAUNCH_H_*/ diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 4c7950025..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 free software; you can redistribute it and/or modify + it 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" @@ -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) { @@ -57,8 +57,8 @@ int main(int argc, char *argv[]) { 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; @@ -74,8 +74,8 @@ int main(int argc, char *argv[]) { } /* - * 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) { @@ -109,18 +109,18 @@ int main(int argc, char *argv[]) { 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++) { @@ -129,8 +129,8 @@ int main(int argc, char *argv[]) { } /* - * 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); @@ -150,8 +150,8 @@ int main(int argc, char *argv[]) { } /* - * Take a nice nap until next cycle - */ + * Take a nice nap until next cycle + */ if(zones.empty()) Sleep(5000); else diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 672525dbd..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 free software; you can redistribute it and/or modify + it 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 "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) { } diff --git a/eqlaunch/worldserver.h b/eqlaunch/worldserver.h index 113dc1ae4..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,7 +29,7 @@ class EQEmuConfig; class WorldServer : public WorldConnection { public: WorldServer(std::map &zones, const char *name, const EQEmuConfig *config); - virtual ~WorldServer(); + virtual ~WorldServer(); virtual void Process(); diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index 96599d4b3..f79ae54a0 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}) @@ -44,23 +44,23 @@ TARGET_LINK_LIBRARIES(loginserver Common debug ${MySQL_LIBRARY_DEBUG} optimized 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) + 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) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/loginserver/Client.cpp b/loginserver/Client.cpp index 0ae477ff0..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); diff --git a/loginserver/Client.h b/loginserver/Client.h index b670e88c0..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 c6ad7093f..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" 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 487a88588..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,10 +138,10 @@ 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); diff --git a/loginserver/Config.h b/loginserver/Config.h index c9b2b1bca..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 71917518b..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. - */ + * 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 9294cb059..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" diff --git a/loginserver/DatabaseMySQL.h b/loginserver/DatabaseMySQL.h index 9a1cea425..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. - */ + * 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 f6a3c5ac4..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); @@ -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); @@ -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 ef7ad30ed..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. - */ + * 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 66498965d..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" @@ -100,7 +100,7 @@ bool Encryption::Load(const char *name) { return false; } - else + else { SetLastError(0); } 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 ecc5a7ba6..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" @@ -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 f64cd5fae..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 01c6ab9d5..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 { @@ -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 cc4ed579d..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); diff --git a/loginserver/Options.h b/loginserver/Options.h index 74d1904b3..38d5d109f 100644 --- a/loginserver/Options.h +++ b/loginserver/Options.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_OPTIONS_H #define EQEMU_OPTIONS_H @@ -26,10 +26,10 @@ class Options { public: /** - * Constructor, sets the default options. - */ + * Constructor, sets the default options. + */ Options() : - allow_unregistered(true), + allow_unregistered(true), trace(false), dump_in_packets(false), dump_out_packets(false), @@ -38,123 +38,123 @@ public: 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 58aa6fd87..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" @@ -172,9 +172,9 @@ 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; @@ -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 8763480a3..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" @@ -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,7 +457,7 @@ 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 { diff --git a/loginserver/WorldServer.h b/loginserver/WorldServer.h index 8b3133965..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 6af899854..9a04123e4 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}) @@ -23,21 +23,21 @@ TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${ 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) + 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) 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 b788e7c20..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 */ @@ -61,3 +59,4 @@ private: }; #endif + diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index c884d45f6..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); @@ -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); @@ -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 a403d379f..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 */ @@ -54,3 +52,4 @@ public: }; #endif + diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index fae1be01f..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 free software; you can redistribute it and/or modify + it 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 @@ -140,7 +140,7 @@ 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 diff --git a/queryserv/worldserver.h b/queryserv/worldserver.h index c42ca5ceb..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(); + public: + WorldServer(); + virtual ~WorldServer(); + virtual void Process(); -private: - virtual void OnConnected(); + private: + virtual void OnConnected(); }; #endif diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt index 902ffb2ff..35dc8bfd3 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,21 @@ 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) + 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) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/shared_memory/items.cpp b/shared_memory/items.cpp index f6ed659d2..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 free software; you can redistribute it and/or modify + it 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 "items.h" @@ -25,21 +25,21 @@ #include "../common/item_struct.h" void LoadItems(SharedDatabase *database) { - EQEmu::IPCMutex mutex("items"); - mutex.Lock(); + 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."); - } + 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(); + 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(); + 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 c292563ec..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 free software; you can redistribute it and/or modify + it 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_SHARED_MEMORY_ITEMS_H diff --git a/shared_memory/loot.cpp b/shared_memory/loot.cpp index ed9bc4577..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 free software; you can redistribute it and/or modify + it 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 "loot.h" @@ -26,36 +26,36 @@ #include "../common/loottable.h" void LoadLoot(SharedDatabase *database) { - EQEmu::IPCMutex mutex("loot"); - mutex.Lock(); + 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); + 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_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_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_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_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::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::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_table_hash(reinterpret_cast(mmf_loot_table.Get()), - loot_table_size, loot_table_max); + EQEmu::FixedMemoryVariableHashSet loot_table_hash(reinterpret_cast(mmf_loot_table.Get()), + loot_table_size, loot_table_max); - EQEmu::FixedMemoryVariableHashSet loot_drop_hash(reinterpret_cast(mmf_loot_drop.Get()), - loot_drop_size, loot_drop_max); + 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(); + 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 89f470c09..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 free software; you can redistribute it and/or modify + it 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_SHARED_MEMORY_LOOT_H diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 7e717434e..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 free software; you can redistribute it and/or modify + it 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 @@ -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 'i': + if(strcasecmp("items", argv[i]) == 0) { + load_items = 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 'f': + if(strcasecmp("factions", argv[i]) == 0) { + load_factions = 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 'l': + if(strcasecmp("loot", argv[i]) == 0) { + load_loot = 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; - } - } + 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_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_items) { + LogFile->write(EQEMuLog::Status, "Loading items..."); + try { + LoadItems(&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_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_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_loot) { + LogFile->write(EQEMuLog::Status, "Loading loot..."); + try { + LoadLoot(&database); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "%s", ex.what()); + return 0; + } + } - 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 5fc2d6845..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 free software; you can redistribute it and/or modify + it 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 "npc_faction.h" @@ -25,21 +25,21 @@ #include "../common/faction.h" void LoadFactions(SharedDatabase *database) { - EQEmu::IPCMutex mutex("faction"); - mutex.Lock(); + 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 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(); + 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(); + 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 57313bb8e..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 free software; you can redistribute it and/or modify + it 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_SHARED_MEMORY_NPC_FACTION_H diff --git a/shared_memory/skill_caps.cpp b/shared_memory/skill_caps.cpp index 8cfae69fc..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 free software; you can redistribute it and/or modify + it 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 "skill_caps.h" @@ -26,17 +26,17 @@ #include "../common/features.h" void LoadSkillCaps(SharedDatabase *database) { - EQEmu::IPCMutex mutex("skill_caps"); - mutex.Lock(); + EQEmu::IPCMutex mutex("skill_caps"); + mutex.Lock(); - 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; - uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); - EQEmu::MemoryMappedFile mmf("shared/skill_caps", size); - mmf.ZeroFile(); + 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 + void *ptr = mmf.Get(); + database->LoadSkillCaps(ptr); + mutex.Unlock(); +} diff --git a/shared_memory/skill_caps.h b/shared_memory/skill_caps.h index 75c18bffa..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 free software; you can redistribute it and/or modify + it 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_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 635d57c29..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 free software; you can redistribute it and/or modify + it 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 "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 7959382a4..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 free software; you can redistribute it and/or modify + it 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_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/fixed_memory_test.h b/tests/fixed_memory_test.h index 89d6dad46..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 free software; you can redistribute it and/or modify + it 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_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_; - } + 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()); - } + 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 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 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 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 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()); - } + TEST_ASSERT(hash.exists(1001)); + TEST_ASSERT(hash.size() == 1); + 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()); + 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); - } + Item_Struct item = hash[1001]; + TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); + TEST_ASSERT(item.ID == 1001); + } - 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 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()); + 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); - } + Item_Struct item = hash[1001]; + TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); + TEST_ASSERT(item.ID == 1001); + } - 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 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); - 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()); - } + 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 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()); + 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); + 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[1001]; + TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); + TEST_ASSERT(item.ID == 1001); + } - 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 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); - 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()); - } + 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 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()); + 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); + 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[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[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); + 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()); - } + 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()); + 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_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[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[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); - } + 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 fcc04ad7f..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 free software; you can redistribute it and/or modify + it 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_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_; - } + 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)); - } + private: + void InitTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_, 501); + TEST_ASSERT(!hash.exists(0)); + TEST_ASSERT(!hash.exists(501)); + } - void LoadTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - TEST_ASSERT(!hash.exists(0)); - TEST_ASSERT(!hash.exists(501)); - } + void LoadTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + 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 InsertTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + test_struct test; + memset(&test, 0, sizeof(test)); + strcpy(test.name, "Bill D."); - hash.insert(0, reinterpret_cast(&test), sizeof(test)); - 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)); + 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); - } + test_struct test = hash[0]; + TEST_ASSERT(strcmp(test.name, "Bill D.") == 0); + } - void InsertAgainTest() { - EQEmu::FixedMemoryVariableHashSet hash(data_, size_); - test_struct test; - memset(&test, 0, sizeof(test)); - strcpy(test.name, "Jimmy P."); + void InsertAgainTest() { + EQEmu::FixedMemoryVariableHashSet hash(data_, size_); + test_struct test; + memset(&test, 0, sizeof(test)); + strcpy(test.name, "Jimmy P."); - hash.insert(501, 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 RetrieveAgainTest() { - 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[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."); + 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&) { } + 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)); - } + 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)); + 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&) { } - } + 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 799fa83e4..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 free software; you can redistribute it and/or modify + it 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_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() { - } + ~IPCMutexTest() { + } - private: - void LockMutexTest() { - EQEmu::IPCMutex mutex("TestMutex1"); - TEST_ASSERT(mutex.Lock()); - TEST_ASSERT(mutex.Unlock()); - } + private: + void LockMutexTest() { + EQEmu::IPCMutex mutex("TestMutex1"); + TEST_ASSERT(mutex.Lock()); + TEST_ASSERT(mutex.Unlock()); + } - void UnlockMutexTest() { - EQEmu::IPCMutex mutex("TestMutex2"); - TEST_ASSERT(!mutex.Unlock()); - } + void UnlockMutexTest() { + EQEmu::IPCMutex mutex("TestMutex2"); + TEST_ASSERT(!mutex.Unlock()); + } - void DoubleLockMutexTest() { - EQEmu::IPCMutex mutex("TestMutex3"); - TEST_ASSERT(mutex.Lock()); - TEST_ASSERT(!mutex.Lock()); - } + 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()); - } + 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 f3cf0e20a..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 free software; you can redistribute it and/or modify + it 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 */ @@ -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 3f77353eb..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 free software; you can redistribute it and/or modify + it 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_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); + 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); + unsigned char *data = reinterpret_cast(mmf.Get()); + TEST_ASSERT(data != nullptr); - *reinterpret_cast(data) = 562; - } + *reinterpret_cast(data) = 562; + } - void LoadExistingMMF() { - EQEmu::MemoryMappedFile mmf("testfile.txt"); - TEST_ASSERT(mmf.Size() == 512); + void LoadExistingMMF() { + EQEmu::MemoryMappedFile mmf("testfile.txt"); + TEST_ASSERT(mmf.Size() == 512); - unsigned char *data = reinterpret_cast(mmf.Get()); - TEST_ASSERT(data != nullptr); + unsigned char *data = reinterpret_cast(mmf.Get()); + TEST_ASSERT(data != nullptr); - uint32 val = *reinterpret_cast(data); - TEST_ASSERT(val == 562); - } + uint32 val = *reinterpret_cast(data); + TEST_ASSERT(val == 562); + } }; #endif diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index 4493d8461..fc813baf6 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}) @@ -25,21 +25,21 @@ TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_ 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) + 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) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index c3f3ad6f0..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 */ @@ -44,7 +42,7 @@ 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); + Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -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); } @@ -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 49374a7a9..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 */ @@ -209,7 +207,7 @@ vector ParseRecipients(string RecipientString) { LastPeriod = (*Iterator).find_last_of("."); - if(LastPeriod != string::npos) { + if(LastPeriod != string::npos) { (*Iterator) = (*Iterator).substr(LastPeriod + 1); @@ -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(); @@ -561,16 +559,16 @@ 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)); @@ -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,12 +603,12 @@ 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)); @@ -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); @@ -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(); @@ -870,7 +868,7 @@ 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: @@ -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) @@ -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) @@ -1447,7 +1445,7 @@ 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()); + Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) { @@ -2139,7 +2137,7 @@ void Client::ChannelKick(string CommandString) { return; } - if(RequiredChannel->IsModerator(Kickee)) { + if(RequiredChannel->IsModerator(Kickee)) { RequiredChannel->RemoveModerator(Kickee); @@ -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 91264a395..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 } }; + { "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 eb60b0c5c..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); @@ -176,7 +174,7 @@ 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; @@ -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); @@ -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); @@ -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 ; @@ -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)) { + 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); @@ -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,7 +703,7 @@ 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,7 +720,7 @@ 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 @@ -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 c42ca5ceb..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 diff --git a/world/Adventure.cpp b/world/Adventure.cpp index f8b4a0611..c5542f7be 100644 --- a/world/Adventure.cpp +++ b/world/Adventure.cpp @@ -115,8 +115,8 @@ bool Adventure::Process() else if(status == AS_WaitingForPrimaryEndTime) { //Do partial failure: send a message to the clients that they can only get a certain amount of points. - SendAdventureMessage(13, "You failed to complete your adventure in time. Complete your adventure goal within 30 minutes to " - "receive a lesser reward. This adventure will end in 30 minutes and your party will be ejected from the dungeon."); + SendAdventureMessage(13, "You failed to complete your adventure in time. Complete your adventure goal within 30 minutes to " + "receive a lesser reward. This adventure will end in 30 minutes and your party will be ejected from the dungeon."); SetStatus(AS_WaitingForSecondaryEndTime); } else @@ -435,4 +435,5 @@ void Adventure::MoveCorpsesToGraveyard() iter++; c_iter++; } -} \ No newline at end of file +} + diff --git a/world/AdventureManager.cpp b/world/AdventureManager.cpp index abd202d61..4a8321a4d 100644 --- a/world/AdventureManager.cpp +++ b/world/AdventureManager.cpp @@ -68,8 +68,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) } /** - * This block checks to see if we actually have any adventures for the requested theme. - */ + * This block checks to see if we actually have any adventures for the requested theme. + */ map >::iterator adv_list_iter = adventure_entries.find(sar->template_id); if(adv_list_iter == adventure_entries.end()) { @@ -84,10 +84,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) } /** - * This block checks to see if our requested group has anyone with an "Active" adventure - * Active being in progress, finished adventures that are still waiting to expire do not count - * Though they will count against you for which new adventure you can get. - */ + * This block checks to see if our requested group has anyone with an "Active" adventure + * Active being in progress, finished adventures that are still waiting to expire do not count + * Though they will count against you for which new adventure you can get. + */ list::iterator iter = adventure_list.begin(); while(iter != adventure_list.end()) { @@ -117,9 +117,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) } /** - * Now we need to get every available adventure for our selected theme and exclude ones we can't use. - * ie. the ones that would cause overlap issues for new adventures with the old unexpired adventures. - */ + * Now we need to get every available adventure for our selected theme and exclude ones we can't use. + * ie. the ones that would cause overlap issues for new adventures with the old unexpired adventures. + */ list excluded_zones; list excluded_zone_ins; for(int i = 0; i < sar->member_count; ++i) @@ -149,9 +149,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) list eligible_adventures = adventure_entries[sar->template_id]; /** - * Remove zones from eligible zones based on their difficulty and type. - * ie only use difficult zones for difficult, collect for collect, etc. - */ + * Remove zones from eligible zones based on their difficulty and type. + * ie only use difficult zones for difficult, collect for collect, etc. + */ list::iterator ea_iter = eligible_adventures.begin(); while(ea_iter != eligible_adventures.end()) { @@ -170,8 +170,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) } /** - * Get levels for this group. - */ + * Get levels for this group. + */ int valid_count = 0; int avg_level = 0; int min_level = 40000; @@ -263,8 +263,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) } /** - * Remove the zones from our eligible zones based on the exclusion above - */ + * Remove the zones from our eligible zones based on the exclusion above + */ list::iterator ez_iter = excluded_zones.begin(); while(ez_iter != excluded_zones.end()) { @@ -282,7 +282,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) } list::iterator ezi_iter = excluded_zone_ins.begin(); - while(ezi_iter != excluded_zone_ins.end()) + while(ezi_iter != excluded_zone_ins.end()) { list::iterator ea_iter = eligible_adventures.begin(); while(ea_iter != eligible_adventures.end()) @@ -297,9 +297,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) ezi_iter++; } - /** - * Remove Zones based on level - */ + /** + * Remove Zones based on level + */ ea_iter = eligible_adventures.begin(); while(ea_iter != eligible_adventures.end()) { diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index 85423e5f1..8ea3397fe 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -1,66 +1,66 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(world_sources - Adventure.cpp - AdventureManager.cpp - client.cpp - cliententry.cpp - clientlist.cpp - CMakeLists.txt - console.cpp - EQLConfig.cpp - EQW.cpp - EQWHTTPHandler.cpp - EQWParser.cpp - HTTPRequest.cpp - LauncherLink.cpp - LauncherList.cpp - lfplist.cpp - LoginServer.cpp - LoginServerList.cpp - net.cpp - perl_EQLConfig.cpp - perl_EQW.cpp - perl_HTTPRequest.cpp - queryserv.cpp - ucs.cpp - wguild_mgr.cpp - world_logsys.cpp - WorldConfig.cpp - worlddb.cpp - zonelist.cpp - zoneserver.cpp + Adventure.cpp + AdventureManager.cpp + client.cpp + cliententry.cpp + clientlist.cpp + CMakeLists.txt + console.cpp + EQLConfig.cpp + EQW.cpp + EQWHTTPHandler.cpp + EQWParser.cpp + HTTPRequest.cpp + LauncherLink.cpp + LauncherList.cpp + lfplist.cpp + LoginServer.cpp + LoginServerList.cpp + net.cpp + perl_EQLConfig.cpp + perl_EQW.cpp + perl_HTTPRequest.cpp + queryserv.cpp + ucs.cpp + wguild_mgr.cpp + world_logsys.cpp + WorldConfig.cpp + worlddb.cpp + zonelist.cpp + zoneserver.cpp ) SET(world_headers - Adventure.h - AdventureManager.h - AdventureTemplate.h - client.h - cliententry.h - clientlist.h - CMakeLists.txt - console.h - EQLConfig.h - EQW.h - EQWHTTPHandler.h - EQWParser.h - HTTPRequest.h - LauncherLink.h - LauncherList.h - lfplist.h - LoginServer.h - LoginServerList.h - net.h - queryserv.h - SoFCharCreateData.h - ucs.h - wguild_mgr.h - WorldConfig.h - worlddb.h - WorldTCPConnection.h - zonelist.h - zoneserver.h + Adventure.h + AdventureManager.h + AdventureTemplate.h + client.h + cliententry.h + clientlist.h + CMakeLists.txt + console.h + EQLConfig.h + EQW.h + EQWHTTPHandler.h + EQWParser.h + HTTPRequest.h + LauncherLink.h + LauncherList.h + lfplist.h + LoginServer.h + LoginServerList.h + net.h + queryserv.h + SoFCharCreateData.h + ucs.h + wguild_mgr.h + WorldConfig.h + worlddb.h + WorldTCPConnection.h + zonelist.h + zoneserver.h ) ADD_EXECUTABLE(world ${world_sources} ${world_headers}) @@ -71,21 +71,21 @@ TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} IF(MSVC) - SET_TARGET_PROPERTIES(world PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(world "Ws2_32.lib") + SET_TARGET_PROPERTIES(world PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + TARGET_LINK_LIBRARIES(world "Ws2_32.lib") ENDIF(MSVC) IF(MINGW) - TARGET_LINK_LIBRARIES(world "WS2_32") + TARGET_LINK_LIBRARIES(world "WS2_32") ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(world "dl") - TARGET_LINK_LIBRARIES(world "z") - TARGET_LINK_LIBRARIES(world "m") - TARGET_LINK_LIBRARIES(world "rt") - TARGET_LINK_LIBRARIES(world "pthread") - ADD_DEFINITIONS(-fPIC) + TARGET_LINK_LIBRARIES(world "dl") + TARGET_LINK_LIBRARIES(world "z") + TARGET_LINK_LIBRARIES(world "m") + TARGET_LINK_LIBRARIES(world "rt") + TARGET_LINK_LIBRARIES(world "pthread") + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/world/EQLConfig.cpp b/world/EQLConfig.cpp index fe88008d6..09ebf52b6 100644 --- a/world/EQLConfig.cpp +++ b/world/EQLConfig.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 "../common/debug.h" #include "EQLConfig.h" @@ -39,7 +39,7 @@ void EQLConfig::LoadSettings() { MYSQL_ROW row; LauncherZone tmp; - char namebuf[128]; + char namebuf[128]; database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64 namebuf[127] = '\0'; @@ -77,15 +77,15 @@ void EQLConfig::LoadSettings() { EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; - char namebuf[128]; + char namebuf[128]; database.DoEscapeString(namebuf, name, strlen(name)&0x3F); //limit len to 64 namebuf[127] = '\0'; if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO launcher (name,dynamics) VALUES('%s', %d)", - namebuf, dynamic_count), errbuf)) { + namebuf, dynamic_count), errbuf)) { LogFile->write(EQEMuLog::Error, "Error in CreateLauncher query: %s", errbuf); safe_delete_array(query); return nullptr; @@ -127,9 +127,9 @@ void EQLConfig::DeleteLauncher() { launcher_list.Remove(m_name.c_str()); char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; - char namebuf[128]; + char namebuf[128]; database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64 namebuf[127] = '\0'; @@ -185,18 +185,18 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { //database update char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; - char namebuf[128]; + char namebuf[128]; database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64 namebuf[127] = '\0'; - char zonebuf[32]; + char zonebuf[32]; database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16 zonebuf[31] = '\0'; if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO launcher_zones (launcher,zone,port) VALUES('%s', '%s', %d)", - namebuf, zonebuf, port), errbuf)) { + namebuf, zonebuf, port), errbuf)) { LogFile->write(EQEMuLog::Error, "Error in BootStaticZone query: %s", errbuf); safe_delete_array(query); return false; @@ -235,18 +235,18 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { //database update char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; - char namebuf[128]; + char namebuf[128]; database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64 namebuf[127] = '\0'; - char zonebuf[32]; + char zonebuf[32]; database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16 zonebuf[31] = '\0'; if (!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE launcher_zones SET port=%d WHERE launcher='%s' AND zone='%s'", - port, namebuf, zonebuf), errbuf)) { + port, namebuf, zonebuf), errbuf)) { LogFile->write(EQEMuLog::Error, "Error in ChangeStaticZone query: %s", errbuf); safe_delete_array(query); return false; @@ -278,12 +278,12 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { //database update char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; - char namebuf[128]; + char namebuf[128]; database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64 namebuf[127] = '\0'; - char zonebuf[32]; + char zonebuf[32]; database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16 zonebuf[31] = '\0'; @@ -310,15 +310,15 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { bool EQLConfig::SetDynamicCount(int count) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; - char namebuf[128]; + char namebuf[128]; database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64 namebuf[127] = '\0'; if (!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE launcher SET dynamics=%d WHERE name='%s'", - count, namebuf), errbuf)) { + count, namebuf), errbuf)) { LogFile->write(EQEMuLog::Error, "Error in SetDynamicCount query: %s", errbuf); safe_delete_array(query); return false; @@ -357,28 +357,3 @@ map EQLConfig::GetZoneDetails(Const_char *zone_ref) { return(res); } - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/world/EQLConfig.h b/world/EQLConfig.h index 1588c5d60..f4d1a4488 100644 --- a/world/EQLConfig.h +++ b/world/EQLConfig.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 EQLCONFIG_H_ #define EQLCONFIG_H_ @@ -58,7 +58,7 @@ public: bool DeleteStaticZone(Const_char *short_name); bool SetDynamicCount(int count); - int GetDynamicCount() const; + int GetDynamicCount() const; vector ListZones(); //returns an array of zone refs map GetZoneDetails(Const_char *zone_ref); @@ -72,11 +72,5 @@ protected: map m_zones; //static zones. }; - - - - - #endif /*EQLCONFIG_H_*/ - diff --git a/world/EQW.cpp b/world/EQW.cpp index 0214b2a6c..5746f06c0 100644 --- a/world/EQW.cpp +++ b/world/EQW.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 */ #ifdef EMBPERL @@ -55,26 +55,23 @@ extern LoginServerList loginserverlist; extern LauncherList launcher_list; extern volatile bool RunLoops; - - - EQW EQW::s_EQW; //IO Capture routine XS(XS_EQWIO_PRINT); /* prototype to pass -Wmissing-prototypes */ XS(XS_EQWIO_PRINT) { - dXSARGS; - if (items < 2) - return; + dXSARGS; + if (items < 2) + return; int r; for(r = 1; r < items; r++) { char *str = SvPV_nolen(ST(r)); EQW::Singleton()->AppendOutput(str); - } + } - XSRETURN_EMPTY; + XSRETURN_EMPTY; } EQW::EQW() { @@ -341,7 +338,7 @@ bool EQW::SetDynamicCount(Const_char *launcher_name, int count) { return(false); } -int EQW::GetDynamicCount(Const_char *launcher_name) { +int EQW::GetDynamicCount(Const_char *launcher_name) { return(0); } */ @@ -391,72 +388,72 @@ bool EQW::SetPublicNote(uint32 charid, const char *note) { } int EQW::CountBugs() { - char errbuf[MYSQL_ERRMSG_SIZE]; + char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; MYSQL_ROW row; - if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT count(*) FROM bugs where status = 0"), errbuf, &result)) { + if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT count(*) FROM bugs where status = 0"), errbuf, &result)) { safe_delete_array(query); - if((row = mysql_fetch_row(result))) { - int count = atoi(row[0]); - mysql_free_result(result); - return count; - } - mysql_free_result(result); - } - safe_delete_array(query); - return 0; + if((row = mysql_fetch_row(result))) { + int count = atoi(row[0]); + mysql_free_result(result); + return count; + } + mysql_free_result(result); + } + safe_delete_array(query); + return 0; } vector EQW::ListBugs(uint32 offset) { - vector res; - char errbuf[MYSQL_ERRMSG_SIZE]; + vector res; + char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; MYSQL_ROW row; - if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM bugs WHERE status = 0 limit %d, 30", offset), errbuf, &result)) { + if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM bugs WHERE status = 0 limit %d, 30", offset), errbuf, &result)) { safe_delete_array(query); - while((row = mysql_fetch_row(result))) { - res.push_back(row[0]); - } - mysql_free_result(result); - } - safe_delete_array(query); - return res; + while((row = mysql_fetch_row(result))) { + res.push_back(row[0]); + } + mysql_free_result(result); + } + safe_delete_array(query); + return res; } map EQW::GetBugDetails(Const_char *id) { - map res; - char errbuf[MYSQL_ERRMSG_SIZE]; + map res; + char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; MYSQL_ROW row; - if(database.RunQuery(query, MakeAnyLenString(&query, "select name, zone, x, y, z, target, bug from bugs where id = %s", id), errbuf, &result)) { + if(database.RunQuery(query, MakeAnyLenString(&query, "select name, zone, x, y, z, target, bug from bugs where id = %s", id), errbuf, &result)) { safe_delete_array(query); - while((row = mysql_fetch_row(result))) { - res["name"] = row[0]; - res["zone"] = row[1]; - res["x"] = row[2]; - res["y"] = row[3]; - res["z"] = row[4]; - res["target"] = row[5]; - res["bug"] = row[6]; - res["id"] = id; - } - mysql_free_result(result); - } - safe_delete_array(query); - return res; + while((row = mysql_fetch_row(result))) { + res["name"] = row[0]; + res["zone"] = row[1]; + res["x"] = row[2]; + res["y"] = row[3]; + res["z"] = row[4]; + res["target"] = row[5]; + res["bug"] = row[6]; + res["id"] = id; + } + mysql_free_result(result); + } + safe_delete_array(query); + return res; } void EQW::ResolveBug(const char *id) { - vector res; - char errbuf[MYSQL_ERRMSG_SIZE]; + vector res; + char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; - if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE bugs SET status=1 WHERE id=%s", id), errbuf)) { + if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE bugs SET status=1 WHERE id=%s", id), errbuf)) { safe_delete_array(query); - } - safe_delete_array(query); + } + safe_delete_array(query); } void EQW::SendMessage(uint32 type, const char *msg) { @@ -469,18 +466,3 @@ void EQW::WorldShutDown(uint32 time, uint32 interval) { #endif //EMBPERL - - - - - - - - - - - - - - - diff --git a/world/EQW.h b/world/EQW.h index c1527435b..d08a5bf4b 100644 --- a/world/EQW.h +++ b/world/EQW.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 EQW_H_ #define EQW_H_ @@ -45,15 +45,15 @@ public: bool LSConnected(); void LSReconnect(); - int CountZones(); + int CountZones(); vector ListBootedZones(); //returns an array of zone_refs (opaque) map GetZoneDetails(Const_char *zone_ref); //returns a hash ref of details - int CountPlayers(); + int CountPlayers(); vector ListPlayers(Const_char *zone_name = ""); //returns an array of player refs (opaque) map GetPlayerDetails(Const_char *player_ref); //returns a hash ref of details - int CountLaunchers(bool active_only); + int CountLaunchers(bool active_only); // vector ListActiveLaunchers(); //returns an array of launcher names vector ListLaunchers(); //returns an array of launcher names EQLConfig * GetLauncher(Const_char *launcher_name); //returns the EQLConfig object for the specified launcher. @@ -72,9 +72,9 @@ public: bool SetTributeFlag(uint32 charid, bool enabled); bool SetPublicNote(uint32 charid, const char *note); - //bugs - int CountBugs(); - vector ListBugs(uint32 offset); //returns an array of zone_refs (opaque) + //bugs + int CountBugs(); + vector ListBugs(uint32 offset); //returns an array of zone_refs (opaque) map GetBugDetails(const char *id); void ResolveBug(const char *id); diff --git a/world/EQWHTTPHandler.cpp b/world/EQWHTTPHandler.cpp index 8bba5c476..7b47ad30f 100644 --- a/world/EQWHTTPHandler.cpp +++ b/world/EQWHTTPHandler.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 "../common/debug.h" #include "EQWHTTPHandler.h" @@ -34,8 +34,8 @@ EQWParser *EQWHTTPHandler::s_parser = nullptr; const int EQWHTTPHandler::READ_BUFFER_LEN = 1024; //for page IO, was a static const member, but VC6 got mad. EQWHTTPHandler::EQWHTTPHandler(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort) -: HttpdSocket(ID,in_socket,irIP,irPort), - m_closeOnFinish(false) +: HttpdSocket(ID,in_socket,irIP,irPort), + m_closeOnFinish(false) { } @@ -192,7 +192,7 @@ void EQWHTTPHandler::SendPage(const std::string &file) { SendBuf(buffer, len); } delete[] buffer; - fclose(f); + fclose(f); #ifdef EMBPERL if(process) { //convert the base form into a useful perl exportable form @@ -336,5 +336,3 @@ ThreadReturnType EQWHTTPServer::ThreadProc(void *data) { THREAD_RETURN(nullptr); }*/ - - diff --git a/world/EQWHTTPHandler.h b/world/EQWHTTPHandler.h index 793d5b0c6..ab88a6e0b 100644 --- a/world/EQWHTTPHandler.h +++ b/world/EQWHTTPHandler.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 EQWHTTPHandler_H #define EQWHTTPHandler_H @@ -96,6 +96,3 @@ protected: #endif - - - diff --git a/world/EQWParser.cpp b/world/EQWParser.cpp index def0c4ec3..bdeedca2c 100644 --- a/world/EQWParser.cpp +++ b/world/EQWParser.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 */ //a lot of this is copied from embperl.cpp, but I didnt feel like factoring the common stuff out @@ -30,7 +30,7 @@ using namespace std; #ifndef GvCV_set -#define GvCV_set(gv,cv) (GvCV(gv) = (cv)) +#define GvCV_set(gv,cv) (GvCV(gv) = (cv)) #endif @@ -130,18 +130,18 @@ void EQWParser::DoInit() { eval_pv( "package EQWIO; " // "&boot_EQEmuIO;" - "sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } " - "sub WRITE { } " - "sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } " - "sub CLOSE { my $me = shift; $me->PRINT('Closing '.$me); } " - "sub DESTROY { my $me = shift; $me->PRINT('Destroying '.$me); } " + "sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } " + "sub WRITE { } " + "sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } " + "sub CLOSE { my $me = shift; $me->PRINT('Closing '.$me); } " + "sub DESTROY { my $me = shift; $me->PRINT('Destroying '.$me); } " //this ties us for all packages - "package MAIN;" - " if(tied *STDOUT) { untie(*STDOUT); }" - " if(tied *STDERR) { untie(*STDERR); }" - " tie *STDOUT, 'EQWIO';" - " tie *STDERR, 'EQWIO';" - ,FALSE); + "package MAIN;" + " if(tied *STDOUT) { untie(*STDOUT); }" + " if(tied *STDERR) { untie(*STDERR); }" + " tie *STDOUT, 'EQWIO';" + " tie *STDERR, 'EQWIO';" + ,FALSE); eval_pv( "package world; " @@ -171,16 +171,16 @@ void EQWParser::DoInit() { //load up EQW eval_pv( - "package EQW;" - "&boot_EQW;" //load our EQW XS - "package EQDB;" - "&boot_EQDB;" //load our EQW XS - "package EQDBRes;" - "&boot_EQDBRes;" //load our EQW XS - "package HTTPRequest;" - "&boot_HTTPRequest;" //load our HTTPRequest XS - "package EQLConfig;" - "&boot_EQLConfig;" //load our EQLConfig XS + "package EQW;" + "&boot_EQW;" //load our EQW XS + "package EQDB;" + "&boot_EQDB;" //load our EQW XS + "package EQDBRes;" + "&boot_EQDBRes;" //load our EQW XS + "package HTTPRequest;" + "&boot_HTTPRequest;" //load our HTTPRequest XS + "package EQLConfig;" + "&boot_EQLConfig;" //load our EQLConfig XS , FALSE ); @@ -211,7 +211,7 @@ EQWParser::~EQWParser() { "package quest;" " untie *STDOUT;" " untie *STDERR;" - ,FALSE); + ,FALSE); */ perl_free(my_perl); } @@ -226,25 +226,25 @@ bool EQWParser::eval_file(const char * packagename, const char * filename, std:: bool EQWParser::dosub(const char * subname, const std::vector &args, string &error, int mode) { bool err = false; - dSP; /* initialize stack pointer */ - ENTER; /* everything created after here */ - SAVETMPS; /* ...is a temporary variable. */ - PUSHMARK(SP); /* remember the stack pointer */ + dSP; // initialize stack pointer + ENTER; // everything created after here + SAVETMPS; // ...is a temporary variable + PUSHMARK(SP); // remember the stack pointer if(args.size() > 0) { for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) - {/* push the arguments onto the perl stack */ + {/* push the arguments onto the perl stack */ XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length()))); } } - PUTBACK; /* make local stack pointer global */ - call_pv(subname, mode); /*eval our code*/ - SPAGAIN; /* refresh stack pointer */ + PUTBACK; // make local stack pointer global + call_pv(subname, mode); /*eval our code*/ + SPAGAIN; // refresh stack pointer if(SvTRUE(ERRSV)) { err = true; } - FREETMPS; /* free temp values */ - LEAVE; /* ...and the XPUSHed "mortal" args.*/ + FREETMPS; // free temp values + LEAVE; // ...and the XPUSHed "mortal" args. if(err) { error = "Perl runtime error: "; @@ -260,7 +260,6 @@ bool EQWParser::eval(const char * code, string &error) { return(dosub("my_eval", arg, error, G_SCALAR|G_DISCARD|G_EVAL|G_KEEPERR)); } - void EQWParser::EQW_eval(const char *pkg, const char *code) { char namebuf[64]; @@ -330,7 +329,6 @@ class MerchantEditor extends BaseEditor { } } - function dispatch() { my $dispatcher = $this->_dispatchers[$action]; $body = new Template($dispatcher["template"]); @@ -348,5 +346,5 @@ function dispatch() { */ - #endif //EMBPERL + diff --git a/world/EQWParser.h b/world/EQWParser.h index 357bdcc8f..564ea0b11 100644 --- a/world/EQWParser.h +++ b/world/EQWParser.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 EQWPARSER_H_ #define EQWPARSER_H_ @@ -68,12 +68,5 @@ protected: }; #endif //EMBPERL - - - - - - - - #endif /*EQWPARSER_H_*/ + diff --git a/world/HTTPRequest.cpp b/world/HTTPRequest.cpp index 34e375244..bc0b8ab2b 100644 --- a/world/HTTPRequest.cpp +++ b/world/HTTPRequest.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 "../common/debug.h" #include "HTTPRequest.h" @@ -80,14 +80,3 @@ void HTTPRequest::redirect(Const_char *URL) { SetResponseCode("302"); } - - - - - - - - - - - diff --git a/world/HTTPRequest.h b/world/HTTPRequest.h index eb4b05a9f..1fd96eadf 100644 --- a/world/HTTPRequest.h +++ b/world/HTTPRequest.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 HTTPREQUEST_H_ #define HTTPREQUEST_H_ @@ -37,7 +37,6 @@ public: //BEGIN PERL EXPORT - Const_char * get(Const_char *name, Const_char *default_value = "") const; int getInt(Const_char *name, int default_value = 0) const; float getFloat(Const_char *name, float default_value = 0.0) const; @@ -57,8 +56,5 @@ protected: std::map m_values; }; - #endif /*HTTPREQUEST_H_*/ - - diff --git a/world/LauncherLink.cpp b/world/LauncherLink.cpp index 802ecfd79..ad580beab 100644 --- a/world/LauncherLink.cpp +++ b/world/LauncherLink.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 "../common/debug.h" @@ -37,10 +37,10 @@ extern LauncherList launcher_list; LauncherLink::LauncherLink(int id, EmuTCPConnection *c) : ID(id), - tcpc(c), - authenticated(false), - m_name(""), - m_bootTimer(2000) + tcpc(c), + authenticated(false), + m_name(""), + m_bootTimer(2000) { m_dynamicCount = 0; m_bootTimer.Disable(); @@ -78,7 +78,7 @@ bool LauncherLink::Process() { if (memcmp(pack->pBuffer, tmppass, 16) == 0) authenticated = true; else { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(WORLD__LAUNCH_ERR, "Launcher authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); @@ -89,7 +89,7 @@ bool LauncherLink::Process() { } } else { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(WORLD__LAUNCH_ERR, "Launcher authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); @@ -188,7 +188,7 @@ bool LauncherLink::ContainsZone(const char *short_name) const { return(m_states.find(short_name) != m_states.end()); /* - * std::map::const_iterator cur, end; + * std::map::const_iterator cur, end; cur = m_states.begin(); end = m_states.end(); for(; cur != end; cur++) { diff --git a/world/LauncherLink.h b/world/LauncherLink.h index 7aaf27e3b..c5936bd3d 100644 --- a/world/LauncherLink.h +++ b/world/LauncherLink.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 LAUNCHERLINK_H_ #define LAUNCHERLINK_H_ @@ -42,7 +42,7 @@ public: inline uint32 GetIP() const { return tcpc->GetrIP(); } inline uint16 GetPort() const { return tcpc->GetrPort(); } inline const char * GetName() const { return(m_name.c_str()); } - inline int CountZones() const { return(m_states.size()); } + inline int CountZones() const { return(m_states.size()); } bool ContainsZone(const char *short_name) const; @@ -58,10 +58,10 @@ public: void GetZoneDetails(const char *short_name, std::map &result); protected: - const int ID; + const int ID; EmuTCPConnection*const tcpc; bool authenticated; - std::string m_name; + std::string m_name; Timer m_bootTimer; uint8 m_dynamicCount; @@ -74,8 +74,5 @@ protected: std::map m_states; }; - - - - #endif /*LAUNCHERLINK_H_*/ + diff --git a/world/LauncherList.cpp b/world/LauncherList.cpp index b7c886b10..d55990e7f 100644 --- a/world/LauncherList.cpp +++ b/world/LauncherList.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 */ @@ -194,29 +194,3 @@ void LauncherList::Remove(const char *name) { } } - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/world/LauncherList.h b/world/LauncherList.h index 37d9e1aae..d40aa64e2 100644 --- a/world/LauncherList.h +++ b/world/LauncherList.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 LAUNCHERLIST_H_ #define LAUNCHERLIST_H_ @@ -54,14 +54,5 @@ protected: int nextID; }; - - - - - - - - - - #endif /*LAUNCHERLIST_H_*/ + diff --git a/world/LoginServer.cpp b/world/LoginServer.cpp index f30d92431..7d7bb446b 100644 --- a/world/LoginServer.cpp +++ b/world/LoginServer.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 @@ -105,100 +105,99 @@ bool LoginServer::Process() { _hex(WORLD__LS_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { - case 0: - break; - case ServerOP_KeepAlive: { - // ignore this - break; - } - case ServerOP_UsertoWorldReq: { - UsertoWorldRequest_Struct* utwr = (UsertoWorldRequest_Struct*) pack->pBuffer; - uint32 id = database.GetAccountIDFromLSID(utwr->lsaccountid); - int16 status = database.CheckStatus(id); + case 0: + break; + case ServerOP_KeepAlive: { + // ignore this + break; + } + case ServerOP_UsertoWorldReq: { + UsertoWorldRequest_Struct* utwr = (UsertoWorldRequest_Struct*) pack->pBuffer; + uint32 id = database.GetAccountIDFromLSID(utwr->lsaccountid); + int16 status = database.CheckStatus(id); - ServerPacket* outpack = new ServerPacket; - outpack->opcode = ServerOP_UsertoWorldResp; - outpack->size = sizeof(UsertoWorldResponse_Struct); - outpack->pBuffer = new uchar[outpack->size]; - memset(outpack->pBuffer, 0, outpack->size); - UsertoWorldResponse_Struct* utwrs = (UsertoWorldResponse_Struct*) outpack->pBuffer; - utwrs->lsaccountid = utwr->lsaccountid; - utwrs->ToID = utwr->FromID; + ServerPacket* outpack = new ServerPacket; + outpack->opcode = ServerOP_UsertoWorldResp; + outpack->size = sizeof(UsertoWorldResponse_Struct); + outpack->pBuffer = new uchar[outpack->size]; + memset(outpack->pBuffer, 0, outpack->size); + UsertoWorldResponse_Struct* utwrs = (UsertoWorldResponse_Struct*) outpack->pBuffer; + utwrs->lsaccountid = utwr->lsaccountid; + utwrs->ToID = utwr->FromID; - if(Config->Locked == true) - { - if((status == 0 || status < 100) && (status != -2 || status != -1)) - utwrs->response = 0; - if(status >= 100) + if(Config->Locked == true) + { + if((status == 0 || status < 100) && (status != -2 || status != -1)) + utwrs->response = 0; + if(status >= 100) + utwrs->response = 1; + } + else { utwrs->response = 1; + } + + int32 x = Config->MaxClients; + if( (int32)numplayers >= x && x != -1 && x != 255 && status < 80) + utwrs->response = -3; + + if(status == -1) + utwrs->response = -1; + if(status == -2) + utwrs->response = -2; + + utwrs->worldid = utwr->worldid; + SendPacket(outpack); + delete outpack; + break; } - else { - utwrs->response = 1; + case ServerOP_LSClientAuth: { + ServerLSClientAuth* slsca = (ServerLSClientAuth*) pack->pBuffer; + + if (RuleI(World, AccountSessionLimit) >= 0) { + // Enforce the limit on the number of characters on the same account that can be + // online at the same time. + client_list.EnforceSessionLimit(slsca->lsaccount_id); + } + + client_list.CLEAdd(slsca->lsaccount_id, slsca->name, slsca->key, slsca->worldadmin, slsca->ip, slsca->local); + break; } - - int32 x = Config->MaxClients; - if( (int32)numplayers >= x && x != -1 && x != 255 && status < 80) - utwrs->response = -3; - - if(status == -1) - utwrs->response = -1; - if(status == -2) - utwrs->response = -2; - - utwrs->worldid = utwr->worldid; - SendPacket(outpack); - delete outpack; - break; - } - case ServerOP_LSClientAuth: { - ServerLSClientAuth* slsca = (ServerLSClientAuth*) pack->pBuffer; - - if (RuleI(World, AccountSessionLimit) >= 0) { - // Enforce the limit on the number of characters on the same account that can be - // online at the same time. - client_list.EnforceSessionLimit(slsca->lsaccount_id); + case ServerOP_LSFatalError: { + #ifndef IGNORE_LS_FATAL_ERROR + WorldConfig::DisableLoginserver(); + _log(WORLD__LS_ERR, "Login server responded with FatalError. Disabling reconnect."); + #else + _log(WORLD__LS_ERR, "Login server responded with FatalError."); + #endif + if (pack->size > 1) { + _log(WORLD__LS_ERR, " %s",pack->pBuffer); + } + break; } - - client_list.CLEAdd(slsca->lsaccount_id, slsca->name, slsca->key, slsca->worldadmin, slsca->ip, slsca->local); - break; - } - case ServerOP_LSFatalError: { -#ifndef IGNORE_LS_FATAL_ERROR - WorldConfig::DisableLoginserver(); - _log(WORLD__LS_ERR, "Login server responded with FatalError. Disabling reconnect."); -#else - _log(WORLD__LS_ERR, "Login server responded with FatalError."); -#endif - if (pack->size > 1) { - _log(WORLD__LS_ERR, " %s",pack->pBuffer); + case ServerOP_SystemwideMessage: { + ServerSystemwideMessage* swm = (ServerSystemwideMessage*) pack->pBuffer; + zoneserver_list.SendEmoteMessageRaw(0, 0, 0, swm->type, swm->message); + break; } - break; - } - case ServerOP_SystemwideMessage: { - ServerSystemwideMessage* swm = (ServerSystemwideMessage*) pack->pBuffer; - zoneserver_list.SendEmoteMessageRaw(0, 0, 0, swm->type, swm->message); - break; - } - case ServerOP_LSRemoteAddr: { - if (!Config->WorldAddress.length()) { - WorldConfig::SetWorldAddress((char *)pack->pBuffer); - _log(WORLD__LS, "Loginserver provided %s as world address",pack->pBuffer); + case ServerOP_LSRemoteAddr: { + if (!Config->WorldAddress.length()) { + WorldConfig::SetWorldAddress((char *)pack->pBuffer); + _log(WORLD__LS, "Loginserver provided %s as world address",pack->pBuffer); + } + break; + } + case ServerOP_LSAccountUpdate: { + _log(WORLD__LS, "Received ServerOP_LSAccountUpdate packet from loginserver"); + CanAccountUpdate = true; + break; + } + default: + { + _log(WORLD__LS_ERR, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); + DumpPacket(pack->pBuffer, pack->size); + break; } - break; } - case ServerOP_LSAccountUpdate: { - _log(WORLD__LS, "Received ServerOP_LSAccountUpdate packet from loginserver"); - CanAccountUpdate = true; - break; - } - default: - { - _log(WORLD__LS_ERR, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); -DumpPacket(pack->pBuffer, pack->size); - break; - } - } - delete pack; } diff --git a/world/LoginServer.h b/world/LoginServer.h index 807874cb9..6cb6957cf 100644 --- a/world/LoginServer.h +++ b/world/LoginServer.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 LOGINSERVER_H #define LOGINSERVER_H diff --git a/world/LoginServerList.cpp b/world/LoginServerList.cpp index 1b133a597..6af65c7b9 100644 --- a/world/LoginServerList.cpp +++ b/world/LoginServerList.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 @@ -69,9 +69,9 @@ bool LoginServerList::Process() { } #ifdef _WINDOWS - void AutoInitLoginServer(void *tmp) { +void AutoInitLoginServer(void *tmp) { #else - void *AutoInitLoginServer(void *tmp) { +void *AutoInitLoginServer(void *tmp) { #endif loginserverlist.InitLoginServer(); #ifndef WIN32 diff --git a/world/WorldConfig.cpp b/world/WorldConfig.cpp index fc377db86..7ef819655 100644 --- a/world/WorldConfig.cpp +++ b/world/WorldConfig.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 "../common/debug.h" #include "WorldConfig.h" diff --git a/world/WorldConfig.h b/world/WorldConfig.h index d1209ea35..419339732 100644 --- a/world/WorldConfig.h +++ b/world/WorldConfig.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 __WorldConfig_H #define __WorldConfig_H diff --git a/world/WorldTCPConnection.h b/world/WorldTCPConnection.h index d01207814..dd9ff7a5b 100644 --- a/world/WorldTCPConnection.h +++ b/world/WorldTCPConnection.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 WorldTCPCONNECTION_H #define WorldTCPCONNECTION_H diff --git a/world/client.cpp b/world/client.cpp index 2023af71f..12dd7180d 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -24,7 +24,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #else #include #ifdef FREEBSD //Timothy Whitman - January 7, 2003 @@ -72,10 +72,10 @@ extern volatile bool RunLoops; Client::Client(EQStreamInterface* ieqs) -: autobootup_timeout(RuleI(World, ZoneAutobootTimeoutMS)), - CLE_keepalive_timer(RuleI(World, ClientKeepaliveTimeoutMS)), - connect(1000), - eqs(ieqs) +: autobootup_timeout(RuleI(World, ZoneAutobootTimeoutMS)), + CLE_keepalive_timer(RuleI(World, ClientKeepaliveTimeoutMS)), + connect(1000), + eqs(ieqs) { // Live does not send datarate as of 3/11/2005 //eqs->SetDataRate(7); @@ -415,7 +415,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { #endif { if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) { - clog(WORLD__CLIENT_ERR,"ID is 0. Is this server connected to minilogin?"); + clog(WORLD__CLIENT_ERR,"ID is 0. Is this server connected to minilogin?"); if(!minilogin) clog(WORLD__CLIENT_ERR,"If so you forget the minilogin variable..."); else @@ -487,7 +487,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { uchar race = app->pBuffer[64]; uchar clas = app->pBuffer[68]; - clog(WORLD__CLIENT,"Name approval request. Name=%s, race=%s, class=%s",char_name,GetRaceName(race),GetEQClassName(clas)); + clog(WORLD__CLIENT,"Name approval request. Name=%s, race=%s, class=%s",char_name,GetRaceName(race),GetEQClassName(clas)); EQApplicationPacket *outapp; outapp = new EQApplicationPacket; @@ -513,9 +513,9 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { QueuePacket(outapp); safe_delete(outapp); - if(!valid) { - memset(char_name, 0, sizeof(char_name)); - } + if(!valid) { + memset(char_name, 0, sizeof(char_name)); + } return true; } @@ -601,45 +601,45 @@ bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) { bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app) { // New OpCode in SoF - uint32 allocs = character_create_allocations.size(); - uint32 combos = character_create_race_class_combos.size(); - uint32 len = sizeof(RaceClassAllocation) * allocs; - len += sizeof(RaceClassCombos) * combos; - len += sizeof(uint8); - len += sizeof(uint32); - len += sizeof(uint32); + uint32 allocs = character_create_allocations.size(); + uint32 combos = character_create_race_class_combos.size(); + uint32 len = sizeof(RaceClassAllocation) * allocs; + len += sizeof(RaceClassCombos) * combos; + len += sizeof(uint8); + len += sizeof(uint32); + len += sizeof(uint32); EQApplicationPacket *outapp = new EQApplicationPacket(OP_CharacterCreateRequest, len); - unsigned char *ptr = outapp->pBuffer; - *((uint8*)ptr) = 0; - ptr += sizeof(uint8); + unsigned char *ptr = outapp->pBuffer; + *((uint8*)ptr) = 0; + ptr += sizeof(uint8); - *((uint32*)ptr) = allocs; - ptr += sizeof(uint32); + *((uint32*)ptr) = allocs; + ptr += sizeof(uint32); - for(int i = 0; i < allocs; ++i) { - RaceClassAllocation *alc = (RaceClassAllocation*)ptr; + for(int i = 0; i < allocs; ++i) { + RaceClassAllocation *alc = (RaceClassAllocation*)ptr; - alc->Index = character_create_allocations[i].Index; - for(int j = 0; j < 7; ++j) { - alc->BaseStats[j] = character_create_allocations[i].BaseStats[j]; - alc->DefaultPointAllocation[j] = character_create_allocations[i].DefaultPointAllocation[j]; - } - ptr += sizeof(RaceClassAllocation); - } + alc->Index = character_create_allocations[i].Index; + for(int j = 0; j < 7; ++j) { + alc->BaseStats[j] = character_create_allocations[i].BaseStats[j]; + alc->DefaultPointAllocation[j] = character_create_allocations[i].DefaultPointAllocation[j]; + } + ptr += sizeof(RaceClassAllocation); + } - *((uint32*)ptr) = combos; - ptr += sizeof(uint32); - for(int i = 0; i < combos; ++i) { - RaceClassCombos *cmb = (RaceClassCombos*)ptr; - cmb->ExpansionRequired = character_create_race_class_combos[i].ExpansionRequired; - cmb->Race = character_create_race_class_combos[i].Race; - cmb->Class = character_create_race_class_combos[i].Class; - cmb->Deity = character_create_race_class_combos[i].Deity; - cmb->AllocationIndex = character_create_race_class_combos[i].AllocationIndex; - cmb->Zone = character_create_race_class_combos[i].Zone; - ptr += sizeof(RaceClassCombos); - } + *((uint32*)ptr) = combos; + ptr += sizeof(uint32); + for(int i = 0; i < combos; ++i) { + RaceClassCombos *cmb = (RaceClassCombos*)ptr; + cmb->ExpansionRequired = character_create_race_class_combos[i].ExpansionRequired; + cmb->Race = character_create_race_class_combos[i].Race; + cmb->Class = character_create_race_class_combos[i].Class; + cmb->Deity = character_create_race_class_combos[i].Deity; + cmb->AllocationIndex = character_create_race_class_combos[i].AllocationIndex; + cmb->Zone = character_create_race_class_combos[i].Zone; + ptr += sizeof(RaceClassCombos); + } QueuePacket(outapp); safe_delete(outapp); @@ -670,7 +670,7 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { QueuePacket(outapp); safe_delete(outapp); } - else + else SendCharInfo(); return true; @@ -692,8 +692,8 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { } if (RuleI(World, MaxClientsPerIP) >= 0) { - client_list.GetCLEIP(this->GetIP()); //Check current CLE Entry IPs against incoming connection - } + client_list.GetCLEIP(this->GetIP()); //Check current CLE Entry IPs against incoming connection + } EnterWorld_Struct *ew=(EnterWorld_Struct *)app->pBuffer; strn0cpy(char_name, ew->name, 64); @@ -1020,12 +1020,12 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { bool Client::Process() { bool ret = true; //bool sendguilds = true; - sockaddr_in to; + sockaddr_in to; memset((char *) &to, 0, sizeof(to)); - to.sin_family = AF_INET; - to.sin_port = port; - to.sin_addr.s_addr = ip; + to.sin_family = AF_INET; + to.sin_port = port; + to.sin_addr.s_addr = ip; if (autobootup_timeout.Check()) { clog(WORLD__CLIENT_ERR, "Zone bootup timer expired, bootup failed or too slow."); @@ -1135,7 +1135,7 @@ void Client::EnterWorld(bool TryBootup) { if (seencharsel) { if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) { - clog(WORLD__CLIENT_ERR,"Enter world failed. Zone is locked."); + clog(WORLD__CLIENT_ERR,"Enter world failed. Zone is locked."); ZoneUnavail(); return; } @@ -1169,39 +1169,39 @@ void Client::Clearance(int8 response) zs = zoneserver_list.FindByZoneID(zoneID); } - if(zs == 0 || response == -1 || response == 0) - { - if (zs == 0) - { - clog(WORLD__CLIENT_ERR,"Unable to find zoneserver in Client::Clearance!!"); - } else { - clog(WORLD__CLIENT_ERR, "Invalid response %d in Client::Clearance", response); - } + if(zs == 0 || response == -1 || response == 0) + { + if (zs == 0) + { + clog(WORLD__CLIENT_ERR,"Unable to find zoneserver in Client::Clearance!!"); + } else { + clog(WORLD__CLIENT_ERR, "Invalid response %d in Client::Clearance", response); + } - ZoneUnavail(); - return; - } + ZoneUnavail(); + return; + } EQApplicationPacket* outapp; - if (zs->GetCAddress() == nullptr) { - clog(WORLD__CLIENT_ERR, "Unable to do zs->GetCAddress() in Client::Clearance!!"); - ZoneUnavail(); - return; - } + if (zs->GetCAddress() == nullptr) { + clog(WORLD__CLIENT_ERR, "Unable to do zs->GetCAddress() in Client::Clearance!!"); + ZoneUnavail(); + return; + } - if (zoneID == 0) { - clog(WORLD__CLIENT_ERR, "zoneID is nullptr in Client::Clearance!!"); - ZoneUnavail(); - return; - } + if (zoneID == 0) { + clog(WORLD__CLIENT_ERR, "zoneID is nullptr in Client::Clearance!!"); + ZoneUnavail(); + return; + } const char* zonename = database.GetZoneName(zoneID); - if (zonename == 0) { - clog(WORLD__CLIENT_ERR, "zonename is nullptr in Client::Clearance!!"); - ZoneUnavail(); - return; - } + if (zonename == 0) { + clog(WORLD__CLIENT_ERR, "zonename is nullptr in Client::Clearance!!"); + ZoneUnavail(); + return; + } // @bp This is the chat server /* @@ -1218,7 +1218,7 @@ void Client::Clearance(int8 response) const char *zs_addr=zs->GetCAddress(); if (!zs_addr[0]) { if (cle->IsLocalClient()) { - struct in_addr in; + struct in_addr in; in.s_addr = zs->GetIP(); zs_addr=inet_ntoa(in); if (!strcmp(zs_addr,"127.0.0.1")) @@ -1376,19 +1376,19 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) clog(WORLD__CLIENT,"Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); // validate the char creation struct - if(ClientVersionBit & BIT_SoFAndLater) { - if(!CheckCharCreateInfoSoF(cc)) - { - clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); - return false; - } - } else { - if(!CheckCharCreateInfoTitanium(cc)) - { - clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); - return false; - } - } + if(ClientVersionBit & BIT_SoFAndLater) { + if(!CheckCharCreateInfoSoF(cc)) + { + clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + return false; + } + } else { + if(!CheckCharCreateInfoTitanium(cc)) + { + clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + return false; + } + } // Convert incoming cc_s to the new PlayerProfile_Struct memset(&pp, 0, sizeof(PlayerProfile_Struct)); // start building the profile @@ -1424,7 +1424,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.eyecolor2 = cc->eyecolor2; pp.hairstyle = cc->hairstyle; pp.haircolor = cc->haircolor; - pp.beard = cc->beard; + pp.beard = cc->beard; pp.beardcolor = cc->beardcolor; pp.drakkin_heritage = cc->drakkin_heritage; pp.drakkin_tattoo = cc->drakkin_tattoo; @@ -1471,7 +1471,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.pvp = database.GetServerType() == 1 ? 1 : 0; //If it is an SoF Client and the SoF Start Zone rule is set, send new chars there - if((ClientVersionBit & BIT_SoFAndLater) && (RuleI(World, SoFStartZoneID) > 0)) { + if((ClientVersionBit & BIT_SoFAndLater) && (RuleI(World, SoFStartZoneID) > 0)) { clog(WORLD__CLIENT,"Found 'SoFStartZoneID' rule setting: %i", (RuleI(World, SoFStartZoneID))); pp.zone_id = (RuleI(World, SoFStartZoneID)); if(pp.zone_id) @@ -1491,7 +1491,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) else clog(WORLD__CLIENT_ERR,"Error getting zone id for '%s'", startzone); } - else // otherwise use normal starting zone logic + else // otherwise use normal starting zone logic { bool ValidStartZone = false; @@ -1518,7 +1518,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.binds[0].y = pp.y; pp.binds[0].z = pp.z; pp.binds[0].heading = pp.heading; - } + } // set starting city location to the initial bind point pp.binds[4] = pp.binds[0]; @@ -1555,482 +1555,483 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) _log(WORLD__CLIENT, "Validating char creation info..."); - RaceClassCombos class_combo; - bool found = false; - int combos = character_create_race_class_combos.size(); - for(int i = 0; i < combos; ++i) { - if(character_create_race_class_combos[i].Class == cc->class_ && - character_create_race_class_combos[i].Race == cc->race && - character_create_race_class_combos[i].Deity == cc->deity) { - if(RuleB(World, EnableTutorialButton) && - (RuleI(World, TutorialZoneID) == cc->start_zone || - (character_create_race_class_combos[i].Zone == cc->start_zone))) { - class_combo = character_create_race_class_combos[i]; - found = true; - break; - } else if(character_create_race_class_combos[i].Zone == cc->start_zone) { - class_combo = character_create_race_class_combos[i]; - found = true; - break; - } - } - } + RaceClassCombos class_combo; + bool found = false; + int combos = character_create_race_class_combos.size(); + for(int i = 0; i < combos; ++i) { + if(character_create_race_class_combos[i].Class == cc->class_ && + character_create_race_class_combos[i].Race == cc->race && + character_create_race_class_combos[i].Deity == cc->deity) { + if(RuleB(World, EnableTutorialButton) && + (RuleI(World, TutorialZoneID) == cc->start_zone || + (character_create_race_class_combos[i].Zone == cc->start_zone))) { + class_combo = character_create_race_class_combos[i]; + found = true; + break; + } else if(character_create_race_class_combos[i].Zone == cc->start_zone) { + class_combo = character_create_race_class_combos[i]; + found = true; + break; + } + } + } - if(!found) { - _log(WORLD__CLIENT_ERR, "Could not find class/race/deity/start_zone combination"); - return false; - } + if(!found) { + _log(WORLD__CLIENT_ERR, "Could not find class/race/deity/start_zone combination"); + return false; + } - uint32 max_stats = 0; - uint32 allocs = character_create_allocations.size(); - RaceClassAllocation allocation; - found = false; - for(int i = 0; i < combos; ++i) { - if(character_create_allocations[i].Index == class_combo.AllocationIndex) { - allocation = character_create_allocations[i]; - found = true; - break; - } - } + uint32 max_stats = 0; + uint32 allocs = character_create_allocations.size(); + RaceClassAllocation allocation; + found = false; + for(int i = 0; i < combos; ++i) { + if(character_create_allocations[i].Index == class_combo.AllocationIndex) { + allocation = character_create_allocations[i]; + found = true; + break; + } + } - if(!found) { - _log(WORLD__CLIENT_ERR, "Could not find starting stats for selected character combo, cannot verify stats"); - return false; - } + if(!found) { + _log(WORLD__CLIENT_ERR, "Could not find starting stats for selected character combo, cannot verify stats"); + return false; + } - max_stats = allocation.DefaultPointAllocation[0] + - allocation.DefaultPointAllocation[1] + - allocation.DefaultPointAllocation[2] + - allocation.DefaultPointAllocation[3] + - allocation.DefaultPointAllocation[4] + - allocation.DefaultPointAllocation[5] + - allocation.DefaultPointAllocation[6]; + max_stats = allocation.DefaultPointAllocation[0] + + allocation.DefaultPointAllocation[1] + + allocation.DefaultPointAllocation[2] + + allocation.DefaultPointAllocation[3] + + allocation.DefaultPointAllocation[4] + + allocation.DefaultPointAllocation[5] + + allocation.DefaultPointAllocation[6]; - if(cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { - _log(WORLD__CLIENT_ERR, "Strength out of range"); - return false; - } + if(cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { + _log(WORLD__CLIENT_ERR, "Strength out of range"); + return false; + } - if(cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { - _log(WORLD__CLIENT_ERR, "Dexterity out of range"); - return false; - } + if(cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { + _log(WORLD__CLIENT_ERR, "Dexterity out of range"); + return false; + } - if(cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { - _log(WORLD__CLIENT_ERR, "Agility out of range"); - return false; - } + if(cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { + _log(WORLD__CLIENT_ERR, "Agility out of range"); + return false; + } - if(cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { - _log(WORLD__CLIENT_ERR, "Stamina out of range"); - return false; - } + if(cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { + _log(WORLD__CLIENT_ERR, "Stamina out of range"); + return false; + } - if(cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { - _log(WORLD__CLIENT_ERR, "Intelligence out of range"); - return false; - } + if(cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { + _log(WORLD__CLIENT_ERR, "Intelligence out of range"); + return false; + } - if(cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { - _log(WORLD__CLIENT_ERR, "Wisdom out of range"); - return false; - } + if(cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { + _log(WORLD__CLIENT_ERR, "Wisdom out of range"); + return false; + } - if(cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { - _log(WORLD__CLIENT_ERR, "Charisma out of range"); - return false; - } + if(cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { + _log(WORLD__CLIENT_ERR, "Charisma out of range"); + return false; + } - uint32 current_stats = 0; - current_stats += cc->STR - allocation.BaseStats[0]; - current_stats += cc->DEX - allocation.BaseStats[1]; - current_stats += cc->AGI - allocation.BaseStats[2]; - current_stats += cc->STA - allocation.BaseStats[3]; - current_stats += cc->INT - allocation.BaseStats[4]; - current_stats += cc->WIS - allocation.BaseStats[5]; - current_stats += cc->CHA - allocation.BaseStats[6]; - if(current_stats > max_stats) { - _log(WORLD__CLIENT_ERR, "Current Stats > Maximum Stats"); - return false; - } + uint32 current_stats = 0; + current_stats += cc->STR - allocation.BaseStats[0]; + current_stats += cc->DEX - allocation.BaseStats[1]; + current_stats += cc->AGI - allocation.BaseStats[2]; + current_stats += cc->STA - allocation.BaseStats[3]; + current_stats += cc->INT - allocation.BaseStats[4]; + current_stats += cc->WIS - allocation.BaseStats[5]; + current_stats += cc->CHA - allocation.BaseStats[6]; + if(current_stats > max_stats) { + _log(WORLD__CLIENT_ERR, "Current Stats > Maximum Stats"); + return false; + } return true; } bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) { - uint32 bSTR, bSTA, bAGI, bDEX, bWIS, bINT, bCHA, bTOTAL, cTOTAL, stat_points; //these are all uint32 in CharCreate_Struct, so we'll make them uint32 here to make the compiler shut up - int classtemp, racetemp; - int Charerrors = 0; + uint32 bSTR, bSTA, bAGI, bDEX, bWIS, bINT, bCHA, bTOTAL, cTOTAL, stat_points; //these are all uint32 in CharCreate_Struct, so we'll make them uint32 here to make the compiler shut up + int classtemp, racetemp; + int Charerrors = 0; // solar: if this is increased you'll have to add a column to the classrace // table below -#define _TABLE_RACES 16 +#define _TABLE_RACES 16 - static const int BaseRace[_TABLE_RACES][7] = - { /* STR STA AGI DEX WIS INT CHR */ - { /*Human*/ 75, 75, 75, 75, 75, 75, 75}, - { /*Barbarian*/ 103, 95, 82, 70, 70, 60, 55}, - { /*Erudite*/ 60, 70, 70, 70, 83, 107, 70}, - { /*Wood Elf*/ 65, 65, 95, 80, 80, 75, 75}, - { /*High Elf*/ 55, 65, 85, 70, 95, 92, 80}, - { /*Dark Elf*/ 60, 65, 90, 75, 83, 99, 60}, - { /*Half Elf*/ 70, 70, 90, 85, 60, 75, 75}, - { /*Dwarf*/ 90, 90, 70, 90, 83, 60, 45}, - { /*Troll*/ 108, 109, 83, 75, 60, 52, 40}, - { /*Ogre*/ 130, 122, 70, 70, 67, 60, 37}, - { /*Halfling*/ 70, 75, 95, 90, 80, 67, 50}, - { /*Gnome*/ 60, 70, 85, 85, 67, 98, 60}, - { /*Iksar*/ 70, 70, 90, 85, 80, 75, 55}, - { /*Vah Shir*/ 90, 75, 90, 70, 70, 65, 65}, - { /*Froglok*/ 70, 80, 100, 100, 75, 75, 50}, - { /*Drakkin*/ 70, 80, 85, 75, 80, 85, 75} - }; + static const int BaseRace[_TABLE_RACES][7] = + { /* STR STA AGI DEX WIS INT CHR */ + { /*Human*/ 75, 75, 75, 75, 75, 75, 75}, + { /*Barbarian*/ 103, 95, 82, 70, 70, 60, 55}, + { /*Erudite*/ 60, 70, 70, 70, 83, 107, 70}, + { /*Wood Elf*/ 65, 65, 95, 80, 80, 75, 75}, + { /*High Elf*/ 55, 65, 85, 70, 95, 92, 80}, + { /*Dark Elf*/ 60, 65, 90, 75, 83, 99, 60}, + { /*Half Elf*/ 70, 70, 90, 85, 60, 75, 75}, + { /*Dwarf*/ 90, 90, 70, 90, 83, 60, 45}, + { /*Troll*/ 108, 109, 83, 75, 60, 52, 40}, + { /*Ogre*/ 130, 122, 70, 70, 67, 60, 37}, + { /*Halfling*/ 70, 75, 95, 90, 80, 67, 50}, + { /*Gnome*/ 60, 70, 85, 85, 67, 98, 60}, + { /*Iksar*/ 70, 70, 90, 85, 80, 75, 55}, + { /*Vah Shir*/ 90, 75, 90, 70, 70, 65, 65}, + { /*Froglok*/ 70, 80, 100, 100, 75, 75, 50}, + { /*Drakkin*/ 70, 80, 85, 75, 80, 85, 75} + }; - static const int BaseClass[PLAYER_CLASS_COUNT][8] = - { /* STR STA AGI DEX WIS INT CHR ADD*/ - { /*Warrior*/ 10, 10, 5, 0, 0, 0, 0, 25}, - { /*Cleric*/ 5, 5, 0, 0, 10, 0, 0, 30}, - { /*Paladin*/ 10, 5, 0, 0, 5, 0, 10, 20}, - { /*Ranger*/ 5, 10, 10, 0, 5, 0, 0, 20}, - { /*ShadowKnight*/ 10, 5, 0, 0, 0, 10, 5, 20}, - { /*Druid*/ 0, 10, 0, 0, 10, 0, 0, 30}, - { /*Monk*/ 5, 5, 10, 10, 0, 0, 0, 20}, - { /*Bard*/ 5, 0, 0, 10, 0, 0, 10, 25}, - { /*Rouge*/ 0, 0, 10, 10, 0, 0, 0, 30}, - { /*Shaman*/ 0, 5, 0, 0, 10, 0, 5, 30}, - { /*Necromancer*/ 0, 0, 0, 10, 0, 10, 0, 30}, - { /*Wizard*/ 0, 10, 0, 0, 0, 10, 0, 30}, - { /*Magician*/ 0, 10, 0, 0, 0, 10, 0, 30}, - { /*Enchanter*/ 0, 0, 0, 0, 0, 10, 10, 30}, - { /*Beastlord*/ 0, 10, 5, 0, 10, 0, 5, 20}, - { /*Berserker*/ 10, 5, 0, 10, 0, 0, 0, 25} - }; + static const int BaseClass[PLAYER_CLASS_COUNT][8] = + { /* STR STA AGI DEX WIS INT CHR ADD*/ + { /*Warrior*/ 10, 10, 5, 0, 0, 0, 0, 25}, + { /*Cleric*/ 5, 5, 0, 0, 10, 0, 0, 30}, + { /*Paladin*/ 10, 5, 0, 0, 5, 0, 10, 20}, + { /*Ranger*/ 5, 10, 10, 0, 5, 0, 0, 20}, + { /*ShadowKnight*/ 10, 5, 0, 0, 0, 10, 5, 20}, + { /*Druid*/ 0, 10, 0, 0, 10, 0, 0, 30}, + { /*Monk*/ 5, 5, 10, 10, 0, 0, 0, 20}, + { /*Bard*/ 5, 0, 0, 10, 0, 0, 10, 25}, + { /*Rouge*/ 0, 0, 10, 10, 0, 0, 0, 30}, + { /*Shaman*/ 0, 5, 0, 0, 10, 0, 5, 30}, + { /*Necromancer*/ 0, 0, 0, 10, 0, 10, 0, 30}, + { /*Wizard*/ 0, 10, 0, 0, 0, 10, 0, 30}, + { /*Magician*/ 0, 10, 0, 0, 0, 10, 0, 30}, + { /*Enchanter*/ 0, 0, 0, 0, 0, 10, 10, 30}, + { /*Beastlord*/ 0, 10, 5, 0, 10, 0, 5, 20}, + { /*Berserker*/ 10, 5, 0, 10, 0, 0, 0, 25} + }; - static const bool ClassRaceLookupTable[PLAYER_CLASS_COUNT][_TABLE_RACES]= - { /*Human Barbarian Erudite Woodelf Highelf Darkelf Halfelf Dwarf Troll Ogre Halfling Gnome Iksar Vahshir Froglok Drakkin*/ - { /*Warrior*/ true, true, false, true, false, true, true, true, true, true, true, true, true, true, true, true}, - { /*Cleric*/ true, false, true, false, true, true, true, true, false, false, true, true, false, false, true, true}, - { /*Paladin*/ true, false, true, false, true, false, true, true, false, false, true, true, false, false, true, true}, - { /*Ranger*/ true, false, false, true, false, false, true, false, false, false, true, false, false, false, false, true}, - { /*ShadowKnight*/ true, false, true, false, false, true, false, false, true, true, false, true, true, false, true, true}, - { /*Druid*/ true, false, false, true, false, false, true, false, false, false, true, false, false, false, false, true}, - { /*Monk*/ true, false, false, false, false, false, false, false, false, false, false, false, true, false, false, true}, - { /*Bard*/ true, false, false, true, false, false, true, false, false, false, false, false, false, true, false, true}, - { /*Rogue*/ true, true, false, true, false, true, true, true, false, false, true, true, false, true, true, true}, - { /*Shaman*/ false, true, false, false, false, false, false, false, true, true, false, false, true, true, true, false}, - { /*Necromancer*/ true, false, true, false, false, true, false, false, false, false, false, true, true, false, true, true}, - { /*Wizard*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, true, true}, - { /*Magician*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, false, true}, - { /*Enchanter*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, false, true}, - { /*Beastlord*/ false, true, false, false, false, false, false, false, true, true, false, false, true, true, false, false}, - { /*Berserker*/ false, true, false, false, false, false, false, true, true, true, false, false, false, true, false, false} - };//Initial table by kathgar, editted by Wiz for accuracy, solar too + static const bool ClassRaceLookupTable[PLAYER_CLASS_COUNT][_TABLE_RACES]= + { /*Human Barbarian Erudite Woodelf Highelf Darkelf Halfelf Dwarf Troll Ogre Halfling Gnome Iksar Vahshir Froglok Drakkin*/ + { /*Warrior*/ true, true, false, true, false, true, true, true, true, true, true, true, true, true, true, true}, + { /*Cleric*/ true, false, true, false, true, true, true, true, false, false, true, true, false, false, true, true}, + { /*Paladin*/ true, false, true, false, true, false, true, true, false, false, true, true, false, false, true, true}, + { /*Ranger*/ true, false, false, true, false, false, true, false, false, false, true, false, false, false, false, true}, + { /*ShadowKnight*/ true, false, true, false, false, true, false, false, true, true, false, true, true, false, true, true}, + { /*Druid*/ true, false, false, true, false, false, true, false, false, false, true, false, false, false, false, true}, + { /*Monk*/ true, false, false, false, false, false, false, false, false, false, false, false, true, false, false, true}, + { /*Bard*/ true, false, false, true, false, false, true, false, false, false, false, false, false, true, false, true}, + { /*Rogue*/ true, true, false, true, false, true, true, true, false, false, true, true, false, true, true, true}, + { /*Shaman*/ false, true, false, false, false, false, false, false, true, true, false, false, true, true, true, false}, + { /*Necromancer*/ true, false, true, false, false, true, false, false, false, false, false, true, true, false, true, true}, + { /*Wizard*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, true, true}, + { /*Magician*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, false, true}, + { /*Enchanter*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, false, true}, + { /*Beastlord*/ false, true, false, false, false, false, false, false, true, true, false, false, true, true, false, false}, + { /*Berserker*/ false, true, false, false, false, false, false, true, true, true, false, false, false, true, false, false} + };//Initial table by kathgar, editted by Wiz for accuracy, solar too - if(!cc) return false; + if(!cc) return false; - _log(WORLD__CLIENT,"Validating char creation info..."); + _log(WORLD__CLIENT,"Validating char creation info..."); - classtemp = cc->class_ - 1; - racetemp = cc->race - 1; - // these have non sequential race numbers so they need to be mapped - if (cc->race == FROGLOK) racetemp = 14; - if (cc->race == VAHSHIR) racetemp = 13; - if (cc->race == IKSAR) racetemp = 12; - if (cc->race == DRAKKIN) racetemp = 15; + classtemp = cc->class_ - 1; + racetemp = cc->race - 1; + // these have non sequential race numbers so they need to be mapped + if (cc->race == FROGLOK) racetemp = 14; + if (cc->race == VAHSHIR) racetemp = 13; + if (cc->race == IKSAR) racetemp = 12; + if (cc->race == DRAKKIN) racetemp = 15; - // if out of range looking it up in the table would crash stuff - // so we return from these - if(classtemp >= PLAYER_CLASS_COUNT) - { - _log(WORLD__CLIENT_ERR," class is out of range"); - return false; - } - if(racetemp >= _TABLE_RACES) - { - _log(WORLD__CLIENT_ERR," race is out of range"); - return false; - } + // if out of range looking it up in the table would crash stuff + // so we return from these + if(classtemp >= PLAYER_CLASS_COUNT) + { + _log(WORLD__CLIENT_ERR," class is out of range"); + return false; + } + if(racetemp >= _TABLE_RACES) + { + _log(WORLD__CLIENT_ERR," race is out of range"); + return false; + } - if(!ClassRaceLookupTable[classtemp][racetemp]) //Lookup table better than a bunch of ifs? - { - _log(WORLD__CLIENT_ERR," invalid race/class combination"); - // we return from this one, since if it's an invalid combination our table - // doesn't have meaningful values for the stats - return false; - } + if(!ClassRaceLookupTable[classtemp][racetemp]) //Lookup table better than a bunch of ifs? + { + _log(WORLD__CLIENT_ERR," invalid race/class combination"); + // we return from this one, since if it's an invalid combination our table + // doesn't have meaningful values for the stats + return false; + } - // solar: add up the base values for this class/race - // this is what they start with, and they have stat_points more - // that can distributed - bSTR = BaseClass[classtemp][0] + BaseRace[racetemp][0]; - bSTA = BaseClass[classtemp][1] + BaseRace[racetemp][1]; - bAGI = BaseClass[classtemp][2] + BaseRace[racetemp][2]; - bDEX = BaseClass[classtemp][3] + BaseRace[racetemp][3]; - bWIS = BaseClass[classtemp][4] + BaseRace[racetemp][4]; - bINT = BaseClass[classtemp][5] + BaseRace[racetemp][5]; - bCHA = BaseClass[classtemp][6] + BaseRace[racetemp][6]; - stat_points = BaseClass[classtemp][7]; - bTOTAL = bSTR + bSTA + bAGI + bDEX + bWIS + bINT + bCHA; - cTOTAL = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA; + // solar: add up the base values for this class/race + // this is what they start with, and they have stat_points more + // that can distributed + bSTR = BaseClass[classtemp][0] + BaseRace[racetemp][0]; + bSTA = BaseClass[classtemp][1] + BaseRace[racetemp][1]; + bAGI = BaseClass[classtemp][2] + BaseRace[racetemp][2]; + bDEX = BaseClass[classtemp][3] + BaseRace[racetemp][3]; + bWIS = BaseClass[classtemp][4] + BaseRace[racetemp][4]; + bINT = BaseClass[classtemp][5] + BaseRace[racetemp][5]; + bCHA = BaseClass[classtemp][6] + BaseRace[racetemp][6]; + stat_points = BaseClass[classtemp][7]; + bTOTAL = bSTR + bSTA + bAGI + bDEX + bWIS + bINT + bCHA; + cTOTAL = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA; - // solar: the first check makes sure the total is exactly what was expected. - // this will catch all the stat cheating, but there's still the issue - // of reducing CHA or INT or something, to use for STR, so we check - // that none are lower than the base or higher than base + stat_points - // NOTE: these could just be else if, but i want to see all the stats - // that are messed up not just the first hit + // solar: the first check makes sure the total is exactly what was expected. + // this will catch all the stat cheating, but there's still the issue + // of reducing CHA or INT or something, to use for STR, so we check + // that none are lower than the base or higher than base + stat_points + // NOTE: these could just be else if, but i want to see all the stats + // that are messed up not just the first hit - if(bTOTAL + stat_points != cTOTAL) - { - _log(WORLD__CLIENT_ERR," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); - Charerrors++; - } + if(bTOTAL + stat_points != cTOTAL) + { + _log(WORLD__CLIENT_ERR," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); + Charerrors++; + } - if(cc->STR > bSTR + stat_points || cc->STR < bSTR) - { - _log(WORLD__CLIENT_ERR," stat STR is out of range"); - Charerrors++; - } - if(cc->STA > bSTA + stat_points || cc->STA < bSTA) - { - _log(WORLD__CLIENT_ERR," stat STA is out of range"); - Charerrors++; - } - if(cc->AGI > bAGI + stat_points || cc->AGI < bAGI) - { - _log(WORLD__CLIENT_ERR," stat AGI is out of range"); - Charerrors++; - } - if(cc->DEX > bDEX + stat_points || cc->DEX < bDEX) - { - _log(WORLD__CLIENT_ERR," stat DEX is out of range"); - Charerrors++; - } - if(cc->WIS > bWIS + stat_points || cc->WIS < bWIS) - { - _log(WORLD__CLIENT_ERR," stat WIS is out of range"); - Charerrors++; - } - if(cc->INT > bINT + stat_points || cc->INT < bINT) - { - _log(WORLD__CLIENT_ERR," stat INT is out of range"); - Charerrors++; - } - if(cc->CHA > bCHA + stat_points || cc->CHA < bCHA) - { - _log(WORLD__CLIENT_ERR," stat CHA is out of range"); - Charerrors++; - } + if(cc->STR > bSTR + stat_points || cc->STR < bSTR) + { + _log(WORLD__CLIENT_ERR," stat STR is out of range"); + Charerrors++; + } + if(cc->STA > bSTA + stat_points || cc->STA < bSTA) + { + _log(WORLD__CLIENT_ERR," stat STA is out of range"); + Charerrors++; + } + if(cc->AGI > bAGI + stat_points || cc->AGI < bAGI) + { + _log(WORLD__CLIENT_ERR," stat AGI is out of range"); + Charerrors++; + } + if(cc->DEX > bDEX + stat_points || cc->DEX < bDEX) + { + _log(WORLD__CLIENT_ERR," stat DEX is out of range"); + Charerrors++; + } + if(cc->WIS > bWIS + stat_points || cc->WIS < bWIS) + { + _log(WORLD__CLIENT_ERR," stat WIS is out of range"); + Charerrors++; + } + if(cc->INT > bINT + stat_points || cc->INT < bINT) + { + _log(WORLD__CLIENT_ERR," stat INT is out of range"); + Charerrors++; + } + if(cc->CHA > bCHA + stat_points || cc->CHA < bCHA) + { + _log(WORLD__CLIENT_ERR," stat CHA is out of range"); + Charerrors++; + } - /*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of) - I am NOT writing those tables - kathgar*/ + /*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of) + I am NOT writing those tables - kathgar*/ - _log(WORLD__CLIENT,"Found %d errors in character creation request", Charerrors); + _log(WORLD__CLIENT,"Found %d errors in character creation request", Charerrors); - return Charerrors == 0; + return Charerrors == 0; } void Client::SetClassStartingSkills( PlayerProfile_Struct *pp ) { - for(uint32 i = 0; i <= HIGHEST_SKILL; ++i) { - if(pp->skills[i] == 0) { - if(i >= SPECIALIZE_ABJURE && i <= SPECIALIZE_EVOCATION) { - continue; - } + for(uint32 i = 0; i <= HIGHEST_SKILL; ++i) { + if(pp->skills[i] == 0) { + if(i >= SPECIALIZE_ABJURE && i <= SPECIALIZE_EVOCATION) { + continue; + } - if(i == MAKE_POISON || - i == TINKERING || - i == RESEARCH || - i == ALCHEMY || - i == BAKING || - i == TAILORING || - i == BLACKSMITHING || - i == FLETCHING || - i == BREWING || - i == POTTERY || - i == JEWELRY_MAKING || - i == BEGGING) { - continue; - } + if(i == MAKE_POISON || + i == TINKERING || + i == RESEARCH || + i == ALCHEMY || + i == BAKING || + i == TAILORING || + i == BLACKSMITHING || + i == FLETCHING || + i == BREWING || + i == POTTERY || + i == JEWELRY_MAKING || + i == BEGGING) { + continue; + } - pp->skills[i] = database.GetSkillCap(pp->class_, (SkillType)i, 1); - } - } + pp->skills[i] = database.GetSkillCap(pp->class_, (SkillType)i, 1); + } + } } void Client::SetRaceStartingSkills( PlayerProfile_Struct *pp ) { - switch( pp->race ) - { - case BARBARIAN: - case DWARF: - case ERUDITE: - case HALF_ELF: - case HIGH_ELF: - case HUMAN: - case OGRE: - case TROLL: - case DRAKKIN: //Drakkin are supposed to get a starting AA Skill - { - // No Race Specific Skills - break; - } - case DARK_ELF: - { - pp->skills[HIDE] = 50; - break; - } - case FROGLOK: - { - pp->skills[SWIMMING] = 125; - break; - } - case GNOME: - { - pp->skills[TINKERING] = 50; - break; - } - case HALFLING: - { - pp->skills[HIDE] = 50; - pp->skills[SNEAK] = 50; - break; - } - case IKSAR: - { - pp->skills[FORAGE] = 50; - pp->skills[SWIMMING] = 100; - break; - } - case WOOD_ELF: - { - pp->skills[FORAGE] = 50; - pp->skills[HIDE] = 50; - break; - } - case VAHSHIR: - { - pp->skills[SAFE_FALL] = 50; - pp->skills[SNEAK] = 50; - break; - } - } + switch( pp->race ) + { + case BARBARIAN: + case DWARF: + case ERUDITE: + case HALF_ELF: + case HIGH_ELF: + case HUMAN: + case OGRE: + case TROLL: + case DRAKKIN: //Drakkin are supposed to get a starting AA Skill + { + // No Race Specific Skills + break; + } + case DARK_ELF: + { + pp->skills[HIDE] = 50; + break; + } + case FROGLOK: + { + pp->skills[SWIMMING] = 125; + break; + } + case GNOME: + { + pp->skills[TINKERING] = 50; + break; + } + case HALFLING: + { + pp->skills[HIDE] = 50; + pp->skills[SNEAK] = 50; + break; + } + case IKSAR: + { + pp->skills[FORAGE] = 50; + pp->skills[SWIMMING] = 100; + break; + } + case WOOD_ELF: + { + pp->skills[FORAGE] = 50; + pp->skills[HIDE] = 50; + break; + } + case VAHSHIR: + { + pp->skills[SAFE_FALL] = 50; + pp->skills[SNEAK] = 50; + break; + } + } } void Client::SetRacialLanguages( PlayerProfile_Struct *pp ) { - switch( pp->race ) - { - case BARBARIAN: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_BARBARIAN] = 100; - break; - } - case DARK_ELF: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_DARK_ELVISH] = 100; - pp->languages[LANG_DARK_SPEECH] = 100; - pp->languages[LANG_ELDER_ELVISH] = 100; - pp->languages[LANG_ELVISH] = 25; - break; - } - case DWARF: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_DWARVISH] = 100; - pp->languages[LANG_GNOMISH] = 25; - break; - } - case ERUDITE: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_ERUDIAN] = 100; - break; - } - case FROGLOK: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_FROGLOK] = 100; - pp->languages[LANG_TROLL] = 25; - break; - } - case GNOME: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_DWARVISH] = 25; - pp->languages[LANG_GNOMISH] = 100; - break; - } - case HALF_ELF: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_ELVISH] = 100; - break; - } - case HALFLING: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_HALFLING] = 100; - break; - } - case HIGH_ELF: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_DARK_ELVISH] = 25; - pp->languages[LANG_ELDER_ELVISH] = 25; - pp->languages[LANG_ELVISH] = 100; - break; - } - case HUMAN: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - break; - } - case IKSAR: - { - pp->languages[LANG_COMMON_TONGUE] = 95; - pp->languages[LANG_DARK_SPEECH] = 100; - pp->languages[LANG_LIZARDMAN] = 100; - break; - } - case OGRE: - { - pp->languages[LANG_COMMON_TONGUE] = 95; - pp->languages[LANG_DARK_SPEECH] = 100; - pp->languages[LANG_OGRE] = 100; - break; - } - case TROLL: - { - pp->languages[LANG_COMMON_TONGUE] = 95; - pp->languages[LANG_DARK_SPEECH] = 100; - pp->languages[LANG_TROLL] = 100; - break; - } - case WOOD_ELF: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_ELVISH] = 100; - break; - } - case VAHSHIR: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_COMBINE_TONGUE] = 100; - pp->languages[LANG_ERUDIAN] = 25; - pp->languages[LANG_VAH_SHIR] = 100; - break; - } - case DRAKKIN: - { - pp->languages[LANG_COMMON_TONGUE] = 100; - pp->languages[LANG_ELDER_DRAGON] = 100; - pp->languages[LANG_DRAGON] = 100; - break; - } - } + switch( pp->race ) + { + case BARBARIAN: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_BARBARIAN] = 100; + break; + } + case DARK_ELF: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_DARK_ELVISH] = 100; + pp->languages[LANG_DARK_SPEECH] = 100; + pp->languages[LANG_ELDER_ELVISH] = 100; + pp->languages[LANG_ELVISH] = 25; + break; + } + case DWARF: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_DWARVISH] = 100; + pp->languages[LANG_GNOMISH] = 25; + break; + } + case ERUDITE: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_ERUDIAN] = 100; + break; + } + case FROGLOK: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_FROGLOK] = 100; + pp->languages[LANG_TROLL] = 25; + break; + } + case GNOME: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_DWARVISH] = 25; + pp->languages[LANG_GNOMISH] = 100; + break; + } + case HALF_ELF: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_ELVISH] = 100; + break; + } + case HALFLING: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_HALFLING] = 100; + break; + } + case HIGH_ELF: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_DARK_ELVISH] = 25; + pp->languages[LANG_ELDER_ELVISH] = 25; + pp->languages[LANG_ELVISH] = 100; + break; + } + case HUMAN: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + break; + } + case IKSAR: + { + pp->languages[LANG_COMMON_TONGUE] = 95; + pp->languages[LANG_DARK_SPEECH] = 100; + pp->languages[LANG_LIZARDMAN] = 100; + break; + } + case OGRE: + { + pp->languages[LANG_COMMON_TONGUE] = 95; + pp->languages[LANG_DARK_SPEECH] = 100; + pp->languages[LANG_OGRE] = 100; + break; + } + case TROLL: + { + pp->languages[LANG_COMMON_TONGUE] = 95; + pp->languages[LANG_DARK_SPEECH] = 100; + pp->languages[LANG_TROLL] = 100; + break; + } + case WOOD_ELF: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_ELVISH] = 100; + break; + } + case VAHSHIR: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_COMBINE_TONGUE] = 100; + pp->languages[LANG_ERUDIAN] = 25; + pp->languages[LANG_VAH_SHIR] = 100; + break; + } + case DRAKKIN: + { + pp->languages[LANG_COMMON_TONGUE] = 100; + pp->languages[LANG_ELDER_DRAGON] = 100; + pp->languages[LANG_DRAGON] = 100; + break; + } + } } + diff --git a/world/client.h b/world/client.h index 1e8f98a74..8d17864ec 100644 --- a/world/client.h +++ b/world/client.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 CLIENT_H #define CLIENT_H @@ -36,7 +36,7 @@ class EQStreamInterface; class Client { public: Client(EQStreamInterface* ieqs); - ~Client(); + ~Client(); bool Process(); void ReceiveData(uchar* buf, int len); @@ -111,7 +111,6 @@ private: EQStreamInterface* const eqs; }; - bool CheckCharCreateInfoSoF(CharCreate_Struct *cc); bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc); diff --git a/world/cliententry.cpp b/world/cliententry.cpp index 9651063d2..dc2f8bf1d 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.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" #include "cliententry.h" @@ -295,32 +295,3 @@ bool ClientListEntry::CheckAuth(uint32 id, const char* iKey, uint32 ip) { return false; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/world/cliententry.h b/world/cliententry.h index f6a63a1b3..dcf79ca4f 100644 --- a/world/cliententry.h +++ b/world/cliententry.h @@ -34,11 +34,11 @@ public: void SetOnline(int8 iOnline = CLE_Status_Online); void SetChar(uint32 iCharID, const char* iCharName); inline int8 Online() { return pOnline; } - inline const uint32 GetID() const { return id; } - inline const uint32 GetIP() const { return pIP; } + inline const uint32 GetID() const { return id; } + inline const uint32 GetIP() const { return pIP; } inline void SetIP(const uint32& iIP) { pIP = iIP; } inline void KeepAlive() { stale = 0; } - inline uint8 GetStaleCounter() const { return stale; } + inline uint8 GetStaleCounter() const { return stale; } void LeavingZone(ZoneServer* iZS = 0, int8 iOnline = CLE_Status_Offline); void Camp(ZoneServer* iZS = 0); @@ -122,5 +122,5 @@ private: char pLFGComments[64]; }; - #endif /*CLIENTENTRY_H_*/ + diff --git a/world/clientlist.cpp b/world/clientlist.cpp index 008ec5df3..82de9cebe 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.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" #include "clientlist.h" @@ -57,7 +57,7 @@ void ClientList::Process() { iterator.Reset(); while(iterator.MoreElements()) { if (!iterator.GetData()->Process()) { - struct in_addr in; + struct in_addr in; in.s_addr = iterator.GetData()->GetIP(); _log(WORLD__CLIENTLIST,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); //the client destructor should take care of this. @@ -113,7 +113,7 @@ void ClientList::EnforceSessionLimit(uint32 iLSAccountID) { ClientEntry = iterator.GetData(); if ((ClientEntry->LSAccountID() == iLSAccountID) && - ((ClientEntry->Admin() <= (RuleI(World, ExemptAccountLimitStatus))) || (RuleI(World, ExemptAccountLimitStatus) < 0))) { + ((ClientEntry->Admin() <= (RuleI(World, ExemptAccountLimitStatus))) || (RuleI(World, ExemptAccountLimitStatus) < 0))) { CharacterCount++; @@ -227,15 +227,15 @@ void ClientList::DisconnectByIP(uint32 iIP) { while(iterator.MoreElements()) { countCLEIPs = iterator.GetData(); if ((countCLEIPs->GetIP() == iIP)) { - if(strlen(countCLEIPs->name())) { - ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); - ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer; - strcpy(skp->adminname, "SessionLimit"); - strcpy(skp->name, countCLEIPs->name()); - skp->adminrank = 255; - zoneserver_list.SendPacket(pack); - safe_delete(pack); - } + if(strlen(countCLEIPs->name())) { + ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); + ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer; + strcpy(skp->adminname, "SessionLimit"); + strcpy(skp->name, countCLEIPs->name()); + skp->adminrank = 255; + zoneserver_list.SendPacket(pack); + safe_delete(pack); + } countCLEIPs->SetOnline(CLE_Status_Offline); iterator.RemoveCurrent(); } @@ -301,7 +301,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect while(iterator.MoreElements()) { ClientListEntry* cle = iterator.GetData(); if (admin >= cle->Admin() && (iName == 0 || namestrlen == 0 || strncasecmp(cle->name(), iName, namestrlen) == 0 || strncasecmp(cle->AccountName(), iName, namestrlen) == 0 || strncasecmp(cle->LSName(), iName, namestrlen) == 0)) { - struct in_addr in; + struct in_addr in; in.s_addr = cle->GetIP(); if (addnewline) { AppendAnyLenString(&output, &outsize, &outlen, newline); @@ -395,7 +395,7 @@ void ClientList::CLEKeepAlive(uint32 numupdates, uint32* wid) { ClientListEntry* ClientList::CheckAuth(uint32 id, const char* iKey, uint32 ip ) { - LinkedListIterator iterator(clientlist); + LinkedListIterator iterator(clientlist); iterator.Reset(); while(iterator.MoreElements()) { @@ -406,7 +406,7 @@ ClientListEntry* ClientList::CheckAuth(uint32 id, const char* iKey, uint32 ip ) return 0; } ClientListEntry* ClientList::CheckAuth(uint32 iLSID, const char* iKey) { - LinkedListIterator iterator(clientlist); + LinkedListIterator iterator(clientlist); iterator.Reset(); while(iterator.MoreElements()) { @@ -880,7 +880,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon WAPP3->ZoneMSGID = ZoneMSGID; WAPP3->Zone = PlayerZone; WAPP3->Class_ = PlayerClass; - WAPP3->Level = PlayerLevel; + WAPP3->Level = PlayerLevel; WAPP3->Race = PlayerRace; WAPP3->Account[0] = 0; @@ -920,16 +920,16 @@ void ClientList::SendLFGMatches(ServerLFGMatchesRequest_Struct *smrs) { // First we check that the player meets the level and class criteria of the person // doing the search. if((CLE->level() >= smrs->FromLevel) && (CLE->level() <= smrs->ToLevel) && - (BitMask & smrs->Classes)) - // Then we check if if the player doing the search meets the level criteria specified + (BitMask & smrs->Classes)) + // Then we check if if the player doing the search meets the level criteria specified // by the player who is LFG. // // GetLFGMatchFilter returns the setting of the 'Only players who match my posted filters - // can query me' checkbox. + // can query me' checkbox. // // FromLevel and ToLevel are the settings of the 'Want group levels:' boxes. - if(!CLE->GetLFGMatchFilter() || ((smrs->QuerierLevel >= CLE->GetLFGFromLevel()) && - (smrs->QuerierLevel <= CLE->GetLFGToLevel()))) + if(!CLE->GetLFGMatchFilter() || ((smrs->QuerierLevel >= CLE->GetLFGFromLevel()) && + (smrs->QuerierLevel <= CLE->GetLFGToLevel()))) Matches++; } Iterator.Advance(); @@ -950,7 +950,7 @@ void ClientList::SendLFGMatches(ServerLFGMatchesRequest_Struct *smrs) { if(CLE->LFG()) { unsigned int BitMask = 1 << CLE->class_(); if((CLE->level() >= smrs->FromLevel) && (CLE->level() <= smrs->ToLevel) && - (BitMask & smrs->Classes)) { + (BitMask & smrs->Classes)) { Matches--; strcpy(Buffer->Name, CLE->name()); Buffer->Class_ = CLE->class_(); @@ -1358,5 +1358,6 @@ void ClientList::SendClientVersionSummary(const char *Name) } zoneserver_list.SendEmoteMessage(Name, 0, 0, 13, "There are %i 6.2, %i Titanium, %i SoF, %i SoD, %i UF, %i RoF clients currently connected.", - Client62Count, ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount); + Client62Count, ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount); } + diff --git a/world/clientlist.h b/world/clientlist.h index 025894a21..1d5fc6ab8 100644 --- a/world/clientlist.h +++ b/world/clientlist.h @@ -40,7 +40,7 @@ public: void SendOnlineGuildMembers(uint32 FromID, uint32 GuildID); void SendClientVersionSummary(const char *Name); void SendLFGMatches(ServerLFGMatchesRequest_Struct *LFGMatchesRequest); - void ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct* whom, WorldTCPConnection* connection); + void ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct* whom, WorldTCPConnection* connection); void SendCLEList(const int16& admin, const char* to, WorldTCPConnection* connection, const char* iName = 0); bool SendPacket(const char* to, ServerPacket* pack); @@ -79,7 +79,5 @@ protected: }; - - - #endif /*CLIENTLIST_H_*/ + diff --git a/world/console.cpp b/world/console.cpp index 052308654..93f73ed4d 100644 --- a/world/console.cpp +++ b/world/console.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 @@ -53,7 +53,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #endif extern ZSList zoneserver_list; @@ -69,9 +69,9 @@ ConsoleList console_list; void CatchSignal(int sig_num); Console::Console(EmuTCPConnection* itcpc) -: WorldTCPConnection(), - timeout_timer(RuleI(Console, SessionTimeOut)), - prompt_timer(1000) +: WorldTCPConnection(), + timeout_timer(RuleI(Console, SessionTimeOut)), + prompt_timer(1000) { tcpc = itcpc; tcpc->SetEcho(true); @@ -89,7 +89,7 @@ Console::~Console() { void Console::Die() { state = CONSOLE_STATE_CLOSED; - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(WORLD__CONSOLE,"Removing console from %s:%d",inet_ntoa(in),GetPort()); tcpc->Disconnect(); @@ -100,17 +100,17 @@ bool Console::SendChannelMessage(const ServerChannelMessage_Struct* scm) { return false; switch (scm->chan_num) { if(RuleB(Chat, ServerWideAuction)){ - case 4: { - SendMessage(1, "%s auctions, '%s'", scm->from, scm->message); - break; + case 4: { + SendMessage(1, "%s auctions, '%s'", scm->from, scm->message); + break; + } } - } - if(RuleB(Chat, ServerWideOOC)){ - case 5: { - SendMessage(1, "%s says ooc, '%s'", scm->from, scm->message); - break; + if(RuleB(Chat, ServerWideOOC)){ + case 5: { + SendMessage(1, "%s says ooc, '%s'", scm->from, scm->message); + break; + } } - } case 6: { SendMessage(1, "%s BROADCASTS, '%s'", scm->from, scm->message); break; @@ -219,7 +219,7 @@ bool Console::Process() { return false; if (!tcpc->Connected()) { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(WORLD__CONSOLE,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); return false; @@ -234,7 +234,7 @@ bool Console::Process() { if (timeout_timer.Check()) { SendMessage(1, 0); SendMessage(1, "Timeout, disconnecting..."); - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(WORLD__CONSOLE,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); return false; @@ -307,7 +307,7 @@ void ConsoleList::KillAll() { void ConsoleList::SendConsoleWho(WorldTCPConnection* connection, const char* to, int16 admin, char** output, uint32* outsize, uint32* outlen) { LinkedListIterator iterator(list); iterator.Reset(); - struct in_addr in; + struct in_addr in; int x = 0; while(iterator.MoreElements()) { @@ -855,3 +855,4 @@ void Console::SendPrompt() { if (tcpc->GetEcho()) SendMessage(0, "%s> ", paccountname); } + diff --git a/world/console.h b/world/console.h index b0ce233aa..26aa95648 100644 --- a/world/console.h +++ b/world/console.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 CONSOLE_H #define CONSOLE_H @@ -106,3 +106,4 @@ private: LinkedList list; }; #endif + diff --git a/world/lfplist.cpp b/world/lfplist.cpp index b72e66b2e..3e2e7611c 100644 --- a/world/lfplist.cpp +++ b/world/lfplist.cpp @@ -1,5 +1,5 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) +/* 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 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 "lfplist.h" @@ -115,7 +115,7 @@ void GroupLFPList::Process() { Group = Iterator.GetData(); int MemberCount = 0; if(Group) { - GroupLFPMemberEntry* GroupMembers = Group->Members; + GroupLFPMemberEntry* GroupMembers = Group->Members; if(!GroupMembers) { Iterator.Advance(); continue; @@ -193,7 +193,7 @@ void GroupLFPList::UpdateGroup(ServerLFPUpdate_Struct *Update) { Group = new GroupLFP(Update->LeaderID); - if(Group) { + if(Group) { Group->SetDetails(Update); LFPGroupList.Append(Group); } diff --git a/world/lfplist.h b/world/lfplist.h index 6801424e8..dbb4f8962 100644 --- a/world/lfplist.h +++ b/world/lfplist.h @@ -1,5 +1,5 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) +/* 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 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 */ #ifndef LFPENTRY_H @@ -64,3 +64,4 @@ private: }; #endif + diff --git a/world/net.cpp b/world/net.cpp index 9bb0aaa3e..3545b8a31 100644 --- a/world/net.cpp +++ b/world/net.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" @@ -51,7 +51,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #include #else #include @@ -62,11 +62,11 @@ using namespace std; #include #ifndef FREEBSD union semun { - int val; - struct semid_ds *buf; - ushort *array; - struct seminfo *__buf; - void *__pad; + int val; + struct semid_ds *buf; + ushort *array; + struct seminfo *__buf; + void *__pad; }; #endif @@ -123,8 +123,8 @@ extern ConsoleList console_list; void CatchSignal(int sig_num); int main(int argc, char** argv) { - RegisterExecutablePlatform(ExePlatformWorld); - set_exception_handler(); + RegisterExecutablePlatform(ExePlatformWorld); + set_exception_handler(); // Load server configuration _log(WORLD__INIT, "Loading server configuration.."); @@ -289,7 +289,7 @@ int main(int argc, char** argv) { database.ClearRaidDetails(); _log(WORLD__INIT, "Loading items.."); if (!database.LoadItems()) { - _log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring"); + _log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring"); } _log(WORLD__INIT, "Loading guilds.."); guild_mgr.LoadGuilds(); @@ -310,9 +310,9 @@ int main(int argc, char** argv) { } } if(RuleB(World, ClearTempMerchantlist)){ - _log(WORLD__INIT, "Clearing temporary merchant lists.."); + _log(WORLD__INIT, "Clearing temporary merchant lists.."); database.ClearMerchantTemp(); - } + } _log(WORLD__INIT, "Loading EQ time of day.."); if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) _log(WORLD__INIT_ERR, "Unable to load %s", Config->EQTimeFile.c_str()); @@ -351,9 +351,9 @@ int main(int argc, char** argv) { Timer PurgeInstanceTimer(450000); PurgeInstanceTimer.Start(450000); - _log(WORLD__INIT, "Loading char create info..."); - database.LoadCharacterCreateAllocations(); - database.LoadCharacterCreateCombos(); + _log(WORLD__INIT, "Loading char create info..."); + database.LoadCharacterCreateAllocations(); + database.LoadCharacterCreateCombos(); char errbuf[TCPConnection_ErrorBufferSize]; if (tcps.Open(Config->WorldTCPPort, errbuf)) { @@ -406,24 +406,24 @@ int main(int argc, char** argv) { //now that we know what patch they are running, start up their client object struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); - if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. + if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. _log(WORLD__CLIENT, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); - if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. - _log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); - Client* client = new Client(eqsi); - // @merth: client->zoneattempt=0; - client_list.Add(client); - } else { - _log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); - eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. - } - } - if (!RuleB(World, UseBannedIPsTable)){ - _log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); - Client* client = new Client(eqsi); - // @merth: client->zoneattempt=0; - client_list.Add(client); - } + if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. + _log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); + Client* client = new Client(eqsi); + // @merth: client->zoneattempt=0; + client_list.Add(client); + } else { + _log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); + eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. + } + } + if (!RuleB(World, UseBannedIPsTable)){ + _log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Client* client = new Client(eqsi); + // @merth: client->zoneattempt=0; + client_list.Add(client); + } } client_list.Process(); diff --git a/world/net.h b/world/net.h index 492c03a9c..b343c8d68 100644 --- a/world/net.h +++ b/world/net.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 WIN32 #include @@ -83,6 +83,6 @@ private: char worldpassword[31]; char worldaddress[255]; char chataddress[255]; - uint8 DEFAULTSTATUS; + uint8 DEFAULTSTATUS; }; diff --git a/world/perl_EQLConfig.cpp b/world/perl_EQLConfig.cpp index 7321c2a78..59e86dcb9 100644 --- a/world/perl_EQLConfig.cpp +++ b/world/perl_EQLConfig.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; @@ -36,7 +36,7 @@ typedef const char Const_char; #undef seed #endif -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -433,23 +433,6 @@ XS(XS_EQLConfig_GetZoneDetails) sv_setpvn(*ele, cur->second.c_str(), cur->second.length()); } } - - - - - - - - - - - - - - - - - } XSRETURN(1); } @@ -471,8 +454,6 @@ XS(boot_EQLConfig) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "GetName"), XS_EQLConfig_GetName, file, "$"); diff --git a/world/perl_EQW.cpp b/world/perl_EQW.cpp index 3ddbf669d..fd6b62262 100644 --- a/world/perl_EQW.cpp +++ b/world/perl_EQW.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 @@ -16,13 +16,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ typedef const char Const_char; @@ -36,7 +36,7 @@ typedef const char Const_char; #undef seed #endif -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -272,23 +272,6 @@ XS(XS_EQW_GetZoneDetails) sv_setpvn(*ele, cur->second.c_str(), cur->second.length()); } } - - - - - - - - - - - - - - - - - } XSRETURN(1); } @@ -409,23 +392,6 @@ XS(XS_EQW_GetPlayerDetails) sv_setpvn(*ele, cur->second.c_str(), cur->second.length()); } } - - - - - - - - - - - - - - - - - } XSRETURN(1); } @@ -864,7 +830,7 @@ XS(XS_EQW_ListBugs) Perl_croak(aTHX_ "Usage: EQW::ListBugs(THIS, id)"); { EQW * THIS; - uint32 id = (uint32)SvUV(ST(1)); + uint32 id = (uint32)SvUV(ST(1)); vector RETVAL; @@ -953,7 +919,7 @@ XS(XS_EQW_ResolveBug) Perl_croak(aTHX_ "Usage: EQW::ResolveBug(THIS, id)"); { EQW * THIS; - const char *id = (const char*)SvPV_nolen(ST(1)); + const char *id = (const char*)SvPV_nolen(ST(1)); if (sv_derived_from(ST(0), "EQW")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -972,53 +938,53 @@ XS(XS_EQW_ResolveBug) XS(XS_EQW_SendMessage); /* prototype to pass -Wmissing-prototypes */ XS(XS_EQW_SendMessage) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: EQW::SendMessage(THIS, type, message)"); - { - EQW * THIS; - dXSTARG; - uint32 msgtype = (uint32)SvUV(ST(1)); - char* msg = (char *)SvPV_nolen(ST(2)); + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: EQW::SendMessage(THIS, type, message)"); + { + EQW * THIS; + dXSTARG; + uint32 msgtype = (uint32)SvUV(ST(1)); + char* msg = (char *)SvPV_nolen(ST(2)); - if (sv_derived_from(ST(0), "EQW")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(EQW *,tmp); - } - else - Perl_croak(aTHX_ "THIS is not of type EQW"); - if(THIS == NULL) - Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + if (sv_derived_from(ST(0), "EQW")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(EQW *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type EQW"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); - THIS->SendMessage(msgtype, msg); - } - XSRETURN_EMPTY; + THIS->SendMessage(msgtype, msg); + } + XSRETURN_EMPTY; } XS(XS_EQW_WorldShutDown); /* prototype to pass -Wmissing-prototypes */ XS(XS_EQW_WorldShutDown) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: EQW::WorldShutDown(THIS, time, interval)"); - { - EQW * THIS; - dXSTARG; - uint32 time = (uint32)SvUV(ST(1)); - uint32 interval = (uint32)SvUV(ST(2)); + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: EQW::WorldShutDown(THIS, time, interval)"); + { + EQW * THIS; + dXSTARG; + uint32 time = (uint32)SvUV(ST(1)); + uint32 interval = (uint32)SvUV(ST(2)); - if (sv_derived_from(ST(0), "EQW")) { - IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(EQW *,tmp); - } - else - Perl_croak(aTHX_ "THIS is not of type EQW"); - if(THIS == NULL) - Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + if (sv_derived_from(ST(0), "EQW")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(EQW *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type EQW"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); - THIS->WorldShutDown(time, interval); - } - XSRETURN_EMPTY; + THIS->WorldShutDown(time, interval); + } + XSRETURN_EMPTY; } #ifdef __cplusplus @@ -1038,8 +1004,6 @@ XS(boot_EQW) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "GetConfig"), XS_EQW_GetConfig, file, "$$"); @@ -1067,10 +1031,10 @@ XS(boot_EQW) newXSproto(strcpy(buf, "SetBankerFlag"), XS_EQW_SetBankerFlag, file, "$$$"); newXSproto(strcpy(buf, "SetTributeFlag"), XS_EQW_SetTributeFlag, file, "$$$"); newXSproto(strcpy(buf, "SetPublicNote"), XS_EQW_SetPublicNote, file, "$$$"); - newXSproto(strcpy(buf, "CountBugs"), XS_EQW_CountBugs, file, "$"); - newXSproto(strcpy(buf, "ListBugs"), XS_EQW_ListBugs, file, "$$"); + newXSproto(strcpy(buf, "CountBugs"), XS_EQW_CountBugs, file, "$"); + newXSproto(strcpy(buf, "ListBugs"), XS_EQW_ListBugs, file, "$$"); newXSproto(strcpy(buf, "GetBugDetails"), XS_EQW_GetBugDetails, file, "$$"); - newXSproto(strcpy(buf, "ResolveBug"), XS_EQW_ResolveBug, file, "$$"); + newXSproto(strcpy(buf, "ResolveBug"), XS_EQW_ResolveBug, file, "$$"); newXSproto(strcpy(buf, "SendMessage"), XS_EQW_SendMessage, file, "$$$"); newXSproto(strcpy(buf, "WorldShutDown"), XS_EQW_WorldShutDown, file, "$$$"); XSRETURN_YES; diff --git a/world/perl_HTTPRequest.cpp b/world/perl_HTTPRequest.cpp index 0fa250739..d9427d809 100644 --- a/world/perl_HTTPRequest.cpp +++ b/world/perl_HTTPRequest.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; @@ -36,7 +36,7 @@ typedef const char Const_char; #undef seed #endif -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -219,23 +219,6 @@ XS(XS_HTTPRequest_get_all) sv_setpvn(*ele, cur->second.c_str(), cur->second.length()); } } - - - - - - - - - - - - - - - - - } XSRETURN(1); } @@ -330,8 +313,6 @@ XS(boot_HTTPRequest) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "get"), XS_HTTPRequest_get, file, "$$;$"); diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 4181ca362..eaa428332 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -54,7 +54,7 @@ bool QueryServConnection::Process() authenticated = true; else { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(QUERYSERV__ERROR, "QueryServ authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); @@ -66,7 +66,7 @@ bool QueryServConnection::Process() } else { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(QUERYSERV__ERROR, "QueryServ authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); @@ -131,3 +131,4 @@ bool QueryServConnection::SendPacket(ServerPacket* pack) return Stream->SendPacket(pack); } + diff --git a/world/ucs.cpp b/world/ucs.cpp index 36e29592f..262e8c187 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -49,7 +49,7 @@ bool UCSConnection::Process() authenticated = true; else { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(UCS__ERROR, "UCS authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); @@ -61,7 +61,7 @@ bool UCSConnection::Process() } else { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); _log(UCS__ERROR, "UCS authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); @@ -127,3 +127,4 @@ void UCSConnection::SendMessage(const char *From, const char *Message) SendPacket(pack); safe_delete(pack); } + diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index ba93980cb..45cad0f56 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.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 "../common/debug.h" #include "wguild_mgr.h" @@ -144,29 +144,3 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { } } - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/world/worlddb.cpp b/world/worlddb.cpp index b6f59b8ea..e99fafcf3 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.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 "worlddb.h" @@ -46,7 +46,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* strcpy(cs->name[i], ""); cs->zone[i] = 0; cs->level[i] = 0; - cs->tutorial[i] = 0; + cs->tutorial[i] = 0; cs->gohome[i] = 0; } @@ -83,8 +83,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs->face[char_num] = pp->face; cs->haircolor[char_num] = pp->haircolor; cs->beardcolor[char_num] = pp->beardcolor; - cs->eyecolor2[char_num] = pp->eyecolor2; - cs->eyecolor1[char_num] = pp->eyecolor1; + cs->eyecolor2[char_num] = pp->eyecolor2; + cs->eyecolor1[char_num] = pp->eyecolor1; cs->hairstyle[char_num] = pp->hairstyle; cs->beard[char_num] = pp->beard; cs->drakkin_heritage[char_num] = pp->drakkin_heritage; @@ -102,7 +102,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* // This part creates home city entries for characters created before the home bind point was tracked. - // Do it here because the player profile is already loaded and it's as good a spot as any. This whole block should + // Do it here because the player profile is already loaded and it's as good a spot as any. This whole block should // probably be removed at some point, when most accounts are safely converted. if(pp->binds[4].zoneId == 0) { bool altered = false; @@ -177,7 +177,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* // @merth: Haven't done bracer01/bracer02 yet. // Also: this needs a second look after items are a little more solid // NOTE: items don't have a color, players MAY have a tint, if the - // use_tint part is set. otherwise use the regular color + // use_tint part is set. otherwise use the regular color inv = new Inventory; if(GetInventory(account_id, cs->name[char_num], inv)) { @@ -269,8 +269,8 @@ int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) { if(!strcmp(BindZoneName, "UNKNWN")) return pp.zone_id; if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET zonename = '%s',zoneid=%i,x=%f, y=%f, z=%f, instanceid=0 WHERE id='%i'", - BindZoneName, pp.binds[bindnum].zoneId, pp.binds[bindnum].x, pp.binds[bindnum].y, pp.binds[bindnum].z, - CharID), errbuf, 0,&affected_rows)) { + BindZoneName, pp.binds[bindnum].zoneId, pp.binds[bindnum].x, pp.binds[bindnum].y, pp.binds[bindnum].z, + CharID), errbuf, 0,&affected_rows)) { return pp.zone_id; } @@ -500,9 +500,9 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru void WorldDatabase::GetLauncherList(std::vector &rl) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_ROW row; rl.clear(); @@ -534,7 +534,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { sprintf(MailKeyString, "%08X", MailKey); if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET mailkey = '%s' WHERE id='%i'", - MailKeyString, CharID), errbuf)) + MailKeyString, CharID), errbuf)) LogFile->write(EQEMuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, errbuf); @@ -545,9 +545,9 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { bool WorldDatabase::GetCharacterLevel(const char *name, int &level) { 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 level FROM character_ WHERE name='%s'", name), errbuf, &result)) { @@ -569,71 +569,69 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) } bool WorldDatabase::LoadCharacterCreateAllocations() { - character_create_allocations.clear(); + character_create_allocations.clear(); - 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 * FROM char_create_point_allocations order by id"), errbuf, &result)) { - safe_delete_array(query); - while(row = mysql_fetch_row(result)) { - RaceClassAllocation allocate; - int r = 0; - allocate.Index = atoi(row[r++]); - allocate.BaseStats[0] = atoi(row[r++]); - allocate.BaseStats[3] = atoi(row[r++]); - allocate.BaseStats[1] = atoi(row[r++]); - allocate.BaseStats[2] = atoi(row[r++]); - allocate.BaseStats[4] = atoi(row[r++]); - allocate.BaseStats[5] = atoi(row[r++]); - allocate.BaseStats[6] = atoi(row[r++]); - allocate.DefaultPointAllocation[0] = atoi(row[r++]); - allocate.DefaultPointAllocation[3] = atoi(row[r++]); - allocate.DefaultPointAllocation[1] = atoi(row[r++]); - allocate.DefaultPointAllocation[2] = atoi(row[r++]); - allocate.DefaultPointAllocation[4] = atoi(row[r++]); - allocate.DefaultPointAllocation[5] = atoi(row[r++]); - allocate.DefaultPointAllocation[6] = atoi(row[r++]); - character_create_allocations.push_back(allocate); - } - mysql_free_result(result); - } else { - safe_delete_array(query); - return false; - } + MYSQL_ROW row; + if(RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM char_create_point_allocations order by id"), errbuf, &result)) { + safe_delete_array(query); + while(row = mysql_fetch_row(result)) { + RaceClassAllocation allocate; + int r = 0; + allocate.Index = atoi(row[r++]); + allocate.BaseStats[0] = atoi(row[r++]); + allocate.BaseStats[3] = atoi(row[r++]); + allocate.BaseStats[1] = atoi(row[r++]); + allocate.BaseStats[2] = atoi(row[r++]); + allocate.BaseStats[4] = atoi(row[r++]); + allocate.BaseStats[5] = atoi(row[r++]); + allocate.BaseStats[6] = atoi(row[r++]); + allocate.DefaultPointAllocation[0] = atoi(row[r++]); + allocate.DefaultPointAllocation[3] = atoi(row[r++]); + allocate.DefaultPointAllocation[1] = atoi(row[r++]); + allocate.DefaultPointAllocation[2] = atoi(row[r++]); + allocate.DefaultPointAllocation[4] = atoi(row[r++]); + allocate.DefaultPointAllocation[5] = atoi(row[r++]); + allocate.DefaultPointAllocation[6] = atoi(row[r++]); + character_create_allocations.push_back(allocate); + } + mysql_free_result(result); + } else { + safe_delete_array(query); + return false; + } - return true; + return true; } bool WorldDatabase::LoadCharacterCreateCombos() { - character_create_race_class_combos.clear(); + character_create_race_class_combos.clear(); - 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 * from char_create_combinations order by race, class, deity, start_zone"), errbuf, &result)) { - safe_delete_array(query); - while(row = mysql_fetch_row(result)) { - RaceClassCombos combo; - int r = 0; - combo.AllocationIndex = atoi(row[r++]); - combo.Race = atoi(row[r++]); - combo.Class = atoi(row[r++]); - combo.Deity = atoi(row[r++]); - combo.Zone = atoi(row[r++]); - combo.ExpansionRequired = atoi(row[r++]); - character_create_race_class_combos.push_back(combo); - } - mysql_free_result(result); - } else { - safe_delete_array(query); - return false; - } + MYSQL_ROW row; + if(RunQuery(query, MakeAnyLenString(&query, "select * from char_create_combinations order by race, class, deity, start_zone"), errbuf, &result)) { + safe_delete_array(query); + while(row = mysql_fetch_row(result)) { + RaceClassCombos combo; + int r = 0; + combo.AllocationIndex = atoi(row[r++]); + combo.Race = atoi(row[r++]); + combo.Class = atoi(row[r++]); + combo.Deity = atoi(row[r++]); + combo.Zone = atoi(row[r++]); + combo.ExpansionRequired = atoi(row[r++]); + character_create_race_class_combos.push_back(combo); + } + mysql_free_result(result); + } else { + safe_delete_array(query); + return false; + } - return true; + return true; } - - diff --git a/world/worlddb.h b/world/worlddb.h index ea2e8a5b6..0dcb6ef44 100644 --- a/world/worlddb.h +++ b/world/worlddb.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 WORLDDB_H_ #define WORLDDB_H_ @@ -38,13 +38,12 @@ public: void SetMailKey(int CharID, int IPAddress, int MailKey); bool GetCharacterLevel(const char *name, int &level); - bool LoadCharacterCreateAllocations(); - bool LoadCharacterCreateCombos(); + bool LoadCharacterCreateAllocations(); + bool LoadCharacterCreateCombos(); protected: }; extern WorldDatabase database; - #endif /*WORLDDB_H_*/ diff --git a/world/zonelist.cpp b/world/zonelist.cpp index 729409767..9a95c034d 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.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" #include "zonelist.h" @@ -87,7 +87,7 @@ void ZSList::Process() { CatchSignal(2); } if(reminder && reminder->Check()){ - SendEmoteMessage(0,0,0,15,":SYSTEM MSG:World coming down, everyone log out now. World will shut down in %i seconds...",shutdowntimer->GetRemainingTime()/1000); + SendEmoteMessage(0,0,0,15,":SYSTEM MSG:World coming down, everyone log out now. World will shut down in %i seconds...",shutdowntimer->GetRemainingTime()/1000); } LinkedListIterator iterator(list); @@ -95,7 +95,7 @@ void ZSList::Process() { while(iterator.MoreElements()) { if (!iterator.GetData()->Process()) { ZoneServer* zs = iterator.GetData(); - struct in_addr in; + struct in_addr in; in.s_addr = zs->GetIP(); _log(WORLD__ZONELIST,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); zs->LSShutDownUpdate(zs->GetZoneID()); @@ -204,7 +204,7 @@ ZoneServer* ZSList::FindByZoneID(uint32 ZoneID) { while(iterator.MoreElements()) { ZoneServer* tmp = iterator.GetData(); - if (tmp->GetZoneID() == ZoneID && tmp->GetInstanceID() == 0) { + if (tmp->GetZoneID() == ZoneID && tmp->GetInstanceID() == 0) { return tmp; } iterator.Advance(); @@ -282,7 +282,7 @@ void ZSList::ListLockedZones(const char* to, WorldTCPConnection* connection) { void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* connection) { LinkedListIterator iterator(list); - struct in_addr in; + struct in_addr in; iterator.Reset(); char locked[4]; @@ -713,12 +713,11 @@ void ZSList::GetZoneIDList(vector &zones) { zones.push_back(zs->GetID()); iterator.Advance(); } - } void ZSList::WorldShutDown(uint32 time, uint32 interval) { - if( time > 0 ) { + if( time > 0 ) { SendEmoteMessage(0,0,0,15,":SYSTEM MSG:World coming down in %i seconds, everyone log out before this time.",time); time *= 1000; @@ -730,15 +729,15 @@ void ZSList::WorldShutDown(uint32 time, uint32 interval) reminder->SetAtTrigger(interval); shutdowntimer->Start(); reminder->Start(); - } - else { - SendEmoteMessage(0,0,0,15,":SYSTEM MSG:World coming down, everyone log out now."); - ServerPacket* pack = new ServerPacket; - pack->opcode = ServerOP_ShutdownAll; - pack->size=0; - SendPacket(pack); - safe_delete(pack); + } + else { + SendEmoteMessage(0,0,0,15,":SYSTEM MSG:World coming down, everyone log out now."); + ServerPacket* pack = new ServerPacket; + pack->opcode = ServerOP_ShutdownAll; + pack->size=0; + SendPacket(pack); + safe_delete(pack); Process(); CatchSignal(2); - } + } } diff --git a/world/zonelist.h b/world/zonelist.h index ce3dad431..19160f790 100644 --- a/world/zonelist.h +++ b/world/zonelist.h @@ -52,7 +52,7 @@ public: Timer* reminder; void NextGroupIDs(uint32 &start, uint32 &end); void SendLSZones(); - uint16 GetAvailableZonePort(); + uint16 GetAvailableZonePort(); int GetZoneCount(); void GetZoneIDList(std::vector &zones); @@ -68,16 +68,5 @@ protected: }; - - - - - - - - - - - - #endif /*ZONELIST_H_*/ + diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 02967cfa7..1332158cd 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.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" #include "zoneserver.h" @@ -186,7 +186,7 @@ bool ZoneServer::Process() { if (memcmp(pack->pBuffer, tmppass, 16) == 0) authenticated = true; else { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); zlog(WORLD__ZONE_ERR,"Zone authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); @@ -197,7 +197,7 @@ bool ZoneServer::Process() { } } else { - struct in_addr in; + struct in_addr in; in.s_addr = GetIP(); zlog(WORLD__ZONE_ERR,"Zone authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); @@ -214,1114 +214,1114 @@ bool ZoneServer::Process() { } } switch(pack->opcode) { - case 0: - break; - case ServerOP_KeepAlive: { - // ignore this - break; - } - case ServerOP_ZAAuth: { - break; - } - case ServerOP_LSZoneBoot:{ - if(pack->size==sizeof(ZoneBoot_Struct)){ - ZoneBoot_Struct* zbs= (ZoneBoot_Struct*)pack->pBuffer; - SetCompile(zbs->compile_time); - } - break; - } - case ServerOP_GroupInvite: { - if(pack->size != sizeof(GroupInvite_Struct)) + case 0: break; - - GroupInvite_Struct* gis = (GroupInvite_Struct*) pack->pBuffer; - - client_list.SendPacket(gis->invitee_name, pack); - break; - } - case ServerOP_GroupFollow: { - if(pack->size != sizeof(ServerGroupFollow_Struct)) - break; - - ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *) pack->pBuffer; - - client_list.SendPacket(sgfs->gf.name1, pack); - break; - } - case ServerOP_GroupFollowAck: { - if(pack->size != sizeof(ServerGroupFollowAck_Struct)) - break; - - ServerGroupFollowAck_Struct *sgfas = (ServerGroupFollowAck_Struct *) pack->pBuffer; - - client_list.SendPacket(sgfas->Name, pack); - break; - } - case ServerOP_GroupCancelInvite: { - if(pack->size != sizeof(GroupCancel_Struct)) - break; - - GroupCancel_Struct *gcs = (GroupCancel_Struct *) pack->pBuffer; - - client_list.SendPacket(gcs->name1, pack); - break; - } - case ServerOP_GroupIDReq: { - SendGroupIDs(); - break; - } - case ServerOP_GroupLeave: { - if(pack->size != sizeof(ServerGroupLeave_Struct)) - break; - zoneserver_list.SendPacket(pack); //bounce it to all zones - break; - } - - case ServerOP_GroupJoin: { - if(pack->size != sizeof(ServerGroupJoin_Struct)) - break; - zoneserver_list.SendPacket(pack); //bounce it to all zones - break; - } - - case ServerOP_ForceGroupUpdate: { - if(pack->size != sizeof(ServerForceGroupUpdate_Struct)) - break; - zoneserver_list.SendPacket(pack); //bounce it to all zones - break; - } - - case ServerOP_OOZGroupMessage: { - zoneserver_list.SendPacket(pack); //bounce it to all zones - break; - } - - case ServerOP_DisbandGroup: { - if(pack->size != sizeof(ServerDisbandGroup_Struct)) - break; - zoneserver_list.SendPacket(pack); //bounce it to all zones - break; - } - - case ServerOP_RaidAdd:{ - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidRemove: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidDisband: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidLockFlag: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidChangeGroup: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_UpdateGroup: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidGroupDisband: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidGroupAdd: { - if(pack->size != sizeof(ServerRaidGroupAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidGroupRemove: { - if(pack->size != sizeof(ServerRaidGroupAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidGroupSay: { - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidSay: { - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidGroupLeader: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_RaidLeader: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_DetailsChange: { - if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) - break; - - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_SpawnCondition: { - if(pack->size != sizeof(ServerSpawnCondition_Struct)) - break; - //bounce the packet to the correct zone server, if its up - ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer; - zoneserver_list.SendPacket(ssc->zoneID, ssc->instanceID, pack); - break; - } - case ServerOP_SpawnEvent: { - if(pack->size != sizeof(ServerSpawnEvent_Struct)) - break; - //bounce the packet to the correct zone server, if its up - ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer; - zoneserver_list.SendPacket(sse->zoneID, 0, pack); - break; - } - case ServerOP_ChannelMessage: { - ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer; - if(scm->chan_num == 20) - { - UCSLink.SendMessage(scm->from, scm->message); + case ServerOP_KeepAlive: { + // ignore this break; } - if (scm->chan_num == 7 || scm->chan_num == 14) { - if (scm->deliverto[0] == '*') { - Console* con = 0; - con = console_list.FindByAccountName(&scm->deliverto[1]); - if (((!con) || (!con->SendChannelMessage(scm))) && (!scm->noreply)) - zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); + case ServerOP_ZAAuth: { + break; + } + case ServerOP_LSZoneBoot:{ + if(pack->size==sizeof(ZoneBoot_Struct)){ + ZoneBoot_Struct* zbs= (ZoneBoot_Struct*)pack->pBuffer; + SetCompile(zbs->compile_time); + } + break; + } + case ServerOP_GroupInvite: { + if(pack->size != sizeof(GroupInvite_Struct)) + break; + + GroupInvite_Struct* gis = (GroupInvite_Struct*) pack->pBuffer; + + client_list.SendPacket(gis->invitee_name, pack); + break; + } + case ServerOP_GroupFollow: { + if(pack->size != sizeof(ServerGroupFollow_Struct)) + break; + + ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *) pack->pBuffer; + + client_list.SendPacket(sgfs->gf.name1, pack); + break; + } + case ServerOP_GroupFollowAck: { + if(pack->size != sizeof(ServerGroupFollowAck_Struct)) + break; + + ServerGroupFollowAck_Struct *sgfas = (ServerGroupFollowAck_Struct *) pack->pBuffer; + + client_list.SendPacket(sgfas->Name, pack); + break; + } + case ServerOP_GroupCancelInvite: { + if(pack->size != sizeof(GroupCancel_Struct)) + break; + + GroupCancel_Struct *gcs = (GroupCancel_Struct *) pack->pBuffer; + + client_list.SendPacket(gcs->name1, pack); + break; + } + case ServerOP_GroupIDReq: { + SendGroupIDs(); + break; + } + case ServerOP_GroupLeave: { + if(pack->size != sizeof(ServerGroupLeave_Struct)) + break; + zoneserver_list.SendPacket(pack); //bounce it to all zones + break; + } + + case ServerOP_GroupJoin: { + if(pack->size != sizeof(ServerGroupJoin_Struct)) + break; + zoneserver_list.SendPacket(pack); //bounce it to all zones + break; + } + + case ServerOP_ForceGroupUpdate: { + if(pack->size != sizeof(ServerForceGroupUpdate_Struct)) + break; + zoneserver_list.SendPacket(pack); //bounce it to all zones + break; + } + + case ServerOP_OOZGroupMessage: { + zoneserver_list.SendPacket(pack); //bounce it to all zones + break; + } + + case ServerOP_DisbandGroup: { + if(pack->size != sizeof(ServerDisbandGroup_Struct)) + break; + zoneserver_list.SendPacket(pack); //bounce it to all zones + break; + } + + case ServerOP_RaidAdd:{ + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidRemove: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidDisband: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidLockFlag: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidChangeGroup: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_UpdateGroup: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidGroupDisband: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidGroupAdd: { + if(pack->size != sizeof(ServerRaidGroupAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidGroupRemove: { + if(pack->size != sizeof(ServerRaidGroupAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidGroupSay: { + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidSay: { + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidGroupLeader: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_RaidLeader: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_DetailsChange: { + if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_SpawnCondition: { + if(pack->size != sizeof(ServerSpawnCondition_Struct)) + break; + //bounce the packet to the correct zone server, if its up + ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer; + zoneserver_list.SendPacket(ssc->zoneID, ssc->instanceID, pack); + break; + } + case ServerOP_SpawnEvent: { + if(pack->size != sizeof(ServerSpawnEvent_Struct)) + break; + //bounce the packet to the correct zone server, if its up + ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer; + zoneserver_list.SendPacket(sse->zoneID, 0, pack); + break; + } + case ServerOP_ChannelMessage: { + ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer; + if(scm->chan_num == 20) + { + UCSLink.SendMessage(scm->from, scm->message); break; } - ClientListEntry* cle = client_list.FindCharacter(scm->deliverto); - if (cle == 0 || cle->Online() < CLE_Status_Zoning || (cle->TellsOff() && ((cle->Anon() == 1 && scm->fromadmin < cle->Admin()) || scm->fromadmin < 80))) { - if (!scm->noreply) - zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); - } - else if (cle->Online() == CLE_Status_Zoning) { - if (!scm->noreply) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - //MYSQL_ROW row; Trumpcard - commenting. Currently unused. - time_t rawtime; - struct tm * timeinfo; - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - char *telldate=asctime(timeinfo); - if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT name from character_ where name='%s'",scm->deliverto), errbuf, &result)) { - safe_delete(query); - if (result!=0) { - if (database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO tellque (Date,Receiver,Sender,Message) values('%s','%s','%s','%s')",telldate,scm->deliverto,scm->from,scm->message), errbuf, &result)) - zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "Your message has been added to the %s's que.", scm->to); + if (scm->chan_num == 7 || scm->chan_num == 14) { + if (scm->deliverto[0] == '*') { + Console* con = 0; + con = console_list.FindByAccountName(&scm->deliverto[1]); + if (((!con) || (!con->SendChannelMessage(scm))) && (!scm->noreply)) + zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); + break; + } + ClientListEntry* cle = client_list.FindCharacter(scm->deliverto); + if (cle == 0 || cle->Online() < CLE_Status_Zoning || (cle->TellsOff() && ((cle->Anon() == 1 && scm->fromadmin < cle->Admin()) || scm->fromadmin < 80))) { + if (!scm->noreply) + zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); + } + else if (cle->Online() == CLE_Status_Zoning) { + if (!scm->noreply) { + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; + MYSQL_RES *result; + //MYSQL_ROW row; Trumpcard - commenting. Currently unused. + time_t rawtime; + struct tm * timeinfo; + time ( &rawtime ); + timeinfo = localtime ( &rawtime ); + char *telldate=asctime(timeinfo); + if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT name from character_ where name='%s'",scm->deliverto), errbuf, &result)) { + safe_delete(query); + if (result!=0) { + if (database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO tellque (Date,Receiver,Sender,Message) values('%s','%s','%s','%s')",telldate,scm->deliverto,scm->from,scm->message), errbuf, &result)) + zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "Your message has been added to the %s's que.", scm->to); + else + zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); + safe_delete(query); + } else zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); - safe_delete(query); + mysql_free_result(result); } else - zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); - mysql_free_result(result); + safe_delete(query); } - else - safe_delete(query); + // zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); } - // zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); + else if (cle->Server() == 0) { + if (!scm->noreply) + zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not contactable at this time'", scm->to, scm->to); + } + else + cle->Server()->SendPacket(pack); } - else if (cle->Server() == 0) { - if (!scm->noreply) - zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not contactable at this time'", scm->to, scm->to); + else { + if (scm->chan_num == 5 || scm->chan_num == 6 || scm->chan_num == 11) { + console_list.SendChannelMessage(scm); + } + zoneserver_list.SendPacket(pack); + } + break; + } + case ServerOP_EmoteMessage: { + ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer; + zoneserver_list.SendEmoteMessageRaw(sem->to, sem->guilddbid, sem->minstatus, sem->type, sem->message); + break; + } + case ServerOP_VoiceMacro: { + + ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer; + + if(svm->Type == VoiceMacroTell) { + + ClientListEntry* cle = client_list.FindCharacter(svm->To); + + if (!cle || (cle->Online() < CLE_Status_Zoning) || !cle->Server()) { + + zoneserver_list.SendEmoteMessage(svm->From, 0, 0, 0, "'%s is not online at this time'", svm->To); + + break; + } + + cle->Server()->SendPacket(pack); } else - cle->Server()->SendPacket(pack); - } - else { - if (scm->chan_num == 5 || scm->chan_num == 6 || scm->chan_num == 11) { - console_list.SendChannelMessage(scm); - } - zoneserver_list.SendPacket(pack); - } - break; - } - case ServerOP_EmoteMessage: { - ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer; - zoneserver_list.SendEmoteMessageRaw(sem->to, sem->guilddbid, sem->minstatus, sem->type, sem->message); - break; - } - case ServerOP_VoiceMacro: { + zoneserver_list.SendPacket(pack); - ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer; - - if(svm->Type == VoiceMacroTell) { - - ClientListEntry* cle = client_list.FindCharacter(svm->To); - - if (!cle || (cle->Online() < CLE_Status_Zoning) || !cle->Server()) { - - zoneserver_list.SendEmoteMessage(svm->From, 0, 0, 0, "'%s is not online at this time'", svm->To); - - break; - } - - cle->Server()->SendPacket(pack); - } - else - zoneserver_list.SendPacket(pack); - - break; - } - - case ServerOP_RezzPlayerAccept: { - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_RezzPlayer: { - - RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer; - if (zoneserver_list.SendPacket(pack)){ - zlog(WORLD__ZONE,"Sent Rez packet for %s",sRezz->rez.your_name); - } - else { - zlog(WORLD__ZONE,"Could not send Rez packet for %s",sRezz->rez.your_name); - } - break; - } - case ServerOP_RezzPlayerReject: - { - char *Recipient = (char *)pack->pBuffer; - client_list.SendPacket(Recipient, pack); - break; - } - - case ServerOP_MultiLineMsg: { - ServerMultiLineMsg_Struct* mlm = (ServerMultiLineMsg_Struct*) pack->pBuffer; - client_list.SendPacket(mlm->to, pack); - break; - } - case ServerOP_SetZone: { - if(pack->size != sizeof(SetZone_Struct)) break; + } - SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer; - if (szs->zoneid != 0) { - if(database.GetZoneName(szs->zoneid)) - SetZone(szs->zoneid, szs->instanceid, szs->staticzone); + case ServerOP_RezzPlayerAccept: { + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_RezzPlayer: { + + RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer; + if (zoneserver_list.SendPacket(pack)){ + zlog(WORLD__ZONE,"Sent Rez packet for %s",sRezz->rez.your_name); + } + else { + zlog(WORLD__ZONE,"Could not send Rez packet for %s",sRezz->rez.your_name); + } + break; + } + case ServerOP_RezzPlayerReject: + { + char *Recipient = (char *)pack->pBuffer; + client_list.SendPacket(Recipient, pack); + break; + } + + case ServerOP_MultiLineMsg: { + ServerMultiLineMsg_Struct* mlm = (ServerMultiLineMsg_Struct*) pack->pBuffer; + client_list.SendPacket(mlm->to, pack); + break; + } + case ServerOP_SetZone: { + if(pack->size != sizeof(SetZone_Struct)) + break; + + SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer; + if (szs->zoneid != 0) { + if(database.GetZoneName(szs->zoneid)) + SetZone(szs->zoneid, szs->instanceid, szs->staticzone); + else + SetZone(0); + } else SetZone(0); - } - else - SetZone(0); - break; - } - case ServerOP_SetConnectInfo: { - if (pack->size != sizeof(ServerConnectInfo)) - break; - ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; - - if (!sci->port) { - clientport=zoneserver_list.GetAvailableZonePort(); - - ServerPacket p(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo)); - memset(p.pBuffer,0,sizeof(ServerConnectInfo)); - ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer; - sci->port = clientport; - SendPacket(&p); - zlog(WORLD__ZONE,"Auto zone port configuration. Telling zone to use port %d",clientport); - } else { - clientport=sci->port; - zlog(WORLD__ZONE,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); - } - - } - case ServerOP_SetLaunchName: { - if(pack->size != sizeof(LaunchName_Struct)) break; - const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer; - launcher_name = ln->launcher_name; - launched_name = ln->zone_name; - zlog(WORLD__ZONE, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); - break; - } - case ServerOP_ShutdownAll: { - if(pack->size==0){ - zoneserver_list.SendPacket(pack); - zoneserver_list.Process(); - CatchSignal(2); } - else{ - WorldShutDown_Struct* wsd=(WorldShutDown_Struct*)pack->pBuffer; - if(wsd->time==0 && wsd->interval==0 && zoneserver_list.shutdowntimer->Enabled()){ - zoneserver_list.shutdowntimer->Disable(); - zoneserver_list.reminder->Disable(); + case ServerOP_SetConnectInfo: { + if (pack->size != sizeof(ServerConnectInfo)) + break; + ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; + + if (!sci->port) { + clientport=zoneserver_list.GetAvailableZonePort(); + + ServerPacket p(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo)); + memset(p.pBuffer,0,sizeof(ServerConnectInfo)); + ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer; + sci->port = clientport; + SendPacket(&p); + zlog(WORLD__ZONE,"Auto zone port configuration. Telling zone to use port %d",clientport); + } else { + clientport=sci->port; + zlog(WORLD__ZONE,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); + } + + } + case ServerOP_SetLaunchName: { + if(pack->size != sizeof(LaunchName_Struct)) + break; + const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer; + launcher_name = ln->launcher_name; + launched_name = ln->zone_name; + zlog(WORLD__ZONE, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); + break; + } + case ServerOP_ShutdownAll: { + if(pack->size==0){ + zoneserver_list.SendPacket(pack); + zoneserver_list.Process(); + CatchSignal(2); } else{ - zoneserver_list.shutdowntimer->SetTimer(wsd->time); - zoneserver_list.reminder->SetTimer(wsd->interval-1000); - zoneserver_list.reminder->SetAtTrigger(wsd->interval); - zoneserver_list.shutdowntimer->Start(); - zoneserver_list.reminder->Start(); - } - } - break; - } - case ServerOP_ZoneShutdown: { - ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; - ZoneServer* zs = 0; - if (s->ZoneServerID != 0) - zs = zoneserver_list.FindByID(s->ZoneServerID); - else if (s->zoneid != 0) - zs = zoneserver_list.FindByName(database.GetZoneName(s->zoneid)); - else - zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: neither ID nor name specified"); - - if (zs == 0) - zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: zoneserver not found"); - else - zs->SendPacket(pack); - break; - } - case ServerOP_ZoneBootup: { - ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; - zoneserver_list.SOPZoneBootup(s->adminname, s->ZoneServerID, database.GetZoneName(s->zoneid), s->makestatic); - break; - } - case ServerOP_ZoneStatus: { - if (pack->size >= 1) - zoneserver_list.SendZoneStatus((char *) &pack->pBuffer[1], (uint8) pack->pBuffer[0], this); - break; - - } - case ServerOP_AcceptWorldEntrance: { - if(pack->size != sizeof(WorldToZone_Struct)) - break; - - WorldToZone_Struct* wtz = (WorldToZone_Struct*) pack->pBuffer; - Client* client = 0; - client = client_list.FindByAccountID(wtz->account_id); - if(client != 0) - client->Clearance(wtz->response); - } - case ServerOP_ZoneToZoneRequest: { - // - // solar: ZoneChange is received by the zone the player is in, then the - // zone sends a ZTZ which ends up here. This code then find the target - // (ingress point) and boots it if needed, then sends the ZTZ to it. - // The ingress server will decide wether the player can enter, then will - // send back the ZTZ to here. This packet is passed back to the egress - // server, which will send a ZoneChange response back to the client - // which can be an error, or a success, in which case the client will - // disconnect, and their zone location will be saved when ~Client is - // called, so it will be available when they ask to zone. - // - - - if(pack->size != sizeof(ZoneToZone_Struct)) - break; - ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer; - ClientListEntry* client = nullptr; - if(WorldConfig::get()->UpdateStats) - client = client_list.FindCharacter(ztz->name); - - zlog(WORLD__ZONE,"ZoneToZone request for %s current zone %d req zone %d\n", - ztz->name, ztz->current_zone_id, ztz->requested_zone_id); - - if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) // this is a request from the egress zone - { - zlog(WORLD__ZONE,"Processing ZTZ for egress from zone for client %s\n", ztz->name); - - if - ( - ztz->admin < 80 && - ztz->ignorerestrictions < 2 && - zoneserver_list.IsZoneLocked(ztz->requested_zone_id) - ) - { - ztz->response = 0; - SendPacket(pack); - break; - } - - ZoneServer *ingress_server = nullptr; - if(ztz->requested_instance_id > 0) - { - ingress_server = zoneserver_list.FindByInstanceID(ztz->requested_instance_id); - } - else - { - ingress_server = zoneserver_list.FindByZoneID(ztz->requested_zone_id); - - } - - if(ingress_server) // found a zone already running - { - _log(WORLD__ZONE,"Found a zone already booted for %s\n", ztz->name); - ztz->response = 1; - } - else // need to boot one - { - int server_id; - if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ - _log(WORLD__ZONE,"Successfully booted a zone for %s\n", ztz->name); - // bootup successful, ready to rock - ztz->response = 1; - ingress_server = zoneserver_list.FindByID(server_id); + WorldShutDown_Struct* wsd=(WorldShutDown_Struct*)pack->pBuffer; + if(wsd->time==0 && wsd->interval==0 && zoneserver_list.shutdowntimer->Enabled()){ + zoneserver_list.shutdowntimer->Disable(); + zoneserver_list.reminder->Disable(); } - else - { - _log(WORLD__ZONE_ERR,"FAILED to boot a zone for %s\n", ztz->name); - // bootup failed, send back error code 0 - ztz->response = 0; + else{ + zoneserver_list.shutdowntimer->SetTimer(wsd->time); + zoneserver_list.reminder->SetTimer(wsd->interval-1000); + zoneserver_list.reminder->SetAtTrigger(wsd->interval); + zoneserver_list.shutdowntimer->Start(); + zoneserver_list.reminder->Start(); } } - if(ztz->response!=0 && client) - client->LSZoneChange(ztz); - SendPacket(pack); // send back to egress server - if(ingress_server) // if we couldn't boot one, this is 0 - { - ingress_server->SendPacket(pack); // inform target server - } + break; } - else // this is response from the ingress server, route it back to the egress server - { - zlog(WORLD__ZONE,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); - ZoneServer *egress_server = nullptr; - if(ztz->current_instance_id > 0) - { - egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id); - } + case ServerOP_ZoneShutdown: { + ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; + ZoneServer* zs = 0; + if (s->ZoneServerID != 0) + zs = zoneserver_list.FindByID(s->ZoneServerID); + else if (s->zoneid != 0) + zs = zoneserver_list.FindByName(database.GetZoneName(s->zoneid)); else - { - egress_server = zoneserver_list.FindByZoneID(ztz->current_zone_id); - } + zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: neither ID nor name specified"); - if(egress_server) - { - egress_server->SendPacket(pack); - } - } - - break; - } - case ServerOP_ClientList: { - if (pack->size != sizeof(ServerClientList_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); - break; - } - client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer); - break; - } - case ServerOP_ClientListKA: { - ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer; - if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); - break; - } - client_list.CLEKeepAlive(sclka->numupdates, sclka->wid); - break; - } - case ServerOP_Who: { - ServerWhoAll_Struct* whoall = (ServerWhoAll_Struct*) pack->pBuffer; - Who_All_Struct* whom = new Who_All_Struct; - memset(whom,0,sizeof(Who_All_Struct)); - whom->gmlookup = whoall->gmlookup; - whom->lvllow = whoall->lvllow; - whom->lvlhigh = whoall->lvlhigh; - whom->wclass = whoall->wclass; - whom->wrace = whoall->wrace; - strcpy(whom->whom,whoall->whom); - client_list.SendWhoAll(whoall->fromid,whoall->from, whoall->admin, whom, this); - delete whom; - break; - } - case ServerOP_RequestOnlineGuildMembers: - { - ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*) pack->pBuffer; - zlog(GUILDS__IN_PACKETS, "ServerOP_RequestOnlineGuildMembers Recieved. FromID=%i GuildID=%i", srogms->FromID, srogms->GuildID); - client_list.SendOnlineGuildMembers(srogms->FromID, srogms->GuildID); - break; - } - case ServerOP_ClientVersionSummary: - { - ServerRequestClientVersionSummary_Struct *srcvss = (ServerRequestClientVersionSummary_Struct*) pack->pBuffer; - client_list.SendClientVersionSummary(srcvss->Name); - break; - } - case ServerOP_ReloadRules: - { - zoneserver_list.SendPacket(pack); - RuleManager::Instance()->LoadRules(&database, "default"); - break; - } - case ServerOP_ReloadRulesWorld: - { - RuleManager::Instance()->LoadRules(&database, "default"); - break; - } - case ServerOP_CameraShake: - { - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_FriendsWho: { - ServerFriendsWho_Struct* FriendsWho = (ServerFriendsWho_Struct*) pack->pBuffer; - client_list.SendFriendsWho(FriendsWho, this); - break; - } - case ServerOP_LFGMatches: { - ServerLFGMatchesRequest_Struct* smrs = (ServerLFGMatchesRequest_Struct*) pack->pBuffer; - client_list.SendLFGMatches(smrs); - break; - } - case ServerOP_LFPMatches: { - ServerLFPMatchesRequest_Struct* smrs = (ServerLFPMatchesRequest_Struct*) pack->pBuffer; - LFPGroupList.SendLFPMatches(smrs); - break; - } - case ServerOP_LFPUpdate: { - ServerLFPUpdate_Struct* sus = (ServerLFPUpdate_Struct*) pack->pBuffer; - if(sus->Action) - LFPGroupList.UpdateGroup(sus); - else - LFPGroupList.RemoveGroup(sus); - break; - } - case ServerOP_ZonePlayer: { - //ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer; - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_KickPlayer: { - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_KillPlayer: { - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_GuildRankUpdate: - { - zoneserver_list.SendPacket(pack); - break; - } - //these opcodes get processed by the guild manager. - case ServerOP_RefreshGuild: - case ServerOP_DeleteGuild: - case ServerOP_GuildCharRefresh: - case ServerOP_GuildMemberUpdate: { - guild_mgr.ProcessZonePacket(pack); - break; - } - - case ServerOP_FlagUpdate: { - ClientListEntry* cle = client_list.FindCLEByAccountID(*((uint32*) pack->pBuffer)); - if (cle) - cle->SetAdmin(*((int16*) &pack->pBuffer[4])); - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_GMGoto: { - if (pack->size != sizeof(ServerGMGoto_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); - break; - } - ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer; - ClientListEntry* cle = client_list.FindCharacter(gmg->gotoname); - if (cle != 0) { - if (cle->Server() == 0) - this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: Cannot identify %s's zoneserver.", gmg->gotoname); - else if (cle->Anon() == 1 && cle->Admin() > gmg->admin) // no snooping for anon GMs - this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: %s not found", gmg->gotoname); + if (zs == 0) + zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: zoneserver not found"); else - cle->Server()->SendPacket(pack); - } - else { - this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: %s not found", gmg->gotoname); - } - break; - } - case ServerOP_Lock: { - if (pack->size != sizeof(ServerLock_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); - break; - } - ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer; - if (slock->mode >= 1) - WorldConfig::LockWorld(); - else - WorldConfig::UnlockWorld(); - if (loginserverlist.Connected()) { - loginserverlist.SendStatus(); - if (slock->mode >= 1) - this->SendEmoteMessage(slock->myname, 0, 0, 13, "World locked"); - else - this->SendEmoteMessage(slock->myname, 0, 0, 13, "World unlocked"); - } - else { - if (slock->mode >= 1) - this->SendEmoteMessage(slock->myname, 0, 0, 13, "World locked, but login server not connected."); - else - this->SendEmoteMessage(slock->myname, 0, 0, 13, "World unlocked, but login server not conencted."); - } - break; - } - case ServerOP_Motd: { - if (pack->size != sizeof(ServerMotd_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); - break; - } - ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer; - database.SetVariable("MOTD",smotd->motd); - //this->SendEmoteMessage(smotd->myname, 0, 0, 13, "Updated Motd."); - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_Uptime: { - if (pack->size != sizeof(ServerUptime_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); - break; - } - ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; - if (sus->zoneserverid == 0) { - ZSList::ShowUpTime(this, sus->adminname); - } - else { - ZoneServer* zs = zoneserver_list.FindByID(sus->zoneserverid); - if (zs) zs->SendPacket(pack); + break; } - break; - } - case ServerOP_Petition: { - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_GetWorldTime: { - zlog(WORLD__ZONE,"Broadcasting a world time update"); - ServerPacket* pack = new ServerPacket; + case ServerOP_ZoneBootup: { + ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; + zoneserver_list.SOPZoneBootup(s->adminname, s->ZoneServerID, database.GetZoneName(s->zoneid), s->makestatic); + break; + } + case ServerOP_ZoneStatus: { + if (pack->size >= 1) + zoneserver_list.SendZoneStatus((char *) &pack->pBuffer[1], (uint8) pack->pBuffer[0], this); + break; - pack->opcode = ServerOP_SyncWorldTime; - pack->size = sizeof(eqTimeOfDay); - pack->pBuffer = new uchar[pack->size]; - memset(pack->pBuffer, 0, pack->size); - eqTimeOfDay* tod = (eqTimeOfDay*) pack->pBuffer; - tod->start_eqtime=zoneserver_list.worldclock.getStartEQTime(); - tod->start_realtime=zoneserver_list.worldclock.getStartRealTime(); - SendPacket(pack); - delete pack; - break; - } - case ServerOP_SetWorldTime: { - zlog(WORLD__ZONE,"Received SetWorldTime"); - eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; - zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); - zlog(WORLD__ZONE,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); - zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str()); - zoneserver_list.SendTimeSync(); - break; - } - case ServerOP_IPLookup: { - if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); - break; } - ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer; - if (pack->size == sizeof(ServerGenericWorldQuery_Struct)) - client_list.SendCLEList(sgwq->admin, sgwq->from, this); - else - client_list.SendCLEList(sgwq->admin, sgwq->from, this, sgwq->query); - break; - } - case ServerOP_LockZone: { - if (pack->size < sizeof(ServerLockZone_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); - break; - } - ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; - switch (s->op) { - case 0: - zoneserver_list.ListLockedZones(s->adminname, this); + case ServerOP_AcceptWorldEntrance: { + if(pack->size != sizeof(WorldToZone_Struct)) break; - case 1: - if (zoneserver_list.SetLockedZone(s->zoneID, true)) - zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", database.GetZoneName(s->zoneID)); - else - this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock"); + + WorldToZone_Struct* wtz = (WorldToZone_Struct*) pack->pBuffer; + Client* client = 0; + client = client_list.FindByAccountID(wtz->account_id); + if(client != 0) + client->Clearance(wtz->response); + } + case ServerOP_ZoneToZoneRequest: { + // + // solar: ZoneChange is received by the zone the player is in, then the + // zone sends a ZTZ which ends up here. This code then find the target + // (ingress point) and boots it if needed, then sends the ZTZ to it. + // The ingress server will decide wether the player can enter, then will + // send back the ZTZ to here. This packet is passed back to the egress + // server, which will send a ZoneChange response back to the client + // which can be an error, or a success, in which case the client will + // disconnect, and their zone location will be saved when ~Client is + // called, so it will be available when they ask to zone. + // + + + if(pack->size != sizeof(ZoneToZone_Struct)) break; - case 2: - if (zoneserver_list.SetLockedZone(s->zoneID, false)) - zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", database.GetZoneName(s->zoneID)); - else - this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock"); - break; - } - break; - } - case ServerOP_ItemStatus: { - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_OOCMute: { - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_Revoke: { - RevokeStruct* rev = (RevokeStruct*)pack->pBuffer; - ClientListEntry* cle = client_list.FindCharacter(rev->name); - if (cle != 0 && cle->Server() != 0) - { - cle->Server()->SendPacket(pack); - } - break; - } - case ServerOP_SpawnPlayerCorpse: { - SpawnPlayerCorpse_Struct* s = (SpawnPlayerCorpse_Struct*)pack->pBuffer; - ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); - if(zs) { - if (zs->SendPacket(pack)) { - zlog(WORLD__ZONE,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); - } - else { - zlog(WORLD__ZONE_ERR,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); - } - } - break; - } - case ServerOP_Consent: { - // Message string id's likely to be used here are: - // CONSENT_YOURSELF = 399 - // CONSENT_INVALID_NAME = 397 - // TARGET_NOT_FOUND = 101 - ZoneServer* zs; - ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer; - ClientListEntry* cle = client_list.FindCharacter(s->grantname); - if(cle) { - if(cle->instance() != 0) + ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer; + ClientListEntry* client = nullptr; + if(WorldConfig::get()->UpdateStats) + client = client_list.FindCharacter(ztz->name); + + zlog(WORLD__ZONE,"ZoneToZone request for %s current zone %d req zone %d\n", + ztz->name, ztz->current_zone_id, ztz->requested_zone_id); + + if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) // this is a request from the egress zone { - zs = zoneserver_list.FindByInstanceID(cle->instance()); - if(zs) { - if(zs->SendPacket(pack)) { - zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); - } - else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); - } + zlog(WORLD__ZONE,"Processing ZTZ for egress from zone for client %s\n", ztz->name); + + if + ( + ztz->admin < 80 && + ztz->ignorerestrictions < 2 && + zoneserver_list.IsZoneLocked(ztz->requested_zone_id) + ) + { + ztz->response = 0; + SendPacket(pack); + break; + } + + ZoneServer *ingress_server = nullptr; + if(ztz->requested_instance_id > 0) + { + ingress_server = zoneserver_list.FindByInstanceID(ztz->requested_instance_id); } else { - delete pack; - pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); - ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; - strcpy(scs->grantname, s->grantname); - strcpy(scs->ownername, s->ownername); - scs->permission = s->permission; - scs->zone_id = s->zone_id; - scs->instance_id = s->instance_id; - scs->message_string_id = 101; - zs = zoneserver_list.FindByInstanceID(s->instance_id); - if(zs) { - if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + ingress_server = zoneserver_list.FindByZoneID(ztz->requested_zone_id); + + } + + if(ingress_server) // found a zone already running + { + _log(WORLD__ZONE,"Found a zone already booted for %s\n", ztz->name); + ztz->response = 1; + } + else // need to boot one + { + int server_id; + if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ + _log(WORLD__ZONE,"Successfully booted a zone for %s\n", ztz->name); + // bootup successful, ready to rock + ztz->response = 1; + ingress_server = zoneserver_list.FindByID(server_id); } - else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + else + { + _log(WORLD__ZONE_ERR,"FAILED to boot a zone for %s\n", ztz->name); + // bootup failed, send back error code 0 + ztz->response = 0; } } + if(ztz->response!=0 && client) + client->LSZoneChange(ztz); + SendPacket(pack); // send back to egress server + if(ingress_server) // if we couldn't boot one, this is 0 + { + ingress_server->SendPacket(pack); // inform target server + } } - else + else // this is response from the ingress server, route it back to the egress server { - zs = zoneserver_list.FindByZoneID(cle->zone()); - if(zs) { - if(zs->SendPacket(pack)) { - zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); - } - else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); - } + zlog(WORLD__ZONE,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); + ZoneServer *egress_server = nullptr; + if(ztz->current_instance_id > 0) + { + egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id); } - else { - // send target not found back to requester - delete pack; - pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); - ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; - strcpy(scs->grantname, s->grantname); - strcpy(scs->ownername, s->ownername); - scs->permission = s->permission; - scs->zone_id = s->zone_id; - scs->message_string_id = 101; - zs = zoneserver_list.FindByZoneID(s->zone_id); - if(zs) { - if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); - } - else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); - } + else + { + egress_server = zoneserver_list.FindByZoneID(ztz->current_zone_id); + } + + if(egress_server) + { + egress_server->SendPacket(pack); } } + + break; } - else { - // send target not found back to requester + case ServerOP_ClientList: { + if (pack->size != sizeof(ServerClientList_Struct)) { + zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); + break; + } + client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer); + break; + } + case ServerOP_ClientListKA: { + ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer; + if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) { + zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); + break; + } + client_list.CLEKeepAlive(sclka->numupdates, sclka->wid); + break; + } + case ServerOP_Who: { + ServerWhoAll_Struct* whoall = (ServerWhoAll_Struct*) pack->pBuffer; + Who_All_Struct* whom = new Who_All_Struct; + memset(whom,0,sizeof(Who_All_Struct)); + whom->gmlookup = whoall->gmlookup; + whom->lvllow = whoall->lvllow; + whom->lvlhigh = whoall->lvlhigh; + whom->wclass = whoall->wclass; + whom->wrace = whoall->wrace; + strcpy(whom->whom,whoall->whom); + client_list.SendWhoAll(whoall->fromid,whoall->from, whoall->admin, whom, this); + delete whom; + break; + } + case ServerOP_RequestOnlineGuildMembers: + { + ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*) pack->pBuffer; + zlog(GUILDS__IN_PACKETS, "ServerOP_RequestOnlineGuildMembers Recieved. FromID=%i GuildID=%i", srogms->FromID, srogms->GuildID); + client_list.SendOnlineGuildMembers(srogms->FromID, srogms->GuildID); + break; + } + case ServerOP_ClientVersionSummary: + { + ServerRequestClientVersionSummary_Struct *srcvss = (ServerRequestClientVersionSummary_Struct*) pack->pBuffer; + client_list.SendClientVersionSummary(srcvss->Name); + break; + } + case ServerOP_ReloadRules: + { + zoneserver_list.SendPacket(pack); + RuleManager::Instance()->LoadRules(&database, "default"); + break; + } + case ServerOP_ReloadRulesWorld: + { + RuleManager::Instance()->LoadRules(&database, "default"); + break; + } + case ServerOP_CameraShake: + { + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_FriendsWho: { + ServerFriendsWho_Struct* FriendsWho = (ServerFriendsWho_Struct*) pack->pBuffer; + client_list.SendFriendsWho(FriendsWho, this); + break; + } + case ServerOP_LFGMatches: { + ServerLFGMatchesRequest_Struct* smrs = (ServerLFGMatchesRequest_Struct*) pack->pBuffer; + client_list.SendLFGMatches(smrs); + break; + } + case ServerOP_LFPMatches: { + ServerLFPMatchesRequest_Struct* smrs = (ServerLFPMatchesRequest_Struct*) pack->pBuffer; + LFPGroupList.SendLFPMatches(smrs); + break; + } + case ServerOP_LFPUpdate: { + ServerLFPUpdate_Struct* sus = (ServerLFPUpdate_Struct*) pack->pBuffer; + if(sus->Action) + LFPGroupList.UpdateGroup(sus); + else + LFPGroupList.RemoveGroup(sus); + break; + } + case ServerOP_ZonePlayer: { + //ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer; + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_KickPlayer: { + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_KillPlayer: { + zoneserver_list.SendPacket(pack); + break; + } + + case ServerOP_GuildRankUpdate: + { + zoneserver_list.SendPacket(pack); + break; + } + //these opcodes get processed by the guild manager. + case ServerOP_RefreshGuild: + case ServerOP_DeleteGuild: + case ServerOP_GuildCharRefresh: + case ServerOP_GuildMemberUpdate: { + guild_mgr.ProcessZonePacket(pack); + break; + } + + case ServerOP_FlagUpdate: { + ClientListEntry* cle = client_list.FindCLEByAccountID(*((uint32*) pack->pBuffer)); + if (cle) + cle->SetAdmin(*((int16*) &pack->pBuffer[4])); + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_GMGoto: { + if (pack->size != sizeof(ServerGMGoto_Struct)) { + zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); + break; + } + ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer; + ClientListEntry* cle = client_list.FindCharacter(gmg->gotoname); + if (cle != 0) { + if (cle->Server() == 0) + this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: Cannot identify %s's zoneserver.", gmg->gotoname); + else if (cle->Anon() == 1 && cle->Admin() > gmg->admin) // no snooping for anon GMs + this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: %s not found", gmg->gotoname); + else + cle->Server()->SendPacket(pack); + } + else { + this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: %s not found", gmg->gotoname); + } + break; + } + case ServerOP_Lock: { + if (pack->size != sizeof(ServerLock_Struct)) { + zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); + break; + } + ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer; + if (slock->mode >= 1) + WorldConfig::LockWorld(); + else + WorldConfig::UnlockWorld(); + if (loginserverlist.Connected()) { + loginserverlist.SendStatus(); + if (slock->mode >= 1) + this->SendEmoteMessage(slock->myname, 0, 0, 13, "World locked"); + else + this->SendEmoteMessage(slock->myname, 0, 0, 13, "World unlocked"); + } + else { + if (slock->mode >= 1) + this->SendEmoteMessage(slock->myname, 0, 0, 13, "World locked, but login server not connected."); + else + this->SendEmoteMessage(slock->myname, 0, 0, 13, "World unlocked, but login server not conencted."); + } + break; + } + case ServerOP_Motd: { + if (pack->size != sizeof(ServerMotd_Struct)) { + zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); + break; + } + ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer; + database.SetVariable("MOTD",smotd->motd); + //this->SendEmoteMessage(smotd->myname, 0, 0, 13, "Updated Motd."); + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_Uptime: { + if (pack->size != sizeof(ServerUptime_Struct)) { + zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); + break; + } + ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; + if (sus->zoneserverid == 0) { + ZSList::ShowUpTime(this, sus->adminname); + } + else { + ZoneServer* zs = zoneserver_list.FindByID(sus->zoneserverid); + if (zs) + zs->SendPacket(pack); + } + break; + } + case ServerOP_Petition: { + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_GetWorldTime: { + zlog(WORLD__ZONE,"Broadcasting a world time update"); + ServerPacket* pack = new ServerPacket; + + pack->opcode = ServerOP_SyncWorldTime; + pack->size = sizeof(eqTimeOfDay); + pack->pBuffer = new uchar[pack->size]; + memset(pack->pBuffer, 0, pack->size); + eqTimeOfDay* tod = (eqTimeOfDay*) pack->pBuffer; + tod->start_eqtime=zoneserver_list.worldclock.getStartEQTime(); + tod->start_realtime=zoneserver_list.worldclock.getStartRealTime(); + SendPacket(pack); delete pack; - pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); - ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; - strcpy(scs->grantname, s->grantname); - strcpy(scs->ownername, s->ownername); - scs->permission = s->permission; - scs->zone_id = s->zone_id; - scs->message_string_id = 397; - zs = zoneserver_list.FindByZoneID(s->zone_id); - if(zs) { - if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); - } - else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); - } + break; } - break; - } - case ServerOP_Consent_Response: { - // Message string id's likely to be used here are: - // CONSENT_YOURSELF = 399 - // CONSENT_INVALID_NAME = 397 - // TARGET_NOT_FOUND = 101 - ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer; - if(s->instance_id != 0) - { - ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id); - if(zs) { - if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); - } - else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); - } + case ServerOP_SetWorldTime: { + zlog(WORLD__ZONE,"Received SetWorldTime"); + eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; + zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); + zlog(WORLD__ZONE,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); + zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str()); + zoneserver_list.SendTimeSync(); + break; } - else - { + case ServerOP_IPLookup: { + if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) { + zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); + break; + } + ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer; + if (pack->size == sizeof(ServerGenericWorldQuery_Struct)) + client_list.SendCLEList(sgwq->admin, sgwq->from, this); + else + client_list.SendCLEList(sgwq->admin, sgwq->from, this, sgwq->query); + break; + } + case ServerOP_LockZone: { + if (pack->size < sizeof(ServerLockZone_Struct)) { + zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); + break; + } + ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; + switch (s->op) { + case 0: + zoneserver_list.ListLockedZones(s->adminname, this); + break; + case 1: + if (zoneserver_list.SetLockedZone(s->zoneID, true)) + zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", database.GetZoneName(s->zoneID)); + else + this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock"); + break; + case 2: + if (zoneserver_list.SetLockedZone(s->zoneID, false)) + zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", database.GetZoneName(s->zoneID)); + else + this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock"); + break; + } + break; + } + case ServerOP_ItemStatus: { + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_OOCMute: { + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_Revoke: { + RevokeStruct* rev = (RevokeStruct*)pack->pBuffer; + ClientListEntry* cle = client_list.FindCharacter(rev->name); + if (cle != 0 && cle->Server() != 0) + { + cle->Server()->SendPacket(pack); + } + break; + } + case ServerOP_SpawnPlayerCorpse: { + SpawnPlayerCorpse_Struct* s = (SpawnPlayerCorpse_Struct*)pack->pBuffer; ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { - if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + if (zs->SendPacket(pack)) { + zlog(WORLD__ZONE,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + } + else { + zlog(WORLD__ZONE_ERR,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + } + } + break; + } + case ServerOP_Consent: { + // Message string id's likely to be used here are: + // CONSENT_YOURSELF = 399 + // CONSENT_INVALID_NAME = 397 + // TARGET_NOT_FOUND = 101 + ZoneServer* zs; + ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer; + ClientListEntry* cle = client_list.FindCharacter(s->grantname); + if(cle) { + if(cle->instance() != 0) + { + zs = zoneserver_list.FindByInstanceID(cle->instance()); + if(zs) { + if(zs->SendPacket(pack)) { + zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); + } + else { + zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); + } + } + else + { + delete pack; + pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); + ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; + strcpy(scs->grantname, s->grantname); + strcpy(scs->ownername, s->ownername); + scs->permission = s->permission; + scs->zone_id = s->zone_id; + scs->instance_id = s->instance_id; + scs->message_string_id = 101; + zs = zoneserver_list.FindByInstanceID(s->instance_id); + if(zs) { + if(!zs->SendPacket(pack)) + zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + } + else { + zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + } + } + } + else + { + zs = zoneserver_list.FindByZoneID(cle->zone()); + if(zs) { + if(zs->SendPacket(pack)) { + zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); + } + else { + zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); + } + } + else { + // send target not found back to requester + delete pack; + pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); + ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; + strcpy(scs->grantname, s->grantname); + strcpy(scs->ownername, s->ownername); + scs->permission = s->permission; + scs->zone_id = s->zone_id; + scs->message_string_id = 101; + zs = zoneserver_list.FindByZoneID(s->zone_id); + if(zs) { + if(!zs->SendPacket(pack)) + zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + } + else { + zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + } + } + } } else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + // send target not found back to requester + delete pack; + pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); + ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; + strcpy(scs->grantname, s->grantname); + strcpy(scs->ownername, s->ownername); + scs->permission = s->permission; + scs->zone_id = s->zone_id; + scs->message_string_id = 397; + zs = zoneserver_list.FindByZoneID(s->zone_id); + if(zs) { + if(!zs->SendPacket(pack)) + zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + } + else { + zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + } } + break; } - break; - } - - case ServerOP_InstanceUpdateTime : - { - ServerInstanceUpdateTime_Struct *iut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer; - ZoneServer *zm = zoneserver_list.FindByInstanceID(iut->instance_id); - if(zm) - { - zm->SendPacket(pack); - } - break; - } - case ServerOP_QGlobalUpdate: - { - if(pack->size != sizeof(ServerQGlobalUpdate_Struct)) - { + case ServerOP_Consent_Response: { + // Message string id's likely to be used here are: + // CONSENT_YOURSELF = 399 + // CONSENT_INVALID_NAME = 397 + // TARGET_NOT_FOUND = 101 + ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer; + if(s->instance_id != 0) + { + ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id); + if(zs) { + if(!zs->SendPacket(pack)) + zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + } + else { + zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + } + } + else + { + ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); + if(zs) { + if(!zs->SendPacket(pack)) + zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + } + else { + zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + } + } break; } - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_QGlobalDelete: - { - if(pack->size != sizeof(ServerQGlobalDelete_Struct)) + case ServerOP_InstanceUpdateTime : { + ServerInstanceUpdateTime_Struct *iut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer; + ZoneServer *zm = zoneserver_list.FindByInstanceID(iut->instance_id); + if(zm) + { + zm->SendPacket(pack); + } + break; + } + case ServerOP_QGlobalUpdate: + { + if(pack->size != sizeof(ServerQGlobalUpdate_Struct)) + { + break; + } + + zoneserver_list.SendPacket(pack); break; } - zoneserver_list.SendPacket(pack); - break; - } - - case ServerOP_AdventureRequest: - { - adventure_manager.CalculateAdventureRequestReply((const char*)pack->pBuffer); - break; - } - - case ServerOP_AdventureRequestCreate: - { - adventure_manager.TryAdventureCreate((const char*)pack->pBuffer); - break; - } - - case ServerOP_AdventureDataRequest: - { - AdventureFinishEvent fe; - while(adventure_manager.PopFinishedEvent((const char*)pack->pBuffer, fe)) + case ServerOP_QGlobalDelete: { - adventure_manager.SendAdventureFinish(fe); + if(pack->size != sizeof(ServerQGlobalDelete_Struct)) + { + break; + } + + zoneserver_list.SendPacket(pack); + break; } - adventure_manager.GetAdventureData((const char*)pack->pBuffer); - break; - } - case ServerOP_AdventureClickDoor: - { - ServerPlayerClickedAdventureDoor_Struct *pcad = (ServerPlayerClickedAdventureDoor_Struct*)pack->pBuffer; - adventure_manager.PlayerClickedDoor(pcad->player, pcad->zone_id, pcad->id); - break; - } + case ServerOP_AdventureRequest: + { + adventure_manager.CalculateAdventureRequestReply((const char*)pack->pBuffer); + break; + } - case ServerOP_AdventureLeave: - { - adventure_manager.LeaveAdventure((const char*)pack->pBuffer); - break; - } + case ServerOP_AdventureRequestCreate: + { + adventure_manager.TryAdventureCreate((const char*)pack->pBuffer); + break; + } - case ServerOP_AdventureCountUpdate: - { - ServerAdventureCount_Struct *sc = (ServerAdventureCount_Struct*)pack->pBuffer; - adventure_manager.IncrementCount(sc->instance_id); - break; - } + case ServerOP_AdventureDataRequest: + { + AdventureFinishEvent fe; + while(adventure_manager.PopFinishedEvent((const char*)pack->pBuffer, fe)) + { + adventure_manager.SendAdventureFinish(fe); + } + adventure_manager.GetAdventureData((const char*)pack->pBuffer); + break; + } - case ServerOP_AdventureAssaCountUpdate: - { - adventure_manager.IncrementAssassinationCount(*((uint16*)pack->pBuffer)); - break; - } + case ServerOP_AdventureClickDoor: + { + ServerPlayerClickedAdventureDoor_Struct *pcad = (ServerPlayerClickedAdventureDoor_Struct*)pack->pBuffer; + adventure_manager.PlayerClickedDoor(pcad->player, pcad->zone_id, pcad->id); + break; + } - case ServerOP_AdventureZoneData: - { - adventure_manager.GetZoneData(*((uint16*)pack->pBuffer)); - break; - } + case ServerOP_AdventureLeave: + { + adventure_manager.LeaveAdventure((const char*)pack->pBuffer); + break; + } - case ServerOP_AdventureLeaderboard: - { - ServerLeaderboardRequest_Struct *lr = (ServerLeaderboardRequest_Struct*)pack->pBuffer; - adventure_manager.DoLeaderboardRequest(lr->player, lr->type); - break; - } + case ServerOP_AdventureCountUpdate: + { + ServerAdventureCount_Struct *sc = (ServerAdventureCount_Struct*)pack->pBuffer; + adventure_manager.IncrementCount(sc->instance_id); + break; + } - case ServerOP_LSAccountUpdate: - { - zlog(WORLD__ZONE, "Received ServerOP_LSAccountUpdate packet from zone"); - loginserverlist.SendAccountUpdate(pack); - break; - } + case ServerOP_AdventureAssaCountUpdate: + { + adventure_manager.IncrementAssassinationCount(*((uint16*)pack->pBuffer)); + break; + } - case ServerOP_UCSMailMessage: - { - UCSLink.SendPacket(pack); - break; - } + case ServerOP_AdventureZoneData: + { + adventure_manager.GetZoneData(*((uint16*)pack->pBuffer)); + break; + } - case ServerOP_QueryServGeneric: - case ServerOP_Speech: - case ServerOP_QSPlayerLogTrades: - { - QSLink.SendPacket(pack); - break; - } - case ServerOP_QSPlayerLogHandins: - { - QSLink.SendPacket(pack); - break; - } - case ServerOP_QSPlayerLogNPCKills: - { - QSLink.SendPacket(pack); - break; - } - case ServerOP_QSPlayerLogDeletes: - { - QSLink.SendPacket(pack); - break; - } - case ServerOP_QSPlayerLogMoves: - { - QSLink.SendPacket(pack); - break; - } - case ServerOP_QSMerchantLogTransactions: - { - QSLink.SendPacket(pack); - break; - } - case ServerOP_CZSignalClientByName: - case ServerOP_CZMessagePlayer: - case ServerOP_CZSignalClient: - { - zoneserver_list.SendPacket(pack); - break; - } - case ServerOP_DepopAllPlayersCorpses: - case ServerOP_DepopPlayerCorpse: - case ServerOP_ReloadTitles: - case ServerOP_SpawnStatusChange: - case ServerOP_ReloadTasks: - case ServerOP_ReloadWorld: - case ServerOP_UpdateSpawn: - { - zoneserver_list.SendPacket(pack); - break; - } - default: - { - zlog(WORLD__ZONE_ERR,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); - DumpPacket(pack->pBuffer, pack->size); - break; - } + case ServerOP_AdventureLeaderboard: + { + ServerLeaderboardRequest_Struct *lr = (ServerLeaderboardRequest_Struct*)pack->pBuffer; + adventure_manager.DoLeaderboardRequest(lr->player, lr->type); + break; + } + + case ServerOP_LSAccountUpdate: + { + zlog(WORLD__ZONE, "Received ServerOP_LSAccountUpdate packet from zone"); + loginserverlist.SendAccountUpdate(pack); + break; + } + + case ServerOP_UCSMailMessage: + { + UCSLink.SendPacket(pack); + break; + } + + case ServerOP_QueryServGeneric: + case ServerOP_Speech: + case ServerOP_QSPlayerLogTrades: + { + QSLink.SendPacket(pack); + break; + } + case ServerOP_QSPlayerLogHandins: + { + QSLink.SendPacket(pack); + break; + } + case ServerOP_QSPlayerLogNPCKills: + { + QSLink.SendPacket(pack); + break; + } + case ServerOP_QSPlayerLogDeletes: + { + QSLink.SendPacket(pack); + break; + } + case ServerOP_QSPlayerLogMoves: + { + QSLink.SendPacket(pack); + break; + } + case ServerOP_QSMerchantLogTransactions: + { + QSLink.SendPacket(pack); + break; + } + case ServerOP_CZSignalClientByName: + case ServerOP_CZMessagePlayer: + case ServerOP_CZSignalClient: + { + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_DepopAllPlayersCorpses: + case ServerOP_DepopPlayerCorpse: + case ServerOP_ReloadTitles: + case ServerOP_SpawnStatusChange: + case ServerOP_ReloadTasks: + case ServerOP_ReloadWorld: + case ServerOP_UpdateSpawn: + { + zoneserver_list.SendPacket(pack); + break; + } + default: + { + zlog(WORLD__ZONE_ERR,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); + DumpPacket(pack->pBuffer, pack->size); + break; + } } delete pack; @@ -1429,4 +1429,3 @@ void ZoneServer::IncommingClient(Client* client) { delete pack; } - diff --git a/world/zoneserver.h b/world/zoneserver.h index 8828dadec..955c0b376 100644 --- a/world/zoneserver.h +++ b/world/zoneserver.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 ZONESERVER_H #define ZONESERVER_H @@ -30,14 +30,14 @@ class ServerPacket; class ZoneServer : public WorldTCPConnection { public: ZoneServer(EmuTCPConnection* itcpc); - ~ZoneServer(); + ~ZoneServer(); virtual inline bool IsZoneServer() { return true; } bool Process(); bool SendPacket(ServerPacket* pack) { return tcpc->SendPacket(pack); } void SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...); void SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message); - bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false); + bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false); void TriggerBootup(uint32 iZoneID = 0, uint32 iInstanceID = 0, const char* iAdminName = 0, bool iMakeStatic = false); void Disconnect() { tcpc->Disconnect(); } void IncommingClient(Client* client); @@ -62,7 +62,7 @@ public: inline bool IsStaticZone() const{ return staticzone; } inline uint32 NumPlayers() const { return pNumPlayers; } inline void AddPlayer() { pNumPlayers++; } - inline void RemovePlayer() { pNumPlayers--; } + inline void RemovePlayer() { pNumPlayers--; } inline const char * GetLaunchName() const { return(launcher_name.c_str()); } inline const char * GetLaunchedName() const { return(launched_name.c_str()); } @@ -89,5 +89,5 @@ private: std::string launched_name; //the name of the zone we launched. }; - #endif + diff --git a/zone/AA.cpp b/zone/AA.cpp index a9e9c146d..b8ec4ab5e 100644 --- a/zone/AA.cpp +++ b/zone/AA.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 */ // Test 1 @@ -195,21 +195,21 @@ void Client::ActivateAA(aaID activate){ uint32 aaremain_min = (aaremain / 60) % 60; uint32 aaremain_sec = aaremain % 60; - if(aa2) { - if (aaremain_hr >= 1) //1 hour or more - Message(13, "You can use the ability %s again in %u hour(s) %u minute(s) %u seconds", - aa2->name, aaremain_hr, aaremain_min, aaremain_sec); - else //less than an hour - Message(13, "You can use the ability %s again in %u minute(s) %u seconds", - aa2->name, aaremain_min, aaremain_sec); - } else { - if (aaremain_hr >= 1) //1 hour or more - Message(13, "You can use this ability again in %u hour(s) %u minute(s) %u seconds", - aaremain_hr, aaremain_min, aaremain_sec); - else //less than an hour - Message(13, "You can use this ability again in %u minute(s) %u seconds", - aaremain_min, aaremain_sec); - } + if(aa2) { + if (aaremain_hr >= 1) //1 hour or more + Message(13, "You can use the ability %s again in %u hour(s) %u minute(s) %u seconds", + aa2->name, aaremain_hr, aaremain_min, aaremain_sec); + else //less than an hour + Message(13, "You can use the ability %s again in %u minute(s) %u seconds", + aa2->name, aaremain_min, aaremain_sec); + } else { + if (aaremain_hr >= 1) //1 hour or more + Message(13, "You can use this ability again in %u hour(s) %u minute(s) %u seconds", + aaremain_hr, aaremain_min, aaremain_sec); + else //less than an hour + Message(13, "You can use this ability again in %u minute(s) %u seconds", + aaremain_min, aaremain_sec); + } return; } @@ -281,30 +281,30 @@ void Client::ActivateAA(aaID activate){ if(caa->reuse_time > 0) { uint32 timer_base = CalcAAReuseTimer(caa); - SendAATimer(AATimerID, 0, 0); - p_timers.Start(AATimerID + pTimerAAStart, timer_base); + SendAATimer(AATimerID, 0, 0); + p_timers.Start(AATimerID + pTimerAAStart, timer_base); if(activate == aaImprovedHarmTouch || activate == aaLeechTouch) { p_timers.Start(pTimerHarmTouch, HarmTouchReuseTime); } - // Bards can cast instant cast AAs while they are casting another song - if (spells[caa->spell_id].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) { - if(!SpellFinished(caa->spell_id, entity_list.GetMob(target_id), 10, -1, -1, spells[caa->spell_id].ResistDiff, false)) { - //Reset on failed cast - SendAATimer(AATimerID, 0, 0xFFFFFF); - Message_StringID(15,ABILITY_FAILED); - p_timers.Clear(&database, AATimerID + pTimerAAStart); - return; - } - } else { - if(!CastSpell(caa->spell_id, target_id, 10, -1, -1, 0, -1, AATimerID + pTimerAAStart, timer_base, 1)) { - //Reset on failed cast - SendAATimer(AATimerID, 0, 0xFFFFFF); - Message_StringID(15,ABILITY_FAILED); - p_timers.Clear(&database, AATimerID + pTimerAAStart); - return; - } - } + // Bards can cast instant cast AAs while they are casting another song + if (spells[caa->spell_id].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) { + if(!SpellFinished(caa->spell_id, entity_list.GetMob(target_id), 10, -1, -1, spells[caa->spell_id].ResistDiff, false)) { + //Reset on failed cast + SendAATimer(AATimerID, 0, 0xFFFFFF); + Message_StringID(15,ABILITY_FAILED); + p_timers.Clear(&database, AATimerID + pTimerAAStart); + return; + } + } else { + if(!CastSpell(caa->spell_id, target_id, 10, -1, -1, 0, -1, AATimerID + pTimerAAStart, timer_base, 1)) { + //Reset on failed cast + SendAATimer(AATimerID, 0, 0xFFFFFF); + Message_StringID(15,ABILITY_FAILED); + p_timers.Clear(&database, AATimerID + pTimerAAStart); + return; + } + } } else { @@ -405,7 +405,7 @@ void Client::HandleAAAction(aaID activate) { switch (GetClass()) { case DRUID: - spell_id = 2760; //2644? + spell_id = 2760; //2644? break; case NECROMANCER: spell_id = 2759; //2643? @@ -496,7 +496,7 @@ void Client::HandleAAAction(aaID activate) { break; case aaActionFadingMemories: - // Do nothing since spell effect works correctly, but mana isn't used. + // Do nothing since spell effect works correctly, but mana isn't used. break; default: @@ -602,10 +602,10 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u if(summon_count > MAX_SWARM_PETS) summon_count = MAX_SWARM_PETS; - static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, + static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, 10, -10, 10, -10, 8, -8, 8, -8 }; - static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, + static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, 10, 10, -10, -10, 8, 8, -8, -8 }; TempPets(true); @@ -695,10 +695,10 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid if(summon_count > MAX_SWARM_PETS) summon_count = MAX_SWARM_PETS; - static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, + static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, 10, -10, 10, -10, 8, -8, 8, -8 }; - static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, + static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, 10, 10, -10, -10, 8, 8, -8, -8 }; TempPets(true); @@ -1113,19 +1113,19 @@ void Client::SendAATimers() { } void Client::SendAATable() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RespondAA, sizeof(AATable_Struct)); + EQApplicationPacket* outapp = new EQApplicationPacket(OP_RespondAA, sizeof(AATable_Struct)); - AATable_Struct* aa2 = (AATable_Struct *)outapp->pBuffer; + AATable_Struct* aa2 = (AATable_Struct *)outapp->pBuffer; aa2->aa_spent = GetAAPointsSpent(); - uint32 i; + uint32 i; for(i=0;i < MAX_PP_AA_ARRAY;i++){ aa2->aa_list[i].aa_skill = aa[i]->AA; aa2->aa_list[i].aa_value = aa[i]->value; aa2->aa_list[i].unknown08 = 0; } - QueuePacket(outapp); - safe_delete(outapp); + QueuePacket(outapp); + safe_delete(outapp); } void Client::SendPreviousAA(uint32 id, int seq){ @@ -1251,7 +1251,7 @@ void Client::SendAA(uint32 id, int seq) { Utilizes two new fields: sof_next_id (which is the next id in the series), sof_current_level (ranks the AA's as the current level) 1) If no AA's purchased only display the base levels of each AA series. 2) When you purchase an AA and its rank is maxed it sends the packet for the completed AA, and the packet - for the next aa in the series. The previous tier is removed from your window, and the new AA is displayed. + for the next aa in the series. The previous tier is removed from your window, and the new AA is displayed. 3) When you zone/buy your player profile will be checked and determine what AA can be displayed base on what you have already. */ @@ -1279,9 +1279,9 @@ void Client::SendAA(uint32 id, int seq) { if (saa_pp->id == saa2->id) break; //You already have this in the player profile. - else if ((saa_pp->sof_current_level < saa2->sof_current_level) && (aa_value < saa_pp->max_level)) + else if ((saa_pp->sof_current_level < saa2->sof_current_level) && (aa_value < saa_pp->max_level)) return; //DISABLE DISPLAY HIGHER - You have not reached max level yet of your current AA. - else if ((saa_pp->sof_current_level < saa2->sof_current_level) && (aa_value == saa_pp->max_level) && (saa_pp->sof_next_id == saa2->id)) + else if ((saa_pp->sof_current_level < saa2->sof_current_level) && (aa_value == saa_pp->max_level) && (saa_pp->sof_next_id == saa2->id)) IsBaseLevel = false; //ALLOW DISPLAY HIGHER } } @@ -1321,9 +1321,9 @@ void Client::SendAA(uint32 id, int seq) { SendAA_Struct* saa_next = nullptr; saa_next = zone->FindAA(saa->sof_next_id); if (saa_next && - (((GetClientVersionBit() == 4) && (saa_next->clientver > 4)) - || ((GetClientVersionBit() == 8) && (saa_next->clientver > 5)) - || ((GetClientVersionBit() == 16) && (saa_next->clientver > 6)))){ + (((GetClientVersionBit() == 4) && (saa_next->clientver > 4)) + || ((GetClientVersionBit() == 8) && (saa_next->clientver > 5)) + || ((GetClientVersionBit() == 16) && (saa_next->clientver > 6)))){ saa->next_id=0xFFFFFFFF; } } @@ -1359,7 +1359,7 @@ void Client::SendAA(uint32 id, int seq) { if(value > 0) { - // AA_Action stores the base ID + // AA_Action stores the base ID const AA_DBAction *caa = &AA_Actions[saa->id - value + 1][value - 1]; if(caa && caa->reuse_time > 0) @@ -1385,7 +1385,7 @@ void Client::SendAA(uint32 id, int seq) { QueuePacket(outapp); safe_delete(outapp); - //will outapp delete the buffer for us even though it didnt make it? --- Yes, it should + //will outapp delete the buffer for us even though it didnt make it? --- Yes, it should } void Client::SendAAList(){ @@ -1504,7 +1504,7 @@ void Client::ResetAA(){ for(itr=aa_points.begin();itr!=aa_points.end();itr++) aa_points[itr->first] = 0; - for(int i = 0; i < _maxLeaderAA; ++i) + for(int i = 0; i < _maxLeaderAA; ++i) m_pp.leader_abilities.ranks[i] = 0; m_pp.group_leadership_points = 0; @@ -1634,13 +1634,13 @@ void Client::InspectBuffs(Client* Inspector, int Rank) //this really need to be renamed to LoadAAActions() bool ZoneDatabase::LoadAAEffects() { char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; memset(AA_Actions, 0, sizeof(AA_Actions)); //I hope the compiler is smart about this size... const char *query = "SELECT aaid,rank,reuse_time,spell_id,target,nonspell_action,nonspell_mana,nonspell_duration," - " redux_aa,redux_rate,redux_aa2,redux_rate2 FROM aa_actions"; + "redux_aa,redux_rate,redux_aa2,redux_rate2 FROM aa_actions"; if(RunQuery(query, static_cast(strlen(query)), errbuf, &result)) { //safe_delete_array(query); @@ -1684,9 +1684,9 @@ bool ZoneDatabase::LoadAAEffects() { //AndMetal: this may now be obsolete since we have Zone::GetTotalAALevels() uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; int total=0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(slot) from aa_effects where aaid=%i", skill_id), errbuf, &result)) { safe_delete_array(query); @@ -1704,8 +1704,8 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { //this will allow us to count the number of effects for an AA by pulling the info from memory instead of the database. hopefully this will same some CPU cycles uint8 Zone::GetTotalAALevels(uint32 skill_id) { - size_t sz = aa_effects[skill_id].size(); - return sz >= 255 ? 255 : static_cast(sz); + size_t sz = aa_effects[skill_id].size(); + return sz >= 255 ? 255 : static_cast(sz); } /* @@ -1728,9 +1728,9 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){ return; 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 effectid, base1, base2, slot from aa_effects where aaid=%i order by slot asc", aa_struct->id), errbuf, &result)) { int ndx=0; while((row = mysql_fetch_row(result))!=nullptr) { @@ -1749,9 +1749,9 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){ uint32 ZoneDatabase::CountAAs(){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; int count=0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(title_sid) from altadv_vars"), errbuf, &result)) { if((row = mysql_fetch_row(result))!=nullptr) @@ -1766,9 +1766,9 @@ uint32 ZoneDatabase::CountAAs(){ uint32 ZoneDatabase::CountAAEffects(){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; int count=0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(id) from aa_effects"), errbuf, &result)) { if((row = mysql_fetch_row(result))!=nullptr){ @@ -1864,7 +1864,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "WHERE " "p.skill_id = a.prereq_skill" "), " - "0) AS prereq_skill_index, " + "0) AS prereq_skill_index, " "a.prereq_minpoints, " "a.spell_type, " "a.spell_refresh, " @@ -1963,19 +1963,19 @@ void Client::DurationRampage(uint32 duration) AA_SwarmPetInfo::AA_SwarmPetInfo() { - target = 0; - owner_id = 0; - duration = nullptr; + target = 0; + owner_id = 0; + duration = nullptr; } AA_SwarmPetInfo::~AA_SwarmPetInfo() { - target = 0; - owner_id = 0; - safe_delete(duration); + target = 0; + owner_id = 0; + safe_delete(duration); } Mob *AA_SwarmPetInfo::GetOwner() { - return entity_list.GetMobID(owner_id); + return entity_list.GetMobID(owner_id); } diff --git a/zone/AA.h b/zone/AA.h index b813171de..334dd5176 100644 --- a/zone/AA.h +++ b/zone/AA.h @@ -24,10 +24,10 @@ typedef enum { //AA Targeting Constants typedef enum { - aaActionNone = 0, - aaActionAETaunt = 1, - aaActionMassBuff = 2, - aaActionFlamingArrows = 3, + aaActionNone = 0, + aaActionAETaunt = 1, + aaActionMassBuff = 2, + aaActionFlamingArrows = 3, aaActionFrostArrows = 4, aaActionRampage = 5, aaActionSharedHealth = 6, @@ -699,1411 +699,1411 @@ typedef enum { //AA IDs typedef enum { //AA IDs - aaNone =0, - aaInnateStrength =2,//implemented as bonus - aaInnateStamina =7,//implemented as bonus - aaInnateAgility =12,//implemented as bonus - /*aaCompleteHeal =13,*///not implemented, but is in dbstr_us.txt - aaInnateDexterity =17,//implemented as bonus - aaInnateIntelligence =22,//implemented as bonus - aaInnateWisdom =27,//implemented as bonus - aaInnateCharisma =32,//implemented as bonus - aaInnateFireProtection =37,//implemented as bonus - aaInnateColdProtection =42,//implemented as bonus - aaInnateMagicProtection =47,//implemented as bonus - aaInnatePoisonProtection =52,//implemented as bonus - aaInnateDiseaseProtection =57,//implemented as bonus - aaInnateRunSpeed =62,//implemented as bonus - aaInnateRegeneration =65,//implemented as bonus - aaInnateMetabolism =68, - aaInnateLungCapacity =71,//handled by client - aaFirstAid =74,//implemented as bonus - aaHealingAdept =77,//implemented as bonus-focus - aaHealingGift =80,//implemented as bonus - aaSpellCastingMastery =83,//untested - aaSpellCastingReinforcement =86,//untested - aaMentalClarity =89,//implemented as bonus - aaSpellCastingFury =92,//implemented as bonus - aaChanellingFocus =95,//implemented as bonus *Live AA effect removed in 2006 - aaSpellCastingSubtlety =98,//untested - aaSpellCastingExpertise =101,//untested - aaSpellCastingDeftness =104,//implemented as bonus-focus - aaNaturalDurability =107,//implemented as bonus - aaNaturalHealing =110,//implemented as bonus - aaCombatFury =113,//implemented as bonus - aaFearResistance =116,//untested - aaFinishingBlow =119,//untested - aaCombatStability =122,//implemented as bonus - aaCombatAgility =125,//implemented as bonus - aaMassGroupBuff =128,//untested - aaDivineResurrection =129,//DB - aaInnateInvisToUndead =130,//DB - aaCelestialRegeneration =131,//untested - aaBestowDivineAura =132,//DB - aaTurnUndead =133,//DB - aaPurifySoul =136,//DB - aaQuickEvacuation =137,//implemented as bonus-focus - aaExodus =140,//untested - aaQuickDamage =141,//implemented as bonus-focus - aaEnhancedRoot =144,//implemented as bonus - aaDireCharm =145,//untested - aaCannibalization =146,//DB - aaQuickBuff =147,//implemented as bonus-focus - aaAlchemyMastery =150, - aaRabidBear =153,//DB - aaManaBurn =154,//DB - aaImprovedFamiliar =155,//untested, implemented? - aaNexusGate =156,//DB - aaUnknown54 =157, - aaPermanentIllusion =158, - aaJewelCraftMastery =159, - aaGatherMana =162,//DB - aaMendCompanion =163,//DB - aaQuickSummoning =164,//implemented as bonus-focus - aaFrenziedBurnout =167,//DB - aaElementalFormFire =168,//DB - aaElementalFormWater =171,//DB - aaElementalFormEarth =174,//DB - aaElementalFormAir =177,//DB - aaImprovedReclaimEnergy =180,//untested - aaTurnSummoned =181,//DB - aaElementalPact =182,//DB - aaLifeBurn =183,//DB - aaDeadMesmerization =184,//DB - aaFearstorm =185,//DB - aaFleshToBone =186,//DB - aaCallToCorpse =187,//DB - aaDivineStun =188,//DB - aaImprovedLayOnHands =189, - aaSlayUndead =190,//implemented as bonus - aaActOfValor =193,//DB - aaHolySteed =194,//DB - aaFearless =195, - aa2HandBash =196,//works. handled by client? - aaInnateCamouflage =197,//DB - aaAmbidexterity =198,//implemented as bonus - aaArcheryMastery =199,//implemented as bonus - aaFletchingMastery =202,//removed from db? - aaEndlessQuiver =205,//implemented as bonus - aaUnholySteed =206,//DB - aaImprovedHarmTouch =207,//untested - aaLeechTouch =208,//DB - aaDeathPeace =209, - aaSoulAbrasion =210,//implemented as bonus-focus - aaInstrumentMastery =213,//untested - aaUnknown91 =216,//not used - aaUnknown92 =219,//not used - aaUnknown93 =222,//not used - aaJamFest =225,//implemented as bonus - aaUnknown95 =228, - aaSonicCall =229, - aaCriticalMend =230,//untested - aaPurifyBody =233,//DB - aaChainCombo =234, - aaRapidFeign =237,//works - aaReturnKick =240,//implemented as bonus - aaEscape =243,//DB - aaPoisonMastery =244, - aaDoubleRiposte =247,//implemented as bonus - aaQuickHide =250, - aaQuickThrow =253,//corrected from dbstr_us.txt - aaPurgePoison =254,//DB - aaFlurry =255,//implemented as bonus - aaRampage =258,//untested - aaAreaTaunt =259,//untested - aaWarcry =260,//DB - aaBandageWound =263,//implemented as bonus - aaSpellCastingReinforcementMastery =266,//untested - aaSpellCastingFuryMastery =267,//untested - aaExtendedNotes =270,//implemented as bonus - aaDragonPunch =273,//implemented as bonus - aaStrongRoot =274,//DB - aaSingingMastery =275,//untested - aaBodyAndMindRejuvenation =278,//added - aaPhysicalEnhancement =279,//implemented as bonus - aaAdvTrapNegotiation =280,//untested - aaAcrobatics =283,//untested - aaScribbleNotes =286, - aaChaoticStab =287,//implemented as bonus - aaPetDiscipline =288,//added - aaHobbleofSpirits =289,//DB - aaFrenzyofSpirit =290,//DB - aaParagonofSpirit =291,//DB - aaAdvancedInnateStrength =292,//implemented as bonus - aaAdvancedInnateStamina =302,//implemented as bonus - aaAdvancedInnateAgility =312,//implemented as bonus - aaAdvancedInnateDexterity =322,//implemented as bonus - aaAdvancedInnateIntelligence =332,//implemented as bonus - aaAdvancedInnateWisdom =342,//implemented as bonus - aaAdvancedInnateCharisma =352,//implemented as bonus - aaWardingofSolusek =362,//implemented as bonus - aaBlessingofEci =372,//implemented as bonus - aaMarrsProtection =382,//implemented as bonus - aaShroudofTheFaceless =392,//implemented as bonus - aaBertoxxulousGift =402,//implemented as bonus - aaNewTanaanCraftingMastery =412, - aaPlanarPower =418,//untested - aaPlanarDurability =423,//added - aaInnateEnlightenment =426,//added - aaAdvancedSpellCastingMastery =431,//untested - aaAdvancedHealingAdept =434,//untested - aaAdvancedHealingGift =437,//untested - aaCoupdeGrace =440,//added - aaFuryoftheAges =443,//implemented as bonus - aaMasteryofthePast =446,//implemented as bonus - aaLightningReflexes =449,//implemented as bonus - aaInnateDefense =454,//implemented as bonus - aaRadiantCure =459,//DB - aaHastenedDivinity =462,//DB - aaHastenedTurning =465,//DB - aaHastenedPurificationofSoul =468,//DB - aaHastenedGathering =471,//DB - aaHastenedRabidity =474,//DB - aaHastenedExodus =477,//DB - aaHastenedRoot =480,//DB - aaHastenedMending =483,//DB - aaHastenedBanishment =486,//DB - aaHastenedInstigation =489,//DB, maybe - aaFuriousRampage =492,//DB - aaHastenedPurificationoftheBody =495,//DB - aaHastyExit =498,//DB - aaHastenedPurification =501,//DB - aaFlashofSteel =504,//implemented as bonus - aaDivineArbitration =507,//DB - aaWrathoftheWild =510,//DB - aaVirulentParalysis =513,//DB - aaHarvestofDruzzil =516,//DB - aaEldritchRune =517,//DB - aaServantofRo =520,//DB - aaWaketheDead =523,//DB - aaSuspendedMinion =526,//untested - aaSpiritCall =528,//DB - aaCelestialRenewal =531,//DB - aaAllegiantFamiliar =533, - aaHandofPiety =534,//DB - aaMithanielsBinding =537,//implemented as bonus - aaMendingoftheTranquil =539, - aaRagingFlurry =542,//implemented as bonus - aaGuardianoftheForest =545,//DB - aaSpiritoftheWood =548,//DB - aaBestialFrenzy =551,//implemented as bonus - aaHarmoniousAttack =556,//implemented as bonus - aaKnightsAdvantage =561,//implemented as bonus - aaFerocity =564,//implemented as bonus - aaViscidRoots =567, - aaSionachiesCrescendo =568,//implemented as bonus - aaAyonaesTutelage =571, - aaFeignedMinion =574, - aaUnfailingDivinity =577, - aaAnimationEmpathy =580,// Implemented - aaRushtoJudgement =583, - aaLivingShield =586, - aaConsumptionoftheSoul =589,//untested - aaBoastfulBellow =592,//DB - aaFervrentBlessing =593,//untested - aaTouchoftheWicked =596,//untested - aaPunishingBlade =599,//implemented as bonus - aaSpeedoftheKnight =602,//implemented as bonus - aaShroudofStealth =605, - aaNimbleEvasion =606, - aaTechniqueofMasterWu =611, - aaHostoftheElements =616,//DB - aaCallofXuzl =619,//DB - aaHastenedStealth =622, - aaIngenuity =625, - aaFleetofFoot =628,//implemented as bonus - aaFadingMemories =630, - aaTacticalMastery =631,//implemented as bonus - aaTheftofLife =634,//implemented as bonus-focus - aaFuryofMagic =637, - aaFuryofMagicMastery2 =640,//whats the difference? - aaProjectIllusion =643, - aaHeadshot =644,//added - aaEntrap =645,//DB - aaUnholyTouch =646,//untested - aaTotalDomination =649,// Implemented - aaStalwartEndurance =652,//implemented as bonus - aaQuickSummoning2 =655,//*not implemented - Liva AA that replaces prior version in later exp. - aaMentalClarity2 =658,//whats the difference? - aaInnateRegeneration2 =661,//whats the difference? - aaManaBurn2 =664,//whats the difference? - aaExtendedNotes2 =665,//*not implemented - Live AA that replaces prior version in later exp. - aaSionachiesCrescendo2 =668,//*not implemented - Live AA that replaces prior version in later exp. - aaImprovedReclaimEnergy2 =671,//whats the difference? untetsed - aaSwiftJourney =672,//implemented as bonus - aaConvalescence =674,//added 9/26/08 - aaLastingBreath =676,//handled by client - aaPackrat =678,//added 9/29/08 - aaHeightenedEndurance =683, - aaWeaponAffinity =686,//implemented as bonus - aaSecondaryForte =691, - aaPersistantCasting =692, - aaTuneofPursuance =695, - aaImprovedInstrumentMastery =700, - aaImprovedSingingMastery =701, - aaExultantBellowing =702, - aaEchoofTaelosia =707, - aaInternalMetronome =710,//implemented as bonus *Live AA removed in 2006 - aaPiousSupplication =715, - aaBeastialAlignment =718,//untested - aaWrathofXuzl =721, - aaFeralSwipe =723,//DB? - aaWardersFury =724,//implemented as bonus - aaWardersAlacrity =729,//implemented as bonus - aaPetAffinity =734,//implemented as bonus - aaMasteryofthePast2 =735,//implemented as bonus [Different classes] - aaSpellCastingSubtlety2 =738,//whats the difference? - aaTouchoftheDivine =741, - aaDivineAvatar =746,//DB - aaExquisiteBenediction =749,//DB - aaQuickenedCuring =754, - aaNaturesBoon =757,//DB - aaAdvancedTracking =762, - aaCriticalAffliction =767, - aaFuryofMagicMastery =770,//whats the difference? - aaDoppelganger =773, - aaEnchancedForgetfulness =776, - aaMesmerizationMastery =781, - aaQuickMassGroupBuff =782, - aaSharedHealth =785, - aaElementalFury =790,//implemented as bonus - aaElementalAlacrity =795,//implemented as bonus - aaElementalAgility =800,//implemented as bonus - aaElementalDurability =803,//implemented as bonus - aaSinisterStrikes =806,//implemented as bonus - aaStrikethrough =807,//implemented as bonus - aaStonewall =810, - aaRapidStrikes =815,//implemented as bonus - aaKickMastery =820,//implemented as bonus - aaHightenedAwareness =823, - aaDestructiveForce =828,//DB - aaSwarmofDecay =831,//DB - aaDeathsFury =834, - aaQuickeningofDeath =839,//implemented as bonus - aaAdvancedTheftofLife =844,//implemented as bonus-focus - aaTripleBackstab =846,//implemented as bonus - aaHastenedPiety =849, - aaImmobilizingBash =852, - aaViciousSmash =855,//implemented as bonus - aaRadiantCure2 =860,//whats the difference? - aaPurification =863, - aaPrecisionofthePathfinder =864,//implemented as bonus - aaCoatofThistles =867, - aaFlamingArrows =872,//untested - aaFrostArrows =875,//untested - aaSeizedOpportunity =878, - aaTrapCircumvention =881, - aaImprovedHastyExit =886, - aaVirulentVenom =888, - aaImprovedConsumptionofSoul =893, - aaIntenseHatred =895, - aaAdvancedSpiritCall =900, - aaCalloftheAncients =902,//DB - aaSturdiness =907, - aaWarlordsTenacity =912,//implemented as effect - aaStrengthenedStrike =915,//implemented as bonus - aaExtendedShielding =918, - aaRosFlamingFamiliar =921,//DB - aaEcisIcyFamiliar =922,//DB - aaDruzzilsMysticalFamiliar =923,//DB - aaAdvancedFuryofMagicMastery =924,//added 9/29/08 - aaWardofDestruction =926,//DB - aaFrenziedDevastation =931,//DB - aaCombatFury2 =934,//implemented as bonus - aaCombatFury3 =937,//implemented as bonus - aaCombatFury4 =940,//implemented as bonus - aaFuryoftheAges2 =943,//implemented as bonus - aaFuryoftheAges3 =946,//implemented as bonus - aaFuryoftheAges4 =949,//implemented as bonus - aaPlanarDurability2 =952,//whats the difference? - aaInnateEnlightenment2 =955,//whats the difference? - aaDireCharm2 =960,//whats the difference? - aaDireCharm3 =961,//whats the difference? - aaTouchoftheDivine2 =962,//whats the difference? - aaTouchofDecay =967, - aaCalloftheAncients2 =970,//whats the difference? - aaImprovedVision =975, - aaEternalBreath =978,//handled by client - aaBlacksmithingMastery =979,//added 9/29/08 - aaBakingMastery =982,//added 9/29/08 - aaBrewingMastery =985,//added 9/29/08 - aaFletchingMastery2 =988,//added 9/29/08 - aaPotteryMastery =991,//added 9/29/08 - aaTailoringMastery =994,//added 9/29/08 - aaSalvage =997, - aaOrigin =1000,//spell - aaChaoticPotential =1001,//added - aaDiscordantDefiance =1006,//implemented as bonus - aaTrialsofMataMuram =1011, - aaMysticalAttuning =1021, - aaDelayDeath =1026,//implemented as bonus - aaHealthyAura =1031, - aaFitness =1036,//implemented as bonus - aaVeteransWrath =1041,//implemented as bonus [Different classes/values on each Veteran's Wrath] - aaVeteransWrath2 =1044,//implemented as bonus - aaVeteransWrath3 =1047,//implemented as bonus - aaVeteransWrath4 =1050,//implemented as bonus - aaDeathblow =1053,//implemented as bonus - aaReflexiveMastery =1061,//implemented as bonus - aaDefensiveInstincts =1066,//implemented as bonus - aaMnemonicRetention =1071,//Implemented - aaExpansiveMind =1072,//added 9/29/08 - aaSleightofHand =1077, - aaSleightofHand2 =1080,//whats the difference? - aaHealingAdeptMastery =1083, - aaHealingGiftMastery =1086, - aaArcaneTongues =1089, - aaMasterofDisguise =1092, - aaSlipperyAttacks =1093, - aaImprovedCriticalAffliction =1099, - aaFortifiedBellowing =1102, - aaFuryofMagic2 =1107,//whats the difference? - aaDanceofBlades =1110, - aaShieldofNotes =1116, - aaRoarofThunder =1119, - aaPersistentMinion =1122, - aaPerfectionofSpirit =1123, - aaReplentishCompanion =1126, - aaAdvancedPetDiscipline =1129, - aaThrowingMastery =1131,//implemented as bonus - aaBlurofAxes =1134,//implemented as bonus - aaHastenedWarCry =1137, - aaDeadAim =1140,//implemented as bonus - aaFrenziedDefense =1143,//*not implemented - duplicate - aaTirelessSprint =1146, - aaDesperation =1149, - aaUntamedRage =1150, - aaEchoingCries =1155, - aaViciousFrenzy =1158, - aaCrazedOnslaught =1163, - aaFrenziedDefense2 =1166,//implemented as bonus - aaOverwhelmingAttack =1172, - aaFuriousRage =1175, - aaBloodPact =1178, - aaShieldingResistance =1181,////implemented as bonus - aaHealingBoon =1186, - aaResplendentCure =1189, - aaCelestialHammer =1192, - aaDivineRetribution =1195, - aaCelestialRejuvination =1203, - aaFerventBenediction =1206, - aaSanctuary =1209, - aaDestructiveFury =1210,//implemented as bonus - added 9/29/08 - aaDestructiveFury2 =1213,//*not implemented [classes changed] - replaces id 1210 - aaBoonoftheForest =1222, - aaSpiritoftheGrove =1225, - aaCalloftheWild =1228, - aaSecondaryRecall =1229, - aaNaturesBounty =1230, - aaStasis =1233, - aaColorShock =1239, - aaMindOverMatter =1242, - aaSoothingWords =1245, - aaElementalSwarm =1248, - aaHeartofFlames =1251, - aaHeartofVapor =1252, - aaHeartofIce =1253, - aaHeartofStone =1254, - aaImitateDeath =1255, - aaCripplingStrike =1256, - aaStunningKick =1259, - aaEyeGouge =1262, - aaIronKicks =1265, - aaStyleoftheMimic =1268, - aaDeathPeace2 =1272,//whats the difference? - aaArmyoftheDead =1274, - aaCelestialStun =1277, - aaHandofDevotion =1278, - aaSteadfastWill =1284, - aaShieldBlock =1287,//implemented as bonus - aaScoutsEfficiency =1290,//implemented as bonus - aaGuardianoftheGlade =1293, - aaTrackingMastery =1296, - aaFlurryofKnives =1301,//implemented as bonus - aaPrecision =1304, - aaNervesofSteel =1307, - aaTouchoftheCursed =1313, - aaSpiritualCorrosion =1316, - aaSoulThief =1319,//implemented as bonus-focus - aaSpiritualChanneling =1323,//implemented as effect - aaBoonoftheAncients =1324, - aaAncestralAid =1327,//implemented as effect - aaResoluteDefiance =1330,//implemented as effect - aaPresstheAttack =1333, - aaMindCrash =1334, - aaProlongedDestruction =1337, - aaRosGreaterFamiliar =1340, - aaEcisGreaterFamiliar =1341, - aaDruzzilsGreaterFamiliar =1342, - aaTeleportBind =1343, - aaDevotedFamiliar =1344, - aaAuspiceoftheHunter =1345, - aaSavageSpirit =1348, - aaPresstheAttack2 =1351,//whats the difference? - aaCripplingStrike2 =1352,//whats the difference? - aaStunningKick2 =1353,//whats the difference? - aaEyeGouge2 =1358,//whats the difference? + aaNone =0, + aaInnateStrength =2,//implemented as bonus + aaInnateStamina =7,//implemented as bonus + aaInnateAgility =12,//implemented as bonus + /*aaCompleteHeal =13,*///not implemented, but is in dbstr_us.txt + aaInnateDexterity =17,//implemented as bonus + aaInnateIntelligence =22,//implemented as bonus + aaInnateWisdom =27,//implemented as bonus + aaInnateCharisma =32,//implemented as bonus + aaInnateFireProtection =37,//implemented as bonus + aaInnateColdProtection =42,//implemented as bonus + aaInnateMagicProtection =47,//implemented as bonus + aaInnatePoisonProtection =52,//implemented as bonus + aaInnateDiseaseProtection =57,//implemented as bonus + aaInnateRunSpeed =62,//implemented as bonus + aaInnateRegeneration =65,//implemented as bonus + aaInnateMetabolism =68, + aaInnateLungCapacity =71,//handled by client + aaFirstAid =74,//implemented as bonus + aaHealingAdept =77,//implemented as bonus-focus + aaHealingGift =80,//implemented as bonus + aaSpellCastingMastery =83,//untested + aaSpellCastingReinforcement =86,//untested + aaMentalClarity =89,//implemented as bonus + aaSpellCastingFury =92,//implemented as bonus + aaChanellingFocus =95,//implemented as bonus *Live AA effect removed in 2006 + aaSpellCastingSubtlety =98,//untested + aaSpellCastingExpertise =101,//untested + aaSpellCastingDeftness =104,//implemented as bonus-focus + aaNaturalDurability =107,//implemented as bonus + aaNaturalHealing =110,//implemented as bonus + aaCombatFury =113,//implemented as bonus + aaFearResistance =116,//untested + aaFinishingBlow =119,//untested + aaCombatStability =122,//implemented as bonus + aaCombatAgility =125,//implemented as bonus + aaMassGroupBuff =128,//untested + aaDivineResurrection =129,//DB + aaInnateInvisToUndead =130,//DB + aaCelestialRegeneration =131,//untested + aaBestowDivineAura =132,//DB + aaTurnUndead =133,//DB + aaPurifySoul =136,//DB + aaQuickEvacuation =137,//implemented as bonus-focus + aaExodus =140,//untested + aaQuickDamage =141,//implemented as bonus-focus + aaEnhancedRoot =144,//implemented as bonus + aaDireCharm =145,//untested + aaCannibalization =146,//DB + aaQuickBuff =147,//implemented as bonus-focus + aaAlchemyMastery =150, + aaRabidBear =153,//DB + aaManaBurn =154,//DB + aaImprovedFamiliar =155,//untested, implemented? + aaNexusGate =156,//DB + aaUnknown54 =157, + aaPermanentIllusion =158, + aaJewelCraftMastery =159, + aaGatherMana =162,//DB + aaMendCompanion =163,//DB + aaQuickSummoning =164,//implemented as bonus-focus + aaFrenziedBurnout =167,//DB + aaElementalFormFire =168,//DB + aaElementalFormWater =171,//DB + aaElementalFormEarth =174,//DB + aaElementalFormAir =177,//DB + aaImprovedReclaimEnergy =180,//untested + aaTurnSummoned =181,//DB + aaElementalPact =182,//DB + aaLifeBurn =183,//DB + aaDeadMesmerization =184,//DB + aaFearstorm =185,//DB + aaFleshToBone =186,//DB + aaCallToCorpse =187,//DB + aaDivineStun =188,//DB + aaImprovedLayOnHands =189, + aaSlayUndead =190,//implemented as bonus + aaActOfValor =193,//DB + aaHolySteed =194,//DB + aaFearless =195, + aa2HandBash =196,//works. handled by client? + aaInnateCamouflage =197,//DB + aaAmbidexterity =198,//implemented as bonus + aaArcheryMastery =199,//implemented as bonus + aaFletchingMastery =202,//removed from db? + aaEndlessQuiver =205,//implemented as bonus + aaUnholySteed =206,//DB + aaImprovedHarmTouch =207,//untested + aaLeechTouch =208,//DB + aaDeathPeace =209, + aaSoulAbrasion =210,//implemented as bonus-focus + aaInstrumentMastery =213,//untested + aaUnknown91 =216,//not used + aaUnknown92 =219,//not used + aaUnknown93 =222,//not used + aaJamFest =225,//implemented as bonus + aaUnknown95 =228, + aaSonicCall =229, + aaCriticalMend =230,//untested + aaPurifyBody =233,//DB + aaChainCombo =234, + aaRapidFeign =237,//works + aaReturnKick =240,//implemented as bonus + aaEscape =243,//DB + aaPoisonMastery =244, + aaDoubleRiposte =247,//implemented as bonus + aaQuickHide =250, + aaQuickThrow =253,//corrected from dbstr_us.txt + aaPurgePoison =254,//DB + aaFlurry =255,//implemented as bonus + aaRampage =258,//untested + aaAreaTaunt =259,//untested + aaWarcry =260,//DB + aaBandageWound =263,//implemented as bonus + aaSpellCastingReinforcementMastery =266,//untested + aaSpellCastingFuryMastery =267,//untested + aaExtendedNotes =270,//implemented as bonus + aaDragonPunch =273,//implemented as bonus + aaStrongRoot =274,//DB + aaSingingMastery =275,//untested + aaBodyAndMindRejuvenation =278,//added + aaPhysicalEnhancement =279,//implemented as bonus + aaAdvTrapNegotiation =280,//untested + aaAcrobatics =283,//untested + aaScribbleNotes =286, + aaChaoticStab =287,//implemented as bonus + aaPetDiscipline =288,//added + aaHobbleofSpirits =289,//DB + aaFrenzyofSpirit =290,//DB + aaParagonofSpirit =291,//DB + aaAdvancedInnateStrength =292,//implemented as bonus + aaAdvancedInnateStamina =302,//implemented as bonus + aaAdvancedInnateAgility =312,//implemented as bonus + aaAdvancedInnateDexterity =322,//implemented as bonus + aaAdvancedInnateIntelligence =332,//implemented as bonus + aaAdvancedInnateWisdom =342,//implemented as bonus + aaAdvancedInnateCharisma =352,//implemented as bonus + aaWardingofSolusek =362,//implemented as bonus + aaBlessingofEci =372,//implemented as bonus + aaMarrsProtection =382,//implemented as bonus + aaShroudofTheFaceless =392,//implemented as bonus + aaBertoxxulousGift =402,//implemented as bonus + aaNewTanaanCraftingMastery =412, + aaPlanarPower =418,//untested + aaPlanarDurability =423,//added + aaInnateEnlightenment =426,//added + aaAdvancedSpellCastingMastery =431,//untested + aaAdvancedHealingAdept =434,//untested + aaAdvancedHealingGift =437,//untested + aaCoupdeGrace =440,//added + aaFuryoftheAges =443,//implemented as bonus + aaMasteryofthePast =446,//implemented as bonus + aaLightningReflexes =449,//implemented as bonus + aaInnateDefense =454,//implemented as bonus + aaRadiantCure =459,//DB + aaHastenedDivinity =462,//DB + aaHastenedTurning =465,//DB + aaHastenedPurificationofSoul =468,//DB + aaHastenedGathering =471,//DB + aaHastenedRabidity =474,//DB + aaHastenedExodus =477,//DB + aaHastenedRoot =480,//DB + aaHastenedMending =483,//DB + aaHastenedBanishment =486,//DB + aaHastenedInstigation =489,//DB, maybe + aaFuriousRampage =492,//DB + aaHastenedPurificationoftheBody =495,//DB + aaHastyExit =498,//DB + aaHastenedPurification =501,//DB + aaFlashofSteel =504,//implemented as bonus + aaDivineArbitration =507,//DB + aaWrathoftheWild =510,//DB + aaVirulentParalysis =513,//DB + aaHarvestofDruzzil =516,//DB + aaEldritchRune =517,//DB + aaServantofRo =520,//DB + aaWaketheDead =523,//DB + aaSuspendedMinion =526,//untested + aaSpiritCall =528,//DB + aaCelestialRenewal =531,//DB + aaAllegiantFamiliar =533, + aaHandofPiety =534,//DB + aaMithanielsBinding =537,//implemented as bonus + aaMendingoftheTranquil =539, + aaRagingFlurry =542,//implemented as bonus + aaGuardianoftheForest =545,//DB + aaSpiritoftheWood =548,//DB + aaBestialFrenzy =551,//implemented as bonus + aaHarmoniousAttack =556,//implemented as bonus + aaKnightsAdvantage =561,//implemented as bonus + aaFerocity =564,//implemented as bonus + aaViscidRoots =567, + aaSionachiesCrescendo =568,//implemented as bonus + aaAyonaesTutelage =571, + aaFeignedMinion =574, + aaUnfailingDivinity =577, + aaAnimationEmpathy =580,// Implemented + aaRushtoJudgement =583, + aaLivingShield =586, + aaConsumptionoftheSoul =589,//untested + aaBoastfulBellow =592,//DB + aaFervrentBlessing =593,//untested + aaTouchoftheWicked =596,//untested + aaPunishingBlade =599,//implemented as bonus + aaSpeedoftheKnight =602,//implemented as bonus + aaShroudofStealth =605, + aaNimbleEvasion =606, + aaTechniqueofMasterWu =611, + aaHostoftheElements =616,//DB + aaCallofXuzl =619,//DB + aaHastenedStealth =622, + aaIngenuity =625, + aaFleetofFoot =628,//implemented as bonus + aaFadingMemories =630, + aaTacticalMastery =631,//implemented as bonus + aaTheftofLife =634,//implemented as bonus-focus + aaFuryofMagic =637, + aaFuryofMagicMastery2 =640,//whats the difference? + aaProjectIllusion =643, + aaHeadshot =644,//added + aaEntrap =645,//DB + aaUnholyTouch =646,//untested + aaTotalDomination =649,// Implemented + aaStalwartEndurance =652,//implemented as bonus + aaQuickSummoning2 =655,//*not implemented - Liva AA that replaces prior version in later exp. + aaMentalClarity2 =658,//whats the difference? + aaInnateRegeneration2 =661,//whats the difference? + aaManaBurn2 =664,//whats the difference? + aaExtendedNotes2 =665,//*not implemented - Live AA that replaces prior version in later exp. + aaSionachiesCrescendo2 =668,//*not implemented - Live AA that replaces prior version in later exp. + aaImprovedReclaimEnergy2 =671,//whats the difference? untetsed + aaSwiftJourney =672,//implemented as bonus + aaConvalescence =674,//added 9/26/08 + aaLastingBreath =676,//handled by client + aaPackrat =678,//added 9/29/08 + aaHeightenedEndurance =683, + aaWeaponAffinity =686,//implemented as bonus + aaSecondaryForte =691, + aaPersistantCasting =692, + aaTuneofPursuance =695, + aaImprovedInstrumentMastery =700, + aaImprovedSingingMastery =701, + aaExultantBellowing =702, + aaEchoofTaelosia =707, + aaInternalMetronome =710,//implemented as bonus *Live AA removed in 2006 + aaPiousSupplication =715, + aaBeastialAlignment =718,//untested + aaWrathofXuzl =721, + aaFeralSwipe =723,//DB? + aaWardersFury =724,//implemented as bonus + aaWardersAlacrity =729,//implemented as bonus + aaPetAffinity =734,//implemented as bonus + aaMasteryofthePast2 =735,//implemented as bonus [Different classes] + aaSpellCastingSubtlety2 =738,//whats the difference? + aaTouchoftheDivine =741, + aaDivineAvatar =746,//DB + aaExquisiteBenediction =749,//DB + aaQuickenedCuring =754, + aaNaturesBoon =757,//DB + aaAdvancedTracking =762, + aaCriticalAffliction =767, + aaFuryofMagicMastery =770,//whats the difference? + aaDoppelganger =773, + aaEnchancedForgetfulness =776, + aaMesmerizationMastery =781, + aaQuickMassGroupBuff =782, + aaSharedHealth =785, + aaElementalFury =790,//implemented as bonus + aaElementalAlacrity =795,//implemented as bonus + aaElementalAgility =800,//implemented as bonus + aaElementalDurability =803,//implemented as bonus + aaSinisterStrikes =806,//implemented as bonus + aaStrikethrough =807,//implemented as bonus + aaStonewall =810, + aaRapidStrikes =815,//implemented as bonus + aaKickMastery =820,//implemented as bonus + aaHightenedAwareness =823, + aaDestructiveForce =828,//DB + aaSwarmofDecay =831,//DB + aaDeathsFury =834, + aaQuickeningofDeath =839,//implemented as bonus + aaAdvancedTheftofLife =844,//implemented as bonus-focus + aaTripleBackstab =846,//implemented as bonus + aaHastenedPiety =849, + aaImmobilizingBash =852, + aaViciousSmash =855,//implemented as bonus + aaRadiantCure2 =860,//whats the difference? + aaPurification =863, + aaPrecisionofthePathfinder =864,//implemented as bonus + aaCoatofThistles =867, + aaFlamingArrows =872,//untested + aaFrostArrows =875,//untested + aaSeizedOpportunity =878, + aaTrapCircumvention =881, + aaImprovedHastyExit =886, + aaVirulentVenom =888, + aaImprovedConsumptionofSoul =893, + aaIntenseHatred =895, + aaAdvancedSpiritCall =900, + aaCalloftheAncients =902,//DB + aaSturdiness =907, + aaWarlordsTenacity =912,//implemented as effect + aaStrengthenedStrike =915,//implemented as bonus + aaExtendedShielding =918, + aaRosFlamingFamiliar =921,//DB + aaEcisIcyFamiliar =922,//DB + aaDruzzilsMysticalFamiliar =923,//DB + aaAdvancedFuryofMagicMastery =924,//added 9/29/08 + aaWardofDestruction =926,//DB + aaFrenziedDevastation =931,//DB + aaCombatFury2 =934,//implemented as bonus + aaCombatFury3 =937,//implemented as bonus + aaCombatFury4 =940,//implemented as bonus + aaFuryoftheAges2 =943,//implemented as bonus + aaFuryoftheAges3 =946,//implemented as bonus + aaFuryoftheAges4 =949,//implemented as bonus + aaPlanarDurability2 =952,//whats the difference? + aaInnateEnlightenment2 =955,//whats the difference? + aaDireCharm2 =960,//whats the difference? + aaDireCharm3 =961,//whats the difference? + aaTouchoftheDivine2 =962,//whats the difference? + aaTouchofDecay =967, + aaCalloftheAncients2 =970,//whats the difference? + aaImprovedVision =975, + aaEternalBreath =978,//handled by client + aaBlacksmithingMastery =979,//added 9/29/08 + aaBakingMastery =982,//added 9/29/08 + aaBrewingMastery =985,//added 9/29/08 + aaFletchingMastery2 =988,//added 9/29/08 + aaPotteryMastery =991,//added 9/29/08 + aaTailoringMastery =994,//added 9/29/08 + aaSalvage =997, + aaOrigin =1000,//spell + aaChaoticPotential =1001,//added + aaDiscordantDefiance =1006,//implemented as bonus + aaTrialsofMataMuram =1011, + aaMysticalAttuning =1021, + aaDelayDeath =1026,//implemented as bonus + aaHealthyAura =1031, + aaFitness =1036,//implemented as bonus + aaVeteransWrath =1041,//implemented as bonus [Different classes/values on each Veteran's Wrath] + aaVeteransWrath2 =1044,//implemented as bonus + aaVeteransWrath3 =1047,//implemented as bonus + aaVeteransWrath4 =1050,//implemented as bonus + aaDeathblow =1053,//implemented as bonus + aaReflexiveMastery =1061,//implemented as bonus + aaDefensiveInstincts =1066,//implemented as bonus + aaMnemonicRetention =1071,//Implemented + aaExpansiveMind =1072,//added 9/29/08 + aaSleightofHand =1077, + aaSleightofHand2 =1080,//whats the difference? + aaHealingAdeptMastery =1083, + aaHealingGiftMastery =1086, + aaArcaneTongues =1089, + aaMasterofDisguise =1092, + aaSlipperyAttacks =1093, + aaImprovedCriticalAffliction =1099, + aaFortifiedBellowing =1102, + aaFuryofMagic2 =1107,//whats the difference? + aaDanceofBlades =1110, + aaShieldofNotes =1116, + aaRoarofThunder =1119, + aaPersistentMinion =1122, + aaPerfectionofSpirit =1123, + aaReplentishCompanion =1126, + aaAdvancedPetDiscipline =1129, + aaThrowingMastery =1131,//implemented as bonus + aaBlurofAxes =1134,//implemented as bonus + aaHastenedWarCry =1137, + aaDeadAim =1140,//implemented as bonus + aaFrenziedDefense =1143,//*not implemented - duplicate + aaTirelessSprint =1146, + aaDesperation =1149, + aaUntamedRage =1150, + aaEchoingCries =1155, + aaViciousFrenzy =1158, + aaCrazedOnslaught =1163, + aaFrenziedDefense2 =1166,//implemented as bonus + aaOverwhelmingAttack =1172, + aaFuriousRage =1175, + aaBloodPact =1178, + aaShieldingResistance =1181,////implemented as bonus + aaHealingBoon =1186, + aaResplendentCure =1189, + aaCelestialHammer =1192, + aaDivineRetribution =1195, + aaCelestialRejuvination =1203, + aaFerventBenediction =1206, + aaSanctuary =1209, + aaDestructiveFury =1210,//implemented as bonus - added 9/29/08 + aaDestructiveFury2 =1213,//*not implemented [classes changed] - replaces id 1210 + aaBoonoftheForest =1222, + aaSpiritoftheGrove =1225, + aaCalloftheWild =1228, + aaSecondaryRecall =1229, + aaNaturesBounty =1230, + aaStasis =1233, + aaColorShock =1239, + aaMindOverMatter =1242, + aaSoothingWords =1245, + aaElementalSwarm =1248, + aaHeartofFlames =1251, + aaHeartofVapor =1252, + aaHeartofIce =1253, + aaHeartofStone =1254, + aaImitateDeath =1255, + aaCripplingStrike =1256, + aaStunningKick =1259, + aaEyeGouge =1262, + aaIronKicks =1265, + aaStyleoftheMimic =1268, + aaDeathPeace2 =1272,//whats the difference? + aaArmyoftheDead =1274, + aaCelestialStun =1277, + aaHandofDevotion =1278, + aaSteadfastWill =1284, + aaShieldBlock =1287,//implemented as bonus + aaScoutsEfficiency =1290,//implemented as bonus + aaGuardianoftheGlade =1293, + aaTrackingMastery =1296, + aaFlurryofKnives =1301,//implemented as bonus + aaPrecision =1304, + aaNervesofSteel =1307, + aaTouchoftheCursed =1313, + aaSpiritualCorrosion =1316, + aaSoulThief =1319,//implemented as bonus-focus + aaSpiritualChanneling =1323,//implemented as effect + aaBoonoftheAncients =1324, + aaAncestralAid =1327,//implemented as effect + aaResoluteDefiance =1330,//implemented as effect + aaPresstheAttack =1333, + aaMindCrash =1334, + aaProlongedDestruction =1337, + aaRosGreaterFamiliar =1340, + aaEcisGreaterFamiliar =1341, + aaDruzzilsGreaterFamiliar =1342, + aaTeleportBind =1343, + aaDevotedFamiliar =1344, + aaAuspiceoftheHunter =1345, + aaSavageSpirit =1348, + aaPresstheAttack2 =1351,//whats the difference? + aaCripplingStrike2 =1352,//whats the difference? + aaStunningKick2 =1353,//whats the difference? + aaEyeGouge2 =1358,//whats the difference? - aaGiftoftheDarkReign =1361,//from dbstr_us.txt - aaTenacityoftheDarkReign =1362,//from dbstr_us.txt - aaEmbraceoftheDarkReign =1363,//from dbstr_us.txt - aaPoweroftheDarkReign =1364,//from dbstr_us.txt - aaFervoroftheDarkReign =1365,//from dbstr_us.txt - aaGiftoftheKeepers =1366,//from dbstr_us.txt - aaValoroftheKeepers =1367,//from dbstr_us.txt - aaEmbraceoftheKeepers =1368,//from dbstr_us.txt - aaPoweroftheKeepers =1369,//from dbstr_us.txt - aaSanctityoftheKeepers =1370,//from dbstr_us.txt + aaGiftoftheDarkReign =1361,//from dbstr_us.txt + aaTenacityoftheDarkReign =1362,//from dbstr_us.txt + aaEmbraceoftheDarkReign =1363,//from dbstr_us.txt + aaPoweroftheDarkReign =1364,//from dbstr_us.txt + aaFervoroftheDarkReign =1365,//from dbstr_us.txt + aaGiftoftheKeepers =1366,//from dbstr_us.txt + aaValoroftheKeepers =1367,//from dbstr_us.txt + aaEmbraceoftheKeepers =1368,//from dbstr_us.txt + aaPoweroftheKeepers =1369,//from dbstr_us.txt + aaSanctityoftheKeepers =1370,//from dbstr_us.txt - aaLessonoftheDevoted =1371,//from dbstr_us.txt - aaInfusionoftheFaithful =1372,//from dbstr_us.txt - aaChaoticJester =1373,//from dbstr_us.txt - aaExpedientRecovery =1374,//from dbstr_us.txt - aaSteadfastServant =1375,//from dbstr_us.txt - aaStaunchRecovery =1376,//from dbstr_us.txt - aaIntensityoftheResolute =1377,//from dbstr_us.txt + aaLessonoftheDevoted =1371,//from dbstr_us.txt + aaInfusionoftheFaithful =1372,//from dbstr_us.txt + aaChaoticJester =1373,//from dbstr_us.txt + aaExpedientRecovery =1374,//from dbstr_us.txt + aaSteadfastServant =1375,//from dbstr_us.txt + aaStaunchRecovery =1376,//from dbstr_us.txt + aaIntensityoftheResolute =1377,//from dbstr_us.txt - aaCurseofBlood =1378,//from dbstr_us.txt - aaAfflictionofBlood =1379,//from dbstr_us.txt - aaTormentofBlood =1380,//from dbstr_us.txt - aaTemptationofBlood =1381,//from dbstr_us.txt - aaInvitationofBlood =1382,//from dbstr_us.txt + aaCurseofBlood =1378,//from dbstr_us.txt + aaAfflictionofBlood =1379,//from dbstr_us.txt + aaTormentofBlood =1380,//from dbstr_us.txt + aaTemptationofBlood =1381,//from dbstr_us.txt + aaInvitationofBlood =1382,//from dbstr_us.txt - aaTurnUndead2 =1383,//from dbstr_us.txt, Class AA changed in DoD - aaWrackUndead =1386,//from dbstr_us.txt, PoP Class AA changed in DoD - aaEradicateUndead =1387,//from dbstr_us.txt - aaInnateSeeInvis =1388,//implemented as bonus - aaProlongedMortality =1389,//from dbstr_us.txt - aaPrecognition =1394,//implemented as bonus - aaThickSkin =1399,//implemented as bonus - aaSilentCasting =1404,//from dbstr_us.txt - aaSilentCasting2 =1409,//from dbstr_us.txt - aaHastenedMindCrash =1414,//from dbstr_us.txt - aaFieldDressing =1417,//implemented as bonus - aaBandageWounds =1420,//implemented as bonus - aaCascadingRage =1425,//from dbstr_us.txt - aaElementalFerocity =1430,//from dbstr_us.txt - aaGiftofMana =1435,//implemented as bonus - aaRuneofShadows =1440,//from dbstr_us.txt - aaChannelingMastery =1445,//from dbstr_us.txt - aaConservation =1453,//from dbstr_us.txt - aaCryofBattle =1458,//from dbstr_us.txt - aaWardofPurity =1459,//from dbstr_us.txt - aaTurnSummoned2 =1462,//from dbstr_us.txt - aaWrackSummoned =1465,//from dbstr_us.txt - aaEradicateSummoned =1466,//from dbstr_us.txt - aaWardersSavagery =1467,//from dbstr_us.txt - aaShackleofSpirits =1470,//from dbstr_us.txt - aaHastenedThunder =1471,//from dbstr_us.txt - aaTranslocationalAnchor =1474,//from dbstr_us.txt - aaStealthyGetaway =1477,//from dbstr_us.txt - aaPyromancy =1478,//from dbstr_us.txt - aaMasteryofFury =1483,//from dbstr_us.txt - aaAbundantHealing =1486,//from dbstr_us.txt - aaGreaterAvatar =1491,//from dbstr_us.txt - aaSharedCamouflage =1494,//from dbstr_us.txt - aaConvergenceofSpirits =1495,//from dbstr_us.txt - aaNaturesGuardian =1498,//from dbstr_us.txt - aaEdictofCommand =1501,//from dbstr_us.txt - aaExtendedBurnout =1504,//from dbstr_us.txt - aaGuardianofRo =1507,//from dbstr_us.txt - aaBloodMagic =1510,//from dbstr_us.txt - aaGraverobbing =1511,//from dbstr_us.txt - aaAfflictionMastery =1514,//from dbstr_us.txt - aaGreaterRabidBear =1517,//from dbstr_us.txt - aaAncestralGuard =1520,//from dbstr_us.txt - aaCloakofLight =1523,//from dbstr_us.txt - aaVanquishUndead =1524,//from dbstr_us.txt - aaCloakofShadows =1527,//from dbstr_us.txt - aaWillfulDeath =1528,//from dbstr_us.txt - aaSwiftBlade =1533,//implemented as bonus - aaWickedBlade =1536,//implemented as bonus - aaForcedOpening =1539,//from dbstr_us.txt - aaAppraisal =1542,//from dbstr_us.txt - aaPreciseStrikes =1543,//from dbstr_us.txt - aaHastenedDeath =1546,//from dbstr_us.txt - aaUnflinchingResolve =1549,//from dbstr_us.txt - aaWeightlessSteps =1552,//from dbstr_us.txt - aaHastenedBlades =1555,//from dbstr_us.txt - aaImprovedHarmoniousAttack =1563,//from dbstr_us.txt - aaImprovedBestialFrenzy =1566,//from dbstr_us.txt - aaSongofStone =1569,//from dbstr_us.txt - aaDeepSleep =1572,//from dbstr_us.txt - aaCompanionsGift =1577,//from dbstr_us.txt - aaHastenedDefiance =1583,//implemented as redux - aaDauntlessPerseverance =1586,//implemented as bonus - aaConcentration =1587,//implemented as bonus - aaEnhancedAggression =1592,//from dbstr_us.txt - aaCallofChallenge =1597,//implemented as effect - aaCacophony =1598,//from dbstr_us.txt - aaImprovedHeadshot =1601,//from dbstr_us.txt - aaAnatomy =1604,//from dbstr_us.txt - aaFetterofSpirits =1607,//from dbstr_us.txt - aaTrickShot =1608,//from dbstr_us.txt - aaLightningStrikes =1616,//implemented as bonus - aaRelentlessAssault =1621,//implemented as bonus - aaKnightsExpertise =1624,//implemented as bonus - aaSelosEnduringCadence =1627,//implemented as bonus + aaTurnUndead2 =1383,//from dbstr_us.txt, Class AA changed in DoD + aaWrackUndead =1386,//from dbstr_us.txt, PoP Class AA changed in DoD + aaEradicateUndead =1387,//from dbstr_us.txt + aaInnateSeeInvis =1388,//implemented as bonus + aaProlongedMortality =1389,//from dbstr_us.txt + aaPrecognition =1394,//implemented as bonus + aaThickSkin =1399,//implemented as bonus + aaSilentCasting =1404,//from dbstr_us.txt + aaSilentCasting2 =1409,//from dbstr_us.txt + aaHastenedMindCrash =1414,//from dbstr_us.txt + aaFieldDressing =1417,//implemented as bonus + aaBandageWounds =1420,//implemented as bonus + aaCascadingRage =1425,//from dbstr_us.txt + aaElementalFerocity =1430,//from dbstr_us.txt + aaGiftofMana =1435,//implemented as bonus + aaRuneofShadows =1440,//from dbstr_us.txt + aaChannelingMastery =1445,//from dbstr_us.txt + aaConservation =1453,//from dbstr_us.txt + aaCryofBattle =1458,//from dbstr_us.txt + aaWardofPurity =1459,//from dbstr_us.txt + aaTurnSummoned2 =1462,//from dbstr_us.txt + aaWrackSummoned =1465,//from dbstr_us.txt + aaEradicateSummoned =1466,//from dbstr_us.txt + aaWardersSavagery =1467,//from dbstr_us.txt + aaShackleofSpirits =1470,//from dbstr_us.txt + aaHastenedThunder =1471,//from dbstr_us.txt + aaTranslocationalAnchor =1474,//from dbstr_us.txt + aaStealthyGetaway =1477,//from dbstr_us.txt + aaPyromancy =1478,//from dbstr_us.txt + aaMasteryofFury =1483,//from dbstr_us.txt + aaAbundantHealing =1486,//from dbstr_us.txt + aaGreaterAvatar =1491,//from dbstr_us.txt + aaSharedCamouflage =1494,//from dbstr_us.txt + aaConvergenceofSpirits =1495,//from dbstr_us.txt + aaNaturesGuardian =1498,//from dbstr_us.txt + aaEdictofCommand =1501,//from dbstr_us.txt + aaExtendedBurnout =1504,//from dbstr_us.txt + aaGuardianofRo =1507,//from dbstr_us.txt + aaBloodMagic =1510,//from dbstr_us.txt + aaGraverobbing =1511,//from dbstr_us.txt + aaAfflictionMastery =1514,//from dbstr_us.txt + aaGreaterRabidBear =1517,//from dbstr_us.txt + aaAncestralGuard =1520,//from dbstr_us.txt + aaCloakofLight =1523,//from dbstr_us.txt + aaVanquishUndead =1524,//from dbstr_us.txt + aaCloakofShadows =1527,//from dbstr_us.txt + aaWillfulDeath =1528,//from dbstr_us.txt + aaSwiftBlade =1533,//implemented as bonus + aaWickedBlade =1536,//implemented as bonus + aaForcedOpening =1539,//from dbstr_us.txt + aaAppraisal =1542,//from dbstr_us.txt + aaPreciseStrikes =1543,//from dbstr_us.txt + aaHastenedDeath =1546,//from dbstr_us.txt + aaUnflinchingResolve =1549,//from dbstr_us.txt + aaWeightlessSteps =1552,//from dbstr_us.txt + aaHastenedBlades =1555,//from dbstr_us.txt + aaImprovedHarmoniousAttack =1563,//from dbstr_us.txt + aaImprovedBestialFrenzy =1566,//from dbstr_us.txt + aaSongofStone =1569,//from dbstr_us.txt + aaDeepSleep =1572,//from dbstr_us.txt + aaCompanionsGift =1577,//from dbstr_us.txt + aaHastenedDefiance =1583,//implemented as redux + aaDauntlessPerseverance =1586,//implemented as bonus + aaConcentration =1587,//implemented as bonus + aaEnhancedAggression =1592,//from dbstr_us.txt + aaCallofChallenge =1597,//implemented as effect + aaCacophony =1598,//from dbstr_us.txt + aaImprovedHeadshot =1601,//from dbstr_us.txt + aaAnatomy =1604,//from dbstr_us.txt + aaFetterofSpirits =1607,//from dbstr_us.txt + aaTrickShot =1608,//from dbstr_us.txt + aaLightningStrikes =1616,//implemented as bonus + aaRelentlessAssault =1621,//implemented as bonus + aaKnightsExpertise =1624,//implemented as bonus + aaSelosEnduringCadence =1627,//implemented as bonus - aaThroneofHeroes =4655, - aaTinkeringMastery =4672, - aaCombatMedic =4688,//implemented as bonus - aaQuickDraw =4698, - aaBattleReady =4699, - aaGlyphofDragonScales =4702,//implemented as effect - aaGlyphofArcaneSecrets =4704,//implemented as effect - aaGlyphofDraconicPotential =4705,//implemented as effect - aaGlyphofDestruction =4706,//implemented as effect - aaKillingSpree =4739,//implemented as effect - aaHoldtheLine =4742, - aaBloodTithe =4761, - aaSleightofHand3 =4767, - aaGiftofRadiantMana =4773, - aaSavageAssault =4795,//Flurry - aaOverbear =4798, - aaHastenedMend =4801, - aaPrecisionofAxes =4809, - aaDeathMask =4819, - aaGrapplingStrike =4836, - aaShieldSpecialist =4844, - aaMarkoftheMageHunter =4849, - aaHamstring =4850, - aaUncannyResilience =4854, + aaThroneofHeroes =4655, + aaTinkeringMastery =4672, + aaCombatMedic =4688,//implemented as bonus + aaQuickDraw =4698, + aaBattleReady =4699, + aaGlyphofDragonScales =4702,//implemented as effect + aaGlyphofArcaneSecrets =4704,//implemented as effect + aaGlyphofDraconicPotential =4705,//implemented as effect + aaGlyphofDestruction =4706,//implemented as effect + aaKillingSpree =4739,//implemented as effect + aaHoldtheLine =4742, + aaBloodTithe =4761, + aaSleightofHand3 =4767, + aaGiftofRadiantMana =4773, + aaSavageAssault =4795,//Flurry + aaOverbear =4798, + aaHastenedMend =4801, + aaPrecisionofAxes =4809, + aaDeathMask =4819, + aaGrapplingStrike =4836, + aaShieldSpecialist =4844, + aaMarkoftheMageHunter =4849, + aaHamstring =4850, + aaUncannyResilience =4854, - aaBlindingFury =4857, - aaBattleLeap =4860, - aaSoulSeeker =4861, - aaHolyLight =4880, - aaSurreality =4887, - aaManaDraw =4890, - aaNightmareStasis =4894, - aaFireCore =4903, - aaVaporCore =4906, - aaIceCore =4909, - aaStoneCore =4912, - aaVolatileManaBlaze =4915, - aaGreaterBloodTithe =4924, - aaGatheringDusk =4927, - aaVeilofMindshadow =4931, - aaSanguineMindCrystal =4934, - aaAzureMindCrystal =4935, - aaArcaneWhisper =4938, - aaDimensionalInstability =4943, - aaCryomancy =4944, - aaSurvivalist =5000, - aaProtectionoftheSpiritWolf =5007, - aaTasteofBlood =5015, - aaHymnoftheLastStand =5017, - aaBladedSong =5020, - aaTwistedShank =5021, - aaDirtyFighting =5022, - aaLigamentSlice =5025, - aaTumble =5028, - aaSiphonSoul =5032, - aaUnflinchingWill =5035, - aaPetrifiedRoots =5061, - aaHastenedSanctuary =5083, - aaMortalCoil =5085, - aaArmoroftheInquisitor =5095, - aaHandofDisruption =5098, - aaSpiritoftheWhiteWolf =5105, - aaPactoftheWolf =5109, - aaDoppelgangersBeckon =5127, - aaBreathofAtathus =5150, - aaBreathofDratonra =5165, - aaBreathofOshvir =5180, - aaBreathofVenesh =5195, - aaBreathofMysaphar =5210, - aaBreathofKeikolin =5225, - aaHuntersFury =5248, - aaUnionofSpirits =5251, - aaShieldBlock2 =5263, - aaDeathsWrath =5264, - aaSummonersBeckon =5269, - aaShiftingElements =5276, - aaArcaneOverkill =5295, - aaFuneralDirge =5298, - aaFierceEye =5717, - aaPreciseBlow =5776, - aaForceofDisruption =5984, - aaPunchMastery =6020, - aaHastenedDestructiveForce =6023, - aaCompanionsDurability =6051, - aaGeneralSturdiness =6119, - aaRapidDefiance =6136, - aaPactoftheWurine =6218, - aaProtectionofDirewood =6232, - aaEnhancedDamageShield =6257, - aaArcomancy =6290, - aaBlessingofResurrection =6299, - aaRakesDeadlyAim =6322, - aaRoguesFury =6325, - aaEnvenomedBlades =6328, - aaCompanionofNecessity =6333, - aaRakesPowerfulAim =6334, - aaHastenedCacophony =6337, - aaHastenedFuneralDirge =6340, - aaMastersHastenedCombination =6343, - aaHastenedSilentCasting =6346, - aaHastenedSilentCasting2 =6349, - aaHastenedTrueshot =6355, - aaOutridersAccuracy =6370, - aaDestructiveCascade =6375, - aaCompanionsRelocation =6379, - aaFocusedParagonofSpirits =6380, - aaCompanionsAgility =6383, - aaMaestrosConcentration =6386, - aaBlessingofLife =6395, - aaPlanarDurability3 =6422, - aaHolyRoot =6436, - aaHastenedRoarofThunder =6442, - aaQuickenedSuspendMinion =6445, - aaQuickenedSummonAxes =6452, - aaCallHither =6455, - aaFortifiedSurvival =6458, - aaFortifiedIntervention =6461, - aaPlanarDurability4 =6467, - aaFuriousLeap =6499, - aaQuickenedHarvestofDruzzil =6503, - aaChatteringBones =6508, - aaWarlordsDeadlyAim =6511, - aaQuickenedCalloftheWild =6514, - aaGiftofExquisiteRadiantMana =6517, - aaHastenedOrigin =6528, - aaDirgeoftheSleepwalker =6533, - aaQuickTime =6534, - aaSteadyHands =6535, - aaSelosSonata =6536, - aaCompanionsBlessing =6537, - aaHastenedBestialAlignment =6538, - aaFortifyCompanion =6539, - aaBurstofPower =6540, - aaPactoftheWurine2 =6541, - aaRecklessAbandon =6542, - aaGiftofResurrection =6543, - aaTouchoftheDivine3 =6544, - aaHastenedCalloftheWild =6545, - aaHuntersAttackPower =6546, - aaHastenedExodus2 =6547, - aaClingingRoot =6548, - aaVielofInvisibility =6549, - aaCriticalAffliction2 =6550, - aaLessenedPresence =6551, - aaManaOverburn =6552, - aaHostoftheElements2 =6553, - aaEnhancedDamageShield2 =6554, - aaHastenedPurifyBody =6555, - aaWrathofLife =6556, - aaKnightsReturnStrike =6557, - aaHuntersReturnKick =6558, - aaHastenedLigamentSlice =6559, - aaKnavesReturnStrike =6560, - aaStormStrike =6561, - aaSilentPresence =6562, - aaTurgursSwarm =6563, - aaInfusedbyRage =6564, - aaGutPunch =6565, - aaWarlordsReturnKick =6566, - aaArcomancy2 =6567, - aaCallofXuzl2 =6568, - aaBETAONLYDestructiveForceTest =6600, - aaRecourseofLife =6601, - aaVehementRage =6607, - aaKneeStrike =6610, - aaHastenedFortitudeDiscipline =6611, - aaHastenedFuriousDiscipline =6614, - aaWarlordsBravery =6617, - aaDeathsRevenge =6630, - aaHarmshield =6635, - aaDestructiveFury3 =6636, - aaVoiceofThule =6639, - aaExplosionofHatred =6640, - aaCascadingTheftofLife =6641, - aaHateStep =6644, - aaViciousBiteofChaos =6645, - aaEncroachingDarkness =6646, - aaSleightofHand4 =6663, - aaEnduringVision =6664, - aaEnduringVision2 =6666, + aaBlindingFury =4857, + aaBattleLeap =4860, + aaSoulSeeker =4861, + aaHolyLight =4880, + aaSurreality =4887, + aaManaDraw =4890, + aaNightmareStasis =4894, + aaFireCore =4903, + aaVaporCore =4906, + aaIceCore =4909, + aaStoneCore =4912, + aaVolatileManaBlaze =4915, + aaGreaterBloodTithe =4924, + aaGatheringDusk =4927, + aaVeilofMindshadow =4931, + aaSanguineMindCrystal =4934, + aaAzureMindCrystal =4935, + aaArcaneWhisper =4938, + aaDimensionalInstability =4943, + aaCryomancy =4944, + aaSurvivalist =5000, + aaProtectionoftheSpiritWolf =5007, + aaTasteofBlood =5015, + aaHymnoftheLastStand =5017, + aaBladedSong =5020, + aaTwistedShank =5021, + aaDirtyFighting =5022, + aaLigamentSlice =5025, + aaTumble =5028, + aaSiphonSoul =5032, + aaUnflinchingWill =5035, + aaPetrifiedRoots =5061, + aaHastenedSanctuary =5083, + aaMortalCoil =5085, + aaArmoroftheInquisitor =5095, + aaHandofDisruption =5098, + aaSpiritoftheWhiteWolf =5105, + aaPactoftheWolf =5109, + aaDoppelgangersBeckon =5127, + aaBreathofAtathus =5150, + aaBreathofDratonra =5165, + aaBreathofOshvir =5180, + aaBreathofVenesh =5195, + aaBreathofMysaphar =5210, + aaBreathofKeikolin =5225, + aaHuntersFury =5248, + aaUnionofSpirits =5251, + aaShieldBlock2 =5263, + aaDeathsWrath =5264, + aaSummonersBeckon =5269, + aaShiftingElements =5276, + aaArcaneOverkill =5295, + aaFuneralDirge =5298, + aaFierceEye =5717, + aaPreciseBlow =5776, + aaForceofDisruption =5984, + aaPunchMastery =6020, + aaHastenedDestructiveForce =6023, + aaCompanionsDurability =6051, + aaGeneralSturdiness =6119, + aaRapidDefiance =6136, + aaPactoftheWurine =6218, + aaProtectionofDirewood =6232, + aaEnhancedDamageShield =6257, + aaArcomancy =6290, + aaBlessingofResurrection =6299, + aaRakesDeadlyAim =6322, + aaRoguesFury =6325, + aaEnvenomedBlades =6328, + aaCompanionofNecessity =6333, + aaRakesPowerfulAim =6334, + aaHastenedCacophony =6337, + aaHastenedFuneralDirge =6340, + aaMastersHastenedCombination =6343, + aaHastenedSilentCasting =6346, + aaHastenedSilentCasting2 =6349, + aaHastenedTrueshot =6355, + aaOutridersAccuracy =6370, + aaDestructiveCascade =6375, + aaCompanionsRelocation =6379, + aaFocusedParagonofSpirits =6380, + aaCompanionsAgility =6383, + aaMaestrosConcentration =6386, + aaBlessingofLife =6395, + aaPlanarDurability3 =6422, + aaHolyRoot =6436, + aaHastenedRoarofThunder =6442, + aaQuickenedSuspendMinion =6445, + aaQuickenedSummonAxes =6452, + aaCallHither =6455, + aaFortifiedSurvival =6458, + aaFortifiedIntervention =6461, + aaPlanarDurability4 =6467, + aaFuriousLeap =6499, + aaQuickenedHarvestofDruzzil =6503, + aaChatteringBones =6508, + aaWarlordsDeadlyAim =6511, + aaQuickenedCalloftheWild =6514, + aaGiftofExquisiteRadiantMana =6517, + aaHastenedOrigin =6528, + aaDirgeoftheSleepwalker =6533, + aaQuickTime =6534, + aaSteadyHands =6535, + aaSelosSonata =6536, + aaCompanionsBlessing =6537, + aaHastenedBestialAlignment =6538, + aaFortifyCompanion =6539, + aaBurstofPower =6540, + aaPactoftheWurine2 =6541, + aaRecklessAbandon =6542, + aaGiftofResurrection =6543, + aaTouchoftheDivine3 =6544, + aaHastenedCalloftheWild =6545, + aaHuntersAttackPower =6546, + aaHastenedExodus2 =6547, + aaClingingRoot =6548, + aaVielofInvisibility =6549, + aaCriticalAffliction2 =6550, + aaLessenedPresence =6551, + aaManaOverburn =6552, + aaHostoftheElements2 =6553, + aaEnhancedDamageShield2 =6554, + aaHastenedPurifyBody =6555, + aaWrathofLife =6556, + aaKnightsReturnStrike =6557, + aaHuntersReturnKick =6558, + aaHastenedLigamentSlice =6559, + aaKnavesReturnStrike =6560, + aaStormStrike =6561, + aaSilentPresence =6562, + aaTurgursSwarm =6563, + aaInfusedbyRage =6564, + aaGutPunch =6565, + aaWarlordsReturnKick =6566, + aaArcomancy2 =6567, + aaCallofXuzl2 =6568, + aaBETAONLYDestructiveForceTest =6600, + aaRecourseofLife =6601, + aaVehementRage =6607, + aaKneeStrike =6610, + aaHastenedFortitudeDiscipline =6611, + aaHastenedFuriousDiscipline =6614, + aaWarlordsBravery =6617, + aaDeathsRevenge =6630, + aaHarmshield =6635, + aaDestructiveFury3 =6636, + aaVoiceofThule =6639, + aaExplosionofHatred =6640, + aaCascadingTheftofLife =6641, + aaHateStep =6644, + aaViciousBiteofChaos =6645, + aaEncroachingDarkness =6646, + aaSleightofHand4 =6663, + aaEnduringVision =6664, + aaEnduringVision2 =6666, - aaCunningDisguiseHuman =6671, - aaCunningDisguiseHalfElf =6672, - aaCunningDisguiseBarbarian =6673, - aaCunningDisguiseErudite =6674, - aaCunningDisguiseTroll =6675, - aaCunningDisguiseGoblin =6676, - aaQuickCannibalize =6690, - aaTigirsInsectSwarm =6691, - aaDampenResistance =6692, - aaHastenedDampenResistance =6697, - aaHastenedDampenResistance2 =6698, - aaSpiritWalk =6702, - aaHastenedVirulentParalysis =6703, - aaLanguidBite =6706, - aaQuickenedBloodofNadox =6709, - aaHastenedSpiritCall =6712, - aaHarmoniousArrow =6750, - aaHastenedWeaponShield =6751, - aaOutridersAttack =6754, - aaGroupGuardianoftheForest =6755, - aaPackHunt =6758, - aaKeenBlade =6761, - aaOutridersEvasion =6764, - aaRangedFinesse =6765, - aaGroupCloakofLight =6790, - aaHealingLight =6791, - aaHalttheDead =6794, - aaDirectedForceofDisruption =6795, - aaRiseofBones =6815, - aaWhisperwind =6818, - aaHastenedBloodMagic =6819, - aaOverpowerUndead =6822, - aaHastenedSwarmofDecay =6823, - aaGiftoftheGrave =6828, - aaHastenedSongofStone =6870, - aaStompingLeap =6930, - aaJuggernautSurge =6931, - aaDistractionAttack =6932, - aaHastenedSavageSpirit =6935, - aaDyingBlow =6938, - aaHastenedDistractionAttack =6941, - aaNaturalInvisibility =6970, - aaAttackoftheWarders =6971, - aaHastenedFeralAttacks =6974, - aaHastenedFocusedParagon =6977, - aaHastenedParagon =6980, - aaGroupBestialAlignment =6983, - aaBiteoftheAsp =6984, - aaRavensClaw =6985, - aaGorillaSmash =6986, - aaAuroriaMastery =6987, - aaHastenedGetaway =7005, - aaForaging =7062, - aaPerfectedInvisibility =7069, - aaHastenedDivineAvatar =7100, - aaHastenedPurification2 =7103, - aaBeastlordsFeralKick =7106, - aaGiftofAmazingExquisiteRadiantMana =7621, - aaHastenedWrathoftheWild =7664, - aaGroupShrink =7669, - aaEnchantDwerium =7732, - aaMassEnchantDwerium =7734, - aaEnchantPalladium =7735, - aaEnchantPalladiumTrio =7736, - aaMassEnchantPalladium =7737, - aaGreaterMassEnchantPalladium =7738, - aaEnchantTemporite =7739, - aaMassEnchantTemporite =7740, + aaCunningDisguiseHuman =6671, + aaCunningDisguiseHalfElf =6672, + aaCunningDisguiseBarbarian =6673, + aaCunningDisguiseErudite =6674, + aaCunningDisguiseTroll =6675, + aaCunningDisguiseGoblin =6676, + aaQuickCannibalize =6690, + aaTigirsInsectSwarm =6691, + aaDampenResistance =6692, + aaHastenedDampenResistance =6697, + aaHastenedDampenResistance2 =6698, + aaSpiritWalk =6702, + aaHastenedVirulentParalysis =6703, + aaLanguidBite =6706, + aaQuickenedBloodofNadox =6709, + aaHastenedSpiritCall =6712, + aaHarmoniousArrow =6750, + aaHastenedWeaponShield =6751, + aaOutridersAttack =6754, + aaGroupGuardianoftheForest =6755, + aaPackHunt =6758, + aaKeenBlade =6761, + aaOutridersEvasion =6764, + aaRangedFinesse =6765, + aaGroupCloakofLight =6790, + aaHealingLight =6791, + aaHalttheDead =6794, + aaDirectedForceofDisruption =6795, + aaRiseofBones =6815, + aaWhisperwind =6818, + aaHastenedBloodMagic =6819, + aaOverpowerUndead =6822, + aaHastenedSwarmofDecay =6823, + aaGiftoftheGrave =6828, + aaHastenedSongofStone =6870, + aaStompingLeap =6930, + aaJuggernautSurge =6931, + aaDistractionAttack =6932, + aaHastenedSavageSpirit =6935, + aaDyingBlow =6938, + aaHastenedDistractionAttack =6941, + aaNaturalInvisibility =6970, + aaAttackoftheWarders =6971, + aaHastenedFeralAttacks =6974, + aaHastenedFocusedParagon =6977, + aaHastenedParagon =6980, + aaGroupBestialAlignment =6983, + aaBiteoftheAsp =6984, + aaRavensClaw =6985, + aaGorillaSmash =6986, + aaAuroriaMastery =6987, + aaHastenedGetaway =7005, + aaForaging =7062, + aaPerfectedInvisibility =7069, + aaHastenedDivineAvatar =7100, + aaHastenedPurification2 =7103, + aaBeastlordsFeralKick =7106, + aaGiftofAmazingExquisiteRadiantMana =7621, + aaHastenedWrathoftheWild =7664, + aaGroupShrink =7669, + aaEnchantDwerium =7732, + aaMassEnchantDwerium =7734, + aaEnchantPalladium =7735, + aaEnchantPalladiumTrio =7736, + aaMassEnchantPalladium =7737, + aaGreaterMassEnchantPalladium =7738, + aaEnchantTemporite =7739, + aaMassEnchantTemporite =7740, - aaLayonHandsRank16 =7866, //Duplicate ID with aaExtendedAstralProjection! + aaLayonHandsRank16 =7866, //Duplicate ID with aaExtendedAstralProjection! - aaHarmTouch =7800,//First 10 AA cost 0 per rank - aaHarmToch2 =7810,//Next 6+ AA cost 3 +1inc per rank - aaLayonHands =7850,//First 10 AA cost 0 per rank - aaLayonHands2 =7860,//Next 6+ AA cost 3 +1inc per rank - //aaExtendedAstralProjection =7866, - aaNeshikasBlink =7869, - aaZanFisWhistle =7872, - aaFivePointPalm =7875, - aaTheftofEssence =7900, - aaMalosinete =7903, - aaHastenedTurnUndead =7940, - aaCascadingDivineAura =7943, - aaGroupPurifySoul =7944, - aaQuickenedRenewal =7945, - aaSanctifiedBlessing =7948, - aaFocusedCelestialRegeneration =7951, - aaMasteryofNature =7980, - aaHastenedNaturesGuardian =7983, - aaSpiritoftheBlackWolf =7986, - aaHastenedLycanSoul =7989, - aaSelfStasis =8030, - aaHastenedVeilofMindshadow =8031, - aaPhantasmalOpponent =8034, - aaHastenedEdictofCommand =8035, - aaFogofMemories =8038, - aaBiteofTashani =8039, - aaExtendedIngenuity =8040, - aaFuryofDruzzil =8060, - aaFuryofEci =8063, - aaFuryofRo =8066, - aaFortifiedEntanglement =8069, - aaForceofWill =8072, - aaAtolsShackles =8075, - aaHastenedManaburn =8076, - aaHastenedCallofXuzl =8082, - aaCompanionsAlacrity =8190, - aaImprovedIntimidation =8193, - aaPerfectedLevitation =8194, - aaHastenedFortifyCompanion =8195, - aaEmpoweredIngenuity =8198, - aaCompanionsFury =8201, - aaQuickenedRadiantCure =8204, - aaQuickenedRadiantCure2 =8207, - aaMentalStamina =8210, - aaHardyEndurance =8215, - aaGroupPerfectInvisibility =8220, - aaFocusofArcanum =8221, - aaGroupPerfectedInvisibilitytoUndead =8222, - aaSpellCastingReinforcementMastery2 =8223, - aaCascadeofLife =8224, - aaSummonCompanion =8227, - aaMentalFortitude =8228, - aaGate =8231, - aaExtendedIngenuity2 =8232, - aaArmorofWisdom1 =8235, - aaArmorofWisdom2 =8240, - aaArmorofWisdom3 =8245, - aaArmorofWisdom4 =8250, - aaArmorofWisdom5 =8255, + aaHarmTouch =7800,//First 10 AA cost 0 per rank + aaHarmToch2 =7810,//Next 6+ AA cost 3 +1inc per rank + aaLayonHands =7850,//First 10 AA cost 0 per rank + aaLayonHands2 =7860,//Next 6+ AA cost 3 +1inc per rank + //aaExtendedAstralProjection =7866, + aaNeshikasBlink =7869, + aaZanFisWhistle =7872, + aaFivePointPalm =7875, + aaTheftofEssence =7900, + aaMalosinete =7903, + aaHastenedTurnUndead =7940, + aaCascadingDivineAura =7943, + aaGroupPurifySoul =7944, + aaQuickenedRenewal =7945, + aaSanctifiedBlessing =7948, + aaFocusedCelestialRegeneration =7951, + aaMasteryofNature =7980, + aaHastenedNaturesGuardian =7983, + aaSpiritoftheBlackWolf =7986, + aaHastenedLycanSoul =7989, + aaSelfStasis =8030, + aaHastenedVeilofMindshadow =8031, + aaPhantasmalOpponent =8034, + aaHastenedEdictofCommand =8035, + aaFogofMemories =8038, + aaBiteofTashani =8039, + aaExtendedIngenuity =8040, + aaFuryofDruzzil =8060, + aaFuryofEci =8063, + aaFuryofRo =8066, + aaFortifiedEntanglement =8069, + aaForceofWill =8072, + aaAtolsShackles =8075, + aaHastenedManaburn =8076, + aaHastenedCallofXuzl =8082, + aaCompanionsAlacrity =8190, + aaImprovedIntimidation =8193, + aaPerfectedLevitation =8194, + aaHastenedFortifyCompanion =8195, + aaEmpoweredIngenuity =8198, + aaCompanionsFury =8201, + aaQuickenedRadiantCure =8204, + aaQuickenedRadiantCure2 =8207, + aaMentalStamina =8210, + aaHardyEndurance =8215, + aaGroupPerfectInvisibility =8220, + aaFocusofArcanum =8221, + aaGroupPerfectedInvisibilitytoUndead =8222, + aaSpellCastingReinforcementMastery2 =8223, + aaCascadeofLife =8224, + aaSummonCompanion =8227, + aaMentalFortitude =8228, + aaGate =8231, + aaExtendedIngenuity2 =8232, + aaArmorofWisdom1 =8235, + aaArmorofWisdom2 =8240, + aaArmorofWisdom3 =8245, + aaArmorofWisdom4 =8250, + aaArmorofWisdom5 =8255, - aaSpellCastingReinforcementArtistry =8262, - aaEarthenBrawn =8263, - aaEarthenStability =8268, - aaEarthenAlacrity =8273, - aaEarthenArtistry =8278, - aaEarthenSagacity =8283, - aaEarthenBrilliance =8288, - aaEarthenAllure =8293, - aaResplendentGlory =8300, - aaRageofRallosZek =8303, - aaEnhancedAreaTaunt =8312, - aaFluidMarch =8314, - aaHastenedSelosKick =8317, - aaHastenedBellow =8319, - aaBelltoneMind =8322, - aaSubtleBlows =8325, - aaLitheBody =8330, - aaEnhancedThiefsEyes =8331, - aaExtendedLanguidBite =8332, - aaQuickenedMalosinete =8335, - aaDrapeofShadows =8341, - aaHostintheShell =8342, - aaHastenedManaDraw =8347, - aaHastenedMezmerization =8350, - aaDreamlikeMight =8351, - aaDreamlikeFortitude =8361, - aaDreamlikeSwiftness =8371, - aaDreamlikeCunning =8381, - aaDreamlikeSapience =8391, - aaArmorRend =8400, - aaFundamentofIntellect =9100, - aaSongwriting =9101, - aaFundamentofIntellect2 =9109, - aaHybridResearch =9111, - aaFundamentofIntellect3 =9118, - aaWrittenPrayer =9121, - aaFundamentofIntellect4 =9127, - aaFundamentofWisdom =9136, - aaFundamentofWisdom2 =9145, - aaFundamentofWisdom3 =9154, - aaFundamentofPower =9163, - aaFundamentofPower2 =9172, - aaFundamentofPower3 =9181, - aaFundamentofPower4 =9190, - aaFundamentofPower5 =9199, - aaFundamentofCombat =9208, - aaFundamentofCombat2 =9217, - aaFundamentofCombat3 =9226, - aaFundamentofCombat4 =9235, - aaFundamentFirstSpireofArcanum =9300, - aaFundamentSecondSpireofArcanum =9303, - aaFundamentThirdSpireofArcanum =9306, - aaFundamentFirstSpireoftheSensei =9309, - aaFundamentSecondSpireoftheSensei =9312, - aaFundamentThirdSpireoftheSensei =9315, - aaFundamentFirstSpireoftheElements =9318, - aaFundamentSecondSpireoftheElements =9321, - aaFundamentThirdSpireoftheElements =9324, - aaFundamentFirstSpireofEnchantment =9327, - aaFundamentSecondSpireofEnchantment =9330, - aaFundamentThirdSpireofEnchantment =9333, - aaFundamentFirstSpireofNecromancy =9336, - aaFundamentSecondSpireofNecromancy =9339, - aaFundamentThirdSpireofNecromancy =9342, - aaFundamentFirstSpireoftheWarlord =9345, - aaFundamentSecondSpireoftheWarlord =9348, - aaFundamentThirdSpireoftheWarlord =9351, - aaFundamentFirstSpireoftheRake =9354, - aaFundamentSecondSpireoftheRake =9357, - aaFundamentThirdSpireoftheRake =9360, - aaFundamentFirstSpireoftheMinstrels =9363, - aaFundamentSecondSpireoftheMinstrels =9366, - aaFundamentThirdSpireoftheMinstrels =9369, - aaFundamentFirstSpireoftheSavageLord =9372, - aaFundamentSecondSpireoftheSavageLord =9375, - aaFundamentThirdSpireoftheSavageLord =9378, - aaFundamentFirstSpireofHoliness =9381, - aaFundamentSecondSpireofHoliness =9384, - aaFundamentThirdSpireofHoliness =9387, - aaFundamentFirstSpireoftheReavers =9390, - aaFundamentSecondSpireoftheReavers =9393, - aaFundamentThirdSpireoftheReavers =9396, - aaFundamentFirstSpireofthePathfinders =9399, - aaFundamentSecondSpireofthePathfinders =9402, - aaFundamentThirdSpireofthePathfinders =9405, - aaFundamentFirstSpireofDivinity =9408, - aaFundamentSecondSpireofDivinity =9411, - aaFundamentThirdSpireofDivinity =9414, - aaFundamentFirstSpireofNature =9417, - aaFundamentSecondSpireofNature =9420, - aaFundamentThirdSpireofNature =9423, - aaFundamentFirstSpireofAncestors =9426, - aaFundamentSecondSpireofAncestors =9429, - aaFundamentThirdSpireofAncestors =9432, - aaFundamentFirstSpireofSavagery =9435, - aaFundamentSecondSpireofSavagery =9438, - aaFundamentThirdSpireofSavagery =9441, - aaHastenedDirgeoftheSleepwalker =10329, - aaVaingloriousShout =10330, - aaLyreLeap =10331, - aaDominationMastery =10332, - aaLyricalPrankster =10333, - aaSelosKick =10336, - aaATuneStuckInYourHead =10339, - aaStonefoot =10340, - aaHastenedStunningKick =10343, - aaInfusionofThunder =10346, - aaChainsofPurity =10348, - aaProjectionofFury =10351, - aaProjectionofDoom =10352, - aaProjectionofPiety =10353, - aaGiftofLife =10354, - aaBlessingofLight =10355, - aaHastenedDivineIntervention =10358, - aaImprovedAtone =10364, - aaAgelessEnmity =10367, - aaCoverTracks =10368, - aaSpellCastingSubtlety3 =10370, - aaImprovedNaturalInvisibility =10373, - aaProtectionoftheWarder =10374, - aaNaturesSalve =10377, - aaFocusofAnimus =10380, - aaImbuedFerocity =10387, - aaNaturesReprieve =10388, - aaExtendedTrickery =10389, - aaAgelessEnmity2 =10392, - aaShacklesofTunare =10393, - aaBeaconoftheRighteous =10394, - aaBobbingCorpse =10395, - aaGroupSpiritoftheWhiteWolf =10396, - aaGroupSpiritoftheBlackWolf =10397, - aaSelfPreservation =10400, - aaHastenedFrenzy =10401, - aaExtendedHavoc =10404, - aaHastenedDeflectionDiscipline =10405, - aaRogueTripleAttackSkillupTest =10410, - aaHastenedHostoftheElements =10413, - aaEnhancedWallofWind =10421, - aaHandofRo =10424, - aaFixationofRo =10425, - aaPeacefulSpiritoftheWood =10426, - aaPeacefulConvergenceofSpirits =10427, - aaQuickenedArmyoftheDead =10434, - aaHealingFrenzy =10450, - aaOverpoweringStrikes =10453, - aaQuickenedBlessingofRessurection =10456, - aaHastenedAtonement =10459, - aaImprovedSanctuary =10462, - aaBlessingofSanctuary =10463, - aaHastenedCelestialHammer =10464, - aaQuickenedTurnUndead =10470, - aaSpiritofEagle =10500, - aaFlightofEagles =10501, - aaEgress =10502, - aaSpiritsofNature =10503, - aaWallofWind =10506, - aaHastenedSpiritoftheWood =10511, - aaHastenedConvergenceofSpirits =10514, - aaHastenedProjectionofFury =10519, - aaHastenedGutPunch =10522, - aaHastenedFirstSpireoftheWarlord =10527, - aaHastenedSecondSpireoftheWarlord =10532, - aaHastenedThirdSpireoftheWarlord =10537, - aaWillingCovenant =10542, - aaWarlordsResurgence =10545, - aaWarlordsFury =10546, - aaSurgeoftheVanquisher =10547, - aaImprovedShieldSpecialist =10548, - aaBeamofSlumber =10550, - aaPhantasmicReflex =10551, - aaHastenedSelfStasis =10558, - aaForcefulBanishment =10561, - aaHastenedBlastofAnger =10579, - aaHastenedFuriousLeap =10582, - aaHastenedGrapplingStrike =10588, - aaForceofElements =10600, - aaAspectofZomm =10601, - aaExtendedSharedHealth =10610, - aaFuriousRefrain =10627, - aaAgileFeet =10650, - aaHastenedDefensivePoses =10653, - aaExtendedImpenetrableDiscipline =10656, - aaHastenedDestructiveForce2 =10657, - aaMendingofBodyandSoul =10666, - aaLevant =10700, - aaReluctantBenevolence =10701, - aaValorousRage =10711, - aaHastenedGroupGuardianoftheForest =10714, - aaHastenedOutridersAttack =10719, - aaHastenedProtectionoftheSpiritWolf =10722, - aaHastenedImbuedFerocity =10727, - aaHastenedHarmoniousArrow =10730, - aaHastenedEntrap =10733, - aaPoisonArrows =10736, - aaBestowDivineAura2 =10752, - aaBlessingofPurification =10753, - aaSensetheDead =10754, - aaBlessingofRo =10789, - aaExtendedWildGrowth =10792, - aaHastenedCalloftheWild2 =10797, - aaHastenedAuspiceoftheHunter =10800, - aaClenchedJaw =10803, - aaScoutsMasteryofFire =10806, - aaScoutsMasteryofIce =10809, - aaScoutsMasteryofMagic =10812, - aaScoutsMasteryofSlashing =10815, - aaScoutsMasteryofPiercing =10818, - aaScoutsMasteryofBluntWeapons =10821, - aaMassiveStrike =10850, - aaStrikethrough2 =10853, - aaHatesAttraction =10900, - aaFeignedMinion2 =10903, - aaHastenedSummonRemains =10909, - aaVisageofDeath =10912, - aaCascadingTheftofLife2 =10915, - aaExtendedSloth =10950, - aaHastenedAncestralAid =10951, - aaHastenedUnionofSpirits =10954, - aaGroupShrink2 =10957, - aaInconspicuousTotem =10958, - aaExtendedPestilence =10959, - aaGroupSpiritWalk =10960, - aaHastenedTaunt =11000, - aaExtendedShieldReflect =11003, - aaExtendedCommandingVoice =11004, - aaHastenedLeap =11007, - aaRefundTest =11017, - aaHastenedDestruction =11050, - aaNetherstep =11055, - aaBeamofDisplacement =11056, - aaTranslocate =11057, - aaTeleport =11058, - aaPlayingPossum =11073, - aaCatlikeReflexes =11074, - aaHastenedBiteoftheAsp =11077, - aaHastenedGorillaSmash =11078, - aaHastenedRavensClaw =11079, - aaChameleonStrike =11080, - aaBearPatriarch =11081, - aaTwoHandsNoMercy =11085, - aaHastenedCryofBattle =11088, - aaTwinproc =12416, - aaTacticalMastery2 =12419, - aaGroupPerfectedLevitation =12422, - aaDoubleRiposte2 =12429, - aaHastenedForcefulRejuvenation =12430, - aaHastenedCompanionsBlessing =12478, - aaMysticalEcho =12489, - aaHastenedJoltingKicks =12500, - aaHastenedHatesAttraction =12582, - aaHastenedFrenziedStabbing =12600, - aaExtendedFrenziedStabbingDiscipline =12603, - aaSpeedoftheScoundrel =12606, - aaHastenedPinpoint =12607, - aaHastenedTwistedChanceDiscipline =12615, - aaVileEfficacy =12634, - aaImprovedDeathPeace =12635, - aaEyesWideOpen =12636, - aaCommunionoftheCheetah =12638, - aaExtendedConvergenceofSpirit =12645, - aaExtendedSpiritoftheWood =12646, - aaSpiritoftheBear =12651, - aaTwinheal =12652, - aaNaturesBlessing =12655, - aaNaturesFury =12661, - aaHastenedStormStrike =12664, - aaExtendedImpenetrableBarrier =12678, - aaExtendedHeelofKanji =12688, - aaExtendedScaledfist =12691, - aaFistsofSteel =12706, - aaExtendedDeftdance =12709, - aaHastenedDeftdance =12710, - aaHastenedLyreLeap =12713, - aaHastenedQuickTime =12716, - aaExtendedQuickTime =12719, - aaExtendedFierceEye =12720, - aaHastenedFierceEye =12721, - aaHastenedDanceofBlades =12727, - aaResoundingDirge =12737, - aaFreeze =12752, - aaShock =12753, - aaQuickenedArmyoftheDead2 =12763, - aaLRKBolt =12764, - aaExoblast =12765, - aaMercurialTorment =12766, - aaPestilentParalysis =12770, - aaHastenedDivineCompanionAura =12773, - aaEmbalmersCarapace =12778, - aaHastenedEncroachingDarkness =12779, - aaExpandingDarkness =12782, - aaAegisofKildrukaun =12785, - aaBestialBloodrage =12804, - aaCompanionsSacrifice =12807, - aaExtendedFeralgia =12816, - aaHastenedProtectiveSpirit =12819, - aaHastenedEmpathicFury =12822, - aaWardersGemination =12825, - aaQuickenedParagonofSpirit =12831, - aaWardersGift =12837, - aaGelidRending =12846, - aaQuickenedNaturesSalve =12849, - aaImprovedWardofDestruction =12852, - aaAbscond =12864, - aaAtolsUnresistableShackles =12865, - aaDimensionalShield =12866, - aaImprovedSustainedDestruction =12867, - aaHastenedHarvestofDruzzil =12881, - aaSurvivaloftheFelicitous =12884, - aaConcussiveIntuition =12885, - aaEcisIcyBlessing =12886, - aaRosFieryBlessing =12887, - aaDruzzilsMysticalBlessing =12888, - aaKerafyrmsFavor =12889, - aaKerafyrmsFavor2 =12890, - aaKerafyrmsPrismaticFamiliar =12892, - aaImprovedTwincast =12893, - aaHastenedPhantasmalOpponent =12894, - aaHastenedFirstSpireofEnchantment =12902, - aaHastenedSecondSpireofEnchantment =12907, - aaHastenedThirdSpireofEnchantment =12912, - aaProfoundVisage =12920, - aaBeguilersBanishment =12923, - aaExtendedPacification =12926, - aaCalculatedInsanity =12931, - aaCripplingAurora =12937, - aaMentalContortion =12938, - aaGlyphSpray =12939, - aaEtherealYield =12940, - aaDiminutiveCompanion =12941, - aaElementalSpellFury =12960, - aaSmallModulationShard =12963, - aaMediumModulationShard =12964, - aaLargeModulationShard =12965, - aaHastenedMalosinete =12968, - aaShieldoftheElements =12971, - aaExtendedMalosinete =12977, - aaExtendedPestilence2 =12988, - aaArmorofAncestralSpirits =12989, - aaGroupPactoftheWolf =12992, - aaHastenedInconspicuousTotem =13001, - aaPurifiedSpirits =13004, - aaGroupSpiritWalk2 =13008, - aaGroupSilentPresence =13009, - aaHastenedCannibalization =13010, - aaHastenedSpiritChanneling =13013, - aaVengefulSpirits =13017, - aaCripplingApparition =13020, - aaHastenedSelfPreservation =13055, - aaBindingAxe =13065, - aaAgonyofAbsolution =13066, - aaHastenedAbsolution =13067, - aaGiftofDreamlikeExquisiteRadiantMana =13090, - aaLingeringDeath =13096, - aaMarrsSalvation =13100, - aaBlessingoftheFaithful =13101, - aaUnbridledStrikeofFear =13108, - aaHastenedForcefulRejuvenation2 =13129, - aaMovingMountains =13130, - aaQuickenedTerrors =13132, - aaBattleFrenzy =13134, - aaQuickenedDivineAvatar =13137, - aaQuickenedSilentCasting =13143, - aaQuickenedSilentCasting2 =13146, - aaBalefireBurst =13164, - aaExplosionofSpite =13165, - aaHastenedExplosionofHatred =13166, - aaHowloftheWarlord =13169, - aaLeapofFaith =13202, - aaHastenedTuneInYourHead =13204, - aaBloodfury =13224, - aaScentofTerris =13225, - aaDrearyDeeds =13252, - aaEnchantFeymetal =13260, - aaMassEnchantFeymetal =13261, - aaPoke =13268, - aaReplicate =13269, - aaInsight =13270, - aaEnchantAlaranMetal =13271, - aaMassEnchantAlaranMetal =13272, - aaLifetap =13274, - aaGiftofAscendantExquisiteRadiantMana =13294, - aaDivineGuardian =13385, - aaDivinePeace =13388, - aaYaulp =13389, - aaHastenedPurifiedSpirits =13416, - aaSwarmofFireflies =13419, - aaHastenedProjectionofFury2 =13441, - aaBladeGuardian =13444, - aaHastenedPossum =13449, - aaHastenedWardersGift =13463, - aaHastenedCompanionsSacrifice =13474, - aaCheetahsPounce =13483, - aaBloodlust =13484, - aaPrimalFury =13485, - aaShaurisSonoriousClouding =13527, - aaSonicDisplacement =13528, - aaLureoftheSirensSong =13529, - aaGlacialArrow =13549, - aaConvergenceofSpirits2 =13556, - aaHastenedOutridersAccuracy =13565, - aaHastenedOutridersEvasion =13568, - aaGraspofSylvanSpirits =13571, - aaBloodthirstyBlade =13616, - aaEnlightenedFocusofArcanum =13646, - aaExtendedSilentCasting =13667, - aaFuryofKerafyrm =13670, - aaHallowedSteed =13673, - aaWickedSteed =13674, - aaEmbalmersCarapace2 =13678, - aaMirroredPestilence =13684, - aaEmbraceTheDecay =13687, - aaQuickenedScentofTerris =13689, - aaFrenzyoftheDead =13693, - aaElementalUnion =13695, - aaCalculatedInsanity2 =13729, - aaHastenedCalculatedInsanity =13753, - aaHastenedMentalContortion =13758, - aaHastenedCripplingAurora =13764, - aaGlyphofIndeterminableReward =13788, - aaRoguesFury2 =13792, - aaPoisonousPerfection =13801, - aaDistantStrike =13844, - aaWarCryoftheBraxi =13872, - aaHastenedJuggernautSurge =13873, - aaHastenedResilience =13878, - aaHastenedBloodPact =13881, - aaHastenedFivePointPalm =13889, - aaPhalanxofOne =13900, - aaHastenedFlashofAnger =13905, - aaHastenedBazuRoar =13908, - aaHastenedScowl =13911, - aaHastenedMarkoftheMageHunter =13917, - aaVeiledStrength =13933, - aaVeiledFortitude =13943, - aaVeiledRapidity =13953, - aaVeiledCunning =13963, - aaVeiledAcumen =13973, - aaVeiledBrilliance =13983, - aaVeiledAllure =13993, - aaRestorationofLife =14010, - aaHastenedBeaconoftheRighteous =14011, - aaKnowledgeofAlaranCulture =14017, - aaKnowledgeofAlaranCultureAdvanced =14018, - aaBraceForImpact =14019, - aaMercilessBlade =14026, - aaCombatantsPact =14029, - aaWarlordsResolve =14032, - aaHastenedWarlordsBravery =14037, - aaHastenedWarlordsTenacity =14040, - aaHastenedLeechTouch =14046, - aaBonyGraspofDeath =14051, - aaThoughtLeech =14052, - aaHastenedLeechcurseDiscipline =14056, - aaHastenedUnholyAuraDiscipline =14059, - aaHastenedHarmshield =14062, - aaHastenedProjectionofDoom =14065, - aaHastenedProjectionofPiety =14068, - aaShieldofBrilliance =14071, - aaShieldofBrilliance2 =14072, - aaHastenedSanctificationDiscipline =14076, - aaSpeedoftheSavior =14080, - aaDivineCall =14081, - aaHastenedLeapofFaith =14085, - aaHastenedMarrsSalvation =14088, - aaHastenedArmoroftheInquisitor =14091, - aaQuickenedStuns =14100, - aaExtendedOutridersAttack =14115, - aaEtheriumBlades =14129, - aaHastenedAssassinationDisciplines =14135, - aaCunningDisguiseShissar =14139, - aaScoutsMasteryofPiercing2 =14141, - aaExtendedEnvenomedBlades =14144, - aaHastenedSpeedFocus =14148, - aaHeelofBrithrax =14151, - aaPressurePoints =14157, - aaHastenedZanFisWhistle =14160, - aaExtendedZanFisWhistle =14163, - aaHastenedThunder2 =14166, - aaHastenedThousandBlades =14169, - aaHastenedTuneStuckInYourHead =14176, - aaExtendedDanceofBlades =14179, - aaExtendedThousandBlades =14180, - aaAllegrettoofBattle =14181, - aaVivaceofConflict =14186, - aaNoteworthyDisguiseDrake =14192, - aaBulwarkofBlades =14193, - aaDecapitation =14200, - aaHastenedBerserkingDisciplines =14203, - aaQuietMiracle =14206, - aaRepeltheWicked =14207, - aaBeaconofLife =14208, - aaBlessedChains =14209, - aaHastenedFocusedCelestialRegeneration =14213, - aaShrink =14224, - aaQuickenedSpiritCalling =14225, - aaQuickenedCalloftheWild2 =14228, - aaSpiritualRebuke =14231, - aaPathosis =14232, - aaPreincarnation =14233, - aaSpiritualBlessing =14234, - aaHastenedNaturesFury =14241, - aaWrathoftheForestWalker =14244, - aaGiftofSylvanSpirits =14249, - aaExtendedVinelashCascade =14254, - aaExtendedSpiritoftheBear =14259, - aaVeiloftheUnderbrush =14262, - aaParalyticSpores =14264, - aaHiddenCommunionoftheCheetah =14265, - aaSteadfastResolve =14275, - aaExtendedGroupBestialAlignment =14278, - aaGroupPerfectedInvisibilitytoUndead2 =14281, - aaPerfectedInvisibilitytoUndead =14282, - aaQuickenedStasis =14283, - aaExtendedDrearyDeeds =14286, - aaQuickenedFrenziedBurnout =14289, - aaQuickenedHostoftheElements =14292, - aaHastenedCompanionsRelocation =14295, - aaModulationSpecialist =14298, - aaStaffBlock =14301, - aaHastenedDrapeofShadows =14304, - aaVirulentTalon =14307, - aaHastenedPestilentParalysis =14308, - aaHastenedMercurialTorment =14311, - aaHastenedWhisperwind =14314, - aaQuickenedScentofTerris2 =14316, - aaQuickenedDeathBloom =14318, - aaDeathsMalaise =14321, - aaDyingGrasp =14322, - aaAHoleInSpace =14323, - aaHastenedForceofWill =14328, - aaHastenedImprovedTwincast =14331, - aaHastenedNightmareStasis =14341, - aaScintillatingBeam =14346, - aaConvergence =14358, - aaGiftofDeathlyResolve =14359, - aaFuneralPyre =14360, - aaHastenedEldritchRune =14364, - aaHerosBarracks =14367, - aaHerosBarracks2 =14368, - aaHerosBarracks3 =14369, - aaHerosBarracks4 =14370, - aaSummonTomeoftheHerosJourney =14371, + aaSpellCastingReinforcementArtistry =8262, + aaEarthenBrawn =8263, + aaEarthenStability =8268, + aaEarthenAlacrity =8273, + aaEarthenArtistry =8278, + aaEarthenSagacity =8283, + aaEarthenBrilliance =8288, + aaEarthenAllure =8293, + aaResplendentGlory =8300, + aaRageofRallosZek =8303, + aaEnhancedAreaTaunt =8312, + aaFluidMarch =8314, + aaHastenedSelosKick =8317, + aaHastenedBellow =8319, + aaBelltoneMind =8322, + aaSubtleBlows =8325, + aaLitheBody =8330, + aaEnhancedThiefsEyes =8331, + aaExtendedLanguidBite =8332, + aaQuickenedMalosinete =8335, + aaDrapeofShadows =8341, + aaHostintheShell =8342, + aaHastenedManaDraw =8347, + aaHastenedMezmerization =8350, + aaDreamlikeMight =8351, + aaDreamlikeFortitude =8361, + aaDreamlikeSwiftness =8371, + aaDreamlikeCunning =8381, + aaDreamlikeSapience =8391, + aaArmorRend =8400, + aaFundamentofIntellect =9100, + aaSongwriting =9101, + aaFundamentofIntellect2 =9109, + aaHybridResearch =9111, + aaFundamentofIntellect3 =9118, + aaWrittenPrayer =9121, + aaFundamentofIntellect4 =9127, + aaFundamentofWisdom =9136, + aaFundamentofWisdom2 =9145, + aaFundamentofWisdom3 =9154, + aaFundamentofPower =9163, + aaFundamentofPower2 =9172, + aaFundamentofPower3 =9181, + aaFundamentofPower4 =9190, + aaFundamentofPower5 =9199, + aaFundamentofCombat =9208, + aaFundamentofCombat2 =9217, + aaFundamentofCombat3 =9226, + aaFundamentofCombat4 =9235, + aaFundamentFirstSpireofArcanum =9300, + aaFundamentSecondSpireofArcanum =9303, + aaFundamentThirdSpireofArcanum =9306, + aaFundamentFirstSpireoftheSensei =9309, + aaFundamentSecondSpireoftheSensei =9312, + aaFundamentThirdSpireoftheSensei =9315, + aaFundamentFirstSpireoftheElements =9318, + aaFundamentSecondSpireoftheElements =9321, + aaFundamentThirdSpireoftheElements =9324, + aaFundamentFirstSpireofEnchantment =9327, + aaFundamentSecondSpireofEnchantment =9330, + aaFundamentThirdSpireofEnchantment =9333, + aaFundamentFirstSpireofNecromancy =9336, + aaFundamentSecondSpireofNecromancy =9339, + aaFundamentThirdSpireofNecromancy =9342, + aaFundamentFirstSpireoftheWarlord =9345, + aaFundamentSecondSpireoftheWarlord =9348, + aaFundamentThirdSpireoftheWarlord =9351, + aaFundamentFirstSpireoftheRake =9354, + aaFundamentSecondSpireoftheRake =9357, + aaFundamentThirdSpireoftheRake =9360, + aaFundamentFirstSpireoftheMinstrels =9363, + aaFundamentSecondSpireoftheMinstrels =9366, + aaFundamentThirdSpireoftheMinstrels =9369, + aaFundamentFirstSpireoftheSavageLord =9372, + aaFundamentSecondSpireoftheSavageLord =9375, + aaFundamentThirdSpireoftheSavageLord =9378, + aaFundamentFirstSpireofHoliness =9381, + aaFundamentSecondSpireofHoliness =9384, + aaFundamentThirdSpireofHoliness =9387, + aaFundamentFirstSpireoftheReavers =9390, + aaFundamentSecondSpireoftheReavers =9393, + aaFundamentThirdSpireoftheReavers =9396, + aaFundamentFirstSpireofthePathfinders =9399, + aaFundamentSecondSpireofthePathfinders =9402, + aaFundamentThirdSpireofthePathfinders =9405, + aaFundamentFirstSpireofDivinity =9408, + aaFundamentSecondSpireofDivinity =9411, + aaFundamentThirdSpireofDivinity =9414, + aaFundamentFirstSpireofNature =9417, + aaFundamentSecondSpireofNature =9420, + aaFundamentThirdSpireofNature =9423, + aaFundamentFirstSpireofAncestors =9426, + aaFundamentSecondSpireofAncestors =9429, + aaFundamentThirdSpireofAncestors =9432, + aaFundamentFirstSpireofSavagery =9435, + aaFundamentSecondSpireofSavagery =9438, + aaFundamentThirdSpireofSavagery =9441, + aaHastenedDirgeoftheSleepwalker =10329, + aaVaingloriousShout =10330, + aaLyreLeap =10331, + aaDominationMastery =10332, + aaLyricalPrankster =10333, + aaSelosKick =10336, + aaATuneStuckInYourHead =10339, + aaStonefoot =10340, + aaHastenedStunningKick =10343, + aaInfusionofThunder =10346, + aaChainsofPurity =10348, + aaProjectionofFury =10351, + aaProjectionofDoom =10352, + aaProjectionofPiety =10353, + aaGiftofLife =10354, + aaBlessingofLight =10355, + aaHastenedDivineIntervention =10358, + aaImprovedAtone =10364, + aaAgelessEnmity =10367, + aaCoverTracks =10368, + aaSpellCastingSubtlety3 =10370, + aaImprovedNaturalInvisibility =10373, + aaProtectionoftheWarder =10374, + aaNaturesSalve =10377, + aaFocusofAnimus =10380, + aaImbuedFerocity =10387, + aaNaturesReprieve =10388, + aaExtendedTrickery =10389, + aaAgelessEnmity2 =10392, + aaShacklesofTunare =10393, + aaBeaconoftheRighteous =10394, + aaBobbingCorpse =10395, + aaGroupSpiritoftheWhiteWolf =10396, + aaGroupSpiritoftheBlackWolf =10397, + aaSelfPreservation =10400, + aaHastenedFrenzy =10401, + aaExtendedHavoc =10404, + aaHastenedDeflectionDiscipline =10405, + aaRogueTripleAttackSkillupTest =10410, + aaHastenedHostoftheElements =10413, + aaEnhancedWallofWind =10421, + aaHandofRo =10424, + aaFixationofRo =10425, + aaPeacefulSpiritoftheWood =10426, + aaPeacefulConvergenceofSpirits =10427, + aaQuickenedArmyoftheDead =10434, + aaHealingFrenzy =10450, + aaOverpoweringStrikes =10453, + aaQuickenedBlessingofRessurection =10456, + aaHastenedAtonement =10459, + aaImprovedSanctuary =10462, + aaBlessingofSanctuary =10463, + aaHastenedCelestialHammer =10464, + aaQuickenedTurnUndead =10470, + aaSpiritofEagle =10500, + aaFlightofEagles =10501, + aaEgress =10502, + aaSpiritsofNature =10503, + aaWallofWind =10506, + aaHastenedSpiritoftheWood =10511, + aaHastenedConvergenceofSpirits =10514, + aaHastenedProjectionofFury =10519, + aaHastenedGutPunch =10522, + aaHastenedFirstSpireoftheWarlord =10527, + aaHastenedSecondSpireoftheWarlord =10532, + aaHastenedThirdSpireoftheWarlord =10537, + aaWillingCovenant =10542, + aaWarlordsResurgence =10545, + aaWarlordsFury =10546, + aaSurgeoftheVanquisher =10547, + aaImprovedShieldSpecialist =10548, + aaBeamofSlumber =10550, + aaPhantasmicReflex =10551, + aaHastenedSelfStasis =10558, + aaForcefulBanishment =10561, + aaHastenedBlastofAnger =10579, + aaHastenedFuriousLeap =10582, + aaHastenedGrapplingStrike =10588, + aaForceofElements =10600, + aaAspectofZomm =10601, + aaExtendedSharedHealth =10610, + aaFuriousRefrain =10627, + aaAgileFeet =10650, + aaHastenedDefensivePoses =10653, + aaExtendedImpenetrableDiscipline =10656, + aaHastenedDestructiveForce2 =10657, + aaMendingofBodyandSoul =10666, + aaLevant =10700, + aaReluctantBenevolence =10701, + aaValorousRage =10711, + aaHastenedGroupGuardianoftheForest =10714, + aaHastenedOutridersAttack =10719, + aaHastenedProtectionoftheSpiritWolf =10722, + aaHastenedImbuedFerocity =10727, + aaHastenedHarmoniousArrow =10730, + aaHastenedEntrap =10733, + aaPoisonArrows =10736, + aaBestowDivineAura2 =10752, + aaBlessingofPurification =10753, + aaSensetheDead =10754, + aaBlessingofRo =10789, + aaExtendedWildGrowth =10792, + aaHastenedCalloftheWild2 =10797, + aaHastenedAuspiceoftheHunter =10800, + aaClenchedJaw =10803, + aaScoutsMasteryofFire =10806, + aaScoutsMasteryofIce =10809, + aaScoutsMasteryofMagic =10812, + aaScoutsMasteryofSlashing =10815, + aaScoutsMasteryofPiercing =10818, + aaScoutsMasteryofBluntWeapons =10821, + aaMassiveStrike =10850, + aaStrikethrough2 =10853, + aaHatesAttraction =10900, + aaFeignedMinion2 =10903, + aaHastenedSummonRemains =10909, + aaVisageofDeath =10912, + aaCascadingTheftofLife2 =10915, + aaExtendedSloth =10950, + aaHastenedAncestralAid =10951, + aaHastenedUnionofSpirits =10954, + aaGroupShrink2 =10957, + aaInconspicuousTotem =10958, + aaExtendedPestilence =10959, + aaGroupSpiritWalk =10960, + aaHastenedTaunt =11000, + aaExtendedShieldReflect =11003, + aaExtendedCommandingVoice =11004, + aaHastenedLeap =11007, + aaRefundTest =11017, + aaHastenedDestruction =11050, + aaNetherstep =11055, + aaBeamofDisplacement =11056, + aaTranslocate =11057, + aaTeleport =11058, + aaPlayingPossum =11073, + aaCatlikeReflexes =11074, + aaHastenedBiteoftheAsp =11077, + aaHastenedGorillaSmash =11078, + aaHastenedRavensClaw =11079, + aaChameleonStrike =11080, + aaBearPatriarch =11081, + aaTwoHandsNoMercy =11085, + aaHastenedCryofBattle =11088, + aaTwinproc =12416, + aaTacticalMastery2 =12419, + aaGroupPerfectedLevitation =12422, + aaDoubleRiposte2 =12429, + aaHastenedForcefulRejuvenation =12430, + aaHastenedCompanionsBlessing =12478, + aaMysticalEcho =12489, + aaHastenedJoltingKicks =12500, + aaHastenedHatesAttraction =12582, + aaHastenedFrenziedStabbing =12600, + aaExtendedFrenziedStabbingDiscipline =12603, + aaSpeedoftheScoundrel =12606, + aaHastenedPinpoint =12607, + aaHastenedTwistedChanceDiscipline =12615, + aaVileEfficacy =12634, + aaImprovedDeathPeace =12635, + aaEyesWideOpen =12636, + aaCommunionoftheCheetah =12638, + aaExtendedConvergenceofSpirit =12645, + aaExtendedSpiritoftheWood =12646, + aaSpiritoftheBear =12651, + aaTwinheal =12652, + aaNaturesBlessing =12655, + aaNaturesFury =12661, + aaHastenedStormStrike =12664, + aaExtendedImpenetrableBarrier =12678, + aaExtendedHeelofKanji =12688, + aaExtendedScaledfist =12691, + aaFistsofSteel =12706, + aaExtendedDeftdance =12709, + aaHastenedDeftdance =12710, + aaHastenedLyreLeap =12713, + aaHastenedQuickTime =12716, + aaExtendedQuickTime =12719, + aaExtendedFierceEye =12720, + aaHastenedFierceEye =12721, + aaHastenedDanceofBlades =12727, + aaResoundingDirge =12737, + aaFreeze =12752, + aaShock =12753, + aaQuickenedArmyoftheDead2 =12763, + aaLRKBolt =12764, + aaExoblast =12765, + aaMercurialTorment =12766, + aaPestilentParalysis =12770, + aaHastenedDivineCompanionAura =12773, + aaEmbalmersCarapace =12778, + aaHastenedEncroachingDarkness =12779, + aaExpandingDarkness =12782, + aaAegisofKildrukaun =12785, + aaBestialBloodrage =12804, + aaCompanionsSacrifice =12807, + aaExtendedFeralgia =12816, + aaHastenedProtectiveSpirit =12819, + aaHastenedEmpathicFury =12822, + aaWardersGemination =12825, + aaQuickenedParagonofSpirit =12831, + aaWardersGift =12837, + aaGelidRending =12846, + aaQuickenedNaturesSalve =12849, + aaImprovedWardofDestruction =12852, + aaAbscond =12864, + aaAtolsUnresistableShackles =12865, + aaDimensionalShield =12866, + aaImprovedSustainedDestruction =12867, + aaHastenedHarvestofDruzzil =12881, + aaSurvivaloftheFelicitous =12884, + aaConcussiveIntuition =12885, + aaEcisIcyBlessing =12886, + aaRosFieryBlessing =12887, + aaDruzzilsMysticalBlessing =12888, + aaKerafyrmsFavor =12889, + aaKerafyrmsFavor2 =12890, + aaKerafyrmsPrismaticFamiliar =12892, + aaImprovedTwincast =12893, + aaHastenedPhantasmalOpponent =12894, + aaHastenedFirstSpireofEnchantment =12902, + aaHastenedSecondSpireofEnchantment =12907, + aaHastenedThirdSpireofEnchantment =12912, + aaProfoundVisage =12920, + aaBeguilersBanishment =12923, + aaExtendedPacification =12926, + aaCalculatedInsanity =12931, + aaCripplingAurora =12937, + aaMentalContortion =12938, + aaGlyphSpray =12939, + aaEtherealYield =12940, + aaDiminutiveCompanion =12941, + aaElementalSpellFury =12960, + aaSmallModulationShard =12963, + aaMediumModulationShard =12964, + aaLargeModulationShard =12965, + aaHastenedMalosinete =12968, + aaShieldoftheElements =12971, + aaExtendedMalosinete =12977, + aaExtendedPestilence2 =12988, + aaArmorofAncestralSpirits =12989, + aaGroupPactoftheWolf =12992, + aaHastenedInconspicuousTotem =13001, + aaPurifiedSpirits =13004, + aaGroupSpiritWalk2 =13008, + aaGroupSilentPresence =13009, + aaHastenedCannibalization =13010, + aaHastenedSpiritChanneling =13013, + aaVengefulSpirits =13017, + aaCripplingApparition =13020, + aaHastenedSelfPreservation =13055, + aaBindingAxe =13065, + aaAgonyofAbsolution =13066, + aaHastenedAbsolution =13067, + aaGiftofDreamlikeExquisiteRadiantMana =13090, + aaLingeringDeath =13096, + aaMarrsSalvation =13100, + aaBlessingoftheFaithful =13101, + aaUnbridledStrikeofFear =13108, + aaHastenedForcefulRejuvenation2 =13129, + aaMovingMountains =13130, + aaQuickenedTerrors =13132, + aaBattleFrenzy =13134, + aaQuickenedDivineAvatar =13137, + aaQuickenedSilentCasting =13143, + aaQuickenedSilentCasting2 =13146, + aaBalefireBurst =13164, + aaExplosionofSpite =13165, + aaHastenedExplosionofHatred =13166, + aaHowloftheWarlord =13169, + aaLeapofFaith =13202, + aaHastenedTuneInYourHead =13204, + aaBloodfury =13224, + aaScentofTerris =13225, + aaDrearyDeeds =13252, + aaEnchantFeymetal =13260, + aaMassEnchantFeymetal =13261, + aaPoke =13268, + aaReplicate =13269, + aaInsight =13270, + aaEnchantAlaranMetal =13271, + aaMassEnchantAlaranMetal =13272, + aaLifetap =13274, + aaGiftofAscendantExquisiteRadiantMana =13294, + aaDivineGuardian =13385, + aaDivinePeace =13388, + aaYaulp =13389, + aaHastenedPurifiedSpirits =13416, + aaSwarmofFireflies =13419, + aaHastenedProjectionofFury2 =13441, + aaBladeGuardian =13444, + aaHastenedPossum =13449, + aaHastenedWardersGift =13463, + aaHastenedCompanionsSacrifice =13474, + aaCheetahsPounce =13483, + aaBloodlust =13484, + aaPrimalFury =13485, + aaShaurisSonoriousClouding =13527, + aaSonicDisplacement =13528, + aaLureoftheSirensSong =13529, + aaGlacialArrow =13549, + aaConvergenceofSpirits2 =13556, + aaHastenedOutridersAccuracy =13565, + aaHastenedOutridersEvasion =13568, + aaGraspofSylvanSpirits =13571, + aaBloodthirstyBlade =13616, + aaEnlightenedFocusofArcanum =13646, + aaExtendedSilentCasting =13667, + aaFuryofKerafyrm =13670, + aaHallowedSteed =13673, + aaWickedSteed =13674, + aaEmbalmersCarapace2 =13678, + aaMirroredPestilence =13684, + aaEmbraceTheDecay =13687, + aaQuickenedScentofTerris =13689, + aaFrenzyoftheDead =13693, + aaElementalUnion =13695, + aaCalculatedInsanity2 =13729, + aaHastenedCalculatedInsanity =13753, + aaHastenedMentalContortion =13758, + aaHastenedCripplingAurora =13764, + aaGlyphofIndeterminableReward =13788, + aaRoguesFury2 =13792, + aaPoisonousPerfection =13801, + aaDistantStrike =13844, + aaWarCryoftheBraxi =13872, + aaHastenedJuggernautSurge =13873, + aaHastenedResilience =13878, + aaHastenedBloodPact =13881, + aaHastenedFivePointPalm =13889, + aaPhalanxofOne =13900, + aaHastenedFlashofAnger =13905, + aaHastenedBazuRoar =13908, + aaHastenedScowl =13911, + aaHastenedMarkoftheMageHunter =13917, + aaVeiledStrength =13933, + aaVeiledFortitude =13943, + aaVeiledRapidity =13953, + aaVeiledCunning =13963, + aaVeiledAcumen =13973, + aaVeiledBrilliance =13983, + aaVeiledAllure =13993, + aaRestorationofLife =14010, + aaHastenedBeaconoftheRighteous =14011, + aaKnowledgeofAlaranCulture =14017, + aaKnowledgeofAlaranCultureAdvanced =14018, + aaBraceForImpact =14019, + aaMercilessBlade =14026, + aaCombatantsPact =14029, + aaWarlordsResolve =14032, + aaHastenedWarlordsBravery =14037, + aaHastenedWarlordsTenacity =14040, + aaHastenedLeechTouch =14046, + aaBonyGraspofDeath =14051, + aaThoughtLeech =14052, + aaHastenedLeechcurseDiscipline =14056, + aaHastenedUnholyAuraDiscipline =14059, + aaHastenedHarmshield =14062, + aaHastenedProjectionofDoom =14065, + aaHastenedProjectionofPiety =14068, + aaShieldofBrilliance =14071, + aaShieldofBrilliance2 =14072, + aaHastenedSanctificationDiscipline =14076, + aaSpeedoftheSavior =14080, + aaDivineCall =14081, + aaHastenedLeapofFaith =14085, + aaHastenedMarrsSalvation =14088, + aaHastenedArmoroftheInquisitor =14091, + aaQuickenedStuns =14100, + aaExtendedOutridersAttack =14115, + aaEtheriumBlades =14129, + aaHastenedAssassinationDisciplines =14135, + aaCunningDisguiseShissar =14139, + aaScoutsMasteryofPiercing2 =14141, + aaExtendedEnvenomedBlades =14144, + aaHastenedSpeedFocus =14148, + aaHeelofBrithrax =14151, + aaPressurePoints =14157, + aaHastenedZanFisWhistle =14160, + aaExtendedZanFisWhistle =14163, + aaHastenedThunder2 =14166, + aaHastenedThousandBlades =14169, + aaHastenedTuneStuckInYourHead =14176, + aaExtendedDanceofBlades =14179, + aaExtendedThousandBlades =14180, + aaAllegrettoofBattle =14181, + aaVivaceofConflict =14186, + aaNoteworthyDisguiseDrake =14192, + aaBulwarkofBlades =14193, + aaDecapitation =14200, + aaHastenedBerserkingDisciplines =14203, + aaQuietMiracle =14206, + aaRepeltheWicked =14207, + aaBeaconofLife =14208, + aaBlessedChains =14209, + aaHastenedFocusedCelestialRegeneration =14213, + aaShrink =14224, + aaQuickenedSpiritCalling =14225, + aaQuickenedCalloftheWild2 =14228, + aaSpiritualRebuke =14231, + aaPathosis =14232, + aaPreincarnation =14233, + aaSpiritualBlessing =14234, + aaHastenedNaturesFury =14241, + aaWrathoftheForestWalker =14244, + aaGiftofSylvanSpirits =14249, + aaExtendedVinelashCascade =14254, + aaExtendedSpiritoftheBear =14259, + aaVeiloftheUnderbrush =14262, + aaParalyticSpores =14264, + aaHiddenCommunionoftheCheetah =14265, + aaSteadfastResolve =14275, + aaExtendedGroupBestialAlignment =14278, + aaGroupPerfectedInvisibilitytoUndead2 =14281, + aaPerfectedInvisibilitytoUndead =14282, + aaQuickenedStasis =14283, + aaExtendedDrearyDeeds =14286, + aaQuickenedFrenziedBurnout =14289, + aaQuickenedHostoftheElements =14292, + aaHastenedCompanionsRelocation =14295, + aaModulationSpecialist =14298, + aaStaffBlock =14301, + aaHastenedDrapeofShadows =14304, + aaVirulentTalon =14307, + aaHastenedPestilentParalysis =14308, + aaHastenedMercurialTorment =14311, + aaHastenedWhisperwind =14314, + aaQuickenedScentofTerris2 =14316, + aaQuickenedDeathBloom =14318, + aaDeathsMalaise =14321, + aaDyingGrasp =14322, + aaAHoleInSpace =14323, + aaHastenedForceofWill =14328, + aaHastenedImprovedTwincast =14331, + aaHastenedNightmareStasis =14341, + aaScintillatingBeam =14346, + aaConvergence =14358, + aaGiftofDeathlyResolve =14359, + aaFuneralPyre =14360, + aaHastenedEldritchRune =14364, + aaHerosBarracks =14367, + aaHerosBarracks2 =14368, + aaHerosBarracks3 =14369, + aaHerosBarracks4 =14370, + aaSummonTomeoftheHerosJourney =14371, aaHighestID //this should always be last, and should always //follow the highest AA ID diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 6f3ad68ee..7f45b1c06 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -1,155 +1,155 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(zone_sources - AA.cpp - aggro.cpp - attack.cpp - beacon.cpp - bonuses.cpp - bot.cpp - botspellsai.cpp - client.cpp - client_logs.cpp - client_mods.cpp - client_packet.cpp - client_process.cpp - command.cpp - doors.cpp - effects.cpp - embparser.cpp - embperl.cpp - embxs.cpp - entity.cpp - exp.cpp - fearpath.cpp - forage.cpp - groups.cpp - guild.cpp - guild_mgr.cpp - hate_list.cpp - horse.cpp - inventory.cpp - loottables.cpp - Map.cpp - merc.cpp - mob.cpp - MobAI.cpp - net.cpp - npc.cpp - NpcAI.cpp - Object.cpp - parser.cpp - pathing.cpp - perl_client.cpp - perl_doors.cpp - perl_entity.cpp - perl_groups.cpp - perl_hateentry.cpp - perl_mob.cpp - perl_npc.cpp - perl_object.cpp - perl_perlpacket.cpp - perl_PlayerCorpse.cpp - perl_questitem.cpp - perl_raids.cpp - perlpacket.cpp - perlparser.cpp - petitions.cpp - pets.cpp - PlayerCorpse.cpp - QGlobals.cpp - questmgr.cpp - QuestParserCollection.cpp - raids.cpp - spawn2.cpp - spawn2.h - spawngroup.cpp - special_attacks.cpp - spell_effects.cpp - spells.cpp - tasks.cpp - titles.cpp - tradeskills.cpp - trading.cpp - trap.cpp - tribute.cpp - updatemgr.cpp - watermap.cpp - waypoints.cpp - worldserver.cpp - zone.cpp - zone_logsys.cpp - zone_profile.cpp - ZoneConfig.cpp - zonedb.cpp - zonedbasync.cpp - zoning.cpp + AA.cpp + aggro.cpp + attack.cpp + beacon.cpp + bonuses.cpp + bot.cpp + botspellsai.cpp + client.cpp + client_logs.cpp + client_mods.cpp + client_packet.cpp + client_process.cpp + command.cpp + doors.cpp + effects.cpp + embparser.cpp + embperl.cpp + embxs.cpp + entity.cpp + exp.cpp + fearpath.cpp + forage.cpp + groups.cpp + guild.cpp + guild_mgr.cpp + hate_list.cpp + horse.cpp + inventory.cpp + loottables.cpp + Map.cpp + merc.cpp + mob.cpp + MobAI.cpp + net.cpp + npc.cpp + NpcAI.cpp + Object.cpp + parser.cpp + pathing.cpp + perl_client.cpp + perl_doors.cpp + perl_entity.cpp + perl_groups.cpp + perl_hateentry.cpp + perl_mob.cpp + perl_npc.cpp + perl_object.cpp + perl_perlpacket.cpp + perl_PlayerCorpse.cpp + perl_questitem.cpp + perl_raids.cpp + perlpacket.cpp + perlparser.cpp + petitions.cpp + pets.cpp + PlayerCorpse.cpp + QGlobals.cpp + questmgr.cpp + QuestParserCollection.cpp + raids.cpp + spawn2.cpp + spawn2.h + spawngroup.cpp + special_attacks.cpp + spell_effects.cpp + spells.cpp + tasks.cpp + titles.cpp + tradeskills.cpp + trading.cpp + trap.cpp + tribute.cpp + updatemgr.cpp + watermap.cpp + waypoints.cpp + worldserver.cpp + zone.cpp + zone_logsys.cpp + zone_profile.cpp + ZoneConfig.cpp + zonedb.cpp + zonedbasync.cpp + zoning.cpp mod_functions.cpp ) SET(zone_headers - AA.h - basic_functions.h - beacon.h - bot.h - botStructs.h - client.h - client_logs.h - client_packet.h - command.h - common.h - doors.h - embparser.h - embperl.h - embxs.h - entity.h - errmsg.h - event_codes.h - forage.h - groups.h - guild_mgr.h - hate_list.h - horse.h - map.h - masterentity.h - maxskill.h - message.h - merc.h - mob.h - net.h - npc.h - NpcAI.h - object.h - parser.h - pathing.h - perlpacket.h - perlparser.h - petitions.h - pets.h - PlayerCorpse.h - QGlobals.h - QuestInterface.h - questmgr.h - QuestParserCollection.h - raid.h - raids.h - skills.h - spawn2.cpp - spawn2.h - spawngroup.h - StringIDs.h - tasks.h - titles.h - trap.h - updatemgr.h - watermap.h - worldserver.h - zone.h - zone_profile.h - ZoneConfig.h - zonedb.h - zonedbasync.h - zonedump.h + AA.h + basic_functions.h + beacon.h + bot.h + botStructs.h + client.h + client_logs.h + client_packet.h + command.h + common.h + doors.h + embparser.h + embperl.h + embxs.h + entity.h + errmsg.h + event_codes.h + forage.h + groups.h + guild_mgr.h + hate_list.h + horse.h + map.h + masterentity.h + maxskill.h + message.h + merc.h + mob.h + net.h + npc.h + NpcAI.h + object.h + parser.h + pathing.h + perlpacket.h + perlparser.h + petitions.h + pets.h + PlayerCorpse.h + QGlobals.h + QuestInterface.h + questmgr.h + QuestParserCollection.h + raid.h + raids.h + skills.h + spawn2.cpp + spawn2.h + spawngroup.h + StringIDs.h + tasks.h + titles.h + trap.h + updatemgr.h + watermap.h + worldserver.h + zone.h + zone_profile.h + ZoneConfig.h + zonedb.h + zonedbasync.h + zonedump.h ) ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers}) @@ -159,21 +159,21 @@ ADD_DEFINITIONS(-DZONE) TARGET_LINK_LIBRARIES(zone Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) - SET_TARGET_PROPERTIES(zone PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(zone "Ws2_32.lib") + SET_TARGET_PROPERTIES(zone PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + TARGET_LINK_LIBRARIES(zone "Ws2_32.lib") ENDIF(MSVC) IF(MINGW) - TARGET_LINK_LIBRARIES(zone "WS2_32") + TARGET_LINK_LIBRARIES(zone "WS2_32") ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(zone "dl") - TARGET_LINK_LIBRARIES(zone "z") - TARGET_LINK_LIBRARIES(zone "m") - TARGET_LINK_LIBRARIES(zone "rt") - TARGET_LINK_LIBRARIES(zone "pthread") - ADD_DEFINITIONS(-fPIC) + TARGET_LINK_LIBRARIES(zone "dl") + TARGET_LINK_LIBRARIES(zone "z") + TARGET_LINK_LIBRARIES(zone "m") + TARGET_LINK_LIBRARIES(zone "rt") + TARGET_LINK_LIBRARIES(zone "pthread") + ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) INCLUDE_DIRECTORIES(${VLD_INCLUDE_DIR}) diff --git a/zone/Map.cpp b/zone/Map.cpp index cbe17bdba..8e959586d 100644 --- a/zone/Map.cpp +++ b/zone/Map.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/MiscFunctions.h" @@ -294,7 +294,7 @@ if(_node->node4 != nullptr) { tmp = SeekNode( _node->nodes[1], x, y ); } } else { - if(y < midy) { //quad 4 + if(y < midy) { //quad 4 if(_node->nodes[2] != NODE_NONE && _node->nodes[3] != node_r) tmp = SeekNode( _node->nodes[3], x, y ); } else { //quad 1 @@ -304,16 +304,16 @@ if(_node->node4 != nullptr) { } if( tmp != NODE_NONE ) return tmp; #else - if(_node->nodes[0] == node_r) return(NODE_NONE); //prevent infinite recursion + if(_node->nodes[0] == node_r) return(NODE_NONE); //prevent infinite recursion tmp = SeekNode( _node->nodes[0], x, y ); if( tmp != NODE_NONE ) return tmp; - if(_node->nodes[1] == node_r) return(NODE_NONE); //prevent infinite recursion + if(_node->nodes[1] == node_r) return(NODE_NONE); //prevent infinite recursion tmp = SeekNode( _node->nodes[1], x, y ); if( tmp != NODE_NONE ) return tmp; - if(_node->nodes[2] == node_r) return(NODE_NONE); //prevent infinite recursion + if(_node->nodes[2] == node_r) return(NODE_NONE); //prevent infinite recursion tmp = SeekNode( _node->nodes[2], x, y ); if( tmp != NODE_NONE ) return tmp; - if(_node->nodes[3] == node_r) return(NODE_NONE); //prevent infinite recursion + if(_node->nodes[3] == node_r) return(NODE_NONE); //prevent infinite recursion tmp = SeekNode( _node->nodes[3], x, y ); if( tmp != NODE_NONE ) return tmp; #endif @@ -326,13 +326,13 @@ printf(" No node found.\n"); } // maybe precalc edges. -int* Map::SeekFace( NodeRef node_r, float x, float y ) { +int* Map::SeekFace( NodeRef node_r, float x, float y ) { if( node_r == NODE_NONE || node_r >= m_Nodes) { return(nullptr); } const PNODE _node = &mNodes[node_r]; if(!(_node->flags & nodeFinal)) { - return(nullptr); //not a final node... could find the proper node... + return(nullptr); //not a final node... could find the proper node... } @@ -348,15 +348,15 @@ int* Map::SeekFace( NodeRef node_r, float x, float y ) { const VERTEX &v3 = cf.c; dx = v2.x - v1.x; dy = v2.y - v1.y; - nx = x - v1.x; ny = y - v1.y; + nx = x - v1.x; ny = y - v1.y; if( dx*ny - dy*nx >0.0f ) continue; dx = v3.x - v2.x; dy = v3.y - v2.y; - nx = x - v2.x; ny = y - v2.y; + nx = x - v2.x; ny = y - v2.y; if( dx*ny - dy*nx >0.0f ) continue; dx = v1.x - v3.x; dy = v1.y - v3.y; - nx = x - v3.x; ny = y - v3.y; + nx = x - v3.x; ny = y - v3.y; if( dx*ny - dy*nx >0.0f ) continue; *face++ = mFaceLists[_node->faces.offset + i]; @@ -396,14 +396,14 @@ bool Map::LineIntersectsZone(VERTEX start, VERTEX end, float step_mag, VERTEX *r if((stepx == 0) && (stepy == 0) && (stepz == 0)) return false; - float factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz); + float factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz); stepx = (stepx/factor)*step_mag; stepy = (stepy/factor)*step_mag; stepz = (stepz/factor)*step_mag; NodeRef cnode, lnode, finalnode; - lnode = NODE_NONE; //last node visited + lnode = NODE_NONE; //last node visited cnode = SeekNode(GetRoot(), start.x, start.y); finalnode = SeekNode(GetRoot(), end.x, end.y); @@ -416,22 +416,22 @@ bool Map::LineIntersectsZone(VERTEX start, VERTEX end, float step_mag, VERTEX *r stepy = (float)end.y - cury; stepz = (float)end.z - curz; - factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz); + factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz); stepx = (stepx/factor)*step_mag; stepy = (stepy/factor)*step_mag; stepz = (stepz/factor)*step_mag; - cnode = SeekNode(GetRoot(), curx, cury); + cnode = SeekNode(GetRoot(), curx, cury); if(cnode != lnode) { - lnode = cnode; + lnode = cnode; if(cnode == NODE_NONE) return false; if(LineIntersectsNode(cnode, start, end, result, on)) - return(true); + return(true); if(cnode == finalnode) return false; @@ -466,11 +466,11 @@ bool Map::LocWithinNode( NodeRef node_r, float x, float y ) const { bool Map::LineIntersectsNode( NodeRef node_r, VERTEX p1, VERTEX p2, VERTEX *result, FACE **on) const { _ZP(Map_LineIntersectsNode); if( node_r == NODE_NONE || node_r >= m_Nodes) { - return(true); //can see through empty nodes, just allow LOS on error... + return(true); //can see through empty nodes, just allow LOS on error... } const PNODE _node = &mNodes[node_r]; if(!(_node->flags & nodeFinal)) { - return(true); //not a final node... not sure best action + return(true); //not a final node... not sure best action } unsigned long i; @@ -512,7 +512,7 @@ float Map::FindBestZ( NodeRef node_r, VERTEX p1, VERTEX *result, FACE **on) cons } const PNODE _node = &mNodes[node_r]; if(!(_node->flags & nodeFinal)) { - return(BEST_Z_INVALID); //not a final node... could find the proper node... + return(BEST_Z_INVALID); //not a final node... could find the proper node... } VERTEX tmp_result; //dummy placeholder if they do not ask for a result. @@ -541,7 +541,7 @@ printf("Start finding best Z...\n"); #endif for(i = 0; i < _node->faces.count; i++) { if(*cfl > m_Faces) - continue; //watch for invalid lists, they seem to happen, e.g. in eastwastes.map + continue; //watch for invalid lists, they seem to happen, e.g. in eastwastes.map cur = &mFinalFaces[ *cfl ]; //printf("Intersecting with face %lu\n", *cfl); @@ -564,7 +564,7 @@ printf("Start finding best Z...\n"); if(best_z != BEST_Z_INVALID) return best_z; - p1.z = p1.z + 10 ; // If we can't find a best Z, the NPC is probably just under the world. Try again from 10 units higher up. + p1.z = p1.z + 10 ; // If we can't find a best Z, the NPC is probably just under the world. Try again from 10 units higher up. } #ifdef DEBUG_BEST_Z @@ -577,7 +577,7 @@ printf("Best Z found: %.2f\n", best_z); bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result) const { if( cface == nullptr ) { - return(false); //cant intersect a face we dont have... i guess + return(false); //cant intersect a face we dont have... i guess } const VERTEX &pa = cface->a; @@ -608,7 +608,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result) return(false); //begin attempt 2 -//#define RTOD 57.2957795 //radians to degrees constant. +//#define RTOD 57.2957795 //radians to degrees constant. float d; float denom,mu; @@ -645,11 +645,11 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result) // Calculate the position on the line that intersects the plane denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z); - if (ABS(denom) < EPS) // Line and plane don't intersect - return(false); + if (ABS(denom) < EPS) // Line and plane don't intersect + return(false); mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom; - if (mu < 0 || mu > 1) // Intersection not along line segment - return(false); + if (mu < 0 || mu > 1) // Intersection not along line segment + return(false); p->x = p1.x + mu * (p2.x - p1.x); p->y = p1.y + mu * (p2.y - p1.y); p->z = p1.z + mu * (p2.z - p1.z); @@ -682,7 +682,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result) // if (ABS(total - 2*M_PI) > EPS) total = (acos(a1) + acos(a2) + acos(a3)) * 57.2957795; if (ABS(total - 360) > EPS) - return(false); + return(false); return(true); */ @@ -737,13 +737,13 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result) // Determine whether or not the intersection point is bounded by pa,pb,pc #define Sign(p1, p2, p3) \ ((p1->x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1->y - p3.y)) - bool b1, b2, b3; + bool b1, b2, b3; - b1 = Sign(p, pa2, pb2) < 0.0f; - b2 = Sign(p, pb2, pc2) < 0.0f; - b3 = Sign(p, pc2, pa2) < 0.0f; + b1 = Sign(p, pa2, pb2) < 0.0f; + b2 = Sign(p, pb2, pc2) < 0.0f; + b3 = Sign(p, pc2, pa2) < 0.0f; - return ((b1 == b2) && (b2 == b3)); + return ((b1 == b2) && (b2 == b3)); */ /* //not working well, seems to block LOS a lot @@ -805,16 +805,16 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result) /* Yet another method adapted from this code: - Vec3 pa1 = pa - p; - Vec3 pa2 = pb - p; - float d = pa1.cross(pa2).dot(n); - if (d < 0) return false; - Vec3 pa3 = pb - p; - d = pa2.cross(pa3).dot(n); - if (d < 0) return false; - d = pa3.cross(pa1).dot(n); - if (d < 0) return false; - return true; + Vec3 pa1 = pa - p; + Vec3 pa2 = pb - p; + float d = pa1.cross(pa2).dot(n); + if (d < 0) return false; + Vec3 pa3 = pb - p; + d = pa2.cross(pa3).dot(n); + if (d < 0) return false; + d = pa3.cross(pa1).dot(n); + if (d < 0) return false; + return true; */ //in practice, this seems to actually take longer diff --git a/zone/MobAI.cpp b/zone/MobAI.cpp index 8634cb79a..e954e5dbe 100644 --- a/zone/MobAI.cpp +++ b/zone/MobAI.cpp @@ -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 */ #include "../common/debug.h" #include @@ -68,9 +68,10 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { float dist2; if (iSpellTypes & SpellType_Escape) { - dist2 = 0; //DistNoRoot(*this); //WTF was up with this... - } else - dist2 = DistNoRoot(*tar); + dist2 = 0; //DistNoRoot(*this); //WTF was up with this... + } + else + dist2 = DistNoRoot(*tar); bool checked_los = false; //we do not check LOS until we are absolutely sure we need to, and we only do it once. @@ -93,8 +94,8 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { (( (spells[AIspells[i].spellid].targettype==ST_AECaster || spells[AIspells[i].spellid].targettype==ST_AEBard) && dist2 <= spells[AIspells[i].spellid].aoerange*spells[AIspells[i].spellid].aoerange - ) || - dist2 <= spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range + ) || + dist2 <= spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range ) && (mana_cost <= GetMana() || GetMana() == GetMaxMana()) && (AIspells[i].time_cancast+(MakeRandomInt(0, 4))) <= Timer::GetCurrentTime() //break up the spelling casting over a period of time. @@ -102,11 +103,11 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { #if MobAI_DEBUG_Spells >= 21 cout << "Mob::AICastSpell: Casting: spellid=" << AIspells[i].spellid - << ", tar=" << tar->GetName() - << ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range *spells[AIspells[i].spellid].range - << ", mana_cost[" << mana_cost << "]<=" << GetMana() - << ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime() - << ", type=" << AIspells[i].type << endl; + << ", tar=" << tar->GetName() + << ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range *spells[AIspells[i].spellid].range + << ", mana_cost[" << mana_cost << "]<=" << GetMana() + << ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime() + << ", type=" << AIspells[i].type << endl; #endif switch (AIspells[i].type) { @@ -155,12 +156,12 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { && tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 && !(tar->IsPet() && tar->GetOwner()->IsClient() && this != tar) //no buffing PC's pets, but they can buff themself ) - { - if(!checked_los) { - if(!CheckLosFN(tar)) - return(false); - checked_los = true; - } + { + if(!checked_los) { + if(!CheckLosFN(tar)) + return(false); + checked_los = true; + } uint32 tempTime = 0; AIDoSpellCast(i, tar, mana_cost, &tempTime); tar->SetDontBuffMeBefore(tempTime); @@ -172,22 +173,22 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { case SpellType_InCombatBuff: { if(MakeRandomInt(0,100) < 50) { - AIDoSpellCast(i, tar, mana_cost); + AIDoSpellCast(i, tar, mana_cost); return true; } break; } case SpellType_Escape: { - if (GetHPRatio() <= 5 ) - { - AIDoSpellCast(i, tar, mana_cost); + if (GetHPRatio() <= 5 ) + { + AIDoSpellCast(i, tar, mana_cost); return true; } break; } - case SpellType_Slow: - case SpellType_Debuff: + case SpellType_Slow: + case SpellType_Debuff: case SpellType_Nuke: { if ( manaR >= 10 && MakeRandomInt(0, 99) < 70 @@ -249,7 +250,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { } case SpellType_Pet: { - //keep mobs from recasting pets when they have them. + //keep mobs from recasting pets when they have them. if (!IsPet() && !GetPetID() && MakeRandomInt(0, 99) < 25) { AIDoSpellCast(i, tar, mana_cost); return true; @@ -257,7 +258,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { break; } case SpellType_Lifetap: { - if ( GetHPRatio() <= 95 + if (GetHPRatio() <= 95 && MakeRandomInt(0, 99) < 50 && tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 ) { @@ -273,7 +274,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { } case SpellType_Snare: { if ( - !tar->IsRooted() + !tar->IsRooted() && MakeRandomInt(0, 99) < 50 && tar->DontSnareMeBefore() < Timer::GetCurrentTime() && tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 @@ -359,8 +360,8 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float if(caster->AI_HasSpells() == false) return false; - if(caster->SpecAttacks[NPC_NO_BUFFHEAL_FRIENDS]) - return false; + if(caster->SpecAttacks[NPC_NO_BUFFHEAL_FRIENDS]) + return false; if (iChance < 100) { uint8 tmp = MakeRandomInt(0, 99); @@ -376,8 +377,8 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float //Only iterate through NPCs - LinkedListIterator iterator(npc_list); - for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) { + LinkedListIterator iterator(npc_list); + for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) { NPC* mob = iterator.GetData(); //Since >90% of mobs will always be out of range, try to @@ -393,7 +394,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float t2 = 0 - t2; if(t3 < 0) t3 = 0 - t3; - if ( t1 > iRange + if (t1 > iRange || t2 > iRange || t3 > iRange || mob->DistNoRoot(*caster) > iRange2 @@ -761,7 +762,7 @@ void Client::AI_Process() bool WaypointChanged, NodeReached; VERTEX Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z, - GetFearSpeed(), WaypointChanged, NodeReached); + GetFearSpeed(), WaypointChanged, NodeReached); if(WaypointChanged) tar_ndx = 20; @@ -1004,7 +1005,7 @@ void Mob::AI_Process() { return; bool engaged = IsEngaged(); - bool doranged = false; + bool doranged = false; // Begin: Additions for Wiz Fear Code // @@ -1037,7 +1038,7 @@ void Mob::AI_Process() { bool WaypointChanged, NodeReached; VERTEX Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z, - GetFearSpeed(), WaypointChanged, NodeReached); + GetFearSpeed(), WaypointChanged, NodeReached); if(WaypointChanged) tar_ndx = 20; @@ -1086,11 +1087,11 @@ void Mob::AI_Process() { #ifdef BOTS if (IsPet() && GetOwner()->IsBot() && target == GetOwner()) - { - // this blocks all pet attacks against owner..bot pet test (copied above check) - RemoveFromHateList(this); - return; - } + { + // this blocks all pet attacks against owner..bot pet test (copied above check) + RemoveFromHateList(this); + return; + } #endif //BOTS if(DivineAura()) @@ -1112,15 +1113,15 @@ void Mob::AI_Process() { (!RuleB(NPC, LiveLikeEnrage) || (RuleB(NPC, LiveLikeEnrage) && ((IsPet() && !IsCharmed() && GetOwner() && GetOwner()->IsClient()) || - (CastToNPC()->GetSwarmOwner() && entity_list.GetMob(CastToNPC()->GetSwarmOwner())->IsClient()))))) + (CastToNPC()->GetSwarmOwner() && entity_list.GetMob(CastToNPC()->GetSwarmOwner())->IsClient()))))) { StartEnrage(); } bool is_combat_range = CombatRange(target); - if (is_combat_range) - { + if (is_combat_range) + { if (AImovement_timer->Check()) { SetRunAnimSpeed(0); @@ -1142,18 +1143,18 @@ void Mob::AI_Process() { //try main hand first if(attack_timer.Check()) { - if(IsNPC()) { - int16 n_atk = CastToNPC()->GetNumberOfAttacks(); - if(n_atk <= 1) { - Attack(target, 13); - } else { - for(int i = 0; i < n_atk; ++i) { - Attack(target, 13); - } - } - } else { - Attack(target, 13); - } + if(IsNPC()) { + int16 n_atk = CastToNPC()->GetNumberOfAttacks(); + if(n_atk <= 1) { + Attack(target, 13); + } else { + for(int i = 0; i < n_atk; ++i) { + Attack(target, 13); + } + } + } else { + Attack(target, 13); + } if (target) { @@ -1191,7 +1192,7 @@ void Mob::AI_Process() { if (GetFlurryChance()) npc_flurry = GetFlurryChance(); - if (MakeRandomInt(0, 99) < npc_flurry) + if (MakeRandomInt(0, 99) < npc_flurry) Flurry(); } @@ -1209,8 +1210,8 @@ void Mob::AI_Process() { if (SpecAttacks[SPECATK_RAMPAGE]) { - //simply based off dex for now, probably a better calc - if(MakeRandomInt(0, 100) < ((int)(GetDEX() / ((GetLevel() * 0.760) + 10.0)) + 5)) + //simply based off dex for now, probably a better calc + if(MakeRandomInt(0, 100) < ((int)(GetDEX() / ((GetLevel() * 0.760) + 10.0)) + 5)) Rampage(); } @@ -1218,7 +1219,7 @@ void Mob::AI_Process() { { //simply based off dex for now, probably a better calc - if(MakeRandomInt(0, 100) < ((int)(GetDEX() / ((GetLevel() * 0.760) + 10.0)) + 5)) + if(MakeRandomInt(0, 100) < ((int)(GetDEX() / ((GetLevel() * 0.760) + 10.0)) + 5)) AreaRampage(); } } @@ -1253,30 +1254,30 @@ void Mob::AI_Process() { } //end is within combat range else { //we cannot reach our target... - //underwater stuff only works with water maps in the zone! - if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) { - Mob *tar = hate_list.GetTop(this); - if(tar == target) { - WipeHateList(); - Heal(); - BuffFadeAll(); - AIwalking_timer->Start(100); - pLastFightingDelayMoving = Timer::GetCurrentTime(); - return; - } else if(tar != nullptr) { - SetTarget(tar); - return; - } - } - } + //underwater stuff only works with water maps in the zone! + if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { + if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) { + Mob *tar = hate_list.GetTop(this); + if(tar == target) { + WipeHateList(); + Heal(); + BuffFadeAll(); + AIwalking_timer->Start(100); + pLastFightingDelayMoving = Timer::GetCurrentTime(); + return; + } else if(tar != nullptr) { + SetTarget(tar); + return; + } + } + } // See if we can summon the mob to us if (!HateSummon()) { //could not summon them, check ranged... if(SpecAttacks[SPECATK_RANGED_ATK]) - doranged = true; + doranged = true; // Now pursue // TODO: Check here for another person on hate list with close hate value @@ -1351,13 +1352,13 @@ void Mob::AI_Process() { else if (AIscanarea_timer->Check()) { /* - * This is where NPCs look around to see if they want to attack anybody. - * - * if REVERSE_AGGRO is enabled, then this timer is disabled unless they - * have the npc_aggro flag on them, and aggro against clients is checked - * by the clients. - * - */ + * This is where NPCs look around to see if they want to attack anybody. + * + * if REVERSE_AGGRO is enabled, then this timer is disabled unless they + * have the npc_aggro flag on them, and aggro against clients is checked + * by the clients. + * + */ _ZP(Mob_AI_Process_scanarea); Mob* tmptar = entity_list.AICheckCloseAggro(this, GetAggroRange(), GetAssistRange()); @@ -1484,15 +1485,15 @@ void Mob::AI_Process() { } } - } - } // else if (AImovement_timer->Check()) - } + } + } // else if (AImovement_timer->Check()) + } - //Do Ranged attack here - if(doranged) - { - RangedAttack(target); - } + //Do Ranged attack here + if(doranged) + { + RangedAttack(target); + } } void NPC::AI_DoMovement() { @@ -1550,13 +1551,13 @@ void NPC::AI_DoMovement() { int16 gridno = CastToNPC()->GetGrid(); - if (gridno > 0 || cur_wp==-2) { - if (movetimercompleted==true) { // time to pause at wp is over + if (gridno > 0 || cur_wp==-2) { + if (movetimercompleted==true) { // time to pause at wp is over if (wandertype == 4 && cur_wp == CastToNPC()->GetMaxWp()) { - CastToNPC()->Depop(true); //depop and resart spawn timer + CastToNPC()->Depop(true); //depop and resart spawn timer } else if (wandertype == 6 && cur_wp == CastToNPC()->GetMaxWp()) { - CastToNPC()->Depop(false);//depop without spawn timer + CastToNPC()->Depop(false);//depop without spawn timer } else { movetimercompleted=false; @@ -1579,7 +1580,7 @@ void NPC::AI_DoMovement() { //kick off event_waypoint depart char temp[16]; sprintf(temp, "%d", cur_wp); - parse->EventNPC(EVENT_WAYPOINT_DEPART, CastToNPC(), nullptr, temp, 0); + parse->EventNPC(EVENT_WAYPOINT_DEPART, CastToNPC(), nullptr, temp, 0); //setup our next waypoint, if we are still on our normal grid //remember that the quest event above could have done anything it wanted with our grid @@ -1590,8 +1591,8 @@ void NPC::AI_DoMovement() { else { DistractedFromGrid = false; } - } - } // endif (movetimercompleted==true) + } + } // endif (movetimercompleted==true) else if (!(AIwalking_timer->Enabled())) { // currently moving if (cur_wp_x == GetX() && cur_wp_y == GetY()) @@ -1651,50 +1652,50 @@ void NPC::AI_DoMovement() { } } - } - else if (IsGuarding()) - { - _ZP(Mob_AI_Process_guard); - - bool CP2Moved; - if(!RuleB(Pathing, Guard) || !zone->pathing) - CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp); - else - { - if(!((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z))) - { - bool WaypointChanged, NodeReached; - VERTEX Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached); - if(WaypointChanged) - tar_ndx = 20; - - if(NodeReached) - entity_list.OpenDoorsNear(CastToNPC()); - - CP2Moved = CalculateNewPosition2(Goal.x, Goal.y, Goal.z, walksp); - } - else - CP2Moved = false; - } - if (!CP2Moved) + else if (IsGuarding()) { - if(moved) { - mlog(AI__WAYPOINTS, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); - ClearFeignMemory(); - moved=false; - SetMoving(false); - if (GetTarget() == nullptr || DistNoRoot(*GetTarget()) >= 5*5 ) + _ZP(Mob_AI_Process_guard); + + bool CP2Moved; + if(!RuleB(Pathing, Guard) || !zone->pathing) + CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp); + else + { + if(!((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z))) { - SetHeading(guard_heading); - } else { - FaceTarget(GetTarget()); + bool WaypointChanged, NodeReached; + VERTEX Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached); + if(WaypointChanged) + tar_ndx = 20; + + if(NodeReached) + entity_list.OpenDoorsNear(CastToNPC()); + + CP2Moved = CalculateNewPosition2(Goal.x, Goal.y, Goal.z, walksp); } - SendPosition(); - SetAppearance(GetGuardPointAnim()); + else + CP2Moved = false; + } - } - } + if (!CP2Moved) + { + if(moved) { + mlog(AI__WAYPOINTS, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); + ClearFeignMemory(); + moved=false; + SetMoving(false); + if (GetTarget() == nullptr || DistNoRoot(*GetTarget()) >= 5*5 ) + { + SetHeading(guard_heading); + } else { + FaceTarget(GetTarget()); + } + SendPosition(); + SetAppearance(GetGuardPointAnim()); + } + } + } } // Note: Mob that caused this may not get added to the hate list until after this function call completes @@ -1703,9 +1704,9 @@ void Mob::AI_Event_Engaged(Mob* attacker, bool iYellForHelp) { return; if(GetAppearance() != eaStanding) - { - SetAppearance(eaStanding); - } + { + SetAppearance(eaStanding); + } if (iYellForHelp) { if(IsPet()) { @@ -1729,7 +1730,7 @@ void Mob::AI_Event_Engaged(Mob* attacker, bool iYellForHelp) { { if(!CastToNPC()->GetCombatEvent() && GetHP() > 0) { - parse->EventNPC(EVENT_COMBAT, CastToNPC(), attacker, "1", 0); + parse->EventNPC(EVENT_COMBAT, CastToNPC(), attacker, "1", 0); uint16 emoteid = GetEmoteID(); if(emoteid != 0) CastToNPC()->DoNPCEmote(ENTERCOMBAT,emoteid); @@ -1766,7 +1767,7 @@ void Mob::AI_Event_NoLongerEngaged() { if(entity_list.GetNPCByID(this->GetID())) { uint16 emoteid = CastToNPC()->GetEmoteID(); - parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0); + parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0); if(emoteid != 0) CastToNPC()->DoNPCEmote(LEAVECOMBAT,emoteid); CastToNPC()->SetCombatEvent(false); @@ -1861,28 +1862,28 @@ bool NPC::AI_IdleCastCheck() { void Mob::StartEnrage() { - // dont continue if already enraged - if (bEnraged) - return; - if (SpecAttackTimers[SPECATK_ENRAGE] && !SpecAttackTimers[SPECATK_ENRAGE]->Check()) - return; - // see if NPC has possibility to enrage - if (!SpecAttacks[SPECATK_ENRAGE]) - return; - // check if timer exists (should be true at all times) - if (SpecAttackTimers[SPECATK_ENRAGE]) - { + // dont continue if already enraged + if (bEnraged) + return; + if (SpecAttackTimers[SPECATK_ENRAGE] && !SpecAttackTimers[SPECATK_ENRAGE]->Check()) + return; + // see if NPC has possibility to enrage + if (!SpecAttacks[SPECATK_ENRAGE]) + return; + // check if timer exists (should be true at all times) + if (SpecAttackTimers[SPECATK_ENRAGE]) + { safe_delete(SpecAttackTimers[SPECATK_ENRAGE]); - SpecAttackTimers[SPECATK_ENRAGE] = nullptr; - } + SpecAttackTimers[SPECATK_ENRAGE] = nullptr; + } - if (!SpecAttackTimers[SPECATK_ENRAGE]) - { - SpecAttackTimers[SPECATK_ENRAGE] = new Timer(EnragedDurationTimer); - } - // start the timer. need to call IsEnraged frequently since we dont have callback timers :-/ - SpecAttackTimers[SPECATK_ENRAGE]->Start(); - bEnraged = true; + if (!SpecAttackTimers[SPECATK_ENRAGE]) + { + SpecAttackTimers[SPECATK_ENRAGE] = new Timer(EnragedDurationTimer); + } + // start the timer. need to call IsEnraged frequently since we dont have callback timers :-/ + SpecAttackTimers[SPECATK_ENRAGE]->Start(); + bEnraged = true; entity_list.MessageClose_StringID(this, true, 200, MT_NPCEnrage, NPC_ENRAGE_START, GetCleanName()); } @@ -1898,13 +1899,13 @@ void Mob::ProcessEnrage(){ bool Mob::IsEnraged() { - return bEnraged; + return bEnraged; } bool Mob::Flurry() { - // this is wrong, flurry is extra attacks on the current target - Mob *target = GetTarget(); + // this is wrong, flurry is extra attacks on the current target + Mob *target = GetTarget(); if (target) { if (!IsPet()) { entity_list.MessageClose_StringID(this, true, 200, MT_NPCFlurry, NPC_FLURRY, GetCleanName(), target->GetCleanName()); @@ -1914,7 +1915,7 @@ bool Mob::Flurry() for (int i = 0; i < RuleI(Combat, MaxFlurryHits); i++) Attack(target); } - return true; + return true; } bool Mob::AddRampage(Mob *mob) @@ -1922,18 +1923,18 @@ bool Mob::AddRampage(Mob *mob) if(!mob) return false; - if (!SpecAttacks[SPECATK_RAMPAGE]) - return false; + if (!SpecAttacks[SPECATK_RAMPAGE]) + return false; - for (int i = 0; i < RampageArray.size(); i++) - { - // if name is already on the list dont add it again - if (strcasecmp(mob->GetName(), RampageArray[i].c_str()) == 0) - return false; + for (int i = 0; i < RampageArray.size(); i++) + { + // if name is already on the list dont add it again + if (strcasecmp(mob->GetName(), RampageArray[i].c_str()) == 0) + return false; } std::string r_name = mob->GetName(); RampageArray.push_back(r_name); - return true; + return true; } void Mob::ClearRampage(){ @@ -1948,26 +1949,26 @@ bool Mob::Rampage() } else { entity_list.MessageClose_StringID(this, true, 200, MT_PetFlurry, NPC_RAMPAGE, GetCleanName()); } - for (int i = 0; i < RampageArray.size(); i++) - { + for (int i = 0; i < RampageArray.size(); i++) + { if(index_hit >= RuleI(Combat, MaxRampageTargets)) break; - // range is important + // range is important Mob *m_target = entity_list.GetMob(RampageArray[i].c_str()); - if(m_target) - { + if(m_target) + { if(m_target == GetTarget()) continue; - if (CombatRange(m_target)) + if (CombatRange(m_target)) { - Attack(m_target); + Attack(m_target); index_hit++; } - } - } + } + } if(index_hit < RuleI(Combat, MaxRampageTargets)) Attack(GetTarget()); - return true; + return true; } void Mob::AreaRampage() @@ -1985,166 +1986,166 @@ void Mob::AreaRampage() } uint32 Mob::GetLevelCon(uint8 mylevel, uint8 iOtherLevel) { - int16 diff = iOtherLevel - mylevel; + int16 diff = iOtherLevel - mylevel; uint32 conlevel=0; - if (diff == 0) - return CON_WHITE; - else if (diff >= 1 && diff <= 2) - return CON_YELLOW; - else if (diff >= 3) - return CON_RED; + if (diff == 0) + return CON_WHITE; + else if (diff >= 1 && diff <= 2) + return CON_YELLOW; + else if (diff >= 3) + return CON_RED; - if (mylevel <= 8) - { - if (diff <= -4) - conlevel = CON_GREEN; - else - conlevel = CON_BLUE; - } - else if (mylevel <= 9) + if (mylevel <= 8) { - if (diff <= -6) - conlevel = CON_GREEN; - else if (diff <= -4) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -4) + conlevel = CON_GREEN; + else + conlevel = CON_BLUE; } - else if (mylevel <= 13) + else if (mylevel <= 9) { - if (diff <= -7) - conlevel = CON_GREEN; - else if (diff <= -5) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -6) + conlevel = CON_GREEN; + else if (diff <= -4) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; + } + else if (mylevel <= 13) + { + if (diff <= -7) + conlevel = CON_GREEN; + else if (diff <= -5) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 15) { - if (diff <= -7) - conlevel = CON_GREEN; - else if (diff <= -5) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -7) + conlevel = CON_GREEN; + else if (diff <= -5) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 17) { - if (diff <= -8) - conlevel = CON_GREEN; - else if (diff <= -6) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -8) + conlevel = CON_GREEN; + else if (diff <= -6) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 21) { - if (diff <= -9) - conlevel = CON_GREEN; - else if (diff <= -7) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -9) + conlevel = CON_GREEN; + else if (diff <= -7) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 25) { - if (diff <= -10) - conlevel = CON_GREEN; - else if (diff <= -8) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -10) + conlevel = CON_GREEN; + else if (diff <= -8) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 29) { - if (diff <= -11) - conlevel = CON_GREEN; - else if (diff <= -9) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -11) + conlevel = CON_GREEN; + else if (diff <= -9) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 31) { - if (diff <= -12) - conlevel = CON_GREEN; - else if (diff <= -9) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -12) + conlevel = CON_GREEN; + else if (diff <= -9) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 33) { - if (diff <= -13) - conlevel = CON_GREEN; - else if (diff <= -10) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -13) + conlevel = CON_GREEN; + else if (diff <= -10) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 37) { - if (diff <= -14) - conlevel = CON_GREEN; - else if (diff <= -11) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -14) + conlevel = CON_GREEN; + else if (diff <= -11) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 41) { - if (diff <= -16) - conlevel = CON_GREEN; - else if (diff <= -12) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -16) + conlevel = CON_GREEN; + else if (diff <= -12) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 45) { - if (diff <= -17) - conlevel = CON_GREEN; - else if (diff <= -13) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -17) + conlevel = CON_GREEN; + else if (diff <= -13) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 49) { - if (diff <= -18) - conlevel = CON_GREEN; - else if (diff <= -14) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -18) + conlevel = CON_GREEN; + else if (diff <= -14) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 53) { - if (diff <= -19) - conlevel = CON_GREEN; - else if (diff <= -15) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -19) + conlevel = CON_GREEN; + else if (diff <= -15) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else if (mylevel <= 55) { - if (diff <= -20) - conlevel = CON_GREEN; - else if (diff <= -15) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -20) + conlevel = CON_GREEN; + else if (diff <= -15) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } else { - if (diff <= -21) - conlevel = CON_GREEN; - else if (diff <= -16) - conlevel = CON_LIGHTBLUE; - else - conlevel = CON_BLUE; + if (diff <= -21) + conlevel = CON_GREEN; + else if (diff <= -16) + conlevel = CON_LIGHTBLUE; + else + conlevel = CON_BLUE; } return conlevel; } @@ -2400,9 +2401,9 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) { uint32 ZoneDatabase::GetMaxNPCSpellsID() { 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 max(id) from npc_spells"), errbuf, &result)) { safe_delete_array(query); diff --git a/zone/NpcAI.h b/zone/NpcAI.h index 2f08d633a..21d5cbc4e 100644 --- a/zone/NpcAI.h +++ b/zone/NpcAI.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 NPCAI_H @@ -34,7 +34,7 @@ Seems more like a bitwise comparison client side.. */ #define DEFAULT_AGGRORADIUS 70 #define DEFAULT_FRENYRADIUS 70 -#define MAX_SHIELDRADIUS 20 +#define MAX_SHIELDRADIUS 20 uint32 GetLevelCon(uint8 PlayerLevel, uint8 NPCLevel); diff --git a/zone/Object.cpp b/zone/Object.cpp index 2e33959a4..25123a62b 100644 --- a/zone/Object.cpp +++ b/zone/Object.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" @@ -345,7 +345,7 @@ void Object::Close() { { last_user = user; // put any remaining items from the world container back into the player's inventory to avoid item loss - // if they close the container without removing all items + // if they close the container without removing all items ItemInst* container = this->m_inst; if(container != nullptr) { @@ -447,7 +447,7 @@ void Object::RandomSpawn(bool send_packet) { bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) { if(m_ground_spawn){//This is a Cool Groundspawn - respawn_timer.Start(); + respawn_timer.Start(); } if (m_type == OT_DROPPEDITEM) { bool cursordelete = false; @@ -456,7 +456,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) // the client updates itself and takes care of sending "duplicate lore item" messages if(sender->CheckLoreConflict(m_inst->GetItem())) { int16 loreslot = sender->GetInv().HasItem(m_inst->GetItem()->ID, 0, invWhereBank); - if(loreslot != SLOT_INVALID) // if the duplicate is in the bank, delete it. + if(loreslot != SLOT_INVALID) // if the duplicate is in the bank, delete it. sender->DeleteItemInInventory(loreslot); else cursordelete = true; // otherwise, we delete the new one @@ -465,13 +465,13 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) char buf[10]; snprintf(buf, 9, "%u", m_inst->GetItem()->ID); buf[9] = '\0'; - parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, buf, 0); + parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, buf, 0); // Transfer item to client sender->PutItemInInventory(SLOT_CURSOR, *m_inst, false); sender->SendItemPacket(SLOT_CURSOR, m_inst, ItemPacketTrade); - if(cursordelete) // delete the item if it's a duplicate lore. We have to do this because the client expects the item packet + if(cursordelete) // delete the item if it's a duplicate lore. We have to do this because the client expects the item packet sender->DeleteItemInInventory(SLOT_CURSOR); if(!m_ground_spawn) @@ -491,7 +491,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) // Remove object database.DeleteObject(m_id); if(!m_ground_spawn) - entity_list.RemoveEntity(this->GetID()); + entity_list.RemoveEntity(this->GetID()); } else { // Tradeskill item EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClickObjectAction, sizeof(ClickObjectAction_Struct)); @@ -559,7 +559,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; uint32 database_id = 0; uint32 item_id = 0; @@ -602,7 +602,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; uint32 item_id = 0; int16 charges = 0; @@ -640,9 +640,9 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec } Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs){ 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 max_x,max_y,max_z,min_x,min_y,heading,name,item,max_allowed,respawn_timer from ground_spawns where zoneid=%i and (version=%u OR version=-1) limit 50", zone_id, version), errbuf, &result)) { @@ -672,7 +672,7 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro void ZoneDatabase::DeleteObject(uint32 id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; // Construct query uint32 len_query = MakeAnyLenString(&query, diff --git a/zone/PlayerCorpse.cpp b/zone/PlayerCorpse.cpp index 8fd0b9c20..6a2fdfe63 100644 --- a/zone/PlayerCorpse.cpp +++ b/zone/PlayerCorpse.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 */ /* New class for handeling corpses and everything associated with them. @@ -33,7 +33,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #endif #include "masterentity.h" @@ -194,14 +194,14 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna // Mongrel: added see_invis and see_invis_undead Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime) // vesuvias - appearence fix - : Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid//bodytype added - ,in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0, - in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0, - in_npc->GetTexture(),in_npc->GetHelmTexture(), - 0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0), - corpse_decay_timer(in_decaytime), - corpse_res_timer(0), +: Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid,//bodytype added + in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0, + in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0, + in_npc->GetTexture(),in_npc->GetHelmTexture(), + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0), + corpse_decay_timer(in_decaytime), + corpse_res_timer(0), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_graveyard_timer(0), loot_cooldown_timer(10) @@ -347,15 +347,15 @@ Corpse::Corpse(Client* client, int32 in_rezexp) if(!RuleB(Character, LeaveNakedCorpses) || RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) { // cash - // Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't. - // (change to first client that supports 'death hover' mode, if not SoF.) - if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) { - SetCash(pp->copper, pp->silver, pp->gold, pp->platinum); - pp->copper = 0; - pp->silver = 0; - pp->gold = 0; - pp->platinum = 0; - } + // Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't. + // (change to first client that supports 'death hover' mode, if not SoF.) + if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) { + SetCash(pp->copper, pp->silver, pp->gold, pp->platinum); + pp->copper = 0; + pp->silver = 0; + pp->gold = 0; + pp->platinum = 0; + } // get their tints memcpy(item_tint, &client->GetPP().item_tint, sizeof(item_tint)); @@ -384,52 +384,52 @@ Corpse::Corpse(Client* client, int32 in_rezexp) } } - // cursor queue // (change to first client that supports 'death hover' mode, if not SoF.) - if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) { + // cursor queue // (change to first client that supports 'death hover' mode, if not SoF.) + if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) { - // bumped starting assignment to 8001 because any in-memory 'slot 8000' item was moved above as 'slot 30' - // this was mainly for client profile state reflection..should match db player inventory entries now. + // bumped starting assignment to 8001 because any in-memory 'slot 8000' item was moved above as 'slot 30' + // this was mainly for client profile state reflection..should match db player inventory entries now. - iter_queue it; - for(it=client->GetInv().cursor_begin(),i=8001; it!=client->GetInv().cursor_end(); it++,i++) { - item = *it; - if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) - { - std::list slot_list = MoveItemToCorpse(client, item, i); - removed_list.merge(slot_list); - cursor = true; - } + iter_queue it; + for(it=client->GetInv().cursor_begin(),i=8001; it!=client->GetInv().cursor_end(); it++,i++) { + item = *it; + if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) + { + std::list slot_list = MoveItemToCorpse(client, item, i); + removed_list.merge(slot_list); + cursor = true; + } } } - if(removed_list.size() != 0) { - std::stringstream ss(""); - ss << "DELETE FROM inventory WHERE charid=" << client->CharacterID(); - ss << " AND ("; - std::list::const_iterator iter = removed_list.begin(); - bool first = true; - while(iter != removed_list.end()) { - if(first) { - first = false; - } else { - ss << " OR "; - } - ss << "slotid=" << (*iter); - iter++; - } - ss << ")"; - database.RunQuery(ss.str().c_str(), ss.str().length()); - } + if(removed_list.size() != 0) { + std::stringstream ss(""); + ss << "DELETE FROM inventory WHERE charid=" << client->CharacterID(); + ss << " AND ("; + std::list::const_iterator iter = removed_list.begin(); + bool first = true; + while(iter != removed_list.end()) { + if(first) { + first = false; + } else { + ss << " OR "; + } + ss << "slotid=" << (*iter); + iter++; + } + ss << ")"; + database.RunQuery(ss.str().c_str(), ss.str().length()); + } - if(cursor) { // all cursor items should be on corpse (client < SoF or RespawnFromHover = false) - while(!client->GetInv().CursorEmpty()) - client->DeleteItemInInventory(SLOT_CURSOR, 0, false, false); - } - else { // only visible cursor made it to corpse (client >= Sof and RespawnFromHover = true) - std::list::const_iterator start = client->GetInv().cursor_begin(); - std::list::const_iterator finish = client->GetInv().cursor_end(); - database.SaveCursor(client->CharacterID(), start, finish); - } + if(cursor) { // all cursor items should be on corpse (client < SoF or RespawnFromHover = false) + while(!client->GetInv().CursorEmpty()) + client->DeleteItemInInventory(SLOT_CURSOR, 0, false, false); + } + else { // only visible cursor made it to corpse (client >= Sof and RespawnFromHover = true) + std::list::const_iterator start = client->GetInv().cursor_begin(); + std::list::const_iterator finish = client->GetInv().cursor_end(); + database.SaveCursor(client->CharacterID(), start, finish); + } client->CalcBonuses(); // will only affect offline profile viewing of dead characters..unneeded overhead client->Save(); @@ -445,17 +445,17 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 int bagindex; int16 interior_slot; ItemInst *interior_item; - std::list returnlist; + std::list returnlist; AddItem(item->GetItem()->ID, item->GetCharges(), equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4)); - returnlist.push_back(equipslot); + returnlist.push_back(equipslot); - // Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea. - if(item->IsType(ItemClassContainer) && ((equipslot >= 22 && equipslot <=30))) // Limit the bag check to inventory and cursor slots. + // Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea. + if(item->IsType(ItemClassContainer) && ((equipslot >= 22 && equipslot <=30))) // Limit the bag check to inventory and cursor slots. { for(bagindex = 0; bagindex <= 9; bagindex++) { - // For empty bags in cursor queue, slot was previously being resolved as SLOT_INVALID (-1) + // For empty bags in cursor queue, slot was previously being resolved as SLOT_INVALID (-1) interior_slot = Inventory::CalcSlotId(equipslot, bagindex); interior_item = client->GetInv().GetItem(interior_slot); @@ -468,16 +468,16 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 } } client->DeleteItemInInventory(equipslot, 0, true, false); - return returnlist; + return returnlist; } // To be called from LoadFromDBData // Mongrel: added see_invis and see_invis_undead Corpse::Corpse(uint32 in_dbid, uint32 in_charid, char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard) : Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture, - 0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0xff, - 0,0,0,0,0,0,0,0,0), + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0xff, + 0,0,0,0,0,0,0,0,0), corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), corpse_res_timer(RuleI(Character, CorpseResTimeMS)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), @@ -880,7 +880,7 @@ void Corpse::AllowMobLoot(Mob *them, uint8 slot) // @merth: this function needs some work void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* app) { - // Added 12/08. Started compressing loot struct on live. + // Added 12/08. Started compressing loot struct on live. char tmp[10]; if(p_depop) { SendLootReqErrorPacket(client, 0); @@ -909,7 +909,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a } uint8 tCanLoot = 1; - bool lootcoin = false; + bool lootcoin = false; if(database.GetVariable("LootCoin", tmp, 9)) { lootcoin = (atoi(tmp) == 1); } if(this->BeingLootedBy != 0xFFFFFFFF && this->BeingLootedBy != client->GetID()) { @@ -1169,7 +1169,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) strcpy(corpse_name, orgname); snprintf(buf, 87, "%d %d %s", inst->GetItem()->ID, inst->GetCharges(), EntityList::RemoveNumbers(corpse_name)); buf[87] = '\0'; - parse->EventPlayer(EVENT_LOOT, client, buf, 0); + parse->EventPlayer(EVENT_LOOT, client, buf, 0); if ((RuleB(Character, EnableDiscoveredItems))) { @@ -1255,7 +1255,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) //now send messages to all interested parties //creates a link for the item - char *link = 0, *link2 = 0; //just like a db query :-) + char *link = 0, *link2 = 0; //just like a db query :-) client->MakeItemLink(link2, inst); MakeAnyLenString(&link, "%c" "%s" "%s" "%c", 0x12, @@ -1338,43 +1338,43 @@ void Corpse::QueryLoot(Client* to) { for(; cur != end; cur++) { ServerLootItem_Struct* sitem = *cur; - if (IsPlayerCorpse()) { - if (sitem->equipSlot >= 251 && sitem->equipSlot <= 340) - sitem->lootslot = 0xFFFF; - else - x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF; + if (IsPlayerCorpse()) { + if (sitem->equipSlot >= 251 && sitem->equipSlot <= 340) + sitem->lootslot = 0xFFFF; + else + x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF; - const Item_Struct* item = database.GetItem(sitem->item_id); + const Item_Struct* item = database.GetItem(sitem->item_id); - if (item) - to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast(sitem->lootslot), sitem->equipSlot, item->Name, item->ID, sitem->charges); - else - to->Message((sitem->lootslot == 0xFFFF), "Error: 0x%04x", sitem->item_id); + if (item) + to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast(sitem->lootslot), sitem->equipSlot, item->Name, item->ID, sitem->charges); + else + to->Message((sitem->lootslot == 0xFFFF), "Error: 0x%04x", sitem->item_id); - if (sitem->lootslot != 0xFFFF) - x++; + if (sitem->lootslot != 0xFFFF) + x++; - y++; - } - else { - sitem->lootslot=y; - const Item_Struct* item = database.GetItem(sitem->item_id); + y++; + } + else { + sitem->lootslot=y; + const Item_Struct* item = database.GetItem(sitem->item_id); - if (item) - to->Message(0, "LootSlot: %i Item: %s (%d), Count: %i", sitem->lootslot, item->Name, item->ID, sitem->charges); - else - to->Message(0, "Error: 0x%04x", sitem->item_id); + if (item) + to->Message(0, "LootSlot: %i Item: %s (%d), Count: %i", sitem->lootslot, item->Name, item->ID, sitem->charges); + else + to->Message(0, "Error: 0x%04x", sitem->item_id); - y++; - } + y++; + } } - if (IsPlayerCorpse()) { - to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetDBID()); - } - else { - to->Message(0, "%i %s on %s.", y, y==1?"item":"items", this->GetName()); - } + if (IsPlayerCorpse()) { + to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetDBID()); + } + else { + to->Message(0, "%i %s on %s.", y, y==1?"item":"items", this->GetName()); + } } bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) @@ -1448,7 +1448,7 @@ void Corpse::Spawn() { bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; + char* query = new char[256]; uint32 query_length = 0; uint32 affected_rows = 0; @@ -1456,12 +1456,12 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) { if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) { safe_delete_array(query); - cerr << "Error1 in DeleteGraveyard query " << errbuf << endl; + cerr << "Error1 in DeleteGraveyard query " << errbuf << endl; return false; - } + } if (affected_rows == 0) { - cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << endl; + cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << endl; return false; } @@ -1469,13 +1469,13 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) { if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) { safe_delete_array(query); - cerr << "Error3 in DeleteGraveyard query " << errbuf << endl; + cerr << "Error3 in DeleteGraveyard query " << errbuf << endl; return false; - } + } safe_delete_array(query); if (affected_rows == 0) { - cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << endl; + cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << endl; return false; } @@ -1483,7 +1483,7 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) { } uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; + char* query = new char[256]; char* end = query; uint32 affected_rows = 0; @@ -1491,13 +1491,13 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) { if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { safe_delete_array(query); - cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << endl; + cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << endl; return 0; - } + } safe_delete_array(query); if (affected_rows == 0) { - cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << endl; + cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << endl; return 0; } @@ -1505,7 +1505,7 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) { } uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; + char* query = new char[256]; char* end = query; uint32 affected_rows = 0; uint32 new_graveyard_id = 0; @@ -1514,13 +1514,13 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &new_graveyard_id)) { safe_delete_array(query); - cerr << "Error1 in NewGraveyardRecord query " << errbuf << endl; + cerr << "Error1 in NewGraveyardRecord query " << errbuf << endl; return 0; - } + } safe_delete_array(query); if (affected_rows == 0) { - cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << endl; + cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << endl; return 0; } @@ -1533,7 +1533,7 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard } uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; + char* query = new char[256]; char* end = query; uint32 affected_rows = 0; @@ -1542,20 +1542,20 @@ uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 in if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { safe_delete_array(query); - cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << endl; + cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << endl; return 0; - } + } safe_delete_array(query); if (affected_rows == 0) { - cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << endl; + cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << endl; return 0; } return dbid; } uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading, bool rezzed) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256+(datasize*2)]; + char* query = new char[256+(datasize*2)]; char* end = query; uint32 affected_rows = 0; @@ -1567,13 +1567,13 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char* if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { safe_delete_array(query); - cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << endl; + cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << endl; return 0; - } + } safe_delete_array(query); if (affected_rows == 0) { - cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << endl; + cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << endl; return 0; } if(rezzed){ @@ -1599,10 +1599,10 @@ void ZoneDatabase::MarkCorpseAsRezzed(uint32 dbid) uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256+(datasize*2)]; + char* query = new char[256+(datasize*2)]; char* end = query; - //MYSQL_RES *result; - //MYSQL_ROW row; + //MYSQL_RES *result; + //MYSQL_ROW row; uint32 affected_rows = 0; uint32 last_insert_id = 0; @@ -1612,20 +1612,20 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin *end++ = '\''; end += sprintf(end,", charname='%s', zoneid=%u, instanceid=%u, charid=%d, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f, timeofdeath=Now(), IsBurried=0", charname, zoneid, instanceid, charid, x, y, z, heading); - if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &last_insert_id)) { + if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &last_insert_id)) { safe_delete_array(query); - cerr << "Error1 in CreatePlayerCorpse query " << errbuf << endl; + cerr << "Error1 in CreatePlayerCorpse query " << errbuf << endl; return 0; - } + } safe_delete_array(query); if (affected_rows == 0) { - cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << endl; + cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << endl; return 0; } if (last_insert_id == 0) { - cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << endl; + cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << endl; return 0; } @@ -1634,7 +1634,7 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256+(datasize*2)]; + char* query = new char[256+(datasize*2)]; char* end = query; uint32 affected_rows = 0; uint32 last_insert_id = 0; @@ -1668,9 +1668,9 @@ bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const ch uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(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 CorpseCount = 0; if (RunQuery(query, MakeAnyLenString(&query, "select count(*) from player_corpses where charid = '%u' and IsBurried = 1", char_id), errbuf, &result)) { @@ -1689,9 +1689,9 @@ uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) { uint32 ZoneDatabase::GetPlayerCorpseCount(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 CorpseCount = 0; if (RunQuery(query, MakeAnyLenString(&query, "select count(*) from player_corpses where charid = '%u'", char_id), errbuf, &result)) { @@ -1710,9 +1710,9 @@ uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) { uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; uint32 id = 0; if (RunQuery(query, MakeAnyLenString(&query, "select id from player_corpses where charid = '%u'", char_id), errbuf, &result)) { @@ -1744,9 +1744,9 @@ uint32 ZoneDatabase::GetPlayerCorpseItemAt(uint32 corpse_id, uint16 slotid) { Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; Corpse* NewCorpse = 0; unsigned long* lengths; @@ -1778,7 +1778,7 @@ Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zone } bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, - float dest_x, float dest_y, float dest_z, float dest_heading) + float dest_x, float dest_y, float dest_z, float dest_heading) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; @@ -1789,20 +1789,20 @@ bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, ui unsigned long* lengths; if(!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET zoneid = %i, instanceid = %i, x = %f, y = %f, z = %f, " - "heading = %f, IsBurried = 0, WasAtGraveyard = 0 WHERE charid = %i", - dest_zoneid, dest_instanceid, dest_x, dest_y, dest_z, dest_heading, char_id), errbuf)) + "heading = %f, IsBurried = 0, WasAtGraveyard = 0 WHERE charid = %i", + dest_zoneid, dest_instanceid, dest_x, dest_y, dest_z, dest_heading, char_id), errbuf)) LogFile->write(EQEMuLog::Error, "Error moving corpses, Query = %s, Error = %s\n", query, errbuf); safe_delete_array(query); if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, charname, data, timeofdeath, rezzed FROM player_corpses WHERE charid='%u'" - "ORDER BY timeofdeath", char_id), errbuf, &result)) + "ORDER BY timeofdeath", char_id), errbuf, &result)) { while((row = mysql_fetch_row(result))) { lengths = mysql_fetch_lengths(result); NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), char_id, row[1], (uchar*) row[2], lengths[2], dest_x, dest_y, - dest_z, dest_heading, row[3],atoi(row[4])==1, false); + dest_z, dest_heading, row[3],atoi(row[4])==1, false); if(NewCorpse) { entity_list.AddCorpse(NewCorpse); NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); @@ -1825,7 +1825,7 @@ bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, ui bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new_instanceid, float new_x, float new_y, float new_z, float new_heading) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; + char* query = new char[256]; char* end = query; uint32 affected_rows = 0; bool Result = false; @@ -1833,11 +1833,11 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new end += sprintf(end, "UPDATE player_corpses SET IsBurried=0, zoneid=%u, instanceid=%u, x=%f, y=%f, z=%f, heading=%f, timeofdeath=Now(), WasAtGraveyard=0 WHERE id=%u", new_zoneid, new_instanceid, new_x, new_y, new_z, new_heading, dbid); if (RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { - if (affected_rows == 1) + if (affected_rows == 1) Result = true; else cerr << "Error2 in UnburyPlayerCorpse query: affected_rows NOT EQUAL to 1, as expected." << endl; - } + } else cerr << "Error1 in UnburyPlayerCorpse query " << errbuf << endl; @@ -1848,9 +1848,9 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; Corpse* NewCorpse = 0; unsigned long* lengths; @@ -1876,9 +1876,9 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) { bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; uint32 query_length = 0; unsigned long* lengths; @@ -1908,9 +1908,9 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) { uint32 ZoneDatabase::GetFirstCorpseID(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 CorpseID = 0; MakeAnyLenString(&query, "SELECT id FROM player_corpses WHERE charid='%u' AND IsBurried=0 ORDER BY timeofdeath LIMIT 1", char_id); @@ -1933,7 +1933,7 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) { bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE id=%d", dbid), errbuf)) { cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << endl; @@ -1947,7 +1947,7 @@ bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) { bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE charid=%d", charid), errbuf)) { cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << endl; @@ -1961,7 +1961,7 @@ bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) { bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where id=%d", dbid), errbuf)) { cerr << "Error in DeletePlayerCorpse query '" << query << "' " << errbuf << endl; @@ -2024,9 +2024,9 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){ if(!dbid) return; char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) FROM player_corpses WHERE id=%d and not timeofdeath=0", dbid), errbuf, &result)) { safe_delete_array(query); while ((row = mysql_fetch_row(result))) { diff --git a/zone/PlayerCorpse.h b/zone/PlayerCorpse.h index e5fbfc7c4..0cb767d7f 100644 --- a/zone/PlayerCorpse.h +++ b/zone/PlayerCorpse.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 CORPSE_H @@ -82,7 +82,7 @@ public: void Delete(); void Bury(); virtual void Depop(); - virtual void DepopCorpse(); + virtual void DepopCorpse(); uint32 GetCopper() { return copper; } uint32 GetSilver() { return silver; } diff --git a/zone/Quest.cpp b/zone/Quest.cpp index 5efd868ba..9a98902ab 100644 --- a/zone/Quest.cpp +++ b/zone/Quest.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 @@ -94,7 +94,7 @@ return false; pquest_entry Quest::Test( int NpcId, int QuestObject ) { for( int i=0;iGetIdentifier()] = qi; - _extensions[qi->GetIdentifier()] = ext; - _load_precedence.push_back(qi); + _interfaces[qi->GetIdentifier()] = qi; + _extensions[qi->GetIdentifier()] = ext; + _load_precedence.push_back(qi); } void QuestParserCollection::AddVar(std::string name, std::string val) { - std::list::iterator iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - (*iter)->AddVar(name, val); - iter++; - } + std::list::iterator iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + (*iter)->AddVar(name, val); + iter++; + } } void QuestParserCollection::ReloadQuests(bool reset_timers) { - _npc_quest_status.clear(); - _player_quest_status = QuestUnloaded; - _global_player_quest_status = QuestUnloaded; + _npc_quest_status.clear(); + _player_quest_status = QuestUnloaded; + _global_player_quest_status = QuestUnloaded; _global_npc_quest_status = QuestUnloaded; - _spell_quest_status.clear(); - _item_quest_status.clear(); - std::list::iterator iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - (*iter)->ReloadQuests(reset_timers); - iter++; - } + _spell_quest_status.clear(); + _item_quest_status.clear(); + std::list::iterator iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + (*iter)->ReloadQuests(reset_timers); + iter++; + } } bool QuestParserCollection::HasQuestSub(uint32 npcid, const char *subname) { - std::map::iterator iter = _npc_quest_status.find(npcid); + std::map::iterator iter = _npc_quest_status.find(npcid); - if(iter != _npc_quest_status.end()) { - //loaded or failed to load - if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); - if(qiter->second->HasQuestSub(npcid, subname)) { - return true; - } - } - } else { - QuestInterface *qi = GetQIByNPCQuest(npcid); - if(qi) { - _npc_quest_status[npcid] = qi->GetIdentifier(); - if(qi->HasQuestSub(npcid, subname)) { - return true; - } - } else { - _npc_quest_status[npcid] = QuestFailedToLoad; - } - } - - if(_global_npc_quest_status == QuestUnloaded){ - QuestInterface *qi = GetQIByGlobalNPCQuest(); - if(qi) { - _global_npc_quest_status = qi->GetIdentifier(); - if(qi->HasGlobalQuestSub(subname)) { - return true; - } - } + if(iter != _npc_quest_status.end()) { + //loaded or failed to load + if(iter->second != QuestFailedToLoad) { + std::map::iterator qiter = _interfaces.find(iter->second); + if(qiter->second->HasQuestSub(npcid, subname)) { + return true; + } + } } else { - if(_global_npc_quest_status != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(_global_npc_quest_status); - if(qiter->second->HasGlobalQuestSub(subname)) { - return true; - } - } - } - return false; + QuestInterface *qi = GetQIByNPCQuest(npcid); + if(qi) { + _npc_quest_status[npcid] = qi->GetIdentifier(); + if(qi->HasQuestSub(npcid, subname)) { + return true; + } + } else { + _npc_quest_status[npcid] = QuestFailedToLoad; + } + } + + if(_global_npc_quest_status == QuestUnloaded){ + QuestInterface *qi = GetQIByGlobalNPCQuest(); + if(qi) { + _global_npc_quest_status = qi->GetIdentifier(); + if(qi->HasGlobalQuestSub(subname)) { + return true; + } + } + } else { + if(_global_npc_quest_status != QuestFailedToLoad) { + std::map::iterator qiter = _interfaces.find(_global_npc_quest_status); + if(qiter->second->HasGlobalQuestSub(subname)) { + return true; + } + } + } + return false; } bool QuestParserCollection::PlayerHasQuestSub(const char *subname) { - if(_player_quest_status == QuestUnloaded) { - QuestInterface *qi = GetQIByGlobalPlayerQuest(); - if(qi) { - _global_player_quest_status = qi->GetIdentifier(); - } + if(_player_quest_status == QuestUnloaded) { + QuestInterface *qi = GetQIByGlobalPlayerQuest(); + if(qi) { + _global_player_quest_status = qi->GetIdentifier(); + } - qi = GetQIByPlayerQuest(); - if(qi) { - _player_quest_status = qi->GetIdentifier(); - return qi->PlayerHasQuestSub(subname) || qi->GlobalPlayerHasQuestSub(subname); - } - } else if(_player_quest_status != QuestFailedToLoad) { - std::map::iterator iter = _interfaces.find(_player_quest_status); - return iter->second->PlayerHasQuestSub(subname) || iter->second->GlobalPlayerHasQuestSub(subname); - } - return false; + qi = GetQIByPlayerQuest(); + if(qi) { + _player_quest_status = qi->GetIdentifier(); + return qi->PlayerHasQuestSub(subname) || qi->GlobalPlayerHasQuestSub(subname); + } + } else if(_player_quest_status != QuestFailedToLoad) { + std::map::iterator iter = _interfaces.find(_player_quest_status); + return iter->second->PlayerHasQuestSub(subname) || iter->second->GlobalPlayerHasQuestSub(subname); + } + return false; } bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, const char *subname) { - std::map::iterator iter = _spell_quest_status.find(spell_id); - if(iter != _spell_quest_status.end()) { - //loaded or failed to load - if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); - return qiter->second->SpellHasQuestSub(spell_id, subname); - } - } else { - QuestInterface *qi = GetQIBySpellQuest(spell_id); - if(qi) { - _spell_quest_status[spell_id] = qi->GetIdentifier(); - return qi->SpellHasQuestSub(spell_id, subname); - } else { - _spell_quest_status[spell_id] = QuestFailedToLoad; - } - } - return false; + std::map::iterator iter = _spell_quest_status.find(spell_id); + if(iter != _spell_quest_status.end()) { + //loaded or failed to load + if(iter->second != QuestFailedToLoad) { + std::map::iterator qiter = _interfaces.find(iter->second); + return qiter->second->SpellHasQuestSub(spell_id, subname); + } + } else { + QuestInterface *qi = GetQIBySpellQuest(spell_id); + if(qi) { + _spell_quest_status[spell_id] = qi->GetIdentifier(); + return qi->SpellHasQuestSub(spell_id, subname); + } else { + _spell_quest_status[spell_id] = QuestFailedToLoad; + } + } + return false; } bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, const char *subname) { - std::string item_script; - if(strcmp("EVENT_SCALE_CALC", subname) == 0 || strcmp("EVENT_ITEM_ENTERZONE", subname) == 0) { - item_script = itm->GetItem()->CharmFile; - } else if(strcmp("EVENT_ITEM_CLICK", subname) == 0 || strcmp("EVENT_ITEM_CLICK_CAST", subname) == 0) { - item_script = "script_"; - item_script += itoa(itm->GetItem()->ScriptFileID); - } else { - item_script = itoa(itm->GetItem()->ID); - } + std::string item_script; + if(strcmp("EVENT_SCALE_CALC", subname) == 0 || strcmp("EVENT_ITEM_ENTERZONE", subname) == 0) { + item_script = itm->GetItem()->CharmFile; + } else if(strcmp("EVENT_ITEM_CLICK", subname) == 0 || strcmp("EVENT_ITEM_CLICK_CAST", subname) == 0) { + item_script = "script_"; + item_script += itoa(itm->GetItem()->ScriptFileID); + } else { + item_script = itoa(itm->GetItem()->ID); + } - std::map::iterator iter = _item_quest_status.find(item_script); - if(iter != _item_quest_status.end()) { - //loaded or failed to load - if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); - return qiter->second->ItemHasQuestSub(itm, subname); - } - } else { - QuestInterface *qi = GetQIByItemQuest(item_script); - if(qi) { - _item_quest_status[item_script] = qi->GetIdentifier(); - return qi->ItemHasQuestSub(itm, subname); - } else { - _item_quest_status[item_script] = QuestFailedToLoad; - } - } - return false; + std::map::iterator iter = _item_quest_status.find(item_script); + if(iter != _item_quest_status.end()) { + //loaded or failed to load + if(iter->second != QuestFailedToLoad) { + std::map::iterator qiter = _interfaces.find(iter->second); + return qiter->second->ItemHasQuestSub(itm, subname); + } + } else { + QuestInterface *qi = GetQIByItemQuest(item_script); + if(qi) { + _item_quest_status[item_script] = qi->GetIdentifier(); + return qi->ItemHasQuestSub(itm, subname); + } else { + _item_quest_status[item_script] = QuestFailedToLoad; + } + } + return false; } void QuestParserCollection::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { - std::map::iterator iter = _npc_quest_status.find(npc->GetNPCTypeID()); - if(iter != _npc_quest_status.end()) { - //loaded or failed to load - if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); - qiter->second->EventNPC(evt, npc, init, data, extra_data); - } - } else { - QuestInterface *qi = GetQIByNPCQuest(npc->GetNPCTypeID()); - if(qi) { - _npc_quest_status[npc->GetNPCTypeID()] = qi->GetIdentifier(); - qi->EventNPC(evt, npc, init, data, extra_data); - } else { - _npc_quest_status[npc->GetNPCTypeID()] = QuestFailedToLoad; - } - } + std::map::iterator iter = _npc_quest_status.find(npc->GetNPCTypeID()); + if(iter != _npc_quest_status.end()) { + //loaded or failed to load + if(iter->second != QuestFailedToLoad) { + std::map::iterator qiter = _interfaces.find(iter->second); + qiter->second->EventNPC(evt, npc, init, data, extra_data); + } + } else { + QuestInterface *qi = GetQIByNPCQuest(npc->GetNPCTypeID()); + if(qi) { + _npc_quest_status[npc->GetNPCTypeID()] = qi->GetIdentifier(); + qi->EventNPC(evt, npc, init, data, extra_data); + } else { + _npc_quest_status[npc->GetNPCTypeID()] = QuestFailedToLoad; + } + } // K, lets also parse templates/global_npc.pl - if(_global_npc_quest_status != QuestUnloaded && _global_npc_quest_status != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(_global_npc_quest_status); - qiter->second->EventGlobalNPC(evt, npc, init, data, extra_data); - } else { - QuestInterface *qi = GetQIByGlobalNPCQuest(); - if(qi) { - _global_npc_quest_status = qi->GetIdentifier(); - qi->EventGlobalNPC(evt, npc, init, data, extra_data); - } else { - _global_npc_quest_status = QuestFailedToLoad; - } - } + if(_global_npc_quest_status != QuestUnloaded && _global_npc_quest_status != QuestFailedToLoad) { + std::map::iterator qiter = _interfaces.find(_global_npc_quest_status); + qiter->second->EventGlobalNPC(evt, npc, init, data, extra_data); + } else { + QuestInterface *qi = GetQIByGlobalNPCQuest(); + if(qi) { + _global_npc_quest_status = qi->GetIdentifier(); + qi->EventGlobalNPC(evt, npc, init, data, extra_data); + } else { + _global_npc_quest_status = QuestFailedToLoad; + } + } } void QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { - if(_player_quest_status == QuestUnloaded) { - QuestInterface *qi = GetQIByGlobalPlayerQuest(); - if(qi) { - _global_player_quest_status = qi->GetIdentifier(); - qi->EventGlobalPlayer(evt, client, data, extra_data); - } + if(_player_quest_status == QuestUnloaded) { + QuestInterface *qi = GetQIByGlobalPlayerQuest(); + if(qi) { + _global_player_quest_status = qi->GetIdentifier(); + qi->EventGlobalPlayer(evt, client, data, extra_data); + } - qi = GetQIByPlayerQuest(); - if(qi) { - _player_quest_status = qi->GetIdentifier(); - qi->EventPlayer(evt, client, data, extra_data); - } + qi = GetQIByPlayerQuest(); + if(qi) { + _player_quest_status = qi->GetIdentifier(); + qi->EventPlayer(evt, client, data, extra_data); + } - } else { - if(_global_player_quest_status != QuestFailedToLoad) { - std::map::iterator iter = _interfaces.find(_global_player_quest_status); + } else { + if(_global_player_quest_status != QuestFailedToLoad) { + std::map::iterator iter = _interfaces.find(_global_player_quest_status); if(iter != _interfaces.end()) - iter->second->EventGlobalPlayer(evt, client, data, extra_data); - } - if(_player_quest_status != QuestFailedToLoad) { - std::map::iterator iter = _interfaces.find(_player_quest_status); - iter->second->EventPlayer(evt, client, data, extra_data); - } - } + iter->second->EventGlobalPlayer(evt, client, data, extra_data); + } + if(_player_quest_status != QuestFailedToLoad) { + std::map::iterator iter = _interfaces.find(_player_quest_status); + iter->second->EventPlayer(evt, client, data, extra_data); + } + } } void QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { - std::string item_script; - if(evt == EVENT_SCALE_CALC || evt == EVENT_ITEM_ENTERZONE) { - item_script = item->GetItem()->CharmFile; - } else if(evt == EVENT_ITEM_CLICK || evt == EVENT_ITEM_CLICK_CAST) { - item_script = "script_"; - item_script += itoa(item->GetItem()->ScriptFileID); - } else { - item_script = itoa(item->GetItem()->ID); - } + std::string item_script; + if(evt == EVENT_SCALE_CALC || evt == EVENT_ITEM_ENTERZONE) { + item_script = item->GetItem()->CharmFile; + } else if(evt == EVENT_ITEM_CLICK || evt == EVENT_ITEM_CLICK_CAST) { + item_script = "script_"; + item_script += itoa(item->GetItem()->ScriptFileID); + } else { + item_script = itoa(item->GetItem()->ID); + } - std::map::iterator iter = _item_quest_status.find(item_script); - if(iter != _item_quest_status.end()) { - //loaded or failed to load - if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); - qiter->second->EventItem(evt, client, item, objid, extra_data); - } - } else { - QuestInterface *qi = GetQIByItemQuest(item_script); - if(qi) { - _item_quest_status[item_script] = qi->GetIdentifier(); - qi->EventItem(evt, client, item, objid, extra_data); - } else { - _item_quest_status[item_script] = QuestFailedToLoad; - } - } + std::map::iterator iter = _item_quest_status.find(item_script); + if(iter != _item_quest_status.end()) { + //loaded or failed to load + if(iter->second != QuestFailedToLoad) { + std::map::iterator qiter = _interfaces.find(iter->second); + qiter->second->EventItem(evt, client, item, objid, extra_data); + } + } else { + QuestInterface *qi = GetQIByItemQuest(item_script); + if(qi) { + _item_quest_status[item_script] = qi->GetIdentifier(); + qi->EventItem(evt, client, item, objid, extra_data); + } else { + _item_quest_status[item_script] = QuestFailedToLoad; + } + } } void QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { - std::map::iterator iter = _spell_quest_status.find(spell_id); - if(iter != _spell_quest_status.end()) { - //loaded or failed to load - if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); - qiter->second->EventSpell(evt, npc, client, spell_id, extra_data); - } - } else { - QuestInterface *qi = GetQIBySpellQuest(spell_id); - if(qi) { - _spell_quest_status[spell_id] = qi->GetIdentifier(); - qi->EventSpell(evt, npc, client, spell_id, extra_data); - } else { - _spell_quest_status[spell_id] = QuestFailedToLoad; - } - } + std::map::iterator iter = _spell_quest_status.find(spell_id); + if(iter != _spell_quest_status.end()) { + //loaded or failed to load + if(iter->second != QuestFailedToLoad) { + std::map::iterator qiter = _interfaces.find(iter->second); + qiter->second->EventSpell(evt, npc, client, spell_id, extra_data); + } + } else { + QuestInterface *qi = GetQIBySpellQuest(spell_id); + if(qi) { + _spell_quest_status[spell_id] = qi->GetIdentifier(); + qi->EventSpell(evt, npc, client, spell_id, extra_data); + } else { + _spell_quest_status[spell_id] = QuestFailedToLoad; + } + } } QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid) { - //first look for /quests/zone/npcid.ext (precedence) - std::string filename = "quests/"; - filename += zone->GetShortName(); - filename += "/"; - filename += itoa(npcid); - std::string tmp; - FILE *f = nullptr; + //first look for /quests/zone/npcid.ext (precedence) + std::string filename = "quests/"; + filename += zone->GetShortName(); + filename += "/"; + filename += itoa(npcid); + std::string tmp; + FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + std::list::iterator iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - //second look for /quests/zone/npcname.ext (precedence) - const NPCType *npc_type = database.GetNPCType(npcid); - if(!npc_type) { - return nullptr; - } - std::string npc_name = npc_type->name; - int sz = static_cast(npc_name.length()); - for(int i = 0; i < sz; ++i) { - if(npc_name[i] == '`') { - npc_name[i] = '-'; - } - } + //second look for /quests/zone/npcname.ext (precedence) + const NPCType *npc_type = database.GetNPCType(npcid); + if(!npc_type) { + return nullptr; + } + std::string npc_name = npc_type->name; + int sz = static_cast(npc_name.length()); + for(int i = 0; i < sz; ++i) { + if(npc_name[i] == '`') { + npc_name[i] = '-'; + } + } - filename = "quests/"; - filename += zone->GetShortName(); - filename += "/"; - filename += npc_name; + filename = "quests/"; + filename += zone->GetShortName(); + filename += "/"; + filename += npc_name; - iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - //third look for /quests/zone/default.ext (precedence) - filename = "quests/"; - filename += zone->GetShortName(); - filename += "/"; - filename += "default"; - iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + //third look for /quests/zone/default.ext (precedence) + filename = "quests/"; + filename += zone->GetShortName(); + filename += "/"; + filename += "default"; + iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - //fourth look for /quests/templates/npcid.ext (precedence) - filename = "quests/"; - filename += QUEST_TEMPLATES_DIRECTORY; - filename += "/"; - filename += itoa(npcid); - iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + //fourth look for /quests/templates/npcid.ext (precedence) + filename = "quests/"; + filename += QUEST_TEMPLATES_DIRECTORY; + filename += "/"; + filename += itoa(npcid); + iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - //fifth look for /quests/templates/npcname.ext (precedence) - filename = "quests/"; - filename += QUEST_TEMPLATES_DIRECTORY; - filename += "/"; - filename += npc_name; - iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + //fifth look for /quests/templates/npcname.ext (precedence) + filename = "quests/"; + filename += QUEST_TEMPLATES_DIRECTORY; + filename += "/"; + filename += npc_name; + iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - //fifth look for /quests/templates/default.ext (precedence) - filename = "quests/"; - filename += QUEST_TEMPLATES_DIRECTORY; - filename += "/"; - filename += "default"; - iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + //fifth look for /quests/templates/default.ext (precedence) + filename = "quests/"; + filename += QUEST_TEMPLATES_DIRECTORY; + filename += "/"; + filename += "default"; + iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - return nullptr; + return nullptr; } QuestInterface *QuestParserCollection::GetQIByPlayerQuest() { @@ -413,174 +413,174 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest() { if(!zone) return nullptr; - //first look for /quests/zone/player_v[instance_version].ext (precedence) - std::string filename = "quests/"; - filename += zone->GetShortName(); - filename += "/"; - filename += "player_v"; - filename += itoa(zone->GetInstanceVersion()); - std::string tmp; - FILE *f = nullptr; + //first look for /quests/zone/player_v[instance_version].ext (precedence) + std::string filename = "quests/"; + filename += zone->GetShortName(); + filename += "/"; + filename += "player_v"; + filename += itoa(zone->GetInstanceVersion()); + std::string tmp; + FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + std::list::iterator iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - //second look for /quests/zone/player.ext (precedence) - filename = "quests/"; - filename += zone->GetShortName(); - filename += "/"; - filename += "player"; + //second look for /quests/zone/player.ext (precedence) + filename = "quests/"; + filename += zone->GetShortName(); + filename += "/"; + filename += "player"; - iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - //third look for /quests/templates/player.ext (precedence) - filename = "quests/"; - filename += QUEST_TEMPLATES_DIRECTORY; - filename += "/"; - filename += "player"; - iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + //third look for /quests/templates/player.ext (precedence) + filename = "quests/"; + filename += QUEST_TEMPLATES_DIRECTORY; + filename += "/"; + filename += "player"; + iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - return nullptr; + return nullptr; } QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(){ - // simply look for templates/global_npc.pl - std::string filename = "quests/"; - filename += QUEST_TEMPLATES_DIRECTORY; - filename += "/"; - filename += "global_npc"; - std::string tmp; - FILE *f = nullptr; + // simply look for templates/global_npc.pl + std::string filename = "quests/"; + filename += QUEST_TEMPLATES_DIRECTORY; + filename += "/"; + filename += "global_npc"; + std::string tmp; + FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + std::list::iterator iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - return nullptr; + return nullptr; } QuestInterface *QuestParserCollection::GetQIByGlobalPlayerQuest() { - //first look for /quests/templates/player.ext (precedence) - std::string filename = "quests/"; - filename += QUEST_TEMPLATES_DIRECTORY; - filename += "/"; - filename += "global_player"; - std::string tmp; - FILE *f = nullptr; + //first look for /quests/templates/player.ext (precedence) + std::string filename = "quests/"; + filename += QUEST_TEMPLATES_DIRECTORY; + filename += "/"; + filename += "global_player"; + std::string tmp; + FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + std::list::iterator iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - return nullptr; + return nullptr; } QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id) { - //first look for /quests/spells/spell_id.ext (precedence) - std::string filename = "quests/spells/"; - filename += itoa(spell_id); - std::string tmp; - FILE *f = nullptr; + //first look for /quests/spells/spell_id.ext (precedence) + std::string filename = "quests/spells/"; + filename += itoa(spell_id); + std::string tmp; + FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + std::list::iterator iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - return nullptr; + return nullptr; } QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script) { - //first look for /quests/items/item_script.ext (precedence) - std::string filename = "quests/items/"; - filename += item_script; - std::string tmp; - FILE *f = nullptr; + //first look for /quests/items/item_script.ext (precedence) + std::string filename = "quests/items/"; + filename += item_script; + std::string tmp; + FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); - while(iter != _load_precedence.end()) { - tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); - tmp += "."; - tmp += ext->second; - f = fopen(tmp.c_str(), "r"); - if(f) { - fclose(f); - return (*iter); - } + std::list::iterator iter = _load_precedence.begin(); + while(iter != _load_precedence.end()) { + tmp = filename; + std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + tmp += "."; + tmp += ext->second; + f = fopen(tmp.c_str(), "r"); + if(f) { + fclose(f); + return (*iter); + } - iter++; - } + iter++; + } - return nullptr; + return nullptr; } diff --git a/zone/QuestParserCollection.h b/zone/QuestParserCollection.h index 640a1557b..341b62798 100644 --- a/zone/QuestParserCollection.h +++ b/zone/QuestParserCollection.h @@ -16,44 +16,44 @@ class QuestParserCollection { public: - QuestParserCollection(); - ~QuestParserCollection(); + QuestParserCollection(); + ~QuestParserCollection(); - void RegisterQuestInterface(QuestInterface *qi, std::string ext); + void RegisterQuestInterface(QuestInterface *qi, std::string ext); - void AddVar(std::string name, std::string val); - void ReloadQuests(bool reset_timers = true); + void AddVar(std::string name, std::string val); + void ReloadQuests(bool reset_timers = true); - bool HasQuestSub(uint32 npcid, const char *subname); + bool HasQuestSub(uint32 npcid, const char *subname); bool PlayerHasQuestSub(const char *subname); bool SpellHasQuestSub(uint32 spell_id, const char *subname); - bool ItemHasQuestSub(ItemInst *itm, const char *subname); + bool ItemHasQuestSub(ItemInst *itm, const char *subname); - void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); - void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); + void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); + void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); private: - QuestInterface *GetQIByNPCQuest(uint32 npcid); + QuestInterface *GetQIByNPCQuest(uint32 npcid); QuestInterface *GetQIByGlobalNPCQuest(); - QuestInterface *GetQIByPlayerQuest(); - QuestInterface *GetQIByGlobalPlayerQuest(); - QuestInterface *GetQIBySpellQuest(uint32 spell_id); - QuestInterface *GetQIByItemQuest(std::string item_script); + QuestInterface *GetQIByPlayerQuest(); + QuestInterface *GetQIByGlobalPlayerQuest(); + QuestInterface *GetQIBySpellQuest(uint32 spell_id); + QuestInterface *GetQIByItemQuest(std::string item_script); - std::map _interfaces; - std::map _extensions; - std::list _load_precedence; + std::map _interfaces; + std::map _extensions; + std::list _load_precedence; - //0x00 = Unloaded - //0xFFFFFFFF = Failed to Load - std::map _npc_quest_status; + //0x00 = Unloaded + //0xFFFFFFFF = Failed to Load + std::map _npc_quest_status; uint32 _global_npc_quest_status; - uint32 _player_quest_status; - uint32 _global_player_quest_status; - std::map _spell_quest_status; - std::map _item_quest_status; + uint32 _player_quest_status; + uint32 _global_player_quest_status; + std::map _spell_quest_status; + std::map _item_quest_status; }; extern QuestParserCollection *parse; diff --git a/zone/StringIDs.h b/zone/StringIDs.h index d54f56c23..af955fe7e 100644 --- a/zone/StringIDs.h +++ b/zone/StringIDs.h @@ -5,13 +5,13 @@ #define GENERIC_9_STRINGS 1 //%1 %2 %3 %4 %5 %6 %7 %8 %9 #define TARGET_OUT_OF_RANGE 100 //Your target is out of range, get closer! #define TARGET_NOT_FOUND 101 //Target player not found. -#define CANNOT_BIND 105 //You cannot form an affinity with this area. Try a city. +#define CANNOT_BIND 105 //You cannot form an affinity with this area. Try a city. #define SPELL_DOES_NOT_WORK_HERE 106 //This spell does not work here. #define SPELL_DOES_NOT_WORK_PLANE 107 //This spell does not work on this plane. #define CANT_SEE_TARGET 108 //You cannot see your target. #define MGB_STRING 113 //The next group buff you cast will hit all targets in range. -#define ABILITY_FAILED 116 //Your ability failed. Timer has been reset. -#define ESCAPE 114 //You escape from combat, hiding yourself from view. +#define ABILITY_FAILED 116 //Your ability failed. Timer has been reset. +#define ESCAPE 114 //You escape from combat, hiding yourself from view. #define TARGET_TOO_FAR 124 //Your target is too far away, get closer! #define PROC_TOOLOW 126 //Your will is not sufficient to command this weapon. #define PROC_PETTOOLOW 127 //Your pet's will is not sufficient to command its weapon. @@ -99,7 +99,7 @@ #define MEND_WORSEN 351 //You have worsened your wounds! #define MEND_FAIL 352 //You have failed to mend your wounds. #define LDON_SENSE_TRAP2 367 //You have not detected any traps. -#define LOOT_LORE_ERROR 371 //You cannot loot this Lore Item. You already have one. +#define LOOT_LORE_ERROR 371 //You cannot loot this Lore Item. You already have one. #define PICK_LORE 379 //You cannot pick up a lore item you already possess. #define CONSENT_DENIED 390 //You do not have consent to summon that corpse. #define DISCIPLINE_RDY 393 //You are ready to use a new discipline now. @@ -126,10 +126,10 @@ #define OTHER_HIT_NONMELEE 434 //%1 was hit by non-melee for %2 points of damage. #define SPELL_WORN_OFF_OF 436 //Your %1 spell has worn off of %2. #define SPELL_WORN_OFF 437 //Your %1 spell has worn off. -#define PET_TAUNTING 438 //Taunting attacker, Master. +#define PET_TAUNTING 438 //Taunting attacker, Master. #define INTERRUPT_SPELL 439 //Your spell is interrupted. #define LOSE_LEVEL 442 //You LOST a level! You are now level %1! -#define GAIN_ABILITY_POINT 446 //You have gained an ability point! You now have %1 ability point%2. +#define GAIN_ABILITY_POINT 446 //You have gained an ability point! You now have %1 ability point%2. #define GAIN_LEVEL 447 //You have gained a level! Welcome to level %1! #define LANG_SKILL_IMPROVED 449 //Your language skills have improved. #define OTHER_LOOTED_MESSAGE 466 //--%1 has looted a %2-- @@ -139,15 +139,15 @@ #define FACTION_BEST 471 //Your faction standing with %1 could not possibly get any better. #define FACTION_BETTER 472 //Your faction standing with %1 got better. #define PET_REPORT_HP 488 //I have %1 percent of my hit points left. -#define PET_NO_TAUNT 489 //No longer taunting attackers, Master. -#define PET_DO_TAUNT 490 //Taunting attackers as normal, Master. +#define PET_NO_TAUNT 489 //No longer taunting attackers, Master. +#define PET_DO_TAUNT 490 //Taunting attackers as normal, Master. #define CORPSE_DECAY1 495 //This corpse will decay in %1 minute(s) %2 seconds. #define DISC_LEVEL_ERROR 503 //You must be a level %1 ... to use this discipline. #define DISCIPLINE_CANUSEIN 504 //You can use a new discipline in %1 minutes %2 seconds. #define PVP_ON 552 //You are now player kill and follow the ways of Discord. #define GENERIC_STRINGID_SAY 554 //%1 says '%T2' #define CANNOT_WAKE 555 //%1 tells you, 'I am unable to wake %2, master.' -#define GUILD_NAME_IN_USE 711 //You cannot create a guild with that name, that guild already exists on this server. +#define GUILD_NAME_IN_USE 711 //You cannot create a guild with that name, that guild already exists on this server. #define GM_GAINXP 1002 //[GM] You have gained %1 AXP and %2 EXP (%3). #define FINISHING_BLOW 1009 //%1 scores a Finishing Blow!! #define ASSASSINATES 1016 //%1 ASSASSINATES their victim!! @@ -169,9 +169,9 @@ #define NPC_FLURRY 1045 //%1 executes a FLURRY of attacks on %2! #define DISCIPLINE_FEARLESS 1076 //%1 becomes fearless. #define DUEL_FINISHED 1088 //dont know text -#define EATING_MESSAGE 1091 //Chomp, chomp, chomp... %1 takes a bite from a %2. -#define DRINKING_MESSAGE 1093 //Glug, glug, glug... %1 takes a drink from a %2. -#define SUCCESSFUL_TAUNT 1095 //I'll teach you to interfere with me %3. +#define EATING_MESSAGE 1091 //Chomp, chomp, chomp... %1 takes a bite from a %2. +#define DRINKING_MESSAGE 1093 //Glug, glug, glug... %1 takes a drink from a %2. +#define SUCCESSFUL_TAUNT 1095 //I'll teach you to interfere with me %3. #define PET_SIT_STRING 1130 //Changing position, Master. #define PET_CALMING 1131 //Sorry, Master..calming down. #define PET_FOLLOWING 1132 //Following you, Master. @@ -180,26 +180,26 @@ #define PET_GETLOST_STRING 1135 //As you wish, oh great one. #define PET_LEADERIS 1136 //My leader is %3. #define I_FOLLOW_NOONE 1137 //I follow no one. -#define PET_ON_HOLD 1138 //Waiting for your order to attack, Master. -#define NOT_LEGAL_TARGET 1139 //I beg forgiveness, Master. That is not a legal target. +#define PET_ON_HOLD 1138 //Waiting for your order to attack, Master. +#define NOT_LEGAL_TARGET 1139 //I beg forgiveness, Master. That is not a legal target. #define MERCHANT_BUSY 1143 //I'm sorry, I am busy right now. #define MERCHANT_GREETING 1144 //Welcome to my shop, %3. #define MERCHANT_HANDY_ITEM1 1145 //Hello there, %3. How about a nice %4? #define MERCHANT_HANDY_ITEM2 1146 //Greetings, %3. You look like you could use a %4. -#define MERCHANT_HANDY_ITEM3 1147 //Hi there %3, just browsing? Have you seen the %4 I just got in? +#define MERCHANT_HANDY_ITEM3 1147 //Hi there %3, just browsing? Have you seen the %4 I just got in? #define MERCHANT_HANDY_ITEM4 1148 //Welcome to my shop, %3. You would probably find a %4 handy. #define AA_POINT 1197 //point #define AA_POINTS 1215 //points #define SPELL_FIZZLE_OTHER 1218 //%1's spell fizzles! #define MISSED_NOTE_OTHER 1219 //A missed note brings %1's song to a close! #define CORPSE_DECAY_NOW 1227 //This corpse is waiting to expire. -#define SURNAME_REJECTED 1374 //Your new surname was rejected. Please try a different name. +#define SURNAME_REJECTED 1374 //Your new surname was rejected. Please try a different name. #define DUEL_DECLINE 1383 //%1 has declined your challenge to duel to the death. #define DUEL_ACCEPTED 1384 //%1 has already accepted a duel with someone else. #define DUEL_CONSIDERING 1385 //%1 is considering a duel with someone else. #define PLAYER_REGAIN 1394 //You have control of yourself again. #define REZZ_ALREADY_PENDING 1379 //You were unable to restore the corpse to life, but you may have success with a later attempt. -#define IN_USE 1406 //Someone else is using that. Try again later. +#define IN_USE 1406 //Someone else is using that. Try again later. #define DUEL_FLED 1408 //%1 has defeated %2 in a duel to the death! %3 has fled like a cowardly dog! #define MEMBER_OF_YOUR_GUILD 1429 #define OFFICER_OF_YOUR_GUILD 1430 @@ -216,7 +216,7 @@ #define SUSPEND_MINION_UNSUSPEND 3267 //%1 tells you, 'I live again...' #define SUSPEND_MINION_SUSPEND 3268 //%1 tells you, 'By your command, master.' #define ONLY_SUMMONED_PETS 3269 //3269 This effect only works with summoned pets. -#define SUSPEND_MINION_FIGHTING 3270 //Your pet must be at peace, first. +#define SUSPEND_MINION_FIGHTING 3270 //Your pet must be at peace, first. #define TRADESKILL_MISSING_ITEM 3455 //You are missing a %1. #define TRADESKILL_MISSING_COMPONENTS 3456 //Sorry, but you don't have everything you need for this recipe in your general inventory. #define TRADESKILL_LEARN_RECIPE 3457 //You have learned the recipe %1! @@ -236,14 +236,14 @@ #define MELEE_SILENCE 5806 //You *CANNOT* use this melee ability, you are suffering from amnesia! #define DISCIPLINE_REUSE_MSG 5807 //You can use the ability %1 again in %2 hour(s) %3 minute(s) %4 seconds. #define DISCIPLINE_REUSE_MSG2 5808 //You can use the ability %1 again in %2 minute(s) %3 seconds. -#define FAILED_TAUNT 5811 //You have failed to taunt your target. +#define FAILED_TAUNT 5811 //You have failed to taunt your target. #define AA_NO_TARGET 5825 //You must first select a target for this ability! -#define FORAGE_MASTERY 6012 //Your forage mastery has enabled you to find something else! -#define GUILD_BANK_CANNOT_DEPOSIT 6097 // Cannot deposit this item. Containers must be empty, and only one of each LORE and no NO TRADE or TEMPORARY items may be deposited. +#define FORAGE_MASTERY 6012 //Your forage mastery has enabled you to find something else! +#define GUILD_BANK_CANNOT_DEPOSIT 6097 // Cannot deposit this item. Containers must be empty, and only one of each LORE and no NO TRADE or TEMPORARY items may be deposited. #define GUILD_BANK_FULL 6098 // There is no more room in the Guild Bank. #define GUILD_BANK_TRANSFERRED 6100 // '%1' transferred to Guild Bank from Deposits. #define GUILD_BANK_EMPTY_HANDS 6108 // You must empty your hands to withdraw from the Guild Bank. -#define GENERIC_STRING 6688 //%1 (used to any basic message) +#define GENERIC_STRING 6688 //%1 (used to any basic message) #define SENTINEL_TRIG_YOU 6724 //You have triggered your sentinel. #define SENTINEL_TRIG_OTHER 6725 //%1 has triggered your sentinel. #define IDENTIFY_SPELL 6765 //Item Lore: %1. @@ -279,11 +279,11 @@ #define SHAKE_OFF_STUN 9077 #define STRIKETHROUGH_STRING 9078 //You strike through your opponent's defenses! #define SPELL_REFLECT 9082 //%1's spell has been reflected by %2. -#define NEW_SPELLS_AVAIL 9149 //You have new spells available to you. Check the merchants near your guild master. -#define PET_NOW_FOCUSING 9254 //Focusing on one target, Master. -#define PET_NOT_FOCUSING 9263 //No longer focusing on one target, Master. -#define PET_NOT_CASTING 9264 //Not casting spells, Master. -#define PET_CASTING 9291 //Casting spells normally, Master. +#define NEW_SPELLS_AVAIL 9149 //You have new spells available to you. Check the merchants near your guild master. +#define PET_NOW_FOCUSING 9254 //Focusing on one target, Master. +#define PET_NOT_FOCUSING 9263 //No longer focusing on one target, Master. +#define PET_NOT_CASTING 9264 //Not casting spells, Master. +#define PET_CASTING 9291 //Casting spells normally, Master. #define AE_RAMPAGE 11015 //%1 goes on a WILD RAMPAGE! #define FACE_ACCEPTED 12028 //Facial features accepted. #define SPELL_LEVEL_TO_LOW 12048 //You will have to achieve level %1 before you can scribe the %2. @@ -329,9 +329,9 @@ #define DIVINE_AURA_NO_ATK 12695 //You can't attack while invulnerable! #define TRY_ATTACKING_SOMEONE 12696 //Try attacking someone other than yourself, it's more productive. #define BACKSTAB_WEAPON 12874 //You need a piercing weapon as your primary weapon in order to backstab -#define MORE_SKILLED_THAN_I 12931 //%1 tells you, 'You are more skilled than I! What could I possibly teach you?' -#define SURNAME_EXISTS 12939 //You already have a surname. Operation failed. -#define SURNAME_LEVEL 12940 //You can only submit a surname upon reaching the 20th level. Operation failed. +#define MORE_SKILLED_THAN_I 12931 //%1 tells you, 'You are more skilled than I! What could I possibly teach you?' +#define SURNAME_EXISTS 12939 //You already have a surname. Operation failed. +#define SURNAME_LEVEL 12940 //You can only submit a surname upon reaching the 20th level. Operation failed. #define SURNAME_TOO_LONG 12942 //Surname must be less than 20 characters in length. #define REPORT_ONCE 12945 //You may only submit a report once per time that you zone. Thank you. #define NOW_INVISIBLE 12950 //%1 is now Invisible. @@ -344,3 +344,4 @@ #define GENERIC_MISS 15041 //%1 missed %2 #endif + diff --git a/zone/ZoneConfig.cpp b/zone/ZoneConfig.cpp index 3c3f4ffdc..65ecefa13 100644 --- a/zone/ZoneConfig.cpp +++ b/zone/ZoneConfig.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 "../common/debug.h" #include "ZoneConfig.h" diff --git a/zone/ZoneConfig.h b/zone/ZoneConfig.h index 41eae1b9c..4fbbf9e59 100644 --- a/zone/ZoneConfig.h +++ b/zone/ZoneConfig.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 __ZoneConfig_H #define __ZoneConfig_H diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 347c52264..2d9bbeb12 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.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 @@ -125,48 +125,48 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) { t2 = 0 - t2; if(t3 < 0) t3 = 0 - t3; - if( ( t1 > iAggroRange) - || ( t2 > iAggroRange) - || ( t3 > iAggroRange) ) { - towho->Message(0, "...%s is out of range (fast). distances (%.3f,%.3f,%.3f), range %.3f", mob->GetName(), - t1, t2, t3, iAggroRange); - return; + if(( t1 > iAggroRange) + || ( t2 > iAggroRange) + || ( t3 > iAggroRange) ) { + towho->Message(0, "...%s is out of range (fast). distances (%.3f,%.3f,%.3f), range %.3f", mob->GetName(), + t1, t2, t3, iAggroRange); + return; } if(mob->IsInvisible(this)) { - towho->Message(0, "...%s is invisible to me. ", mob->GetName()); - return; + towho->Message(0, "...%s is invisible to me. ", mob->GetName()); + return; } if((mob->IsClient() && - (!mob->CastToClient()->Connected() - || mob->CastToClient()->IsLD() - || mob->CastToClient()->IsBecomeNPC() - || mob->CastToClient()->GetGM() - ) - )) + (!mob->CastToClient()->Connected() + || mob->CastToClient()->IsLD() + || mob->CastToClient()->IsBecomeNPC() + || mob->CastToClient()->GetGM() + ) + )) { - towho->Message(0, "...%s is my owner. ", mob->GetName()); - return; + towho->Message(0, "...%s is my owner. ", mob->GetName()); + return; } if(mob == GetOwner()) { - towho->Message(0, "...%s a GM or is not connected. ", mob->GetName()); - return; + towho->Message(0, "...%s a GM or is not connected. ", mob->GetName()); + return; } - float dist2 = mob->DistNoRoot(*this); + float dist2 = mob->DistNoRoot(*this); float iAggroRange2 = iAggroRange*iAggroRange; if( dist2 > iAggroRange2 ) { - towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(), - dist2, iAggroRange2); - return; + towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(), + dist2, iAggroRange2); + return; } if(GetINT() > 75 && mob->GetLevelCon(GetLevel()) == CON_GREEN ) { - towho->Message(0, "...%s is red to me (basically)", mob->GetName(), - dist2, iAggroRange2); - return; + towho->Message(0, "...%s is red to me (basically)", mob->GetName(), + dist2, iAggroRange2); + return; } if(verbose) { @@ -224,15 +224,15 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) { || fv == FACTION_THREATENLY )) { - towho->Message(0, "...%s faction not low enough. value='%s'", mob->GetName(), FactionValueToString(fv)); - return; + towho->Message(0, "...%s faction not low enough. value='%s'", mob->GetName(), FactionValueToString(fv)); + return; } if(fv == FACTION_THREATENLY) { - towho->Message(0, "...%s threatening to me, so they only have a %d chance per check of attacking.", mob->GetName()); + towho->Message(0, "...%s threatening to me, so they only have a %d chance per check of attacking.", mob->GetName()); } if(!CheckLosFN(mob)) { - towho->Message(0, "...%s is out of sight.", mob->GetName()); + towho->Message(0, "...%s is out of sight.", mob->GetName()); } towho->Message(0, "...%s meets all conditions, I should be attacking them.", mob->GetName()); @@ -262,7 +262,7 @@ bool Mob::CheckWillAggro(Mob *mob) { // Check If it's invisible and if we can see invis // Check if it's a client, and that the client is connected and not linkdead, - // and that the client isn't Playing an NPC, with thier gm flag on + // and that the client isn't Playing an NPC, with thier gm flag on // Check if it's not a Interactive NPC // Trumpcard: The 1st 3 checks are low cost calcs to filter out unnessecary distance checks. Leave them at the beginning, they are the most likely occurence. // Image: I moved this up by itself above faction and distance checks because if one of these return true, theres no reason to go through the other information @@ -278,17 +278,17 @@ bool Mob::CheckWillAggro(Mob *mob) { t2 = 0 - t2; if(t3 < 0) t3 = 0 - t3; - if( ( t1 > iAggroRange) - || ( t2 > iAggroRange) - || ( t3 > iAggroRange) - ||(mob->IsInvisible(this)) - || (mob->IsClient() && - (!mob->CastToClient()->Connected() - || mob->CastToClient()->IsLD() - || mob->CastToClient()->IsBecomeNPC() - || mob->CastToClient()->GetGM() - ) - )) + if(( t1 > iAggroRange) + || ( t2 > iAggroRange) + || ( t3 > iAggroRange) + ||(mob->IsInvisible(this)) + || (mob->IsClient() && + (!mob->CastToClient()->Connected() + || mob->CastToClient()->IsLD() + || mob->CastToClient()->IsBecomeNPC() + || mob->CastToClient()->GetGM() + ) + )) { return(false); } @@ -301,7 +301,7 @@ bool Mob::CheckWillAggro(Mob *mob) { return(false); } - float dist2 = mob->DistNoRoot(*this); + float dist2 = mob->DistNoRoot(*this); float iAggroRange2 = iAggroRange*iAggroRange; if( dist2 > iAggroRange2 ) { @@ -354,14 +354,14 @@ bool Mob::CheckWillAggro(Mob *mob) { #endif return(true); } - } + } #if EQDEBUG >= 6 - printf("Is In zone?:%d\n", mob->InZone()); - printf("Dist^2: %f\n", dist2); - printf("Range^2: %f\n", iAggroRange2); - printf("Faction: %d\n", fv); - printf("Int: %d\n", GetINT()); - printf("Con: %d\n", GetLevelCon(mob->GetLevel())); + printf("Is In zone?:%d\n", mob->InZone()); + printf("Dist^2: %f\n", dist2); + printf("Range^2: %f\n", iAggroRange2); + printf("Faction: %d\n", fv); + printf("Int: %d\n", GetINT()); + printf("Con: %d\n", GetLevelCon(mob->GetLevel())); #endif return(false); } @@ -478,7 +478,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { if(useprimfaction || sender->GetReverseFactionCon(mob) <= FACTION_AMIABLE ) { //attacking someone on same faction, or a friend - //Father Nitwit: make sure we can see them. + //Father Nitwit: make sure we can see them. if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) LogFile->write(EQEMuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", @@ -495,7 +495,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { /* solar: returns false if attack should not be allowed I try to list every type of conflict that's possible here, so it's easy -to see how the decision is made. Yea, it could be condensed and made +to see how the decision is made. Yea, it could be condensed and made faster, but I'm doing it this way to make it readable and easy to modify */ @@ -557,7 +557,7 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack) // solar: the format here is a matrix of mob type vs mob type. // redundant ones are omitted and the reverse is tried if it falls through. - // first figure out if we're pets. we always look at the master's flags. + // first figure out if we're pets. we always look at the master's flags. // no need to compare pets to anything mob1 = our_owner ? our_owner : this; mob2 = target_owner ? target_owner : target; @@ -706,7 +706,7 @@ type', in which case, the answer is yes. // solar: this is to check if non detrimental things are allowed to be done -// to the target. clients cannot affect npcs and vice versa, and clients +// to the target. clients cannot affect npcs and vice versa, and clients // cannot affect other clients that are not of the same pvp flag as them. // also goes for their pets bool Mob::IsBeneficialAllowed(Mob *target) @@ -723,7 +723,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) // solar: see IsAttackAllowed for notes - // first figure out if we're pets. we always look at the master's flags. + // first figure out if we're pets. we always look at the master's flags. // no need to compare pets to anything mob1 = this->GetOwnerID() ? this->GetOwner() : this; mob2 = target->GetOwnerID() ? target->GetOwner() : target; @@ -757,7 +757,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) } else if(_NPC(mob2)) // client to npc { - /* fall through and swap positions */ + /* fall through and swap positions */ } else if(_BECOMENPC(mob2)) // client to becomenpc { @@ -914,17 +914,17 @@ bool Mob::CheckLos(Mob* other) { float dist_z = tmp_z - trg_z; if (dist_z < 0) dist_z *= -1; - if (dist_x < dist_y && dist_z < dist_y) + if (dist_x < dist_y && dist_z < dist_y) { perwalk_x /= (dist_y/dist_x); perwalk_z /= (dist_y/dist_z); } - else if (dist_y < dist_x && dist_z < dist_x) + else if (dist_y < dist_x && dist_z < dist_x) { perwalk_y /= (dist_x/dist_y); perwalk_z /= (dist_x/dist_z); } - else if (dist_x < dist_z && dist_y < dist_z) + else if (dist_x < dist_z && dist_y < dist_z) { perwalk_x /= (dist_z/dist_x); perwalk_y /= (dist_z/dist_y); @@ -1003,7 +1003,7 @@ bool Mob::CheckLos(Mob* other) { iface++; } /* solar: our aggro code isn't using this right now, just spells, so i'm - taking out the +-10 check for now to make it work right on hills + taking out the +-10 check for now to make it work right on hills if (best_z - 10 > trg_z || best_z + 10 < trg_z) { return false; @@ -1074,7 +1074,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { } } #if LOSDEBUG>=5 - else { + else { LogFile->write(EQEMuLog::Debug, "WTF, I have no node, what am I standing on??? (%.2f, %.2f).", myloc.x, myloc.y); } #endif @@ -1096,7 +1096,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { } } #if LOSDEBUG>=5 - else if(onode == NODE_NONE) { + else if(onode == NODE_NONE) { LogFile->write(EQEMuLog::Debug, "WTF, They have no node, what are they standing on??? (%.2f, %.2f).", myloc.x, myloc.y); } #endif @@ -1365,8 +1365,8 @@ int32 Mob::CheckHealAggroAmount(uint16 spellid, uint32 heal_possible) { break; } default:{ - break; - } + break; + } } } if (IsBardSong(spell_id)) @@ -1413,7 +1413,7 @@ void Mob::AddFeignMemory(Client* attacker) { void Mob::RemoveFromFeignMemory(Client* attacker) { feign_memory_list.erase(attacker->CharacterID()); if(feign_memory_list.empty() && AIfeignremember_timer != nullptr) - AIfeignremember_timer->Disable(); + AIfeignremember_timer->Disable(); if(feign_memory_list.empty()) { minLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMin); @@ -1424,14 +1424,14 @@ void Mob::RemoveFromFeignMemory(Client* attacker) { } void Mob::ClearFeignMemory() { - std::set::iterator RememberedCharID = feign_memory_list.begin(); - while (RememberedCharID != feign_memory_list.end()) - { - Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID); - if(remember_client != nullptr) //Still in zone - remember_client->RemoveXTarget(this, false); - ++RememberedCharID; - } + std::set::iterator RememberedCharID = feign_memory_list.begin(); + while (RememberedCharID != feign_memory_list.end()) + { + Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID); + if(remember_client != nullptr) //Still in zone + remember_client->RemoveXTarget(this, false); + ++RememberedCharID; + } feign_memory_list.clear(); minLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMin); @@ -1487,5 +1487,3 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) { return false; } - - diff --git a/zone/attack.cpp b/zone/attack.cpp index 9ced16fd8..c08382838 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2002 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 */ #if EQDEBUG >= 5 @@ -48,7 +48,7 @@ extern WorldServer worldserver; #ifdef _WINDOWS #define snprintf _snprintf #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #endif extern EntityList entity_list; @@ -171,11 +171,11 @@ bool Mob::AttackAnimation(SkillType &skillinuse, int Hand, const ItemInst* weapo type = animDualWield; DoAnim(type); - return true; + return true; } // called when a mob is attacked, does the checks to see if it's a hit -// and does other mitigation checks. 'this' is the mob being attacked. +// and does other mitigation checks. 'this' is the mob being attacked. bool Mob::CheckHitChance(Mob* other, SkillType skillinuse, int Hand, int16 chance_mod) { /*/ @@ -306,10 +306,10 @@ bool Mob::CheckHitChance(Mob* other, SkillType skillinuse, int Hand, int16 chanc //Accuracy = Spell Effect , HitChance = 'Accuracy' from Item Effect //Only AA derived accuracy can be skill limited. ie (Precision of the Pathfinder, Dead Aim) hitBonus += (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1] + - attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1] + - attacker->aabonuses.Accuracy[HIGHEST_SKILL+1] + - attacker->aabonuses.Accuracy[skillinuse] + - attacker->itembonuses.HitChance) / 15.0f; + attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1] + + attacker->aabonuses.Accuracy[HIGHEST_SKILL+1] + + attacker->aabonuses.Accuracy[skillinuse] + + attacker->itembonuses.HitChance) / 15.0f; hitBonus += chance_mod; //Modifier applied from casted/disc skill attacks. @@ -354,13 +354,13 @@ bool Mob::CheckHitChance(Mob* other, SkillType skillinuse, int Hand, int16 chanc bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) { /* solar: called when a mob is attacked, does the checks to see if it's a hit - * and does other mitigation checks. 'this' is the mob being attacked. + * and does other mitigation checks. 'this' is the mob being attacked. * * special return values: - * -1 - block - * -2 - parry - * -3 - riposte - * -4 - dodge + * -1 - block + * -2 - parry + * -3 - riposte + * -4 - dodge * */ float skill; @@ -390,7 +390,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) if (CanRiposte && damage > 0 && CanThisClassRiposte() && !other->BehindMob(this, other->GetX(), other->GetY())) { riposte_chance = (100.0f + (float)defender->aabonuses.RiposteChance + (float)defender->spellbonuses.RiposteChance + (float)defender->itembonuses.RiposteChance) / 100.0f; - skill = GetSkill(RIPOSTE); + skill = GetSkill(RIPOSTE); if (IsClient()) { CastToClient()->CheckIncreaseSkill(RIPOSTE, other, -10); } @@ -504,7 +504,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) if (damage > 0 && CanThisClassDodge() && !other->BehindMob(this, other->GetX(), other->GetY())) { dodge_chance = (100.0f + (float)defender->spellbonuses.DodgeChance + (float)defender->itembonuses.DodgeChance) / 100.0f; - skill = CastToClient()->GetSkill(DODGE); + skill = CastToClient()->GetSkill(DODGE); if (IsClient()) { CastToClient()->CheckIncreaseSkill(DODGE, other, -10); } @@ -674,7 +674,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit) { thac0 = thac0cap; } - d -= 10.0 * (a_diff / thac0); + d -= 10.0 * (a_diff / thac0); } else if(mit_roll > atk_roll) { @@ -688,7 +688,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit) } - d += 10 * (m_diff / thac20); + d += 10 * (m_diff / thac20); } if(d < 0.0) @@ -936,7 +936,7 @@ int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate if (hate) *hate += dmg; } else if(GetOwner() && GetLevel() >= RuleI(Combat, PetAttackMagicLevel)){ //pets wouldn't actually use this but... - dmg = 1; //it gives us an idea if we can hit + dmg = 1; //it gives us an idea if we can hit } else if(SpecAttacks[SPECATK_MAGICAL]){ dmg = 1; @@ -1111,7 +1111,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b //SetAttackTimer(); if ( - (IsCasting() && GetClass() != BARD && !IsFromSpell) + (IsCasting() && GetClass() != BARD && !IsFromSpell) || other == nullptr || ((IsClient() && CastToClient()->dead) || (other->IsClient() && other->CastToClient()->dead)) || (GetHP() < 0) @@ -1261,7 +1261,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b //riposte bool slippery_attack = false; // Part of hack to allow riposte to become a miss, but still allow a Strikethrough chance (like on Live) - if (damage == -3) { + if (damage == -3) { if (bRiposte) return false; else { if (Hand == 14) {// Do we even have it & was attack with mainhand? If not, don't bother with other calculations @@ -1305,7 +1305,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b other->AddToHateList(this, hate); /////////////////////////////////////////////////////////// - ////// Send Attack Damage + ////// Send Attack Damage /////////////////////////////////////////////////////////// other->Damage(this, damage, SPELL_UNKNOWN, skillinuse); @@ -1472,7 +1472,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ GetMerc()->Suspend(); } - parse->EventPlayer(EVENT_DEATH, this, "", 0); + parse->EventPlayer(EVENT_DEATH, this, "", 0); if (killerMob != nullptr) { @@ -1721,7 +1721,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ } } -bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell) // Kaiyodo - base function has changed prototype, need to update overloaded version +bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell) // Kaiyodo - base function has changed prototype, need to update overloaded version { _ZP(NPC_Attack); int damage = 0; @@ -1741,10 +1741,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //Check that we can attack before we calc heading and face our target if (!IsAttackAllowed(other)) { if (this->GetOwnerID()) - this->Say_StringID(NOT_LEGAL_TARGET); + this->Say_StringID(NOT_LEGAL_TARGET); if(other) { - if (other->IsClient()) - other->CastToClient()->RemoveXTarget(this, false); + if (other->IsClient()) + other->CastToClient()->RemoveXTarget(this, false); RemoveFromHateList(other); mlog(COMBAT__ATTACKS, "I am not allowed to attack %s", other->GetName()); } @@ -1766,9 +1766,9 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //figure out what weapon they are using, if any const Item_Struct* weapon = nullptr; if (Hand == 13 && equipment[SLOT_PRIMARY] > 0) - weapon = database.GetItem(equipment[SLOT_PRIMARY]); + weapon = database.GetItem(equipment[SLOT_PRIMARY]); else if (equipment[SLOT_SECONDARY]) - weapon = database.GetItem(equipment[SLOT_SECONDARY]); + weapon = database.GetItem(equipment[SLOT_SECONDARY]); //We dont factor much from the weapon into the attack. //Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons @@ -1864,11 +1864,11 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //check if we're hitting above our max or below it. if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) { mlog(COMBAT__DAMAGE, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); - damage = (min_dmg+eleBane); + damage = (min_dmg+eleBane); } if((max_dmg+eleBane) != 0 && damage > (max_dmg+eleBane)) { mlog(COMBAT__DAMAGE, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); - damage = (max_dmg+eleBane); + damage = (max_dmg+eleBane); } damage = mod_npc_damage(damage, skillinuse, Hand, &weapon_inst, other); @@ -1930,7 +1930,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(GetHP() > 0 && other->GetHP() >= DeathHP) { other->Damage(this, damage, SPELL_UNKNOWN, skillinuse, false); // Not avoidable client already had thier chance to Avoid - } else + } else return false; if (HasDied()) //killed by damage shield ect @@ -1986,10 +1986,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } if (damage > 0) - return true; + return true; else - return false; + return false; } void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic) { @@ -2000,7 +2000,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillType attack_ski if(attacked_timer.Check()) { mlog(COMBAT__HITS, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); - parse->EventNPC(EVENT_ATTACK, this, other, "", 0); + parse->EventNPC(EVENT_ATTACK, this, other, "", 0); } attacked_timer.Start(CombatEventTimer_expire); @@ -2164,7 +2164,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski killerMob->TrySpellOnKill(killed_level,spell); } /* Send the EVENT_KILLED_MERIT event and update kill tasks - * for all group members */ + * for all group members */ for (int i = 0; i < MAX_GROUP_MEMBERS; i++) { if (kg->members[i] != nullptr && kg->members[i]->IsClient()) { // If Group Member is Client Client *c = kg->members[i]->CastToClient(); @@ -2357,7 +2357,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski this->DoNPCEmote(ONDEATH,emoteid); if(oos->IsNPC()) { - parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0); + parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0); uint16 emoteid = oos->GetEmoteID(); if(emoteid != 0) oos->CastToNPC()->DoNPCEmote(KILLEDNPC,emoteid); @@ -2374,13 +2374,13 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski } void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) { - assert(other != nullptr); - if (other == this) - return; + assert(other != nullptr); + if (other == this) + return; - if(damage < 0){ - hate = 1; - } + if(damage < 0){ + hate = 1; + } bool wasengaged = IsEngaged(); Mob* owner = other->GetOwner(); @@ -2417,18 +2417,18 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if(other->SpecAttacks[IMMUNE_AGGRO_ON]) return; - if(SpecAttacks[NPC_TUNNELVISION]) { - Mob *top = GetTarget(); - if(top && top != other) { - hate *= RuleR(Aggro, TunnelVisionAggroMod); - } - } + if(SpecAttacks[NPC_TUNNELVISION]) { + Mob *top = GetTarget(); + if(top && top != other) { + hate *= RuleR(Aggro, TunnelVisionAggroMod); + } + } - if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(other->GetX(), other->GetY(), other->GetZ())) { - return; - } - } + if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { + if(!zone->watermap->InLiquid(other->GetX(), other->GetY(), other->GetZ())) { + return; + } + } // first add self // The damage on the hate list is used to award XP to the killer. This check is to prevent Killstealing. @@ -2496,7 +2496,7 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, } if (!wasengaged) { if(IsNPC() && other->IsClient() && other->CastToClient()) - parse->EventNPC(EVENT_AGGRO, this->CastToNPC(), other, "", 0); + parse->EventNPC(EVENT_AGGRO, this->CastToNPC(), other, "", 0); AI_Event_Engaged(other, iYellForHelp); adverrorinfo = 8293; } @@ -2550,8 +2550,8 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { //value for spells that effect pets. Unclear as to why. For now will convert all positive to be consistent. if (attacker->IsOffHandAtk()){ int16 mitigation = attacker->itembonuses.DSMitigationOffHand + - attacker->spellbonuses.DSMitigationOffHand + - attacker->aabonuses.DSMitigationOffHand; + attacker->spellbonuses.DSMitigationOffHand + + attacker->aabonuses.DSMitigationOffHand; DS -= DS*mitigation/100; } DS -= DS * attacker->itembonuses.DSMitigation / 100; @@ -2607,13 +2607,13 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) // Assert: This function should only be called for hits by the mainhand, as damage bonuses apply only to the - // weapon in the primary slot. Be sure to check that Hand == 13 before calling. + // weapon in the primary slot. Be sure to check that Hand == 13 before calling. // Assert: The caller should ensure that Weapon is actually a weapon before calling this function. - // The ItemInst::IsWeapon() method can be used to quickly determine this. + // The ItemInst::IsWeapon() method can be used to quickly determine this. // Assert: This function should not be called if the player's level is below 28, as damage bonuses do not begin - // to apply until level 28. + // to apply until level 28. // Assert: This function should not be called unless the player is a melee class, as casters do not receive a damage bonus. @@ -2679,9 +2679,9 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) if( ucPlayerLevel == 65 && Weapon->Delay <= 59 ) { // Consider these two facts: - // * Level 65 is the maximum level on many EQ Emu servers. - // * If you listed the levels of all characters logged on to a server, odds are that the number you'll - // see most frequently is level 65. That is, there are more level 65 toons than any other single level. + // * Level 65 is the maximum level on many EQ Emu servers. + // * If you listed the levels of all characters logged on to a server, odds are that the number you'll + // see most frequently is level 65. That is, there are more level 65 toons than any other single level. // // Therefore, if we can optimize this function for level 65 toons, we're speeding up the server! // @@ -2907,7 +2907,7 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) } else { - static const uint8 ucDelay46Levels28to52[] = {6, 6, 7, 8, 8, 8, 9, 10, 10, 11, 11, 11, 13, 13, 13, 14, 14, 15, 16, 16, 16, 17, 18, 20, 22}; + static const uint8 ucDelay46Levels28to52[] = {6, 6, 7, 8, 8, 8, 9, 10, 10, 11, 11, 11, 13, 13, 13, 14, 14, 15, 16, 16, 16, 17, 18, 20, 22}; return ucDelay46Levels28to52[ucPlayerLevel-28] + ((Weapon->Delay-46) / 3); } @@ -3019,11 +3019,11 @@ int Mob::GetMonkHandToHandDamage(void) // Kaiyodo - Determine a monk's fist damage. Table data from www.monkly-business.com // saved as static array - this should speed this function up considerably static int damage[66] = { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 99, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,11,11,11,11,11, - 12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14, - 14,14,15,15,15,15 }; + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + 99, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,11,11,11,11,11, + 12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14, + 14,14,15,15,15,15 }; // Have a look to see if we have epic fists on @@ -3032,10 +3032,10 @@ int Mob::GetMonkHandToHandDamage(void) else { int Level = GetLevel(); - if (Level > 65) - return(19); - else - return damage[Level]; + if (Level > 65) + return(19); + else + return damage[Level]; } } @@ -3045,16 +3045,16 @@ int Mob::GetMonkHandToHandDelay(void) // saved as static array - this should speed this function up considerably static int delayshuman[66] = { // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, - 36,36,36,36,36,35,35,35,35,35,34,34,34,34,34,33,33,33,33,33, - 32,32,32,32,32,31,31,31,31,31,30,30,30,29,29,29,28,28,28,27, - 26,24,22,20,20,20 }; + 99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, + 36,36,36,36,36,35,35,35,35,35,34,34,34,34,34,33,33,33,33,33, + 32,32,32,32,32,31,31,31,31,31,30,30,30,29,29,29,28,28,28,27, + 26,24,22,20,20,20 }; static int delaysiksar[66] = { // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, - 36,36,36,36,36,36,36,36,36,36,35,35,35,35,35,34,34,34,34,34, - 33,33,33,33,33,32,32,32,32,32,31,31,31,30,30,30,29,29,29,28, - 27,24,22,20,20,20 }; + 99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, + 36,36,36,36,36,36,36,36,36,36,35,35,35,35,35,34,34,34,34,34, + 33,33,33,33,33,32,32,32,32,32,31,31,31,30,30,30,29,29,29,28, + 27,24,22,20,20,20 }; // Have a look to see if we have epic fists on if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652) @@ -3064,17 +3064,17 @@ int Mob::GetMonkHandToHandDelay(void) int Level = GetLevel(); if (GetRace() == HUMAN) { - if (Level > 65) - return(24); - else - return delayshuman[Level]; + if (Level > 65) + return(24); + else + return delayshuman[Level]; } else //heko: iksar table { - if (Level > 65) - return(25); - else - return delaysiksar[Level]; + if (Level > 65) + return(25); + else + return delaysiksar[Level]; } } } @@ -3218,34 +3218,34 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi bool Mob::HasProcs() const { - for (int i = 0; i < MAX_PROCS; i++) - if (PermaProcs[i].spellID != SPELL_UNKNOWN || SpellProcs[i].spellID != SPELL_UNKNOWN) - return true; - return false; + for (int i = 0; i < MAX_PROCS; i++) + if (PermaProcs[i].spellID != SPELL_UNKNOWN || SpellProcs[i].spellID != SPELL_UNKNOWN) + return true; + return false; } bool Mob::HasDefensiveProcs() const { for (int i = 0; i < MAX_PROCS; i++) - if (DefensiveProcs[i].spellID != SPELL_UNKNOWN) - return true; - return false; + if (DefensiveProcs[i].spellID != SPELL_UNKNOWN) + return true; + return false; } bool Mob::HasSkillProcs() const { for (int i = 0; i < MAX_PROCS; i++) - if (SkillProcs[i].spellID != SPELL_UNKNOWN) - return true; - return false; + if (SkillProcs[i].spellID != SPELL_UNKNOWN) + return true; + return false; } bool Mob::HasRangedProcs() const { for (int i = 0; i < MAX_PROCS; i++) - if (RangedProcs[i].spellID != SPELL_UNKNOWN) - return true; - return false; + if (RangedProcs[i].spellID != SPELL_UNKNOWN) + return true; + return false; } bool Client::CheckDoubleAttack(bool tripleAttack) { @@ -3300,8 +3300,8 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if( spell_id != SPELL_UNKNOWN || attacker == nullptr ) avoidable = false; - // only apply DS if physical damage (no spell damage) - // damage shield calls this function with spell_id set, so its unavoidable + // only apply DS if physical damage (no spell damage) + // damage shield calls this function with spell_id set, so its unavoidable if (attacker && damage > 0 && spell_id == SPELL_UNKNOWN && skill_used != ARCHERY && skill_used != THROWING) { DamageShield(attacker); @@ -3372,7 +3372,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if(attacker->CastToClient()->GetFilter(FilterDamageShields) != FilterHide) attacker->Message(15, "The Spellshield absorbed %d of %d points of damage", origdmg - damage, origdmg); } - if (damage == 0 && attacker && origdmg != damage && IsClient()) { + if (damage == 0 && attacker && origdmg != damage && IsClient()) { //Kayen: Probably need to add a filter for this - Not sure if this msg is correct but there should be a message for spell negate/runes. Message(263, "%s tries to cast on you, but YOUR magical skin absorbs the spell.",attacker->GetCleanName()); } @@ -3433,13 +3433,13 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons TryDeathSave(); } - //fade mez if we are mezzed + //fade mez if we are mezzed if (IsMezzed()) { mlog(COMBAT__HITS, "Breaking mez due to attack."); BuffFadeByEffect(SE_Mez); } - //check stun chances if bashing + //check stun chances if bashing if (damage > 0 && ((skill_used == BASH || skill_used == KICK) && attacker)) { // NPCs can stun with their bash/kick as soon as they recieve it. @@ -3485,8 +3485,8 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //see if root will break if (IsRooted() && !FromDamageShield) { // neotoyko: only spells cancel root - /*Dev Quote 2010: http://forums.station.sony.com/eq/posts/list.m?topic_id=161443 - The Viscid Roots AA does the following: Reduces the chance for root to break by X percent. + /*Dev Quote 2010: http://forums.station.sony.com/eq/posts/list.m?topic_id=161443 + The Viscid Roots AA does the following: Reduces the chance for root to break by X percent. There is no distinction of any kind between the caster inflicted damage, or anyone else's damage. There is also no distinction between Direct and DOT damage in the root code. There is however, a provision that if the damage inflicted is greater than 500 per hit, the @@ -3521,8 +3521,8 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons SendHPUpdate(); } //end `if damage was done` - //send damage packet... - if(!iBuffTic) { //buff ticks do not send damage, instead they just call SendHPUpdate(), which is done below + //send damage packet... + if(!iBuffTic) { //buff ticks do not send damage, instead they just call SendHPUpdate(), which is done below EQApplicationPacket* outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct* a = (CombatDamage_Struct*)outapp->pBuffer; a->target = GetID(); @@ -3551,8 +3551,8 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //special crap for spell damage, looks hackish to me char val1[20]={0}; owner->Message_StringID(MT_NonMelee,OTHER_HIT_NONMELEE,GetCleanName(),ConvertArray(damage,val1)); - } else { - if(damage > 0) { + } else { + if(damage > 0) { if(spell_id != SPELL_UNKNOWN) filter = iBuffTic ? FilterDOT : FilterSpellDamage; else @@ -3583,9 +3583,9 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } } else - entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee,HIT_NON_MELEE,attacker->GetCleanName(),GetCleanName(),ConvertArray(damage,val1)); - } else { - if(damage > 0) { + entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee,HIT_NON_MELEE,attacker->GetCleanName(),GetCleanName(),ConvertArray(damage,val1)); + } else { + if(damage > 0) { if(spell_id != SPELL_UNKNOWN) filter = iBuffTic ? FilterDOT : FilterSpellDamage; else @@ -3628,7 +3628,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons safe_delete(outapp); } else { - //else, it is a buff tic... + //else, it is a buff tic... // Everhood - So we can see our dot dmg like live shows it. if(spell_id != SPELL_UNKNOWN && damage > 0 && attacker && attacker != this && attacker->IsClient()) { //might filter on (attack_skill>200 && attack_skill<250), but I dont think we need it @@ -3833,7 +3833,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { _ZP(Mob_TryWeaponProcA); if(!on) { SetTarget(nullptr); - LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } @@ -4037,7 +4037,7 @@ void Mob::TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage) { critMod += GetCritDmgMob(skill) * 2; // To account for base crit mod being 200 not 100 damage = (damage * critMod) / 100; - entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, CRITICAL_HIT, GetCleanName(), itoa(damage)); + entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, CRITICAL_HIT, GetCleanName(), itoa(damage)); } } } @@ -4190,7 +4190,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillType skillinuse) } else { - mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); return false; } } @@ -4207,8 +4207,8 @@ void Mob::DoRiposte(Mob* defender) { if (HasDied()) return; int16 DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[0] + - defender->spellbonuses.GiveDoubleRiposte[0] + - defender->itembonuses.GiveDoubleRiposte[0]; + defender->spellbonuses.GiveDoubleRiposte[0] + + defender->itembonuses.GiveDoubleRiposte[0]; //Live AA - Double Riposte if(DoubleRipChance && (DoubleRipChance >= MakeRandomInt(0, 100))) { @@ -4383,3 +4383,4 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) return damage; } } + diff --git a/zone/basic_functions.h b/zone/basic_functions.h index 5f8e30d6c..3fa8ba523 100644 --- a/zone/basic_functions.h +++ b/zone/basic_functions.h @@ -25,7 +25,7 @@ char com_list[512]; int calc(char * stuff) { int result = 0; int i = 0; - int a = 0; + int a = 0; static char temp[100]; int op = 0; memset(temp,0x0,100); @@ -105,15 +105,15 @@ int GetArgs(char * string) char temp[255]; char c_name[255]; int params = 0; - //char *buffer = new char[512]; // this is never deleted, causes zone to crash - char *buffer = com_list; - memset(temp,0x0,255); - //memset(buffer,0x0,512); - //#ifdef WIN32 - //strcpy(buffer,com_list); - //#else - //strncpy(buffer,com_list,sizeof(buffer)-1); - //#endif + //char *buffer = new char[512]; // this is never deleted, causes zone to crash + char *buffer = com_list; + memset(temp,0x0,255); + //memset(buffer,0x0,512); + //#ifdef WIN32 + //strcpy(buffer,com_list); + //#else + //strncpy(buffer,com_list,sizeof(buffer)-1); + //#endif int i=0; while (*buffer) { @@ -136,39 +136,39 @@ int GetArgs(char * string) } return 0; #else - if (strstr(string,"if")) { return 0; } - if (strstr(string,"sfollow")) { return 0; } - if (strstr(string,"save")) { return 0; } - if (strstr(string,"while")) { return 0; } - if (strstr(string,"break")) { return 1; } - if (strstr(string,"follow")) { return 1; } - if (strstr(string,"setallskill")) { return 1; } - if (strstr(string,"me")) { return 1; } - if (strstr(string,"flagcheck")) { return 1; } - if (strstr(string,"echo")) { return 1; } - if (strstr(string,"summonitem")) { return 1; } - if (strstr(string,"say")) { return 1; } - if (strstr(string,"emote")) { return 1; } - if (strstr(string,"shout")) { return 1; } - if (strstr(string,"depop")) { return 1; } - if (strstr(string,"cumflag")) { return 1; } - if (strstr(string,"exp")) { return 1; } - if (strstr(string,"level")) { return 1; } - if (strstr(string,"safemove")) { return 1; } - if (strstr(string,"rain")) { return 1; } - if (strstr(string,"snow")) { return 1; } - if (strstr(string,"pvp")) { return 1; } - if (strstr(string,"doanim")) { return 1; } - if (strstr(string,"dbspawnadd")) { return 2; } - if (strstr(string,"castspell")) { return 2; } - if (strstr(string,"flagcheck")) { return 2; } - if (strstr(string,"addskill")) { return 2; } - if (strstr(string,"write")) { return 2; } - if (strstr(string,"settarget")) { return 2; } - if (strstr(string,"givecash")) { return 4; } - if (strstr(string,"movepc")) { return 4; } - if (strstr(string,"spawn")) { return 6; } - return 0; + if (strstr(string,"if")) { return 0; } + if (strstr(string,"sfollow")) { return 0; } + if (strstr(string,"save")) { return 0; } + if (strstr(string,"while")) { return 0; } + if (strstr(string,"break")) { return 1; } + if (strstr(string,"follow")) { return 1; } + if (strstr(string,"setallskill")) { return 1; } + if (strstr(string,"me")) { return 1; } + if (strstr(string,"flagcheck")) { return 1; } + if (strstr(string,"echo")) { return 1; } + if (strstr(string,"summonitem")) { return 1; } + if (strstr(string,"say")) { return 1; } + if (strstr(string,"emote")) { return 1; } + if (strstr(string,"shout")) { return 1; } + if (strstr(string,"depop")) { return 1; } + if (strstr(string,"cumflag")) { return 1; } + if (strstr(string,"exp")) { return 1; } + if (strstr(string,"level")) { return 1; } + if (strstr(string,"safemove")) { return 1; } + if (strstr(string,"rain")) { return 1; } + if (strstr(string,"snow")) { return 1; } + if (strstr(string,"pvp")) { return 1; } + if (strstr(string,"doanim")) { return 1; } + if (strstr(string,"dbspawnadd")) { return 2; } + if (strstr(string,"castspell")) { return 2; } + if (strstr(string,"flagcheck")) { return 2; } + if (strstr(string,"addskill")) { return 2; } + if (strstr(string,"write")) { return 2; } + if (strstr(string,"settarget")) { return 2; } + if (strstr(string,"givecash")) { return 4; } + if (strstr(string,"movepc")) { return 4; } + if (strstr(string,"spawn")) { return 6; } + return 0; #endif // 0 } diff --git a/zone/beacon.cpp b/zone/beacon.cpp index 433f99627..2d2d9a942 100644 --- a/zone/beacon.cpp +++ b/zone/beacon.cpp @@ -1,24 +1,24 @@ -/* 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 */ /* -solar: Beacon class, extends Mob. Used for AE rain spells to have a mob +solar: Beacon class, extends Mob. Used for AE rain spells to have a mob target to center around. */ @@ -30,7 +30,7 @@ target to center around. #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #endif #include "masterentity.h" diff --git a/zone/beacon.h b/zone/beacon.h index d7ef43fd6..3d4f0ae23 100644 --- a/zone/beacon.h +++ b/zone/beacon.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 BEACON_H diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index c72fae7e9..ae8bf3c53 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -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 */ #include "../common/debug.h" #include "../common/spdat.h" @@ -532,10 +532,10 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu void Client::CalcEdibleBonuses(StatBonuses* newbon) { #if EQDEBUG >= 11 - cout<<"Client::CalcEdibleBonuses(StatBonuses* newbon)"<ConsumeProjectile += base1; break; - case SE_ForageAdditionalItems: - newbon->ForageAdditionalItems += base1; - break; - case SE_Salvage: - newbon->SalvageChance += base1; - break; + case SE_ForageAdditionalItems: + newbon->ForageAdditionalItems += base1; + break; + case SE_Salvage: + newbon->SalvageChance += base1; + break; case SE_ArcheryDamageModifier: newbon->ArcheryDamageModifier += base1; break; @@ -952,7 +952,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) { if(!newbon->SpellOnKill[i] || ((newbon->SpellOnKill[i] == base2) && (newbon->SpellOnKill[i+1] < base1))) { - //base1 = chance, base2 = SpellID to be triggered, base3 = min npc level + //base1 = chance, base2 = SpellID to be triggered, base3 = min npc level newbon->SpellOnKill[i] = base2; newbon->SpellOnKill[i+1] = base1; @@ -1275,7 +1275,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne break; } - case SE_AttackSpeed2: + case SE_AttackSpeed2: { if ((effect_value - 100) > 0) { // Haste V2 - Stacks with V1 but does not Overcap if ((effect_value - 100) > newbon->hastetype2) { @@ -1283,17 +1283,17 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne } } break; - } + } - case SE_AttackSpeed3: - { + case SE_AttackSpeed3: + { if (effect_value > 0) { // Haste V3 - Stacks and Overcaps if (effect_value > newbon->hastetype3) { newbon->hastetype3 = effect_value; } } break; - } + } case SE_AttackSpeed4: { @@ -1598,10 +1598,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne if (RuleB(Spells, AdditiveBonusValues) && item_bonus) newbon->AvoidMeleeChance += effect_value; - else if((effect_value < 0) && (newbon->AvoidMeleeChance > effect_value)) + else if((effect_value < 0) && (newbon->AvoidMeleeChance > effect_value)) newbon->AvoidMeleeChance = effect_value; - else if(newbon->AvoidMeleeChance < effect_value) + else if(newbon->AvoidMeleeChance < effect_value) newbon->AvoidMeleeChance = effect_value; break; } @@ -1625,7 +1625,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->DodgeChance += effect_value; else if((effect_value < 0) && (newbon->DodgeChance > effect_value)) - newbon->DodgeChance = effect_value; + newbon->DodgeChance = effect_value; if(newbon->DodgeChance < effect_value) newbon->DodgeChance = effect_value; @@ -1638,7 +1638,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->ParryChance += effect_value; else if((effect_value < 0) && (newbon->ParryChance > effect_value)) - newbon->ParryChance = effect_value; + newbon->ParryChance = effect_value; if(newbon->ParryChance < effect_value) newbon->ParryChance = effect_value; @@ -1651,7 +1651,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->DualWieldChance += effect_value; else if((effect_value < 0) && (newbon->DualWieldChance > effect_value)) - newbon->DualWieldChance = effect_value; + newbon->DualWieldChance = effect_value; if(newbon->DualWieldChance < effect_value) newbon->DualWieldChance = effect_value; @@ -1665,7 +1665,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->DoubleAttackChance += effect_value; else if((effect_value < 0) && (newbon->DoubleAttackChance > effect_value)) - newbon->DoubleAttackChance = effect_value; + newbon->DoubleAttackChance = effect_value; if(newbon->DoubleAttackChance < effect_value) newbon->DoubleAttackChance = effect_value; @@ -1676,9 +1676,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->TripleAttackChance += effect_value; + newbon->TripleAttackChance += effect_value; - else if((effect_value < 0) && (newbon->TripleAttackChance > effect_value)) + else if((effect_value < 0) && (newbon->TripleAttackChance > effect_value)) newbon->TripleAttackChance = effect_value; if(newbon->TripleAttackChance < effect_value) @@ -1691,7 +1691,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne if (RuleB(Spells, AdditiveBonusValues) && item_bonus) newbon->MeleeLifetap += spells[spell_id].base[i]; - else if((effect_value < 0) && (newbon->MeleeLifetap > effect_value)) + else if((effect_value < 0) && (newbon->MeleeLifetap > effect_value)) newbon->MeleeLifetap = spells[spell_id].base[i]; if(newbon->MeleeLifetap < spells[spell_id].base[i]) @@ -1731,8 +1731,8 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->Fearless = true; break; - case SE_HundredHands: - { + case SE_HundredHands: + { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) newbon->HundredHands += spells[spell_id].base[i]; @@ -1741,7 +1741,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne else if (effect_value < 0 && effect_value < newbon->HundredHands) newbon->HundredHands = effect_value; //Decrease Weapon Delay break; - } + } case SE_MeleeSkillCheck: { @@ -1820,7 +1820,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->ProcChance += effect_value; else if((effect_value < 0) && (newbon->DoubleAttackChance > effect_value)) - newbon->ProcChance = effect_value; + newbon->ProcChance = effect_value; if(newbon->ProcChance < effect_value) newbon->ProcChance = effect_value; @@ -2198,13 +2198,13 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->ConsumeProjectile += effect_value; break; - case SE_ForageAdditionalItems: - newbon->ForageAdditionalItems += effect_value; - break; + case SE_ForageAdditionalItems: + newbon->ForageAdditionalItems += effect_value; + break; - case SE_Salvage: - newbon->SalvageChance += effect_value; - break; + case SE_Salvage: + newbon->SalvageChance += effect_value; + break; case SE_ArcheryDamageModifier: newbon->ArcheryDamageModifier += effect_value; @@ -2443,9 +2443,9 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y, bool login) uint16 oldexp = e_inst->GetExp(); if(login) { - parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0); - } - parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0); + parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0); + } + parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0); if (e_inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client e_inst->ScaleItem(); @@ -2466,10 +2466,10 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y, bool login) EvoItemInst* e_inst = (EvoItemInst*)a_inst; uint16 oldexp = e_inst->GetExp(); - if(login) { - parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0); - } - parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0); + if(login) { + parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0); + } + parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0); if (e_inst->GetExp() != oldexp) { @@ -3345,17 +3345,17 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) itembonuses.ConsumeProjectile = effect_value; break; - case SE_ForageAdditionalItems: - spellbonuses.ForageAdditionalItems = effect_value; - aabonuses.ForageAdditionalItems = effect_value; - itembonuses.ForageAdditionalItems = effect_value; - break; + case SE_ForageAdditionalItems: + spellbonuses.ForageAdditionalItems = effect_value; + aabonuses.ForageAdditionalItems = effect_value; + itembonuses.ForageAdditionalItems = effect_value; + break; - case SE_Salvage: - spellbonuses.SalvageChance = effect_value; - aabonuses.SalvageChance = effect_value; - itembonuses.SalvageChance = effect_value; - break; + case SE_Salvage: + spellbonuses.SalvageChance = effect_value; + aabonuses.SalvageChance = effect_value; + itembonuses.SalvageChance = effect_value; + break; case SE_ArcheryDamageModifier: spellbonuses.ArcheryDamageModifier = effect_value; @@ -3500,3 +3500,4 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) } } } + diff --git a/zone/bot.cpp b/zone/bot.cpp index a2ffd5850..0717536cd 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1288,7 +1288,7 @@ void Bot::GenerateArmorClass() uint16 Bot::GetPrimarySkillValue() { - SkillType skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill + SkillType skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill bool equiped = m_inv.GetItem(SLOT_PRIMARY); if(!equiped) @@ -1297,7 +1297,7 @@ uint16 Bot::GetPrimarySkillValue() } else { - uint8 type = m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType; //is this the best way to do this? + uint8 type = m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType; //is this the best way to do this? switch(type) { case ItemType1HS: // 1H Slashing @@ -1471,7 +1471,7 @@ void Bot::LoadAAs() { MYSQL_RES* DatasetResult; MYSQL_ROW DataRow; - int maxAAExpansion = RuleI(Bots, BotAAExpansion); //get expansion to get AAs up to + int maxAAExpansion = RuleI(Bots, BotAAExpansion); //get expansion to get AAs up to botAAs.clear(); //start fresh if(GetClass() == BERSERKER) @@ -1502,7 +1502,7 @@ void Bot::LoadAAs() { //Get level required for AA if(RequiredLevel != AARequiredLevelAndCost.end()) - req_level = RequiredLevel->second.Level; + req_level = RequiredLevel->second.Level; else req_level = (sendAA->class_type + i * sendAA->level_inc); @@ -1903,7 +1903,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) { if(!newbon->SpellOnKill[i] || ((newbon->SpellOnKill[i] == base2) && (newbon->SpellOnKill[i+1] < base1))) { - //base1 = chance, base2 = SpellID to be triggered, base3 = min npc level + //base1 = chance, base2 = SpellID to be triggered, base3 = min npc level newbon->SpellOnKill[i] = base2; newbon->SpellOnKill[i+1] = base1; @@ -2473,17 +2473,17 @@ void Bot::SaveBuffs() { IsPersistent = 0; if(!database.RunQuery(Query, MakeAnyLenString(&Query, "INSERT INTO botbuffs (BotId, SpellId, CasterLevel, DurationFormula, " - "TicsRemaining, PoisonCounters, DiseaseCounters, CurseCounters, CorruptionCounters, HitCount, MeleeRune, MagicRune, " - "DeathSaveSuccessChance, CasterAARank, Persistent) VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u);", - GetBotID(), buffs[BuffCount].spellid, buffs[BuffCount].casterlevel, spells[buffs[BuffCount].spellid].buffdurationformula, - buffs[BuffCount].ticsremaining, - CalculatePoisonCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, - CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, - CalculateCurseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, - CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, - buffs[BuffCount].numhits, buffs[BuffCount].melee_rune, buffs[BuffCount].magic_rune, - buffs[BuffCount].deathSaveSuccessChance, - buffs[BuffCount].deathsaveCasterAARank, IsPersistent), TempErrorMessageBuffer)) { + "TicsRemaining, PoisonCounters, DiseaseCounters, CurseCounters, CorruptionCounters, HitCount, MeleeRune, MagicRune, " + "DeathSaveSuccessChance, CasterAARank, Persistent) VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u);", + GetBotID(), buffs[BuffCount].spellid, buffs[BuffCount].casterlevel, spells[buffs[BuffCount].spellid].buffdurationformula, + buffs[BuffCount].ticsremaining, + CalculatePoisonCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, + CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, + CalculateCurseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, + CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, + buffs[BuffCount].numhits, buffs[BuffCount].melee_rune, buffs[BuffCount].magic_rune, + buffs[BuffCount].deathSaveSuccessChance, + buffs[BuffCount].deathsaveCasterAARank, IsPersistent), TempErrorMessageBuffer)) { errorMessage = std::string(TempErrorMessageBuffer); safe_delete(Query); Query = 0; @@ -2527,15 +2527,15 @@ void Bot::LoadBuffs() { buffs[BuffCount].casterlevel = atoi(DataRow[1]); buffs[BuffCount].ticsremaining = atoi(DataRow[3]); - if(CalculatePoisonCounters(buffs[BuffCount].spellid) > 0) { - buffs[BuffCount].counters = atoi(DataRow[4]); - } else if(CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0) { - buffs[BuffCount].counters = atoi(DataRow[5]); - } else if(CalculateCurseCounters(buffs[BuffCount].spellid) > 0) { - buffs[BuffCount].counters = atoi(DataRow[6]); - } else if(CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0) { - buffs[BuffCount].counters = atoi(DataRow[7]); - } + if(CalculatePoisonCounters(buffs[BuffCount].spellid) > 0) { + buffs[BuffCount].counters = atoi(DataRow[4]); + } else if(CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0) { + buffs[BuffCount].counters = atoi(DataRow[5]); + } else if(CalculateCurseCounters(buffs[BuffCount].spellid) > 0) { + buffs[BuffCount].counters = atoi(DataRow[6]); + } else if(CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0) { + buffs[BuffCount].counters = atoi(DataRow[7]); + } buffs[BuffCount].numhits = atoi(DataRow[8]); buffs[BuffCount].melee_rune = atoi(DataRow[9]); buffs[BuffCount].magic_rune = atoi(DataRow[10]); @@ -3340,7 +3340,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillType skil } } - if (damage == -3) { + if (damage == -3) { DoRiposte(other); if (HasDied()) return; @@ -3591,7 +3591,7 @@ void Bot::AI_Process() { for(int counter = 0; counter < g->GroupCount(); counter++) { if(g->members[counter]) { Mob* tar = g->members[counter]->GetTarget(); - if(tar && tar->IsNPC() && tar->GetHateAmount(g->members[counter]) && IsAttackAllowed(g->members[counter]->GetTarget())) { + if(tar && tar->IsNPC() && tar->GetHateAmount(g->members[counter]) && IsAttackAllowed(g->members[counter]->GetTarget())) { AddToHateList(tar, 1); if(HasPet()) @@ -6185,7 +6185,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli item2 = database.GetItem(items[y]); if(item2) { if(botCanWear[y]) { - Say("Thank you for the %s, %s.", item2->Name, client->GetName()); + Say("Thank you for the %s, %s.", item2->Name, client->GetName()); } else { Say("I can't use this %s!", item2->Name); @@ -6565,7 +6565,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //riposte bool slippery_attack = false; // Part of hack to allow riposte to become a miss, but still allow a Strikethrough chance (like on Live) - if (damage == -3) { + if (damage == -3) { if (FromRiposte) return false; else { if (Hand == SLOT_SECONDARY) {// Do we even have it & was attack with mainhand? If not, don't bother with other calculations @@ -6609,7 +6609,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b } /////////////////////////////////////////////////////////// - ////// Send Attack Damage + ////// Send Attack Damage /////////////////////////////////////////////////////////// other->Damage(this, damage, SPELL_UNKNOWN, skillinuse); @@ -7218,8 +7218,8 @@ int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { int buff_tracker = -1; int buff_slot = 0; - uint16 focusspellid = 0; - uint16 focusspell_tracker = 0; + uint16 focusspellid = 0; + uint16 focusspell_tracker = 0; uint32 buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { focusspellid = buffs[buff_slot].spellid; @@ -7419,7 +7419,7 @@ int16 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel return 0; break; default: - LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -7751,7 +7751,7 @@ int16 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } } @@ -7811,13 +7811,13 @@ float Bot::GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_spe bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) { /* solar: called when a mob is attacked, does the checks to see if it's a hit - * and does other mitigation checks. 'this' is the mob being attacked. + * and does other mitigation checks. 'this' is the mob being attacked. * * special return values: - * -1 - block - * -2 - parry - * -3 - riposte - * -4 - dodge + * -1 - block + * -2 - parry + * -3 - riposte + * -4 - dodge * */ if(GetAppearance() == eaDead) @@ -7850,7 +7850,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) if (CanRiposte && damage > 0 && CanThisClassRiposte() && !other->BehindMob(this, other->GetX(), other->GetY())) { riposte_chance = (100.0f + (float)defender->GetAABonuses().RiposteChance + (float)defender->GetSpellBonuses().RiposteChance + (float)defender->GetItemBonuses().RiposteChance) / 100.0f; - skill = GetSkill(RIPOSTE); + skill = GetSkill(RIPOSTE); if (!ghit) { //if they are not using a garunteed hit discipline bonus = 2.0 + skill/60.0 + (GetDEX()/200); @@ -7953,7 +7953,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) if (damage > 0 && CanThisClassDodge() && !other->BehindMob(this, other->GetX(), other->GetY())) { dodge_chance = (100.0f + (float)defender->GetSpellBonuses().DodgeChance + (float)defender->GetItemBonuses().DodgeChance) / 100.0f; - skill = GetSkill(DODGE); + skill = GetSkill(DODGE); if (!ghit) { //if they are not using a garunteed hit discipline bonus = 2.0 + skill/60.0 + (GetAGI()/200); @@ -7994,7 +7994,7 @@ int Bot::GetMonkHandToHandDamage(void) // Kaiyodo - Determine a monk's fist damage. Table data from www.monkly-business.com // saved as static array - this should speed this function up considerably static int damage[66] = { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 99, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,11,11,11,11,11, 12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14, @@ -8153,7 +8153,7 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillType skillinuse) } else { - mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); return false; } } @@ -8170,8 +8170,8 @@ void Bot::DoRiposte(Mob* defender) { //double riposte int16 DoubleRipChance = defender->GetAABonuses().GiveDoubleRiposte[0] + - defender->GetSpellBonuses().GiveDoubleRiposte[0] + - defender->GetItemBonuses().GiveDoubleRiposte[0]; + defender->GetSpellBonuses().GiveDoubleRiposte[0] + + defender->GetItemBonuses().GiveDoubleRiposte[0]; if(DoubleRipChance && (DoubleRipChance >= MakeRandomInt(0, 100))) { mlog(COMBAT__ATTACKS, "Preforming a double riposte (%d percent chance)", DoubleRipChance); @@ -8306,7 +8306,7 @@ void Bot::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit) { thac0 = thac0cap; } - d -= 10.0 * (a_diff / thac0); + d -= 10.0 * (a_diff / thac0); } else if(mit_roll > atk_roll) { @@ -8317,7 +8317,7 @@ void Bot::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit) { thac20 = thac20cap; } - d += 10 * (m_diff / thac20); + d += 10 * (m_diff / thac20); } if(d < 0.0) @@ -8576,7 +8576,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) if(primaryweapondamage > 0){ if(level > 25){ - max_hit = (((2*backstab_dmg) * GetDamageTable(BACKSTAB) / 100) * 10 * GetSkill(BACKSTAB) / 355) + ((level-25)/3) + 1; + max_hit = (((2*backstab_dmg) * GetDamageTable(BACKSTAB) / 100) * 10 * GetSkill(BACKSTAB) / 355) + ((level-25)/3) + 1; hate = 20 * backstab_dmg * GetSkill(BACKSTAB) / 355; } else{ @@ -8591,7 +8591,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) } else { - // Trumpcard: Replaced switch statement with formula calc. This will give minhit increases all the way to 65. + // Trumpcard: Replaced switch statement with formula calc. This will give minhit increases all the way to 65. min_hit = (level * ( level*5 - 105)) / 100; } @@ -8715,11 +8715,11 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { if(level >= RuleI(Combat, NPCBashKickLevel)){ bool canBash = false; if((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) // Racial Slam - || (m_inv.GetItem(SLOT_SECONDARY) && m_inv.GetItem(SLOT_SECONDARY)->GetItem()->ItemType == ItemTypeShield) //Using Shield + || (m_inv.GetItem(SLOT_SECONDARY) && m_inv.GetItem(SLOT_SECONDARY)->GetItem()->ItemType == ItemTypeShield) //Using Shield || (m_inv.GetItem(SLOT_PRIMARY) && (m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HS || m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HB || m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HPierce) - && GetAA(aa2HandBash) >= 1)) { //Using 2 hand weapon, but has AA 2 Hand Bash + && GetAA(aa2HandBash) >= 1)) { //Using 2 hand weapon, but has AA 2 Hand Bash canBash = true; } @@ -8742,11 +8742,11 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { case PALADIN: if(level >= RuleI(Combat, NPCBashKickLevel)){ if((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) // Racial Slam - || (m_inv.GetItem(SLOT_SECONDARY) && m_inv.GetItem(SLOT_SECONDARY)->GetItem()->ItemType == ItemTypeShield) //Using Shield + || (m_inv.GetItem(SLOT_SECONDARY) && m_inv.GetItem(SLOT_SECONDARY)->GetItem()->ItemType == ItemTypeShield) //Using Shield || (m_inv.GetItem(SLOT_PRIMARY) && (m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HS || m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HB || m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HPierce) - && GetAA(aa2HandBash) >= 1)) { //Using 2 hand weapon, but has AA 2 Hand Bash + && GetAA(aa2HandBash) >= 1)) { //Using 2 hand weapon, but has AA 2 Hand Bash skill_to_use = BASH; } } @@ -8828,10 +8828,10 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { int AtkRounds = 3; int skillmod = 0; - if(MaxSkill(FRENZY) > 0) - skillmod = 100*GetSkill(FRENZY)/MaxSkill(FRENZY); + if(MaxSkill(FRENZY) > 0) + skillmod = 100*GetSkill(FRENZY)/MaxSkill(FRENZY); - int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100); + int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100); int32 min_dmg = 0; DoAnim(anim2HSlashing); @@ -9415,7 +9415,7 @@ void Bot::SetAttackTimer() { int speed = (int)((36 *(100+DelayMod)/100)*(100.0f+attack_speed)*PermaHaste); //if(speed < RuleI(Combat, MinHastedDelay) && IsClient()) //lower bound // speed = RuleI(Combat, MinHastedDelay); - TimerToUse->SetAtTrigger(speed, true); // Hand to hand, non-monk 2/36 + TimerToUse->SetAtTrigger(speed, true); // Hand to hand, non-monk 2/36 } } else { //we have a weapon, use its delay @@ -9462,8 +9462,8 @@ void Bot::SetAttackTimer() { int32 Bot::Additional_SpellDmg(uint16 spell_id, bool bufftick) { int32 spell_dmg = 0; - spell_dmg += GetBotFocusEffect(BotfocusFF_Damage_Amount, spell_id); - spell_dmg += GetBotFocusEffect(BotfocusSpellDamage, spell_id); + spell_dmg += GetBotFocusEffect(BotfocusFF_Damage_Amount, spell_id); + spell_dmg += GetBotFocusEffect(BotfocusSpellDamage, spell_id); //For DOTs you need to apply the damage over the duration of the dot to each tick (this is how live did it) if (bufftick){ @@ -9495,8 +9495,8 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value) { if (tt == ST_UndeadAE || tt == ST_Undead || tt == ST_Summoned) { //undead/summoned spells modifier += GetBotFocusEffect(BotfocusImprovedUndeadDamage, spell_id); - } else { - //damage spells. + } else { + //damage spells. modifier += GetBotFocusEffect(BotfocusImprovedDamage, spell_id); modifier += GetBotFocusEffect(BotfocusSpellEffectiveness, spell_id); modifier += GetBotFocusEffect(BotfocusImprovedDamage2, spell_id); @@ -9509,7 +9509,7 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value) { } //This adds the extra damage from the AA Unholy Touch, 450 per level to the AA Improved Harm TOuch. - if (spell_id == SPELL_IMP_HARM_TOUCH) { //Improved Harm Touch + if (spell_id == SPELL_IMP_HARM_TOUCH) { //Improved Harm Touch value -= GetAA(aaUnholyTouch) * 450; //Unholy Touch } @@ -9544,7 +9544,7 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value) { ratio += RuleI(Spells, WizCritRatio); } if(aabonuses.SpellCritDmgIncrease > 0) // wizards get an additional bonus - ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225% + ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225% } //Improved Harm Touch is a guaranteed crit if you have at least one level of SCF. @@ -9598,8 +9598,8 @@ int32 Bot::Additional_Heal(uint16 spell_id) { int32 heal_amt = 0; - heal_amt += GetBotFocusEffect(BotfocusAdditionalHeal, spell_id); - heal_amt += GetBotFocusEffect(BotfocusAdditionalHeal2, spell_id); + heal_amt += GetBotFocusEffect(BotfocusAdditionalHeal, spell_id); + heal_amt += GetBotFocusEffect(BotfocusAdditionalHeal2, spell_id); if (heal_amt){ int duration = CalcBuffDuration(this, this, spell_id); @@ -9901,7 +9901,7 @@ bool Bot::SpellEffect(Mob* caster, uint16 spell_id, float partial) { Result = Mob::SpellEffect(caster, spell_id, partial); - // Franck-add: If healed/doted, a bot must show its new HP to its leader + // Franck-add: If healed/doted, a bot must show its new HP to its leader if(IsGrouped()) { Group *g = GetGroup(); if(g) { @@ -11300,7 +11300,7 @@ bool Bot::IsGroupPrimaryHealer() { case RANGER: case BEASTLORD: { - result = GroupHasPriestClass(g) ? false : true; + result = GroupHasPriestClass(g) ? false : true; break; } default: @@ -11335,7 +11335,7 @@ bool Bot::IsGroupPrimarySlower() { } case BEASTLORD: { - result = (GroupHasShamanClass(g) || GroupHasEnchanterClass(g)) ? false : true; + result = (GroupHasShamanClass(g) || GroupHasEnchanterClass(g)) ? false : true; break; } default: @@ -11972,7 +11972,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { c->Message(0, "#bot taunt [on|off] - Turns taunt on/off for targeted bot"); c->Message(0, "#bot stance [name] [stance (id)|list] - Sets/lists stance for named bot (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)"); c->Message(0, "#bot groupmessages [on|off] [bot name|all] - Turns group messages on/off for named bot/all bots."); - c->Message(0, "#bot defensive [bot name] - Causes warrior or knight bot to use defensive discipline / buff."); + c->Message(0, "#bot defensive [bot name] - Causes warrior or knight bot to use defensive discipline / buff."); c->Message(0, "#bot healrotation help - Displays the commands available to manage BOT heal rotations."); // TODO: // c->Message(0, "#bot illusion - Enchanter Bot cast an illusion buff spell on you or your target."); @@ -12068,9 +12068,9 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { MYSQL_ROW DataRow; c->Message(0, "-----------------#bot armorcolor help-----------------------------"); - c->Message(0, "Armor: 17(Chest/Robe), 7(Arms), 9(Bracer), 12(Hands), 18(Legs), 19(Boots), 2(Helm)"); + c->Message(0, "Armor: 17(Chest/Robe), 7(Arms), 9(Bracer), 12(Hands), 18(Legs), 19(Boots), 2(Helm)"); c->Message(0, "------------------------------------------------------------------"); - c->Message(0, "Color: [red] [green] [blue] (enter a number from 0-255 for each"); + c->Message(0, "Color: [red] [green] [blue] (enter a number from 0-255 for each"); c->Message(0, "------------------------------------------------------------------"); c->Message(0, "Example: #bot armorcolor 17 0 255 0 - this would make the chest bright green"); return; @@ -12191,7 +12191,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } if(!strcasecmp(sep->arg[1], "help") && !strcasecmp(sep->arg[2], "create") ){ - c->Message(0, "Classes: 1(Warrior), 2(Cleric), 3(Paladin), 4(Ranger), 5(Sk), 6(Druid), 7(Monk), 8(Bard), 9(Rogue), 10(Shaman), 11(Necro), 12(Wiz), 13(Mag), 14(Ench), 15(Beast), 16(Bersek)"); + c->Message(0, "Classes: 1(Warrior), 2(Cleric), 3(Paladin), 4(Ranger), 5(Sk), 6(Druid), 7(Monk), 8(Bard), 9(Rogue), 10(Shaman), 11(Necro), 12(Wiz), 13(Mag), 14(Ench), 15(Beast), 16(Bersek)"); c->Message(0, "------------------------------------------------------------------"); c->Message(0, "Races: 1(Human), 2(Barb), 3(Erudit), 4(Wood elf), 5(High elf), 6(Dark elf), 7(Half elf), 8(Dwarf), 9(Troll), 10(Ogre), 11(Halfling), 12(Gnome), 128(Iksar), 130(Vah shir), 330(Froglok), 522(Drakkin)"); c->Message(0, "------------------------------------------------------------------"); @@ -12281,7 +12281,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { if(bot && !listAll) { // Specific bot only - if(bot->GetClass() != WARRIOR && bot->GetClass() != MONK && bot->GetClass() != BARD && bot->GetClass() != BERSERKER && bot->GetClass() != ROGUE) + if(bot->GetClass() != WARRIOR && bot->GetClass() != MONK && bot->GetClass() != BARD && bot->GetClass() != BERSERKER && bot->GetClass() != ROGUE) c->Message(0, "Name: %s -- Class: %s -- Mana: %3.1f%%", bot->GetCleanName(), ClassIdToString(bot->GetClass()).c_str(), bot->GetManaRatio()); } else { @@ -12292,7 +12292,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { for(std::list::iterator botsListItr = spawnedBots.begin(); botsListItr != spawnedBots.end(); botsListItr++) { Bot* tempBot = *botsListItr; if(tempBot) { - if(tempBot->GetClass() != WARRIOR && tempBot->GetClass() != MONK && tempBot->GetClass() != BARD && tempBot->GetClass() != BERSERKER && tempBot->GetClass() != ROGUE) + if(tempBot->GetClass() != WARRIOR && tempBot->GetClass() != MONK && tempBot->GetClass() != BARD && tempBot->GetClass() != BERSERKER && tempBot->GetClass() != ROGUE) c->Message(0, "Name: %s -- Class: %s -- Mana: %3.1f%%", tempBot->GetCleanName(), ClassIdToString(tempBot->GetClass()).c_str(), tempBot->GetManaRatio()); } } @@ -12835,7 +12835,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } } if(hasruneer) { - if (c->GetLevel() <= 12) { + if (c->GetLevel() <= 12) { runeer->Say("I need to be level 13 or higher for this..."); } else if ((c->GetLevel() >= 13) && (c->GetLevel() <= 21)) { @@ -12976,7 +12976,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } switch(CurerClass) { case CLERIC: - if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 1)) { + if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 1)) { Curer->Say("Trying to cure us of %s.", sep->arg[2]); Curer->CastToBot()->Bot_Command_Cure(1, Curer->GetLevel()); } @@ -13004,7 +13004,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { break; case SHAMAN: - if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 2)) { + if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 2)) { Curer->Say("Trying to cure us of %s.", sep->arg[2]); Curer->CastToBot()->Bot_Command_Cure(1, Curer->GetLevel()); } @@ -13580,11 +13580,11 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } } } - if((hasevac) && (c->GetLevel() >= 18)) { + if((hasevac) && (c->GetLevel() >= 18)) { evac->Say("Attempting to Evac you %s.", c->GetName()); evac->CastToClient()->CastSpell(2183, c->GetID(), 1, -1, -1); } - else if((hasevac) && (c->GetLevel() <= 17)) { + else if((hasevac) && (c->GetLevel() <= 17)) { evac->Say("I'm not level 18 yet.", c->GetName()); } return; @@ -13628,11 +13628,11 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } switch(SowerClass) { case DRUID: - if ((!strcasecmp(sep->arg[2], "regular")) && (zone->CanCastOutdoor()) && (c->GetLevel() >= 10) ) { + if ((!strcasecmp(sep->arg[2], "regular")) && (zone->CanCastOutdoor()) && (c->GetLevel() >= 10) ) { Sower->Say("Casting sow..."); Sower->CastSpell(278, c->GetID(), 1, -1, -1); } - else if ((!strcasecmp(sep->arg[2], "regular")) && (zone->CanCastOutdoor()) && (c->GetLevel() <= 10) ) { + else if ((!strcasecmp(sep->arg[2], "regular")) && (zone->CanCastOutdoor()) && (c->GetLevel() <= 10) ) { Sower->Say("I'm not level 10 yet."); } else if ((!strcasecmp(sep->arg[2], "wolf")) && zone->CanCastOutdoor() && (c->GetLevel() >= 20)) { @@ -13715,7 +13715,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { default: - c->Message(15, "You must have a Druid, Shaman, Ranger, or Beastlord in your group."); + c->Message(15, "You must have a Druid, Shaman, Ranger, or Beastlord in your group."); break; } } @@ -13806,7 +13806,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } switch(GaterClass) { case DRUID: - if ((!strcasecmp(sep->arg[2], "karana")) && (c->GetLevel() >= 25) ) { + if ((!strcasecmp(sep->arg[2], "karana")) && (c->GetLevel() >= 25) ) { Gater->Say("Casting Circle of Karana..."); Gater->CastSpell(550, c->GetID(), 1, -1, -1); } @@ -13940,7 +13940,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { case WIZARD: - if ((!strcasecmp(sep->arg[2], "commons")) && (c->GetLevel() >= 35) ) { + if ((!strcasecmp(sep->arg[2], "commons")) && (c->GetLevel() >= 35) ) { Gater->Say("Casting Common Portal..."); Gater->CastSpell(566, c->GetID(), 1, -1, -1); } @@ -14117,7 +14117,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } switch(EndurerClass) { case DRUID: - if (c->GetLevel() < 6) { + if (c->GetLevel() < 6) { Endurer->Say("I'm not level 6 yet."); } else { @@ -14127,7 +14127,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } break; case SHAMAN: - if (c->GetLevel() < 12) { + if (c->GetLevel() < 12) { Endurer->Say("I'm not level 12 yet."); } else { @@ -14136,7 +14136,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } break; case RANGER: - if (c->GetLevel() < 20) { + if (c->GetLevel() < 20) { Endurer->Say("I'm not level 20 yet."); } else { @@ -14145,7 +14145,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } break; case ENCHANTER: - if (c->GetLevel() < 12) { + if (c->GetLevel() < 12) { Endurer->Say("I'm not level 12 yet."); } else { @@ -14154,14 +14154,14 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } break; case BEASTLORD: - if (c->GetLevel() < 25) { + if (c->GetLevel() < 25) { Endurer->Say("I'm not level 25 yet."); - } + } else { Endurer->Say("Casting Enduring Breath..."); Endurer->CastSpell(86, c->GetID(), 1, -1, -1); } - break; + break; default: c->Message(15, "You must have a Druid, Shaman, Ranger, Enchanter, or Beastlord in your group."); break; @@ -14214,21 +14214,21 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } switch(InviserClass) { case ENCHANTER: - if ((c->GetLevel() <= 14) && (!strcasecmp(sep->arg[2], "undead"))) { + if ((c->GetLevel() <= 14) && (!strcasecmp(sep->arg[2], "undead"))) { Inviser->Say("I'm not level 14 yet."); } else if ((!c->IsInvisible(c)) && (!c->invisible_undead) && (c->GetLevel() >= 14) && (!strcasecmp(sep->arg[2], "undead"))) { Inviser->Say("Casting invis undead..."); Inviser->CastSpell(235, c->GetID(), 1, -1, -1); } - else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "live"))) { + else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "live"))) { Inviser->Say("I'm not level 4 yet."); } else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 4) && (!strcasecmp(sep->arg[2], "live"))) { Inviser->Say("Casting invisibilty..."); Inviser->CastSpell(42, c->GetID(), 1, -1, -1); } - else if ((c->GetLevel() <= 6) && (!strcasecmp(sep->arg[2], "see"))) { + else if ((c->GetLevel() <= 6) && (!strcasecmp(sep->arg[2], "see"))) { Inviser->Say("I'm not level 6 yet."); } else if ((c->GetLevel() >= 6) && (!strcasecmp(sep->arg[2], "see"))) { @@ -14243,17 +14243,17 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } break; case MAGICIAN: - if (!strcasecmp(sep->arg[2], "undead")) { + if (!strcasecmp(sep->arg[2], "undead")) { Inviser->Say("I don't have that spell."); } - else if ((c->GetLevel() <= 8) && (!strcasecmp(sep->arg[2], "live"))) { + else if ((c->GetLevel() <= 8) && (!strcasecmp(sep->arg[2], "live"))) { Inviser->Say("I'm not level 8 yet."); } else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 8) && (!strcasecmp(sep->arg[2], "live"))) { Inviser->Say("Casting invisibilty..."); Inviser->CastSpell(42, c->GetID(), 1, -1, -1); } - else if ((c->GetLevel() <= 16) && (!strcasecmp(sep->arg[2], "see"))) { + else if ((c->GetLevel() <= 16) && (!strcasecmp(sep->arg[2], "see"))) { Inviser->Say("I'm not level 16 yet."); } else if ((c->GetLevel() >= 16) && (!strcasecmp(sep->arg[2], "see"))) { @@ -14268,21 +14268,21 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } break; case WIZARD: - if ((c->GetLevel() <= 39) && (!strcasecmp(sep->arg[2], "undead"))) { + if ((c->GetLevel() <= 39) && (!strcasecmp(sep->arg[2], "undead"))) { Inviser->Say("I'm not level 39 yet."); } else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 39) && (!strcasecmp(sep->arg[2], "undead"))) { Inviser->Say("Casting invis undead..."); Inviser->CastSpell(235, c->GetID(), 1, -1, -1); } - else if ((c->GetLevel() <= 16) && (!strcasecmp(sep->arg[2], "live"))) { + else if ((c->GetLevel() <= 16) && (!strcasecmp(sep->arg[2], "live"))) { Inviser->Say("I'm not level 16 yet."); } else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 16) && (!strcasecmp(sep->arg[2], "live"))) { Inviser->Say("Casting invisibilty..."); Inviser->CastSpell(42, c->GetID(), 1, -1, -1); } - else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "see"))) { + else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "see"))) { Inviser->Say("I'm not level 6 yet."); } else if ((c->GetLevel() >= 4) && (!strcasecmp(sep->arg[2], "see"))) { @@ -14315,10 +14315,10 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } break; case DRUID: - if (!strcasecmp(sep->arg[2], "undead")) { + if (!strcasecmp(sep->arg[2], "undead")) { Inviser->Say("I don't have that spell..."); } - else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "live"))) { + else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "live"))) { Inviser->Say("I'm not level 4 yet."); } else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 18) && (!strcasecmp(sep->arg[2], "live"))) { @@ -14332,7 +14332,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { else if ((c->GetLevel() >= 4) && (!strcasecmp(sep->arg[2], "live")) && (!zone->CanCastOutdoor())) { Inviser->Say("I can't cast this spell indoors..."); } - else if ((c->GetLevel() <= 13) && (!strcasecmp(sep->arg[2], "see"))) { + else if ((c->GetLevel() <= 13) && (!strcasecmp(sep->arg[2], "see"))) { Inviser->Say("I'm not level 13 yet."); } else if ((c->GetLevel() >= 13) && (!strcasecmp(sep->arg[2], "see"))) { @@ -14391,7 +14391,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } switch(LeverClass) { case DRUID: - if (c->GetLevel() <= 14) { + if (c->GetLevel() <= 14) { Lever->Say("I'm not level 14 yet."); } else if (zone->CanCastOutdoor()) { @@ -14486,7 +14486,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } switch(ResisterClass) { case CLERIC: - if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 6)) { + if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 6)) { Resister->Say("Casting poison protection...", sep->arg[2]); Resister->CastToBot()->Bot_Command_Resist(1, Resister->GetLevel()); } @@ -14519,7 +14519,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { break; case SHAMAN: - if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 20)) { + if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 20)) { Resister->Say("Casting poison protection...", sep->arg[2]); Resister->CastToBot()->Bot_Command_Resist(12, Resister->GetLevel()); } @@ -15015,7 +15015,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { return; } - if(!strcasecmp(sep->arg[1], "botgroup") && !strcasecmp(sep->arg[2], "load")) { + if(!strcasecmp(sep->arg[1], "botgroup") && !strcasecmp(sep->arg[2], "load")) { // If client is grouped, check for aggro on each group member. Group *g = c->GetGroup(); @@ -15027,7 +15027,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { // Fail if current group member is client and has aggro // OR has a popuplated hate list (assume bot). if((g->members[i]->IsClient() && g->members[i]->CastToClient()->GetAggroCount()) - || g->members[i]->IsEngaged()) { + || g->members[i]->IsEngaged()) { c->Message(0, "You can't spawn bots while your group is engaged."); return; } @@ -15238,7 +15238,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { if(!strcasecmp(sep->arg[1], "haircolor") || !strcasecmp(sep->arg[1], "hair") || !strcasecmp(sep->arg[1], "beard") || !strcasecmp(sep->arg[1], "beardcolor") || !strcasecmp(sep->arg[1], "face") || !strcasecmp(sep->arg[1], "eyes") || !strcasecmp(sep->arg[1], "heritage") || !strcasecmp(sep->arg[1], "tattoo") || !strcasecmp(sep->arg[1], "details")) { if(c->GetTarget() && c->GetTarget()->IsBot()) { - if (sep->IsNumber(2)) { + if (sep->IsNumber(2)) { if (c->GetTarget()->CastToBot()->GetBotOwnerCharacterID() == c->CharacterID()) { Bot *target = c->GetTarget()->CastToBot(); uint16 Race = target->GetRace(); @@ -15402,7 +15402,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { int stance = atoi(sep->arg[3]); if(stance >= MaxStances || stance < 0){ - c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)"); + c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)"); return; } else { @@ -15456,7 +15456,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } } else { - c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)"); + c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)"); } return; } @@ -16074,7 +16074,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { Bot* tempBot = *botListItr; if(tempBot->GetInHealRotation() && tempBot->GetHealRotationLeader() == tempBot) { //list leaders and number of bots per rotation - c->Message(0, "Bot Heal Rotation- Leader: %s, Number of Members: %i, Timer: %1.1f", tempBot->GetCleanName(), tempBot->GetNumHealRotationMembers(), (float)(tempBot->GetHealRotationTimer()/1000)); + c->Message(0, "Bot Heal Rotation- Leader: %s, Number of Members: %i, Timer: %1.1f", tempBot->GetCleanName(), tempBot->GetNumHealRotationMembers(), (float)(tempBot->GetHealRotationTimer()/1000)); } } } @@ -16099,7 +16099,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { //list leader and number of members c->Message(0, "Bot Heal Rotation- Leader: %s", leaderBot->GetCleanName()); - c->Message(0, "Bot Heal Rotation- Timer: %1.1f", ((float)leaderBot->GetHealRotationTimer()/1000.0f)); + c->Message(0, "Bot Heal Rotation- Timer: %1.1f", ((float)leaderBot->GetHealRotationTimer()/1000.0f)); for(list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { Bot* tempBot = *botListItr; @@ -16315,11 +16315,11 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl if(caster->AICastSpell(g->members[i], 100, SpellType_Heal)) return true; } - else if((g->members[i]->GetClass() == WARRIOR || g->members[i]->GetClass() == PALADIN || g->members[i]->GetClass() == SHADOWKNIGHT) && g->members[i]->GetHPRatio() < 95) { + else if((g->members[i]->GetClass() == WARRIOR || g->members[i]->GetClass() == PALADIN || g->members[i]->GetClass() == SHADOWKNIGHT) && g->members[i]->GetHPRatio() < 95) { if(caster->AICastSpell(g->members[i], 100, SpellType_Heal)) return true; } - else if(g->members[i]->GetClass() == ENCHANTER && g->members[i]->GetHPRatio() < 80) { + else if(g->members[i]->GetClass() == ENCHANTER && g->members[i]->GetHPRatio() < 80) { if(caster->AICastSpell(g->members[i], 100, SpellType_Heal)) return true; } @@ -16379,11 +16379,11 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl if(caster->AICastSpell(g->members[i], 100, SpellType_Heal)) return true; } - else if((g->members[i]->GetClass() == WARRIOR || g->members[i]->GetClass() == PALADIN || g->members[i]->GetClass() == SHADOWKNIGHT) && g->members[i]->GetHPRatio() < hpRatioToHeal) { + else if((g->members[i]->GetClass() == WARRIOR || g->members[i]->GetClass() == PALADIN || g->members[i]->GetClass() == SHADOWKNIGHT) && g->members[i]->GetHPRatio() < hpRatioToHeal) { if(caster->AICastSpell(g->members[i], 100, SpellType_Heal)) return true; } - else if(g->members[i]->GetClass() == ENCHANTER && g->members[i]->GetHPRatio() < hpRatioToHeal) { + else if(g->members[i]->GetClass() == ENCHANTER && g->members[i]->GetHPRatio() < hpRatioToHeal) { if(caster->AICastSpell(g->members[i], 100, SpellType_Heal)) return true; } @@ -16543,7 +16543,7 @@ void EntityList::AddBot(Bot *newBot, bool SendSpawnPacket, bool dontqueue) { safe_delete(ns); } - parse->EventNPC(EVENT_SPAWN, newBot, nullptr, "", 0); + parse->EventNPC(EVENT_SPAWN, newBot, nullptr, "", 0); } bot_list.push_back(newBot); @@ -16653,7 +16653,7 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) { { if(iterator.GetData()->IsTrackable()) { Mob* cur_entity = iterator.GetData(); - int Extras = (cur_entity->IsBot() || cur_entity->IsPet() || cur_entity->IsFamiliar() || cur_entity->IsClient()); + int Extras = (cur_entity->IsBot() || cur_entity->IsPet() || cur_entity->IsFamiliar() || cur_entity->IsClient()); const char *const MyArray[] = { "a_","an_","Innkeep_","Barkeep_", "Guard_","Merchant_","Lieutenant_", @@ -16686,20 +16686,20 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) { "stone_","lava_","_","" }; unsigned int MyArraySize; - for ( MyArraySize = 0; true; MyArraySize++) { //Find empty string & get size - if (!(*(MyArray[MyArraySize]))) break; //Checks for null char in 1st pos + for ( MyArraySize = 0; true; MyArraySize++) { //Find empty string & get size + if (!(*(MyArray[MyArraySize]))) break; //Checks for null char in 1st pos }; if (NamedOnly) { - bool ContinueFlag = false; - const char *CurEntityName = cur_entity->GetName(); //Call function once - for (int Index = 0; Index < MyArraySize; Index++) { - if (!strncasecmp(CurEntityName, MyArray[Index], strlen(MyArray[Index])) || (Extras)) { - iterator.Advance(); - ContinueFlag = true; - break; //From Index for - }; - }; - if (ContinueFlag) continue; //Moved here or would apply to Index for + bool ContinueFlag = false; + const char *CurEntityName = cur_entity->GetName(); //Call function once + for (int Index = 0; Index < MyArraySize; Index++) { + if (!strncasecmp(CurEntityName, MyArray[Index], strlen(MyArray[Index])) || (Extras)) { + iterator.Advance(); + ContinueFlag = true; + break; //From Index for + }; + }; + if (ContinueFlag) continue; //Moved here or would apply to Index for }; CurrentCon = client->GetLevelCon(cur_entity->GetLevel()); @@ -16992,12 +16992,12 @@ bool Bot::HasOrMayGetAggro() { Mob *topHate = GetTarget()->GetHateTop(); if(topHate == this) - mayGetAggro = true; //I currently have aggro + mayGetAggro = true; //I currently have aggro else { uint32 myHateAmt = GetTarget()->GetHateAmount(this); uint32 topHateAmt = GetTarget()->GetHateAmount(topHate); - if(myHateAmt > 0 && topHateAmt > 0 && (uint8)((myHateAmt/topHateAmt)*100) > 90) //I have 90% as much hate as top, next action may give me aggro + if(myHateAmt > 0 && topHateAmt > 0 && (uint8)((myHateAmt/topHateAmt)*100) > 90) //I have 90% as much hate as top, next action may give me aggro mayGetAggro = true; } } @@ -17086,7 +17086,7 @@ bool Bot::UseDiscipline(uint32 spell_id, uint32 target) { //make sure we can use it.. if(!IsValidSpell(spell_id)) { - Say("Not a valid spell"); + Say("Not a valid spell"); return(false); } @@ -17155,7 +17155,7 @@ bool Bot::AddHealRotationMember( Bot* healer ) { for(int i=0; i<3; i++){ healer->ClearHealRotationMembers(); healer->ClearHealRotationTargets(); - healer->AddHealRotationTarget(entity_list.GetMob(_healRotationTargets[i])); // add all targets.. + healer->AddHealRotationTarget(entity_list.GetMob(_healRotationTargets[i])); // add all targets.. } healer->SetHealRotationTimer(tempBot->GetHealRotationTimer()); healer->SetHealRotationLeader(this); @@ -17189,10 +17189,10 @@ bool Bot::AddHealRotationMember( Bot* healer ) { } bool Bot::RemoveHealRotationMember( Bot* healer ) { - if(healer && GetNumHealRotationMembers() > 0) { + if(healer && GetNumHealRotationMembers() > 0) { Bot* leader = healer->GetHealRotationLeader(); - Bot* prevBot = healer->GetPrevHealRotationMember(); - Bot* nextBot = healer->GetNextHealRotationMember(); + Bot* prevBot = healer->GetPrevHealRotationMember(); + Bot* nextBot = healer->GetNextHealRotationMember(); if(healer == this) { if(nextBot != this) { @@ -17202,21 +17202,21 @@ bool Bot::RemoveHealRotationMember( Bot* healer ) { } //remove healer from list - healer->SetHealRotationTimer(0); - healer->ClearHealRotationMembers(); + healer->SetHealRotationTimer(0); + healer->ClearHealRotationMembers(); healer->ClearHealRotationTargets(); healer->ClearHealRotationLeader(); healer->SetHasHealedThisCycle(false); healer->SetHealRotationActive(false); - healer->SetInHealRotation(false); + healer->SetInHealRotation(false); - if(prevBot && nextBot && GetNumHealRotationMembers() > 1) { - //set previous rotation member's next member to new member - prevBot->SetNextHealRotationMember(nextBot); + if(prevBot && nextBot && GetNumHealRotationMembers() > 1) { + //set previous rotation member's next member to new member + prevBot->SetNextHealRotationMember(nextBot); - //set previous rotation member's next member to new member - nextBot->SetPrevHealRotationMember(prevBot); - } + //set previous rotation member's next member to new member + nextBot->SetPrevHealRotationMember(prevBot); + } //update rotation data list botList = GetBotsInHealRotation(leader); @@ -17325,7 +17325,7 @@ bool Bot::AddHealRotationTarget( Mob *target, int index ) { bool Bot::RemoveHealRotationTarget( Mob* target ) { int index = 0; bool removed = false; - if(target) { + if(target) { //notify all heal rotation members to remove target for(int i=0; iGetID()) { @@ -17366,17 +17366,17 @@ bool Bot::RemoveHealRotationTarget( int index ) { void Bot::ClearHealRotationMembers() { _healRotationMemberPrev = 0; // No previous member - _healRotationMemberNext = 0; // No next member + _healRotationMemberNext = 0; // No next member } void Bot::ClearHealRotationTargets() { - for(int i=0; i 0) { //get target at specified index target = entity_list.GetMob(_healRotationTargets[index]); } - return target; + return target; } list Bot::GetBotsInHealRotation(Bot* rotationLeader) { diff --git a/zone/bot.h b/zone/bot.h index 2d86cd8db..47a1516b2 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -139,7 +139,7 @@ public: virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false); - virtual bool HasRaid() { return (GetRaid() ? true : false); } + virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasGroup() { return (GetGroup() ? true : false); } virtual Raid* GetRaid() { return entity_list.GetRaidByMob(this); } virtual Group* GetGroup() { return entity_list.GetGroupByMob(this); } @@ -166,7 +166,7 @@ public: void CalcBotStats(bool showtext = true); uint16 BotGetSpells(int spellslot) { return AIspells[spellslot].spellid; } uint16 BotGetSpellType(int spellslot) { return AIspells[spellslot].type; } - uint16 BotGetSpellPriority(int spellslot) { return AIspells[spellslot].priority; } + uint16 BotGetSpellPriority(int spellslot) { return AIspells[spellslot].priority; } virtual float GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed, uint16 hand); virtual bool AvoidDamage(Mob* other, int32 &damage, bool CanRiposte); virtual int GetMonkHandToHandDamage(void); @@ -240,45 +240,45 @@ public: void ClearHealRotationLeader() { _healRotationLeader = 0; } void ClearHealRotationMembers(); void ClearHealRotationTargets(); - inline virtual int16 GetMaxStat(); - inline virtual int16 GetMaxResist(); - inline virtual int16 GetMaxSTR(); - inline virtual int16 GetMaxSTA(); - inline virtual int16 GetMaxDEX(); - inline virtual int16 GetMaxAGI(); - inline virtual int16 GetMaxINT(); - inline virtual int16 GetMaxWIS(); - inline virtual int16 GetMaxCHA(); - inline virtual int16 GetMaxMR(); - inline virtual int16 GetMaxPR(); - inline virtual int16 GetMaxDR(); - inline virtual int16 GetMaxCR(); - inline virtual int16 GetMaxFR(); - inline virtual int16 GetMaxCorrup(); - int16 CalcATK(); - int16 CalcSTR(); - int16 CalcSTA(); - int16 CalcDEX(); - int16 CalcAGI(); - int16 CalcINT(); - int16 CalcWIS(); - int16 CalcCHA(); + inline virtual int16 GetMaxStat(); + inline virtual int16 GetMaxResist(); + inline virtual int16 GetMaxSTR(); + inline virtual int16 GetMaxSTA(); + inline virtual int16 GetMaxDEX(); + inline virtual int16 GetMaxAGI(); + inline virtual int16 GetMaxINT(); + inline virtual int16 GetMaxWIS(); + inline virtual int16 GetMaxCHA(); + inline virtual int16 GetMaxMR(); + inline virtual int16 GetMaxPR(); + inline virtual int16 GetMaxDR(); + inline virtual int16 GetMaxCR(); + inline virtual int16 GetMaxFR(); + inline virtual int16 GetMaxCorrup(); + int16 CalcATK(); + int16 CalcSTR(); + int16 CalcSTA(); + int16 CalcDEX(); + int16 CalcAGI(); + int16 CalcINT(); + int16 CalcWIS(); + int16 CalcCHA(); int16 CalcMR(); int16 CalcFR(); int16 CalcDR(); int16 CalcPR(); int16 CalcCR(); int16 CalcCorrup(); - int32 CalcHPRegenCap(); - int32 CalcManaRegenCap(); + int32 CalcHPRegenCap(); + int32 CalcManaRegenCap(); int32 LevelRegen(); int32 CalcHPRegen(); int32 CalcManaRegen(); uint32 CalcCurrentWeight(); - int GroupLeadershipAAHealthEnhancement(); - int GroupLeadershipAAManaEnhancement(); + int GroupLeadershipAAHealthEnhancement(); + int GroupLeadershipAAManaEnhancement(); int GroupLeadershipAAHealthRegeneration(); - int GroupLeadershipAAOffenseEnhancement(); + int GroupLeadershipAAOffenseEnhancement(); void CalcRestState(); int32 CalcMaxEndurance(); //This calculates the maximum endurance we can have int32 CalcBaseEndurance(); //Calculates Base End @@ -519,7 +519,7 @@ public: inline virtual int16 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath; } - inline InspectMessage_Struct& GetInspectMessage() { return _botInspectMessage; } + inline InspectMessage_Struct& GetInspectMessage() { return _botInspectMessage; } inline const InspectMessage_Struct& GetInspectMessage() const { return _botInspectMessage; } // "SET" Class Methods diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 36662e38b..dd560b6cb 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -340,7 +340,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { case ARCHETYPE_CASTER: //TODO: probably more caster specific spell effects in here if(IsEffectInSpell(selectedBotSpell.SpellId, SE_AttackSpeed) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ATK) || - IsEffectInSpell(selectedBotSpell.SpellId, SE_STR) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ReverseDS)) + IsEffectInSpell(selectedBotSpell.SpellId, SE_STR) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ReverseDS)) { continue; } @@ -412,7 +412,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { if (hpr <= 5 || (IsNPC() && CastToNPC()->IsInteractive() && tar != this) ) #else if(hpr > 15 && ((botClass == WIZARD) || (botClass == ENCHANTER) || (botClass == RANGER))) - mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells + mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells if (hpr <= 15 || mayGetAggro) #endif @@ -423,7 +423,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { break; if(IsInvulnerabilitySpell(botSpell.SpellId)) - tar = this; //target self for invul type spells + tar = this; //target self for invul type spells castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost); } @@ -572,7 +572,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { //short duration buffs or other buffs only to be cast during combat. if (IsSelfConversionSpell(selectedBotSpell.SpellId)) { if(GetManaRatio() > 90.0f || GetHPRatio() < 50.0f || GetHPRatio() < (GetManaRatio() + 10.0f)) - break; //don't cast if low hp, lots of mana, or if mana is higher than hps + break; //don't cast if low hp, lots of mana, or if mana is higher than hps } castedSpell = AIDoSpellCast(selectedBotSpell.SpellIndex, tar, selectedBotSpell.ManaCost); @@ -836,7 +836,7 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain SetMana(hasMana); extraMana = false; } - else { //handle spell recast and recast timers + else { //handle spell recast and recast timers if(GetClass() == BARD && IsGroupSpell(AIspells[i].spellid)) { AIspells[i].time_cancast = (spells[AIspells[i].spellid].recast_time > (spells[AIspells[i].spellid].buffduration * 6000)) ? Timer::GetCurrentTime() + spells[AIspells[i].spellid].recast_time : Timer::GetCurrentTime() + spells[AIspells[i].spellid].buffduration * 6000; //spellend_timer.Start(spells[AIspells[i].spellid].cast_time); @@ -912,7 +912,7 @@ bool Bot::AI_IdleCastCheck() { result = true; } // Pets class will first cast their pet, then buffs - else if(botClass == DRUID || botClass == MAGICIAN || botClass == SHADOWKNIGHT || botClass == SHAMAN || botClass == NECROMANCER || botClass == ENCHANTER || botClass == BEASTLORD || botClass == WIZARD) { + else if(botClass == DRUID || botClass == MAGICIAN || botClass == SHADOWKNIGHT || botClass == SHAMAN || botClass == NECROMANCER || botClass == ENCHANTER || botClass == BEASTLORD || botClass == WIZARD) { if(!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Cure)) { if (!AICastSpell(this, 100, SpellType_Pet)) { if (!AICastSpell(this, 100, SpellType_Heal)) { @@ -1492,88 +1492,88 @@ BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster) { } BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster) { - BotSpell result; + BotSpell result; - result.SpellId = 0; - result.SpellIndex = 0; - result.ManaCost = 0; + result.SpellId = 0; + result.SpellIndex = 0; + result.ManaCost = 0; - if(botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP); + if(botCaster) { + std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { - // Assuming all the spells have been loaded into this list by level and in descending order - if(IsRegularGroupHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + // Assuming all the spells have been loaded into this list by level and in descending order + if(IsRegularGroupHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { + result.SpellId = botSpellListItr->SpellId; + result.SpellIndex = botSpellListItr->SpellIndex; + result.ManaCost = botSpellListItr->ManaCost; - break; - } - } - } + break; + } + } + } - return result; + return result; } BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster) { - BotSpell result; + BotSpell result; - result.SpellId = 0; - result.SpellIndex = 0; - result.ManaCost = 0; + result.SpellId = 0; + result.SpellIndex = 0; + result.ManaCost = 0; - if(botCaster) { - std::list botHoTSpellList = GetBotSpellsForSpellEffect(botCaster, SE_HealOverTime); - std::vector botSpellList = botCaster->GetBotSpells(); + if(botCaster) { + std::list botHoTSpellList = GetBotSpellsForSpellEffect(botCaster, SE_HealOverTime); + std::vector botSpellList = botCaster->GetBotSpells(); - for(std::list::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); botSpellListItr++) { - // Assuming all the spells have been loaded into this list by level and in descending order - if(IsGroupHealOverTimeSpell(botSpellListItr->SpellId)) { + for(std::list::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); botSpellListItr++) { + // Assuming all the spells have been loaded into this list by level and in descending order + if(IsGroupHealOverTimeSpell(botSpellListItr->SpellId)) { - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (botSpellList[i].spellid <= 0 || botSpellList[i].spellid >= SPDAT_RECORDS) { - // this is both to quit early to save cpu and to avoid casting bad spells - // Bad info from database can trigger this incorrectly, but that should be fixed in DB, not here - continue; - } - - if(botSpellList[i].spellid == botSpellListItr->SpellId && (botSpellList[i].type & SpellType_Heal) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; - } - } - - break; + for (int i = botSpellList.size() - 1; i >= 0; i--) { + if (botSpellList[i].spellid <= 0 || botSpellList[i].spellid >= SPDAT_RECORDS) { + // this is both to quit early to save cpu and to avoid casting bad spells + // Bad info from database can trigger this incorrectly, but that should be fixed in DB, not here + continue; } - } - } - return result; -} - -BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) { - BotSpell result; - - result.SpellId = 0; - result.SpellIndex = 0; - result.ManaCost = 0; - - if(botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CompleteHeal); - - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { - // Assuming all the spells have been loaded into this list by level and in descending order - if(IsGroupCompleteHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { + if(botSpellList[i].spellid == botSpellListItr->SpellId && (botSpellList[i].type & SpellType_Heal) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; result.SpellIndex = botSpellListItr->SpellIndex; result.ManaCost = botSpellListItr->ManaCost; - - break; } } - } + + break; + } + } + } + + return result; +} + +BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) { + BotSpell result; + + result.SpellId = 0; + result.SpellIndex = 0; + result.ManaCost = 0; + + if(botCaster) { + std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CompleteHeal); + + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + // Assuming all the spells have been loaded into this list by level and in descending order + if(IsGroupCompleteHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { + result.SpellId = botSpellListItr->SpellId; + result.SpellIndex = botSpellListItr->SpellIndex; + result.ManaCost = botSpellListItr->ManaCost; + + break; + } + } + } return result; } @@ -2142,9 +2142,9 @@ int32 Bot::GetSpellRecastTimer(Bot *caster, int timer_index) { bool Bot::CheckSpellRecastTimers(Bot *caster, int SpellIndex) { if(caster) { - if(caster->AIspells[SpellIndex].time_cancast < Timer::GetCurrentTime()) { //checks spell recast - if(GetSpellRecastTimer(caster, spells[caster->AIspells[SpellIndex].spellid].EndurTimerIndex) < Timer::GetCurrentTime()) { //checks for spells on the same timer - return true; //can cast spell + if(caster->AIspells[SpellIndex].time_cancast < Timer::GetCurrentTime()) { //checks spell recast + if(GetSpellRecastTimer(caster, spells[caster->AIspells[SpellIndex].spellid].EndurTimerIndex) < Timer::GetCurrentTime()) { //checks for spells on the same timer + return true; //can cast spell } } } @@ -2180,8 +2180,8 @@ uint32 Bot::GetDisciplineRemainingTime(Bot *caster, int timer_index) { bool Bot::CheckDisciplineRecastTimers(Bot *caster, int timer_index) { if(caster) { - if(GetDisciplineRecastTimer(caster, timer_index) < Timer::GetCurrentTime()) { //checks for spells on the same timer - return true; //can cast spell + if(GetDisciplineRecastTimer(caster, timer_index) < Timer::GetCurrentTime()) { //checks for spells on the same timer + return true; //can cast spell } } return false; diff --git a/zone/client.cpp b/zone/client.cpp index 27554cdde..8f16956aa 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2003 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/debug.h" #include @@ -34,7 +34,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #else #include #include @@ -476,7 +476,7 @@ void Client::ReportConnectingState() { LogFile->write(EQEMuLog::Debug, "We received client ready notification, but never finished Client::CompleteConnect"); break; case ClientConnectFinished: //client finally moved to finished state, were done here - LogFile->write(EQEMuLog::Debug, " Client is successfully connected."); + LogFile->write(EQEMuLog::Debug, "Client is successfully connected."); break; }; } @@ -484,12 +484,12 @@ void Client::ReportConnectingState() { bool Client::Save(uint8 iCommitNow) { #if 0 // Orig. Offset: 344 / 0x00000000 -// Length: 36 / 0x00000024 - unsigned char rawData[36] = +// Length: 36 / 0x00000024 + unsigned char rawData[36] = { - 0x0D, 0x30, 0xE1, 0x30, 0x1E, 0x10, 0x22, 0x10, 0x20, 0x10, 0x21, 0x10, 0x1C, 0x20, 0x1F, 0x10, - 0x7C, 0x10, 0x68, 0x10, 0x51, 0x10, 0x78, 0x10, 0xBD, 0x10, 0xD2, 0x10, 0xCD, 0x10, 0xD1, 0x10, - 0x01, 0x10, 0x6D, 0x10 + 0x0D, 0x30, 0xE1, 0x30, 0x1E, 0x10, 0x22, 0x10, 0x20, 0x10, 0x21, 0x10, 0x1C, 0x20, 0x1F, 0x10, + 0x7C, 0x10, 0x68, 0x10, 0x51, 0x10, 0x78, 0x10, 0xBD, 0x10, 0xD2, 0x10, 0xCD, 0x10, 0xD1, 0x10, + 0x01, 0x10, 0x6D, 0x10 } ; for (int tmp = 0;tmp <=35;tmp++){ m_pp.unknown0256[89+tmp] = rawData[tmp]; @@ -536,7 +536,7 @@ bool Client::Save(uint8 iCommitNow) { if(RequiredLevel != AARequiredLevelAndCost.end()) { - spentpoints += RequiredLevel->second.Cost; + spentpoints += RequiredLevel->second.Cost; } else spentpoints += (curAA->cost + (curAA->cost_inc * rank)); @@ -646,13 +646,13 @@ void Client::SaveBackup() { CLIENTPACKET::CLIENTPACKET() { - app = nullptr; - ack_req = false; + app = nullptr; + ack_req = false; } CLIENTPACKET::~CLIENTPACKET() { - safe_delete(app); + safe_delete(app); } //this assumes we do not own pApp, and clones it. @@ -663,13 +663,13 @@ bool Client::AddPacket(const EQApplicationPacket *pApp, bool bAckreq) { //drop the packet because it will never get sent. return(false); } - CLIENTPACKET *c = new CLIENTPACKET; + CLIENTPACKET *c = new CLIENTPACKET; - c->ack_req = bAckreq; - c->app = pApp->Copy(); + c->ack_req = bAckreq; + c->app = pApp->Copy(); - clientpackets.Append(c); - return true; + clientpackets.Append(c); + return true; } //this assumes that it owns the object pointed to by *pApp @@ -680,14 +680,14 @@ bool Client::AddPacket(EQApplicationPacket** pApp, bool bAckreq) { //drop the packet because it will never get sent. return(false); } - CLIENTPACKET *c = new CLIENTPACKET; + CLIENTPACKET *c = new CLIENTPACKET; - c->ack_req = bAckreq; - c->app = *pApp; + c->ack_req = bAckreq; + c->app = *pApp; *pApp = 0; - clientpackets.Append(c); - return true; + clientpackets.Append(c); + return true; } bool Client::SendAllPackets() { @@ -729,15 +729,15 @@ void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req, CLIENT_CO } // if the program doesnt care about the status or if the status isnt what we requested - if (required_state != CLIENT_CONNECTINGALL && client_state != required_state) - { - // todo: save packets for later use - AddPacket(app, ack_req); -// LogFile->write(EQEMuLog::Normal, "Adding Packet to list (%d) (%d)", app->GetOpcode(), (int)required_state); - } - else - if(eqs) - eqs->QueuePacket(app, ack_req); + if (required_state != CLIENT_CONNECTINGALL && client_state != required_state) + { + // todo: save packets for later use + AddPacket(app, ack_req); +// LogFile->write(EQEMuLog::Normal, "Adding Packet to list (%d) (%d)", app->GetOpcode(), (int)required_state); + } + else + if(eqs) + eqs->QueuePacket(app, ack_req); } void Client::FastQueuePacket(EQApplicationPacket** app, bool ack_req, CLIENT_CONN_STATUS required_state) { @@ -745,15 +745,15 @@ void Client::FastQueuePacket(EQApplicationPacket** app, bool ack_req, CLIENT_CON //cout << "Sending: 0x" << hex << setw(4) << setfill('0') << (*app)->GetOpcode() << dec << ", size=" << (*app)->size << endl; // if the program doesnt care about the status or if the status isnt what we requested - if (required_state != CLIENT_CONNECTINGALL && client_state != required_state) { - // todo: save packets for later use - AddPacket(app, ack_req); -// LogFile->write(EQEMuLog::Normal, "Adding Packet to list (%d) (%d)", (*app)->GetOpcode(), (int)required_state); + if (required_state != CLIENT_CONNECTINGALL && client_state != required_state) { + // todo: save packets for later use + AddPacket(app, ack_req); +// LogFile->write(EQEMuLog::Normal, "Adding Packet to list (%d) (%d)", (*app)->GetOpcode(), (int)required_state); return; - } - else { - if(eqs) - eqs->FastQueuePacket((EQApplicationPacket **)app, ack_req); + } + else { + if(eqs) + eqs->FastQueuePacket((EQApplicationPacket **)app, ack_req); else if (app && (*app)) delete *app; *app = 0; @@ -890,10 +890,10 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s sender = GetPet(); entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message); - break; - } + break; + } case 4: { // Auction - if(RuleB(Chat, ServerWideAuction)) + if(RuleB(Chat, ServerWideAuction)) { if(!global_channel_timer.Check()) { @@ -905,7 +905,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s if(GetRevoked()) { - Message(0, "You have been revoked. You may not talk on Auction."); + Message(0, "You have been revoked. You may not talk on Auction."); return; } @@ -918,13 +918,13 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } } - if (!worldserver.SendChannelMessage(this, 0, 4, 0, language, message)) + if (!worldserver.SendChannelMessage(this, 0, 4, 0, language, message)) Message(0, "Error: World server disconnected"); } else if(!RuleB(Chat, ServerWideAuction)) { Mob *sender = this; - if (GetPet() && GetPet()->FindType(SE_VoiceGraft)) + if (GetPet() && GetPet()->FindType(SE_VoiceGraft)) sender = GetPet(); entity_list.ChannelMessage(sender, chan_num, language, message); @@ -943,13 +943,13 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } if(worldserver.IsOOCMuted() && admin < 100) { - Message(0,"OOC has been muted. Try again later."); + Message(0,"OOC has been muted. Try again later."); return; } if(GetRevoked()) { - Message(0, "You have been revoked. You may not talk on OOC."); + Message(0, "You have been revoked. You may not talk on OOC."); return; } @@ -997,7 +997,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s if(GetRevoked()) { - Message(0, "You have been revoked. You may not send tells."); + Message(0, "You have been revoked. You may not send tells."); return; } @@ -1035,7 +1035,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s break; } case 8: { // /say - if(message[0] == COMMAND_CHAR) { + if(message[0] == COMMAND_CHAR) { if(command_dispatch(this, message) == -2) { if(RuleB(Chat, FlowCommandstoPerl_EVENT_SAY)) { if(parse->PlayerHasQuestSub("EVENT_SAY")) { @@ -1053,10 +1053,10 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s printf("Message: %s\n",message); entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message); - if(parse->PlayerHasQuestSub("EVENT_SAY")) - { - parse->EventPlayer(EVENT_SAY, this, message, language); - } + if(parse->PlayerHasQuestSub("EVENT_SAY")) + { + parse->EventPlayer(EVENT_SAY, this, message, language); + } if (sender != this) break; @@ -1073,7 +1073,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s if (DistNoRootNoZ(*GetTarget()) <= 200) { if(GetTarget()->CastToNPC()->IsMoving() && !GetTarget()->CastToNPC()->IsOnHatelist(GetTarget())) GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec)); - parse->EventNPC(EVENT_SAY, GetTarget()->CastToNPC(), this, message, language); + parse->EventNPC(EVENT_SAY, GetTarget()->CastToNPC(), this, message, language); } } @@ -1093,7 +1093,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s else { if(parse->HasQuestSub(GetTarget()->GetNPCTypeID(), "EVENT_AGGRO_SAY")) { if (DistNoRootNoZ(*GetTarget()) <= 200) { - parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language); + parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language); } } } @@ -1205,8 +1205,8 @@ void Client::Message(uint32 type, const char* message, ...) { if (GetFilter(FilterSpellCrits) == FilterHide && type == MT_SpellCrits) return; - va_list argptr; - char *buffer = new char[4096]; + va_list argptr; + char *buffer = new char[4096]; va_start(argptr, message); vsnprintf(buffer, 4096, message, argptr); va_end(argptr); @@ -1234,42 +1234,42 @@ void Client::Message(uint32 type, const char* message, ...) { void Client::QuestJournalledMessage(const char *npcname, const char* message) { - // npcnames longer than 60 characters crash the client when they log back in - const int MaxNPCNameLength = 60; - // I assume there is an upper safe limit on the message length. Don't know what it is, but 4000 doesn't crash - // the client. - const int MaxMessageLength = 4000; + // npcnames longer than 60 characters crash the client when they log back in + const int MaxNPCNameLength = 60; + // I assume there is an upper safe limit on the message length. Don't know what it is, but 4000 doesn't crash + // the client. + const int MaxMessageLength = 4000; - char OutNPCName[MaxNPCNameLength+1]; - char OutMessage[MaxMessageLength+1]; + char OutNPCName[MaxNPCNameLength+1]; + char OutMessage[MaxMessageLength+1]; - // Apparently Visual C++ snprintf is not C99 compliant and doesn't put the null terminator - // in if the formatted string >= the maximum length, so we put it in. - // - snprintf(OutNPCName, MaxNPCNameLength, "%s", npcname); OutNPCName[MaxNPCNameLength]='\0'; - snprintf(OutMessage, MaxMessageLength, "%s", message); OutMessage[MaxMessageLength]='\0'; + // Apparently Visual C++ snprintf is not C99 compliant and doesn't put the null terminator + // in if the formatted string >= the maximum length, so we put it in. + // + snprintf(OutNPCName, MaxNPCNameLength, "%s", npcname); OutNPCName[MaxNPCNameLength]='\0'; + snprintf(OutMessage, MaxMessageLength, "%s", message); OutMessage[MaxMessageLength]='\0'; - uint32 len_packet = sizeof(SpecialMesg_Struct) + strlen(OutNPCName) + strlen(OutMessage); - EQApplicationPacket* app = new EQApplicationPacket(OP_SpecialMesg, len_packet); - SpecialMesg_Struct* sm=(SpecialMesg_Struct*)app->pBuffer; + uint32 len_packet = sizeof(SpecialMesg_Struct) + strlen(OutNPCName) + strlen(OutMessage); + EQApplicationPacket* app = new EQApplicationPacket(OP_SpecialMesg, len_packet); + SpecialMesg_Struct* sm=(SpecialMesg_Struct*)app->pBuffer; - sm->header[0] = 0; - sm->header[1] = 2; - sm->header[2] = 0; - sm->msg_type = 0x0a; - sm->target_spawn_id = GetID(); + sm->header[0] = 0; + sm->header[1] = 2; + sm->header[2] = 0; + sm->msg_type = 0x0a; + sm->target_spawn_id = GetID(); - char *dest = &sm->sayer[0]; + char *dest = &sm->sayer[0]; - memcpy(dest, OutNPCName, strlen(OutNPCName) + 1); + memcpy(dest, OutNPCName, strlen(OutNPCName) + 1); - dest = dest + strlen(OutNPCName) + 13; + dest = dest + strlen(OutNPCName) + 13; - memcpy(dest, OutMessage, strlen(OutMessage) + 1); + memcpy(dest, OutMessage, strlen(OutMessage) + 1); - QueuePacket(app); + QueuePacket(app); - safe_delete(app); + safe_delete(app); } void Client::SetMaxHP() { @@ -1473,13 +1473,13 @@ void Client::SendSound(){//Makes a sound. memset(&x[12],0x4A01,sizeof(uint16)); x[16]=0x05; x[28]=0x00;//change this value to give gold to the client - memset(&x[40],0xFFFFFFFF,sizeof(uint32)); - memset(&x[44],0xFFFFFFFF,sizeof(uint32)); - memset(&x[48],0xFFFFFFFF,sizeof(uint32)); - memset(&x[52],0xFFFFFFFF,sizeof(uint32)); - memset(&x[56],0xFFFFFFFF,sizeof(uint32)); - memset(&x[60],0xFFFFFFFF,sizeof(uint32)); - memset(&x[64],0xffffffff,sizeof(uint32)); + memset(&x[40],0xFFFFFFFF,sizeof(uint32)); + memset(&x[44],0xFFFFFFFF,sizeof(uint32)); + memset(&x[48],0xFFFFFFFF,sizeof(uint32)); + memset(&x[52],0xFFFFFFFF,sizeof(uint32)); + memset(&x[56],0xFFFFFFFF,sizeof(uint32)); + memset(&x[60],0xFFFFFFFF,sizeof(uint32)); + memset(&x[64],0xffffffff,sizeof(uint32)); memcpy(outapp->pBuffer,x,outapp->size); QueuePacket(outapp); safe_delete(outapp); @@ -2191,52 +2191,52 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ // Add Amount of Platinum tmp2 = tmp/1000; - int32 new_val = m_pp.platinum + tmp2; - if(new_val < 0) { - m_pp.platinum = 0; - } else { - m_pp.platinum = m_pp.platinum + tmp2; - } + int32 new_val = m_pp.platinum + tmp2; + if(new_val < 0) { + m_pp.platinum = 0; + } else { + m_pp.platinum = m_pp.platinum + tmp2; + } tmp-=tmp2*1000; - //if (updateclient) + //if (updateclient) // SendClientMoneyUpdate(3,tmp2); // Add Amount of Gold tmp2 = tmp/100; - new_val = m_pp.gold + tmp2; - if(new_val < 0) { - m_pp.gold = 0; - } else { - m_pp.gold = m_pp.gold + tmp2; - } + new_val = m_pp.gold + tmp2; + if(new_val < 0) { + m_pp.gold = 0; + } else { + m_pp.gold = m_pp.gold + tmp2; + } tmp-=tmp2*100; //if (updateclient) - // SendClientMoneyUpdate(2,tmp2); + // SendClientMoneyUpdate(2,tmp2); // Add Amount of Silver tmp2 = tmp/10; - new_val = m_pp.silver + tmp2; - if(new_val < 0) { - m_pp.silver = 0; - } else { - m_pp.silver = m_pp.silver + tmp2; - } - tmp-=tmp2*10; - //if (updateclient) + new_val = m_pp.silver + tmp2; + if(new_val < 0) { + m_pp.silver = 0; + } else { + m_pp.silver = m_pp.silver + tmp2; + } + tmp-=tmp2*10; + //if (updateclient) // SendClientMoneyUpdate(1,tmp2); // Add Copper //tmp = tmp - (tmp2* 10); - //if (updateclient) + //if (updateclient) // SendClientMoneyUpdate(0,tmp); tmp2 = tmp; - new_val = m_pp.copper + tmp2; - if(new_val < 0) { - m_pp.copper = 0; - } else { - m_pp.copper = m_pp.copper + tmp2; - } + new_val = m_pp.copper + tmp2; + if(new_val < 0) { + m_pp.copper = 0; + } else { + m_pp.copper = m_pp.copper + tmp2; + } //send them all at once, since the above code stopped working. @@ -2247,26 +2247,26 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ Save(); - LogFile->write(EQEMuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); + LogFile->write(EQEMuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); } void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool updateclient){ - int32 new_value = m_pp.platinum + platinum; - if(new_value >= 0 && new_value > m_pp.platinum) - m_pp.platinum += platinum; + int32 new_value = m_pp.platinum + platinum; + if(new_value >= 0 && new_value > m_pp.platinum) + m_pp.platinum += platinum; - new_value = m_pp.gold + gold; - if(new_value >= 0 && new_value > m_pp.gold) - m_pp.gold += gold; + new_value = m_pp.gold + gold; + if(new_value >= 0 && new_value > m_pp.gold) + m_pp.gold += gold; - new_value = m_pp.silver + silver; - if(new_value >= 0 && new_value > m_pp.silver) - m_pp.silver += silver; + new_value = m_pp.silver + silver; + if(new_value >= 0 && new_value > m_pp.silver) + m_pp.silver += silver; - new_value = m_pp.copper + copper; - if(new_value >= 0 && new_value > m_pp.copper) - m_pp.copper += copper; + new_value = m_pp.copper + copper; + if(new_value >= 0 && new_value > m_pp.copper) + m_pp.copper += copper; if(updateclient) SendMoneyUpdate(); @@ -2275,7 +2275,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat Save(); #if (EQDEBUG>=5) - LogFile->write(EQEMuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", + LogFile->write(EQEMuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); #endif } @@ -2294,10 +2294,10 @@ void Client::SendMoneyUpdate() { bool Client::HasMoney(uint64 Copper) { - if((static_cast(m_pp.copper) + - (static_cast(m_pp.silver) * 10) + - (static_cast(m_pp.gold) * 100) + - (static_cast(m_pp.platinum) * 1000)) >= Copper) + if ((static_cast(m_pp.copper) + + (static_cast(m_pp.silver) * 10) + + (static_cast(m_pp.gold) * 100) + + (static_cast(m_pp.platinum) * 1000)) >= Copper) return true; return false; @@ -2306,27 +2306,27 @@ bool Client::HasMoney(uint64 Copper) { uint64 Client::GetCarriedMoney() { return ((static_cast(m_pp.copper) + - (static_cast(m_pp.silver) * 10) + - (static_cast(m_pp.gold) * 100) + - (static_cast(m_pp.platinum) * 1000))); + (static_cast(m_pp.silver) * 10) + + (static_cast(m_pp.gold) * 100) + + (static_cast(m_pp.platinum) * 1000))); } uint64 Client::GetAllMoney() { return ( - (static_cast(m_pp.copper) + - (static_cast(m_pp.silver) * 10) + - (static_cast(m_pp.gold) * 100) + - (static_cast(m_pp.platinum) * 1000) + - (static_cast(m_pp.copper_bank) + - (static_cast(m_pp.silver_bank) * 10) + - (static_cast(m_pp.gold_bank) * 100) + - (static_cast(m_pp.platinum_bank) * 1000) + - (static_cast(m_pp.copper_cursor) + - (static_cast(m_pp.silver_cursor) * 10) + - (static_cast(m_pp.gold_cursor) * 100) + - (static_cast(m_pp.platinum_cursor) * 1000) + - (static_cast(m_pp.platinum_shared) * 1000))))); + (static_cast(m_pp.copper) + + (static_cast(m_pp.silver) * 10) + + (static_cast(m_pp.gold) * 100) + + (static_cast(m_pp.platinum) * 1000) + + (static_cast(m_pp.copper_bank) + + (static_cast(m_pp.silver_bank) * 10) + + (static_cast(m_pp.gold_bank) * 100) + + (static_cast(m_pp.platinum_bank) * 1000) + + (static_cast(m_pp.copper_cursor) + + (static_cast(m_pp.silver_cursor) * 10) + + (static_cast(m_pp.gold_cursor) * 100) + + (static_cast(m_pp.platinum_cursor) * 1000) + + (static_cast(m_pp.platinum_shared) * 1000))))); } bool Client::CheckIncreaseSkill(SkillType skillid, Mob *against_who, int chancemodi) { @@ -2479,7 +2479,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillType skillid, uint16 max else { Message(13, "Your spell casting specializations skills have been reset. " - "Only %i primary specialization skill is allowed.", MaxSpecializations); + "Only %i primary specialization skill is allowed.", MaxSpecializations); for(int i = SPECIALIZE_ABJURE; i <= SPECIALIZE_EVOCATION; ++i) SetSkill((SkillType)i, 1); @@ -2487,7 +2487,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillType skillid, uint16 max Save(); LogFile->write(EQEMuLog::Normal, "Reset %s's caster specialization skills to 1. " - "Too many specializations skills were above 50.", GetCleanName()); + "Too many specializations skills were above 50.", GetCleanName()); } } @@ -2930,7 +2930,7 @@ void Client::Message_StringID(uint32 type, uint32 string_id, uint32 distance) // to load the eqstr file and count them in the string. // This hack sucks but it's gonna work for now. // -void Client::Message_StringID(uint32 type, uint32 string_id, const char* message1, +void Client::Message_StringID(uint32 type, uint32 string_id, const char* message1, const char* message2,const char* message3,const char* message4, const char* message5,const char* message6,const char* message7, const char* message8,const char* message9, uint32 distance) @@ -3142,10 +3142,10 @@ uint8 Client::SlotConvert2(uint8 slot){ void Client::Escape() { - entity_list.RemoveFromTargets(this, true); - SetInvisible(1); + entity_list.RemoveFromTargets(this, true); + SetInvisible(1); - Message_StringID(MT_Skills, ESCAPE); + Message_StringID(MT_Skills, ESCAPE); } float Client::CalcPriceMod(Mob* other, bool reverse) @@ -3706,7 +3706,7 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { strcpy(ts->Caster, Caster->GetName()); ts->SpellID = SpellID; - if((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) { + if((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) { ts->ZoneID = m_pp.binds[0].zoneId; ts->x = m_pp.binds[0].x; ts->y = m_pp.binds[0].y; @@ -3766,7 +3766,7 @@ void Client::SendPopupToClient(const char *Title, const char *Text, uint32 Popup OnLevelMessage_Struct *olms = (OnLevelMessage_Struct *) outapp->pBuffer; if((strlen(Title) > (sizeof(olms->Title)-1)) || - (strlen(Text) > (sizeof(olms->Text)-1))) return; + (strlen(Text) > (sizeof(olms->Text)-1))) return; strcpy(olms->Title, Title); strcpy(olms->Text, Text); @@ -4010,7 +4010,7 @@ void Client::UpdateLFP() { uint16 Client::GetPrimarySkillValue() { - SkillType skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill + SkillType skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill bool equiped = m_inv.GetItem(13); if (!equiped) @@ -4018,7 +4018,7 @@ uint16 Client::GetPrimarySkillValue() else { - uint8 type = m_inv.GetItem(13)->GetItem()->ItemType; //is this the best way to do this? + uint8 type = m_inv.GetItem(13)->GetItem()->ItemType; //is this the best way to do this? switch (type) { @@ -4137,7 +4137,7 @@ void Client::VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber) { void Client::ClearGroupAAs() { - for(unsigned int i = 0; i < MAX_GROUP_LEADERSHIP_AA_ARRAY; i++) + for(unsigned int i = 0; i < MAX_GROUP_LEADERSHIP_AA_ARRAY; i++) m_pp.leader_abilities.ranks[i] = 0; m_pp.group_leadership_points = 0; @@ -4448,10 +4448,10 @@ void Client::HandleLDoNSenseTraps(NPC *target, uint16 skill, uint8 type) { case -1: case 0: - Message_StringID(MT_Skills, LDON_DONT_KNOW_TRAPPED, target->GetCleanName()); + Message_StringID(MT_Skills, LDON_DONT_KNOW_TRAPPED, target->GetCleanName()); break; case 1: - Message_StringID(MT_Skills, LDON_CERTAIN_TRAP, target->GetCleanName()); + Message_StringID(MT_Skills, LDON_CERTAIN_TRAP, target->GetCleanName()); target->SetLDoNTrapDetected(true); break; default: @@ -4610,7 +4610,7 @@ void Client::SummonAndRezzAllCorpses() entity_list.RemoveAllCorpsesByCharID(CharacterID()); int CorpseCount = database.SummonAllPlayerCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), - GetX(), GetY(), GetZ(), GetHeading()); + GetX(), GetY(), GetZ(), GetHeading()); if(CorpseCount <= 0) { Message(clientMessageYellow, "You have no corpses to summnon."); @@ -4648,7 +4648,7 @@ void Client::SummonAllCorpses(float dest_x, float dest_y, float dest_z, float de entity_list.RemoveAllCorpsesByCharID(CharacterID()); int CorpseCount = database.SummonAllPlayerCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), - dest_x, dest_y, dest_z, dest_heading); + dest_x, dest_y, dest_z, dest_heading); if(CorpseCount <= 0) { return; @@ -4709,7 +4709,7 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z) // setting city to zero allows the player to use /setstartcity to set the city themselves if(zoneid == 0) { m_pp.binds[4].zoneId = 0; - this->Message(15,"Your starting city has been reset. Use /setstartcity to choose a new one"); + this->Message(15,"Your starting city has been reset. Use /setstartcity to choose a new one"); return; } @@ -4948,7 +4948,7 @@ void Client::Signal(uint32 data) char buf[32]; snprintf(buf, 31, "%d", data); buf[31] = '\0'; - parse->EventPlayer(EVENT_SIGNAL, this, buf, 0); + parse->EventPlayer(EVENT_SIGNAL, this, buf, 0); } const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) const @@ -5429,7 +5429,7 @@ void Client::UpdateLDoNLosses(uint32 t, int32 n) void Client::SuspendMinion() { - NPC *CurrentPet = GetPet()->CastToNPC(); + NPC *CurrentPet = GetPet()->CastToNPC(); int AALevel = GetAA(aaSuspendedMinion); @@ -5603,7 +5603,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { if(requestee->IsClient() && (requestee != requester)) { requestee->Message(0, "%s is looking at your equipment...", requester->GetName()); } requester->QueuePacket(outapp); // Send answer to requester - safe_delete(outapp); + safe_delete(outapp); } } @@ -6149,8 +6149,8 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid if(summon_count > MAX_SWARM_PETS) summon_count = MAX_SWARM_PETS; - static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, 10, -10, 10, -10, 8, -8, 8, -8 }; - static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, 10, 10, -10, -10, 8, 8, -8, -8 }; + static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, 10, -10, 10, -10, 8, -8, 8, -8 }; + static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, 10, 10, -10, -10, 8, 8, -8, -8 }; TempPets(true); while(summon_count > 0) { @@ -6207,9 +6207,9 @@ void Client::SendStatsWindow(Client* client, bool use_window) std::string color_red = ""; std::string color_blue = ""; - std::string color_green = ""; - std::string bright_green = ""; - std::string bright_red = ""; + std::string color_green = ""; + std::string bright_green = ""; + std::string bright_red = ""; std::string heroic_color = " +"; // Set Class @@ -6240,21 +6240,21 @@ void Client::SendStatsWindow(Client* client, bool use_window) case 522: race_Name = "Drakkin"; break; default: break; } - /*########################################################## + /*########################################################## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - H/M/E String + H/M/E String ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ##########################################################*/ std::string HME_row = ""; - //Loop Variables - /*===========================*/ - std::string cur_field = ""; - std::string total_field = ""; - std::string cur_name = ""; + //Loop Variables + /*===========================*/ + std::string cur_field = ""; + std::string total_field = ""; + std::string cur_name = ""; std::string cur_spacing = ""; std::string cur_color = ""; - int hme_rows = 3; // Rows in display + int hme_rows = 3; // Rows in display int max_HME_value_len = 9; // 9 digits in the displayed value for(int hme_row_counter = 0; hme_row_counter < hme_rows; hme_row_counter++) @@ -6292,28 +6292,28 @@ void Client::SendStatsWindow(Client* client, bool use_window) HME_row += indM + cur_name + cur_spacing + cur_color + cur_field + " / " + total_field + "
"; } - /*########################################################## + /*########################################################## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Regen String + Regen String ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ##########################################################*/ std::string regen_string; - //Loop Variables - /*===========================*/ + //Loop Variables + /*===========================*/ std::string regen_row_header = ""; std::string regen_row_color = ""; - std::string base_regen_field = ""; - std::string base_regen_spacing = ""; - std::string item_regen_field = ""; - std::string item_regen_spacing = ""; - std::string cap_regen_field = ""; - std::string cap_regen_spacing = ""; - std::string spell_regen_field = ""; - std::string spell_regen_spacing = ""; - std::string aa_regen_field = ""; + std::string base_regen_field = ""; + std::string base_regen_spacing = ""; + std::string item_regen_field = ""; + std::string item_regen_spacing = ""; + std::string cap_regen_field = ""; + std::string cap_regen_spacing = ""; + std::string spell_regen_field = ""; + std::string spell_regen_spacing = ""; + std::string aa_regen_field = ""; std::string aa_regen_spacing = ""; - std::string total_regen_field = ""; - int regen_rows = 3; // Number of rows + std::string total_regen_field = ""; + int regen_rows = 3; // Number of rows int max_regen_value_len = 5; // 5 digits in the displayed value(larger values will not get cut off, this is just a baseline) for(int regen_row_counter = 0; regen_row_counter < regen_rows; regen_row_counter++) @@ -6379,29 +6379,29 @@ void Client::SendStatsWindow(Client* client, bool use_window) regen_string += ") " + cap_regen_spacing + div + spell_regen_spacing + spell_regen_field; regen_string += div + aa_regen_spacing + aa_regen_field + div + total_regen_field + "

"; } - /*########################################################## + /*########################################################## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Stat String + Stat String ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ##########################################################*/ std::string stat_field = ""; - //Loop Variables - /*===========================*/ - //first field(stat) + //Loop Variables + /*===========================*/ + //first field(stat) std::string a_stat = "";; - std::string a_stat_name = ""; - std::string a_stat_spacing = ""; - //second field(heroic stat) - std::string h_stat = ""; - std::string h_stat_spacing = ""; - //third field(resist) - std::string a_resist = ""; - std::string a_resist_name = ""; - std::string a_resist_spacing = ""; - //fourth field(heroic resist) - std::string h_resist_field = ""; + std::string a_stat_name = ""; + std::string a_stat_spacing = ""; + //second field(heroic stat) + std::string h_stat = ""; + std::string h_stat_spacing = ""; + //third field(resist) + std::string a_resist = ""; + std::string a_resist_name = ""; + std::string a_resist_spacing = ""; + //fourth field(heroic resist) + std::string h_resist_field = ""; - int stat_rows = 7; // Number of rows + int stat_rows = 7; // Number of rows int max_stat_value_len = 3; // 3 digits in the displayed value for(int stat_row_counter = 0; stat_row_counter < stat_rows; stat_row_counter++) @@ -6483,27 +6483,27 @@ void Client::SendStatsWindow(Client* client, bool use_window) stat_field += h_stat_spacing + a_resist_name + a_resist_spacing + a_resist + heroic_color + h_resist_field + "

"; } } - /*########################################################## + /*########################################################## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Mod2 String + Mod2 String ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ##########################################################*/ std::string mod2_field = ""; - //Loop Variables - /*===========================*/ + //Loop Variables + /*===========================*/ std::string mod2a = ""; - std::string mod2a_name = ""; - std::string mod2a_spacing = ""; + std::string mod2a_name = ""; + std::string mod2a_spacing = ""; std::string mod2a_cap = ""; std::string mod_row_spacing = ""; std::string mod2b = ""; - std::string mod2b_name = ""; - std::string mod2b_spacing = ""; + std::string mod2b_name = ""; + std::string mod2b_spacing = ""; std::string mod2b_cap = ""; int mod2a_space_count; int mod2b_space_count; - int mod2_rows = 4; + int mod2_rows = 4; int max_mod2_value_len = 3; // 3 digits in the displayed value for(int mod2_row_counter = 0; mod2_row_counter < mod2_rows; mod2_row_counter++) @@ -6703,104 +6703,104 @@ void Client::SendStatsWindow(Client* client, bool use_window) } void Client::SendAltCurrencies() { - if(GetClientVersion() >= EQClientSoF) { - uint32 count = zone->AlternateCurrencies.size(); - if(count == 0) { - return; - } + if(GetClientVersion() >= EQClientSoF) { + uint32 count = zone->AlternateCurrencies.size(); + if(count == 0) { + return; + } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, - sizeof(AltCurrencyPopulate_Struct) + sizeof(AltCurrencyPopulateEntry_Struct) * count); - AltCurrencyPopulate_Struct *altc = (AltCurrencyPopulate_Struct*)outapp->pBuffer; - altc->opcode = ALT_CURRENCY_OP_POPULATE; - altc->count = count; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, + sizeof(AltCurrencyPopulate_Struct) + sizeof(AltCurrencyPopulateEntry_Struct) * count); + AltCurrencyPopulate_Struct *altc = (AltCurrencyPopulate_Struct*)outapp->pBuffer; + altc->opcode = ALT_CURRENCY_OP_POPULATE; + altc->count = count; - uint32 i = 0; - list::iterator iter = zone->AlternateCurrencies.begin(); - while(iter != zone->AlternateCurrencies.end()) { - const Item_Struct* item = database.GetItem((*iter).item_id); - altc->entries[i].currency_number = (*iter).id; - altc->entries[i].unknown00 = 1; - altc->entries[i].currency_number2 = (*iter).id; - altc->entries[i].item_id = (*iter).item_id; - if(item) { - altc->entries[i].item_icon = item->Icon; - altc->entries[i].stack_size = item->StackSize; - } else { - altc->entries[i].item_icon = 1000; - altc->entries[i].stack_size = 1000; - } - i++; - iter++; - } + uint32 i = 0; + list::iterator iter = zone->AlternateCurrencies.begin(); + while(iter != zone->AlternateCurrencies.end()) { + const Item_Struct* item = database.GetItem((*iter).item_id); + altc->entries[i].currency_number = (*iter).id; + altc->entries[i].unknown00 = 1; + altc->entries[i].currency_number2 = (*iter).id; + altc->entries[i].item_id = (*iter).item_id; + if(item) { + altc->entries[i].item_icon = item->Icon; + altc->entries[i].stack_size = item->StackSize; + } else { + altc->entries[i].item_icon = 1000; + altc->entries[i].stack_size = 1000; + } + i++; + iter++; + } - FastQueuePacket(&outapp); - } + FastQueuePacket(&outapp); + } } void Client::SetAlternateCurrencyValue(uint32 currency_id, uint32 new_amount) { - alternate_currency[currency_id] = new_amount; - database.UpdateAltCurrencyValue(CharacterID(), currency_id, new_amount); - SendAlternateCurrencyValue(currency_id); + alternate_currency[currency_id] = new_amount; + database.UpdateAltCurrencyValue(CharacterID(), currency_id, new_amount); + SendAlternateCurrencyValue(currency_id); } void Client::AddAlternateCurrencyValue(uint32 currency_id, int32 amount) { - if(amount == 0) { - return; - } + if(amount == 0) { + return; + } - int new_value = 0; - std::map::iterator iter = alternate_currency.find(currency_id); - if(iter == alternate_currency.end()) { - new_value = amount; - } else { - new_value = (*iter).second + amount; - } + int new_value = 0; + std::map::iterator iter = alternate_currency.find(currency_id); + if(iter == alternate_currency.end()) { + new_value = amount; + } else { + new_value = (*iter).second + amount; + } - if(new_value < 0) { - alternate_currency[currency_id] = 0; - database.UpdateAltCurrencyValue(CharacterID(), currency_id, 0); - } else { - alternate_currency[currency_id] = new_value; - database.UpdateAltCurrencyValue(CharacterID(), currency_id, new_value); - } - SendAlternateCurrencyValue(currency_id); + if(new_value < 0) { + alternate_currency[currency_id] = 0; + database.UpdateAltCurrencyValue(CharacterID(), currency_id, 0); + } else { + alternate_currency[currency_id] = new_value; + database.UpdateAltCurrencyValue(CharacterID(), currency_id, new_value); + } + SendAlternateCurrencyValue(currency_id); } void Client::SendAlternateCurrencyValues() { - list::iterator iter = zone->AlternateCurrencies.begin(); - while(iter != zone->AlternateCurrencies.end()) { - SendAlternateCurrencyValue((*iter).id, false); - iter++; - } + list::iterator iter = zone->AlternateCurrencies.begin(); + while(iter != zone->AlternateCurrencies.end()) { + SendAlternateCurrencyValue((*iter).id, false); + iter++; + } } void Client::SendAlternateCurrencyValue(uint32 currency_id, bool send_if_null) { - uint32 value = GetAlternateCurrencyValue(currency_id); - if(value > 0 || (value == 0 && send_if_null)) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); - AltCurrencyUpdate_Struct *update = (AltCurrencyUpdate_Struct*)outapp->pBuffer; - update->opcode = 7; - strcpy(update->name, GetName()); - update->currency_number = currency_id; - update->amount = value; - update->unknown072 = 1; - FastQueuePacket(&outapp); - } + uint32 value = GetAlternateCurrencyValue(currency_id); + if(value > 0 || (value == 0 && send_if_null)) { + EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); + AltCurrencyUpdate_Struct *update = (AltCurrencyUpdate_Struct*)outapp->pBuffer; + update->opcode = 7; + strcpy(update->name, GetName()); + update->currency_number = currency_id; + update->amount = value; + update->unknown072 = 1; + FastQueuePacket(&outapp); + } } uint32 Client::GetAlternateCurrencyValue(uint32 currency_id) const { - std::map::const_iterator iter = alternate_currency.find(currency_id); - if(iter == alternate_currency.end()) { - return 0; - } else { - return (*iter).second; - } + std::map::const_iterator iter = alternate_currency.find(currency_id); + if(iter == alternate_currency.end()) { + return 0; + } else { + return (*iter).second; + } } void Client::OpenLFGuildWindow() @@ -6959,13 +6959,13 @@ void Client::SendXTargetPacket(uint32 Slot, Mob *m) } else { - if(strlen(XTargets[Slot].Name) && ((XTargets[Slot].Type == CurrentTargetPC) || - (XTargets[Slot].Type == GroupTank) || - (XTargets[Slot].Type == GroupAssist) || - (XTargets[Slot].Type == Puller) || - (XTargets[Slot].Type == RaidAssist1) || - (XTargets[Slot].Type == RaidAssist2) || - (XTargets[Slot].Type == RaidAssist3))) + if (strlen(XTargets[Slot].Name) && ((XTargets[Slot].Type == CurrentTargetPC) || + (XTargets[Slot].Type == GroupTank) || + (XTargets[Slot].Type == GroupAssist) || + (XTargets[Slot].Type == Puller) || + (XTargets[Slot].Type == RaidAssist1) || + (XTargets[Slot].Type == RaidAssist2) || + (XTargets[Slot].Type == RaidAssist3))) { outapp->WriteUInt8(2); } @@ -6986,15 +6986,15 @@ void Client::RemoveGroupXTargets() for(int i = 0; i < GetMaxXTargets(); ++i) { - if((XTargets[i].Type == GroupTank) || - (XTargets[i].Type == GroupAssist) || - (XTargets[i].Type == Puller) || - (XTargets[i].Type == RaidAssist1) || - (XTargets[i].Type == RaidAssist2) || - (XTargets[i].Type == RaidAssist3) || - (XTargets[i].Type == GroupMarkTarget1) || - (XTargets[i].Type == GroupMarkTarget2) || - (XTargets[i].Type == GroupMarkTarget3)) + if ((XTargets[i].Type == GroupTank) || + (XTargets[i].Type == GroupAssist) || + (XTargets[i].Type == Puller) || + (XTargets[i].Type == RaidAssist1) || + (XTargets[i].Type == RaidAssist2) || + (XTargets[i].Type == RaidAssist3) || + (XTargets[i].Type == GroupMarkTarget1) || + (XTargets[i].Type == GroupMarkTarget2) || + (XTargets[i].Type == GroupMarkTarget3)) { XTargets[i].ID = 0; XTargets[i].Name[0] = 0; @@ -7361,9 +7361,8 @@ FACTION_VALUE Client::GetReverseFactionCon(Mob* iOther) { //o-------------------------------------------------------------- //| Name: GetFactionLevel; rembrant, Dec. 16, 2001 //o-------------------------------------------------------------- -//| Notes: Gets the characters faction standing with the -//| specified NPC. -//| Will return Indifferent on failure. +//| Notes: Gets the characters faction standing with the specified NPC. +//| Will return Indifferent on failure. //o-------------------------------------------------------------- FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc) { @@ -7372,24 +7371,24 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra if (pFaction < 0) return GetSpecialFactionCon(tnpc); FACTION_VALUE fac = FACTION_INDIFFERENT; - //int32 pFacValue; -Trumpcard: commenting. Not currently used. + //int32 pFacValue; -Trumpcard: commenting. Not currently used. int32 tmpFactionValue; FactionMods fmods; - // neotokyo: few optimizations - if (GetFeigned()) + // neotokyo: few optimizations + if (GetFeigned()) return FACTION_INDIFFERENT; - if (invisible_undead && tnpc && !tnpc->SeeInvisibleUndead()) - return FACTION_INDIFFERENT; - if (IsInvisible(tnpc)) + if (invisible_undead && tnpc && !tnpc->SeeInvisibleUndead()) return FACTION_INDIFFERENT; - if (tnpc && tnpc->GetOwnerID() != 0) // pets con amiably to owner and indiff to rest + if (IsInvisible(tnpc)) + return FACTION_INDIFFERENT; + if (tnpc && tnpc->GetOwnerID() != 0) // pets con amiably to owner and indiff to rest if (char_id == tnpc->GetOwner()->CastToClient()->CharacterID()) return FACTION_AMIABLE; else return FACTION_INDIFFERENT; - //First get the NPC's Primary faction + //First get the NPC's Primary faction if(pFaction > 0) { //Get the faction data from the database @@ -7405,13 +7404,13 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra } } else - { - return(FACTION_INDIFFERENT); - } + { + return(FACTION_INDIFFERENT); + } - // merchant fix - if (tnpc && tnpc->IsNPC() && tnpc->CastToNPC()->MerchantType && (fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) - fac = FACTION_DUBIOUS; + // merchant fix + if (tnpc && tnpc->IsNPC() && tnpc->CastToNPC()->MerchantType && (fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) + fac = FACTION_DUBIOUS; if (tnpc != 0 && fac != FACTION_SCOWLS && tnpc->CastToNPC()->CheckAggro(this)) fac = FACTION_THREATENLY; @@ -7422,10 +7421,9 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra //o-------------------------------------------------------------- //| Name: SetFactionLevel; rembrant, Dec. 20, 2001 //o-------------------------------------------------------------- -//| Notes: Sets the characters faction standing with the -//| specified NPC. +//| Notes: Sets the characters faction standing with the specified NPC. //o-------------------------------------------------------------- -void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity) +void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity) { _ZP(Client_SetFactionLevel); int32 faction_id[MAX_NPC_FACTIONS]={ 0,0,0,0,0,0,0,0,0,0 }; @@ -7469,56 +7467,56 @@ void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, u mod = MIN_FACTION; // Calculate the faction - if(npc_value[i] != 0) { - tmpValue = current_value + mod + npc_value[i]; + if(npc_value[i] != 0) { + tmpValue = current_value + mod + npc_value[i]; - // Make sure faction hits don't go to GMs... - if (m_pp.gm==1 && (tmpValue < current_value)) { - tmpValue = current_value; - } + // Make sure faction hits don't go to GMs... + if (m_pp.gm==1 && (tmpValue < current_value)) { + tmpValue = current_value; + } - // Make sure we dont go over the min/max faction limits - if(tmpValue >= MAX_FACTION) - { - t = MAX_FACTION - mod; - if(current_value == t) { - //do nothing, it is already maxed out - } else if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], t, temp[i], factionvalues))) - { - return; - } - } - else if(tmpValue <= MIN_FACTION) - { - t = MIN_FACTION - mod; - if(current_value == t) { - //do nothing, it is already maxed out - } else if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], t, temp[i], factionvalues))) - { - return; - } - } - else - { - if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], current_value + npc_value[i], temp[i], factionvalues))) - { - return; - } - } - if(tmpValue <= MIN_FACTION) - tmpValue = MIN_FACTION; + // Make sure we dont go over the min/max faction limits + if(tmpValue >= MAX_FACTION) + { + t = MAX_FACTION - mod; + if(current_value == t) { + //do nothing, it is already maxed out + } else if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], t, temp[i], factionvalues))) + { + return; + } + } + else if(tmpValue <= MIN_FACTION) + { + t = MIN_FACTION - mod; + if(current_value == t) { + //do nothing, it is already maxed out + } else if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], t, temp[i], factionvalues))) + { + return; + } + } + else + { + if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], current_value + npc_value[i], temp[i], factionvalues))) + { + return; + } + } + if(tmpValue <= MIN_FACTION) + tmpValue = MIN_FACTION; - char* msg = BuildFactionMessage(npc_value[i],faction_id[i],tmpValue,temp[i]); - if (msg != 0) - Message(0, msg); - safe_delete_array(msg); - } - } + char* msg = BuildFactionMessage(npc_value[i],faction_id[i],tmpValue,temp[i]); + if (msg != 0) + Message(0, msg); + safe_delete_array(msg); + } + } } return; } -void Client::SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp) +void Client::SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp) { _ZP(Client_SetFactionLevel2); int32 current_value; @@ -7570,7 +7568,7 @@ bool Client::HatedByClass(uint32 p_race, uint32 p_class, uint32 p_deity, int32 p int32 tmpFactionValue; FactionMods fmods; - //First get the NPC's Primary faction + //First get the NPC's Primary faction if(pFaction > 0) { //Get the faction data from the database diff --git a/zone/client.h b/zone/client.h index 949a6658d..52d298b61 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2003 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 CLIENT_H #define CLIENT_H @@ -61,10 +61,10 @@ extern TaskManager *taskmanager; class CLIENTPACKET { public: - CLIENTPACKET(); - ~CLIENTPACKET(); - EQApplicationPacket *app; - bool ack_req; + CLIENTPACKET(); + ~CLIENTPACKET(); + EQApplicationPacket *app; + bool ack_req; }; enum { //Type arguments to the Message* routines. @@ -189,13 +189,13 @@ public: #include "client_packet.h" Client(EQStreamInterface * ieqs); - ~Client(); + ~Client(); //abstract virtual function implementations requird by base abstract class virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false); - virtual bool HasRaid() { return (GetRaid() ? true : false); } + virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasGroup() { return (GetGroup() ? true : false); } virtual Raid* GetRaid() { return entity_list.GetRaidByClient(this); } virtual Group* GetGroup() { return entity_list.GetGroupByClient(this); } @@ -207,14 +207,14 @@ public: void AI_Process(); void AI_SpellCast(); void Trader_ShowItems(); - void Trader_CustomerBrowsing(Client *Customer); + void Trader_CustomerBrowsing(Client *Customer); void Trader_EndTrader(); void Trader_StartTrader(); uint8 WithCustomer(uint16 NewCustomer); void KeyRingLoad(); void KeyRingAdd(uint32 item_id); bool KeyRingCheck(uint32 item_id); - void KeyRingList(); + void KeyRingList(); virtual bool IsClient() const { return true; } virtual void DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw); bool FinishConnState2(DBAsyncWork* dbaw); @@ -233,13 +233,13 @@ public: uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity); ItemInst* FindTraderItemBySerialNumber(int32 SerialNumber); void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot); - void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid); + void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid); void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges); void TradeRequestFailed(const EQApplicationPacket* app); void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app); void TraderUpdate(uint16 slot_id,uint32 trader_id); void FinishTrade(Mob* with, ServerPacket* qspack = nullptr, bool finalizer = false); - void SendZonePoints(); + void SendZonePoints(); void SendBuyerResults(char *SearchQuery, uint32 SearchID); void ShowBuyLines(const EQApplicationPacket *app); @@ -248,7 +248,7 @@ public: void UpdateBuyLine(const EQApplicationPacket *app); void BuyerItemSearch(const EQApplicationPacket *app); void SetBuyerWelcomeMessage(const char* WelcomeMessage) { BuyerWelcomeMessage = WelcomeMessage; } - const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); } + const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); } void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); virtual bool Process(); @@ -260,7 +260,7 @@ public: void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...); void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); void Message(uint32 type, const char* message, ...); - void QuestJournalledMessage(const char *npcname, const char* message); + void QuestJournalledMessage(const char *npcname, const char* message); void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber); void SendSound(); void LearnRecipe(uint32 recipeID); @@ -289,13 +289,13 @@ public: inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; } inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); } void WorldKick(); - inline uint8 GetAnon() const { return m_pp.anon; } + inline uint8 GetAnon() const { return m_pp.anon; } inline PlayerProfile_Struct& GetPP() { return m_pp; } inline ExtendedProfile_Struct& GetEPP() { return m_epp; } inline Inventory& GetInv() { return m_inv; } inline const Inventory& GetInv() const { return m_inv; } inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } - inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; } + inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; } inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel); @@ -323,7 +323,7 @@ public: inline void SetBaseClass(uint32 i) { m_pp.class_=i; } inline void SetBaseRace(uint32 i) { m_pp.race=i; } inline void SetBaseGender(uint32 i) { m_pp.gender=i; } - inline void SetDeity(uint32 i) {m_pp.deity=i;deity=i;} + inline void SetDeity(uint32 i) {m_pp.deity=i;deity=i;} inline uint8 GetLevel2() const { return m_pp.level2; } inline uint16 GetBaseRace() const { return m_pp.race; } @@ -346,11 +346,11 @@ public: int32 CalcMaxMana(); int32 CalcBaseMana(); const int32& SetMana(int32 amount); - int32 CalcManaRegenCap(); + int32 CalcManaRegenCap(); void ServerFilter(SetServerFilter_Struct* filter); void BulkSendTraderInventory(uint32 char_id); - void SendSingleTraderItem(uint32 char_id, int uniqueid); + void SendSingleTraderItem(uint32 char_id, int uniqueid); void BulkSendMerchantInventory(int merchant_id, int npcid); inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } @@ -392,19 +392,19 @@ public: int16 GetMaxStat() const; int16 GetMaxResist() const; - int16 GetMaxSTR() const; - int16 GetMaxSTA() const; - int16 GetMaxDEX() const; - int16 GetMaxAGI() const; - int16 GetMaxINT() const; - int16 GetMaxWIS() const; - int16 GetMaxCHA() const; - int16 GetMaxMR() const; - int16 GetMaxPR() const; - int16 GetMaxDR() const; - int16 GetMaxCR() const; - int16 GetMaxFR() const; - int16 GetMaxCorrup() const; + int16 GetMaxSTR() const; + int16 GetMaxSTA() const; + int16 GetMaxDEX() const; + int16 GetMaxAGI() const; + int16 GetMaxINT() const; + int16 GetMaxWIS() const; + int16 GetMaxCHA() const; + int16 GetMaxMR() const; + int16 GetMaxPR() const; + int16 GetMaxDR() const; + int16 GetMaxCR() const; + int16 GetMaxFR() const; + int16 GetMaxCorrup() const; inline uint8 GetBaseSTR() const { return m_pp.STR; } inline uint8 GetBaseSTA() const { return m_pp.STA; } inline uint8 GetBaseCHA() const { return m_pp.CHA; } @@ -502,8 +502,8 @@ public: //This gets the skill value of the item type equiped in the Primary Slot uint16 GetPrimarySkillValue(); - bool Flurry(); - bool Rampage(); + bool Flurry(); + bool Rampage(); void DurationRampage(uint32 duration); inline uint32 GetEXP() const { return m_pp.exp; } @@ -526,17 +526,17 @@ public: void AddLeadershipEXP(uint32 group_exp, uint32 raid_exp); void SendLeadershipEXPUpdate(); bool IsLeadershipEXPOn(); - inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } + inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } int GroupLeadershipAAHealthEnhancement(); int GroupLeadershipAAManaEnhancement(); int GroupLeadershipAAHealthRegeneration(); int GroupLeadershipAAOffenseEnhancement(); void InspectBuffs(Client* Inspector, int Rank); - uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); } - uint32 GetGroupPoints() { return(m_pp.group_leadership_points); } - uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); } - uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } - uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } + uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); } + uint32 GetGroupPoints() { return(m_pp.group_leadership_points); } + uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); } + uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } + uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } virtual void SetLevel(uint8 set_level, bool command = false); void GoToBind(uint8 bindnum = 0); void GoToSafeCoords(uint16 zone_id, uint16 instance_id); @@ -561,14 +561,14 @@ public: inline const int32 GetInstanceID() const { return zone->GetInstanceID(); } FACTION_VALUE GetReverseFactionCon(Mob* iOther); - FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc); + FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc); int32 GetCharacterFactionLevel(int32 faction_id); - int32 GetModCharacterFactionLevel(int32 faction_id); + int32 GetModCharacterFactionLevel(int32 faction_id); bool HatedByClass(uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction); - char* BuildFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp); + char* BuildFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp); void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity); - void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); + void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); int16 GetRawItemAC(); uint16 GetCombinedAC_TEST(); @@ -592,7 +592,7 @@ public: void SendGuildChannel(); void SendGuildSpawnAppearance(); void SendGuildMembers(); - void SendGuildList(); + void SendGuildList(); void SendGuildJoin(GuildJoin_Struct* gj); void RefreshGuildInfo(); @@ -602,7 +602,7 @@ public: void SendEnduranceUpdate(); uint8 GetFace() const { return m_pp.face; } void WhoAll(Who_All_Struct* whom); - void FriendsWho(char *FriendsString); + void FriendsWho(char *FriendsString); void Stun(int duration); void UnStun(); @@ -639,7 +639,7 @@ public: void CheckSongSkillIncrease(uint16 spell_id); bool CheckIncreaseSkill(SkillType skillid, Mob *against_who, int chancemodi = 0); void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill); - void SetLanguageSkill(int langid, int value); + void SetLanguageSkill(int langid, int value); void SetHoTT(uint32 mobid); void ShowSkillsWindow(); void SendStatsWindow(Client* client, bool use_window); @@ -679,7 +679,7 @@ public: bool LootToStack(uint32 itemid); void SetFeigned(bool in_feigned); /// this cures timing issues cuz dead animation isn't done but server side feigning is? - inline bool GetFeigned() const { return(feigned); } + inline bool GetFeigned() const { return(feigned); } EQStreamInterface* Connection() { return eqs; } #ifdef PACKET_PROFILER void DumpPacketProfile() { if(eqs) eqs->DumpPacketProfile(); } @@ -713,22 +713,22 @@ public: inline PTimerList &GetPTimers() { return(p_timers); } //AA Methods - void SendAAList(); - void ResetAA(); - void SendAA(uint32 id, int seq=1); - void SendPreviousAA(uint32 id, int seq=1); - void BuyAA(AA_Action* action); + void SendAAList(); + void ResetAA(); + void SendAA(uint32 id, int seq=1); + void SendPreviousAA(uint32 id, int seq=1); + void BuyAA(AA_Action* action); //this function is used by some AA stuff void MemorizeSpell(uint32 slot,uint32 spellid,uint32 scribing); void SetAATitle(const char *Title); void SetTitleSuffix(const char *txt); inline uint32 GetMaxAAXP(void) const { return max_AAXP; } - inline uint32 GetAAXP() const { return m_pp.expAA; } + inline uint32 GetAAXP() const { return m_pp.expAA; } void SendAAStats(); void SendAATable(); void SendAATimers(); - int GetAATimerID(aaID activate); - int CalcAAReuseTimer(const AA_DBAction *caa); + int GetAATimerID(aaID activate); + int CalcAAReuseTimer(const AA_DBAction *caa); void ActivateAA(aaID activate); void SendAATimer(uint32 ability, uint32 begin, uint32 end); void EnableAAEffect(aaEffectType type, uint32 duration = 0); @@ -745,7 +745,7 @@ public: // Item methods uint32 NukeItem(uint32 itemnum, uint8 where_to_check = - (invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)); + (invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)); void SetTint(int16 slot_id, uint32 color); void SetTint(int16 slot_id, Color_Struct& color); void SetMaterial(int16 slot_id, uint32 item_id); @@ -770,7 +770,7 @@ public: void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); bool IsValidSlot(uint32 slot); - bool IsBankSlot(uint32 slot); + bool IsBankSlot(uint32 slot); inline bool IsTrader() const { return(Trader); } inline bool IsBuyer() const { return(Buyer); } @@ -786,14 +786,14 @@ public: bool CheckTradeLoreConflict(Client* other); void LinkDead(); void Insight(uint32 t_id); - bool CheckDoubleAttack(bool tripleAttack = false); + bool CheckDoubleAttack(bool tripleAttack = false); //remove charges/multiple objects from inventory: //bool DecreaseByType(uint32 type, uint8 amt); bool DecreaseByID(uint32 type, uint8 amt); uint8 SlotConvert2(uint8 slot); //Maybe not needed. void Escape(); //AA Escape - void RemoveNoRent(bool client_update = true); + void RemoveNoRent(bool client_update = true); void RemoveDuplicateLore(bool client_update = true); void MoveSlotNotAllowed(bool client_update = true); virtual void RangedAttack(Mob* other); @@ -819,9 +819,9 @@ public: void SendDisciplineUpdate(); bool UseDiscipline(uint32 spell_id, uint32 target); - bool CheckTitle(int titleset); - void EnableTitle(int titleset); - void RemoveTitle(int titleset); + bool CheckTitle(int titleset); + void EnableTitle(int titleset); + void RemoveTitle(int titleset); #ifdef PACKET_UPDATE_MANAGER inline UpdateManager *GetUpdateManager() { return(&update_manager); } @@ -862,120 +862,87 @@ public: void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...); bool PendingTranslocate; time_t TranslocateTime; - bool PendingSacrifice; - string SacrificeCaster; - struct Translocate_Struct PendingTranslocateData; - void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); + bool PendingSacrifice; + string SacrificeCaster; + struct Translocate_Struct PendingTranslocateData; + void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); - // Task System Methods + // Task System Methods void LoadClientTaskState(); void RemoveClientTaskState(); - void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1); - void SendTaskFailed(int TaskID, int TaskIndex); - void SendTaskComplete(int TaskIndex); + void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1); + void SendTaskFailed(int TaskID, int TaskIndex); + void SendTaskComplete(int TaskIndex); inline void CancelTask(int TaskIndex) { if(taskstate) taskstate->CancelTask(this, TaskIndex); } - inline bool SaveTaskState() - { return (taskmanager ? taskmanager->SaveClientState(this, taskstate) : false); } + inline bool SaveTaskState() { return (taskmanager ? taskmanager->SaveClientState(this, taskstate) : false); } inline bool IsTaskStateLoaded() { return taskstate != nullptr; } - inline bool IsTaskActive(int TaskID) - { return (taskstate ? taskstate->IsTaskActive(TaskID) : false); } + inline bool IsTaskActive(int TaskID) { return (taskstate ? taskstate->IsTaskActive(TaskID) : false); } - inline bool IsTaskActivityActive(int TaskID, int ActivityID) - { return (taskstate ? taskstate->IsTaskActivityActive(TaskID, ActivityID) : false); } + inline bool IsTaskActivityActive(int TaskID, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityActive(TaskID, ActivityID) : false); } - inline ActivityState GetTaskActivityState(int index, int ActivityID) - { return (taskstate ? taskstate->GetTaskActivityState(index, ActivityID) : ActivityHidden); } + inline ActivityState GetTaskActivityState(int index, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityState(index, ActivityID) : ActivityHidden); } - inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count) - { if(taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count); } + inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count) { if(taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count); } - inline void ResetTaskActivity(int TaskID, int ActivityID) - { if(taskstate) taskstate->ResetTaskActivity(this, TaskID, ActivityID); } + inline void ResetTaskActivity(int TaskID, int ActivityID) { if(taskstate) taskstate->ResetTaskActivity(this, TaskID, ActivityID); } - inline void UpdateTasksOnKill(int NPCTypeID) - { if(taskstate) taskstate->UpdateTasksOnKill(this, NPCTypeID); } + inline void UpdateTasksOnKill(int NPCTypeID) { if(taskstate) taskstate->UpdateTasksOnKill(this, NPCTypeID); } - inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1) - { if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); } + inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1) { if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); } - inline void UpdateTasksOnExplore(int ExploreID) - { if(taskstate) taskstate->UpdateTasksOnExplore(this, ExploreID); } + inline void UpdateTasksOnExplore(int ExploreID) { if(taskstate) taskstate->UpdateTasksOnExplore(this, ExploreID); } - inline bool UpdateTasksOnSpeakWith(int NPCTypeID) - { if(taskstate) return taskstate->UpdateTasksOnSpeakWith(this, NPCTypeID); else return false; } + inline bool UpdateTasksOnSpeakWith(int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnSpeakWith(this, NPCTypeID); else return false; } - inline bool UpdateTasksOnDeliver(uint32 *Items, int Cash, int NPCTypeID) - { if(taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; } + inline bool UpdateTasksOnDeliver(uint32 *Items, int Cash, int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; } - inline void TaskSetSelector(Mob *mob, int TaskSetID) - { if(taskmanager) taskmanager->TaskSetSelector(this, taskstate, mob, TaskSetID); } + inline void TaskSetSelector(Mob *mob, int TaskSetID) { if(taskmanager) taskmanager->TaskSetSelector(this, taskstate, mob, TaskSetID); } - inline void EnableTask(int TaskCount, int *TaskList) - { if(taskstate) taskstate->EnableTask(CharacterID(), TaskCount, TaskList); } + inline void EnableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->EnableTask(CharacterID(), TaskCount, TaskList); } - inline void DisableTask(int TaskCount, int *TaskList) - { if(taskstate) taskstate->DisableTask(CharacterID(), TaskCount, TaskList); } + inline void DisableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->DisableTask(CharacterID(), TaskCount, TaskList); } - inline bool IsTaskEnabled(int TaskID) - { return (taskstate ? taskstate->IsTaskEnabled(TaskID) : false); } + inline bool IsTaskEnabled(int TaskID) { return (taskstate ? taskstate->IsTaskEnabled(TaskID) : false); } - inline void ProcessTaskProximities(float X, float Y, float Z) - { if(taskstate) taskstate->ProcessTaskProximities(this, X, Y, Z); } + inline void ProcessTaskProximities(float X, float Y, float Z) { if(taskstate) taskstate->ProcessTaskProximities(this, X, Y, Z); } - inline void AssignTask(int TaskID, int NPCID) - { if(taskstate) taskstate->AcceptNewTask(this, TaskID, NPCID); } + inline void AssignTask(int TaskID, int NPCID) { if(taskstate) taskstate->AcceptNewTask(this, TaskID, NPCID); } - inline int ActiveSpeakTask(int NPCID) - { if(taskstate) return taskstate->ActiveSpeakTask(NPCID); else return 0; } + inline int ActiveSpeakTask(int NPCID) { if(taskstate) return taskstate->ActiveSpeakTask(NPCID); else return 0; } - inline int ActiveSpeakActivity(int NPCID, int TaskID) - { if(taskstate) return taskstate->ActiveSpeakActivity(NPCID, TaskID); else return 0; } + inline int ActiveSpeakActivity(int NPCID, int TaskID) { if(taskstate) return taskstate->ActiveSpeakActivity(NPCID, TaskID); else return 0; } - inline void FailTask(int TaskID) - { if(taskstate) taskstate->FailTask(this, TaskID); } + inline void FailTask(int TaskID) { if(taskstate) taskstate->FailTask(this, TaskID); } - inline int TaskTimeLeft(int TaskID) - { return (taskstate ? taskstate->TaskTimeLeft(TaskID) : 0); } + inline int TaskTimeLeft(int TaskID) { return (taskstate ? taskstate->TaskTimeLeft(TaskID) : 0); } - inline int EnabledTaskCount(int TaskSetID) - { return (taskstate ? taskstate->EnabledTaskCount(TaskSetID) : -1); } + inline int EnabledTaskCount(int TaskSetID) { return (taskstate ? taskstate->EnabledTaskCount(TaskSetID) : -1); } - inline int IsTaskCompleted(int TaskID) - { return (taskstate ? taskstate->IsTaskCompleted(TaskID) : -1); } + inline int IsTaskCompleted(int TaskID) { return (taskstate ? taskstate->IsTaskCompleted(TaskID) : -1); } - inline void ShowClientTasks() - { if(taskstate) taskstate->ShowClientTasks(this); } + inline void ShowClientTasks() { if(taskstate) taskstate->ShowClientTasks(this); } - inline void CancelAllTasks() - { if(taskstate) taskstate->CancelAllTasks(this); } + inline void CancelAllTasks() { if(taskstate) taskstate->CancelAllTasks(this); } - inline int GetActiveTaskCount() - { return (taskstate ? taskstate->GetActiveTaskCount() : 0); } + inline int GetActiveTaskCount() { return (taskstate ? taskstate->GetActiveTaskCount() : 0); } - inline int GetActiveTaskID(int index) - { return (taskstate ? taskstate->GetActiveTaskID(index) : -1); } + inline int GetActiveTaskID(int index) { return (taskstate ? taskstate->GetActiveTaskID(index) : -1); } - inline int GetTaskStartTime(int index) - { return (taskstate ? taskstate->GetTaskStartTime(index) : -1); } + inline int GetTaskStartTime(int index) { return (taskstate ? taskstate->GetTaskStartTime(index) : -1); } - inline bool IsTaskActivityCompleted(int index, int ActivityID) - { return (taskstate ? taskstate->IsTaskActivityCompleted(index, ActivityID) : false); } + inline bool IsTaskActivityCompleted(int index, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityCompleted(index, ActivityID) : false); } - inline int GetTaskActivityDoneCount(int ClientTaskIndex, int ActivityID) - { return (taskstate ? taskstate->GetTaskActivityDoneCount(ClientTaskIndex, ActivityID) :0); } + inline int GetTaskActivityDoneCount(int ClientTaskIndex, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCount(ClientTaskIndex, ActivityID) :0); } - inline int GetTaskActivityDoneCountFromTaskID(int TaskID, int ActivityID) - { return (taskstate ? taskstate->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID) :0); } + inline int GetTaskActivityDoneCountFromTaskID(int TaskID, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID) :0); } - inline int ActiveTasksInSet(int TaskSet) - { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); } + inline int ActiveTasksInSet(int TaskSet) { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); } - inline int CompletedTasksInSet(int TaskSet) - { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); } + inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); } inline const EQClientVersion GetClientVersion() const { return ClientVersion; } inline const uint32 GetClientVersionBit() const { return ClientVersionBit; } @@ -1128,7 +1095,7 @@ public: Timer* GetMercTimer() { return &merc_timer; }; const char* GetRacePlural(Client* client); const char* GetClassPlural(Client* client); - void SendWebLink(const char* website); + void SendWebLink(const char* website); bool StoreTurnInItems(Mob* with); void DuplicateLoreMessage(uint32 ItemID); @@ -1167,7 +1134,7 @@ protected: friend class Mob; void CalcItemBonuses(StatBonuses* newbon); void AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug = false, bool isTribute = false); - int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); + int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); void CalcEdibleBonuses(StatBonuses* newbon); void CalcAABonuses(StatBonuses* newbon); void ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon); @@ -1219,22 +1186,22 @@ private: void HandleTraderPriceUpdate(const EQApplicationPacket *app); - int16 CalcAC(); - int16 GetACMit(); - int16 GetACAvoid(); - int16 CalcATK(); - int CalcHaste(); + int16 CalcAC(); + int16 GetACMit(); + int16 GetACAvoid(); + int16 CalcATK(); + int CalcHaste(); - int16 CalcAlcoholPhysicalEffect(); - int16 CalcSTR(); - int16 CalcSTA(); - int16 CalcDEX(); - int16 CalcAGI(); - int16 CalcINT(); - int16 CalcWIS(); - int16 CalcCHA(); + int16 CalcAlcoholPhysicalEffect(); + int16 CalcSTR(); + int16 CalcSTA(); + int16 CalcDEX(); + int16 CalcAGI(); + int16 CalcINT(); + int16 CalcWIS(); + int16 CalcCHA(); - int16 CalcMR(); + int16 CalcMR(); int16 CalcFR(); int16 CalcDR(); int16 CalcPR(); @@ -1253,13 +1220,13 @@ private: uint32 pLastUpdate; uint32 pLastUpdateWZ; - uint8 playeraction; + uint8 playeraction; EQStreamInterface* eqs; uint32 ip; uint16 port; - CLIENT_CONN_STATUS client_state; + CLIENT_CONN_STATUS client_state; uint32 character_id; uint32 WID; uint32 account_id; @@ -1296,15 +1263,15 @@ private: uint16 BoatID; uint16 TrackingID; uint16 CustomerID; - uint32 account_creation; + uint32 account_creation; uint8 firstlogon; - uint32 mercid; // current merc - uint8 mercSlot; // selected merc slot + uint32 mercid; // current merc + uint8 mercSlot; // selected merc slot bool Trader; bool Buyer; string BuyerWelcomeMessage; bool AbilityTimer; - int Haste; //precalced value + int Haste; //precalced value int32 max_end; int32 cur_end; @@ -1323,9 +1290,9 @@ private: bool CanBeInZone(); void SendLogoutPackets(); - bool AddPacket(const EQApplicationPacket *, bool); - bool AddPacket(EQApplicationPacket**, bool); - bool SendAllPackets(); + bool AddPacket(const EQApplicationPacket *, bool); + bool AddPacket(EQApplicationPacket**, bool); + bool SendAllPackets(); LinkedList clientpackets; //Zoning related stuff @@ -1391,7 +1358,7 @@ private: uint32 tribute_master_id; FILE *SQL_log; - uint32 max_AAXP; + uint32 max_AAXP; uint32 staminacount; AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile map aa_points; @@ -1404,7 +1371,7 @@ private: int32 last_reported_mana; int32 last_reported_endur; - unsigned int AggroCount; // How many mobs are aggro on us. + unsigned int AggroCount; // How many mobs are aggro on us. unsigned int RestRegenHP; unsigned int RestRegenMana; @@ -1431,7 +1398,7 @@ private: bool m_KnockBackExemption; bool m_PortExemption; bool m_SenseExemption; - std::map alternate_currency; + std::map alternate_currency; //Connecting debug code. enum { //connecting states, used for debugging only @@ -1472,3 +1439,4 @@ private: #include "parser.h" #endif + diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index 4b0bd3f89..987a2ad24 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.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 "../common/debug.h" #include "../common/features.h" diff --git a/zone/client_logs.h b/zone/client_logs.h index 8cbc3c88b..bff215c42 100644 --- a/zone/client_logs.h +++ b/zone/client_logs.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 CLIENT_LOGS_H @@ -60,5 +60,3 @@ extern ClientLogs client_logs; #endif //CLIENT_LOGS #endif - - diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 29676ae01..1e81c563e 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.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 "masterentity.h" @@ -1319,7 +1319,7 @@ int16 Client::CalcINT() { if(m_pp.intoxication) { - int16 AlcINT = INT - (int16)((float)m_pp.intoxication / 200.0f * (float)INT) - 1; + int16 AlcINT = INT - (int16)((float)m_pp.intoxication / 200.0f * (float)INT) - 1; if((AlcINT < (int)(0.2 * INT))) INT = (int)(0.2f * (float)INT); @@ -1348,7 +1348,7 @@ int16 Client::CalcWIS() { if(m_pp.intoxication) { - int16 AlcWIS = WIS - (int16)((float)m_pp.intoxication / 200.0f * (float)WIS) - 1; + int16 AlcWIS = WIS - (int16)((float)m_pp.intoxication / 200.0f * (float)WIS) - 1; if((AlcWIS < (int)(0.2 * WIS))) WIS = (int)(0.2f * (float)WIS); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 28a3f77bb..84e36f401 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2009 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -8,11 +8,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 + You should have received a copy of the GNU General Public 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" @@ -33,7 +33,7 @@ #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #else #include #include @@ -407,7 +407,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) EmuOpcode opcode = app->GetOpcode(); if (opcode == OP_AckPacket) { - return true; + return true; } #if EQDEBUG >= 9 @@ -489,7 +489,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) //LogFile->write(EQEMuLog::Error,"Wrong size on OP_SetDatarate. Got: %i, Expected: %i", app->size, sizeof(float)); //return; //} - //LogFile->write(EQEMuLog::Debug, "HandlePacket() OP_SetDataRate request : %f", *(float*) app->pBuffer); + //LogFile->write(EQEMuLog::Debug, "HandlePacket() OP_SetDataRate request : %f", *(float*) app->pBuffer); //float tmpDR = *(float*) app->pBuffer; //if (tmpDR <= 0.0f) { //LogFile->write(EQEMuLog::Error,"HandlePacket() OP_SetDataRate INVALID request : %f <= 0", tmpDR); @@ -555,7 +555,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) //DO NOT FORGET TO EDIT ZoneDatabase::GetCharacterInfoForLogin if you change this dbaw->AddQuery(2, &query, MakeAnyLenString(&query, "SELECT id,profile,zonename,x,y,z,guild_id,rank,extprofile,class,level,lfp,lfg,instanceid,xtargets,firstlogon" - " FROM character_ LEFT JOIN guild_members ON id=char_id WHERE id=%i", + " FROM character_ LEFT JOIN guild_members ON id=char_id WHERE id=%i", character_id)); dbaw->AddQuery(3, &query, MakeAnyLenString(&query, "SELECT faction_id,current_value FROM faction_values WHERE temp = 0 AND char_id = %i", @@ -880,7 +880,7 @@ void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) LogFile->write(EQEMuLog::Error, "Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) - DumpPacket(app); + DumpPacket(app); #endif return; } @@ -1205,7 +1205,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) rewind_y_diff *= rewind_y_diff; //We only need to store updated values if the player has moved. - //If the player has moved more than units for x or y, then we'll store + //If the player has moved more than units for x or y, then we'll store //his pre-PPU x and y for /rewind, in case he gets stuck. if ((rewind_x_diff > 750) || (rewind_y_diff > 750)) { rewind_x = x_pos; @@ -1214,7 +1214,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) } //If the PPU was a large jump, such as a cross zone gate or Call of Hero, - //just update rewind coords to the new ppu coords. This will prevent exploitation. + //just update rewind coords to the new ppu coords. This will prevent exploitation. if ((rewind_x_diff > 5000) || (rewind_y_diff > 5000)) { rewind_x = ppu->x_pos; @@ -1224,7 +1224,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if(proximity_timer.Check()) { entity_list.ProcessMove(this, ppu->x_pos, ppu->y_pos, ppu->z_pos); - if(RuleB(TaskSystem, EnableTaskSystem) && RuleB(TaskSystem,EnableTaskProximity)) + if(RuleB(TaskSystem, EnableTaskSystem) && RuleB(TaskSystem,EnableTaskProximity)) ProcessTaskProximities(ppu->x_pos, ppu->y_pos, ppu->z_pos); proximity_x = ppu->x_pos; proximity_y = ppu->y_pos; @@ -1245,7 +1245,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) // Break Hide if moving without sneaking and set rewind timer if moved if(ppu->y_pos != y_pos || ppu->x_pos != x_pos){ - if((hidden || improved_hidden) && !sneaking){ + if((hidden || improved_hidden) && !sneaking){ hidden = false; improved_hidden = false; if(!invisible) { @@ -1285,7 +1285,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if(zone->watermap) { - if(zone->watermap->InLiquid(x_pos, y_pos, z_pos)) + if(zone->watermap->InLiquid(x_pos, y_pos, z_pos)) { CheckIncreaseSkill(SWIMMING, nullptr, -17); } @@ -1428,9 +1428,9 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) if(nt) { SetTarget(nt); - if((nt->IsClient() && !nt->CastToClient()->GetPVP()) || - (nt->IsPet() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP()) || - (nt->IsMerc() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP())) + if ((nt->IsClient() && !nt->CastToClient()->GetPVP()) || + (nt->IsPet() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP()) || + (nt->IsMerc() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP())) nt->SendBuffsToClient(this); } else @@ -2067,7 +2067,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if(parse->ItemHasQuestSub(p_inst, "EVENT_ITEM_CLICK")) { - parse->EventItem(EVENT_ITEM_CLICK, this, p_inst, p_inst->GetID(), slot_id); + parse->EventItem(EVENT_ITEM_CLICK, this, p_inst, p_inst->GetID(), slot_id); inst = m_inv[slot_id]; if (!inst) { @@ -2288,7 +2288,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) Mob* tmp = entity_list.GetMob(eid->entity_id); if (tmp == 0 || !tmp->IsNPC() || ((tmp->GetClass() != ADVENTUREMERCHANT) && - (tmp->GetClass() != DISCORD_MERCHANT) && (tmp->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (tmp->GetClass() != DARK_REIGN_MERCHANT))) + (tmp->GetClass() != DISCORD_MERCHANT) && (tmp->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (tmp->GetClass() != DARK_REIGN_MERCHANT))) return; //you have to be somewhat close to them to be properly using them @@ -2303,14 +2303,14 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) std::list::const_iterator itr; for(itr = merlist.begin();itr != merlist.end() && count<255;itr++){ const MerchantList &ml = *itr; - if(GetLevel() < ml.level_required) { - continue; - } + if(GetLevel() < ml.level_required) { + continue; + } - int32 fac = tmp->GetPrimaryFaction(); - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } + int32 fac = tmp->GetPrimaryFaction(); + if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { + continue; + } item = database.GetItem(ml.item); if(item) @@ -2383,7 +2383,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) uint32 merchantid = 0; Mob* tmp = entity_list.GetMob(aps->npcid); if (tmp == 0 || !tmp->IsNPC() || ((tmp->GetClass() != ADVENTUREMERCHANT) && - (tmp->GetClass() != DISCORD_MERCHANT) && (tmp->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (tmp->GetClass() != DARK_REIGN_MERCHANT))) + (tmp->GetClass() != DISCORD_MERCHANT) && (tmp->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (tmp->GetClass() != DARK_REIGN_MERCHANT))) return; //you have to be somewhat close to them to be properly using them @@ -2399,18 +2399,18 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) for(itr = merlist.begin();itr != merlist.end();itr++){ MerchantList ml = *itr; - if(GetLevel() < ml.level_required) { - continue; - } + if(GetLevel() < ml.level_required) { + continue; + } - int32 fac = tmp->GetPrimaryFaction(); - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } + int32 fac = tmp->GetPrimaryFaction(); + if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { + continue; + } - item = database.GetItem(ml.item); - if(!item) - continue; + item = database.GetItem(ml.item); + if(!item) + continue; if(item->ID == aps->itemid) { //This check to make sure that the item is actually on the NPC, people attempt to inject packets to get items summoned... found = true; break; @@ -2651,15 +2651,15 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) } } - if(con->faction == FACTION_APPREHENSIVE) { - con->faction = FACTION_SCOWLS; - } else if(con->faction == FACTION_DUBIOUS) { - con->faction = FACTION_THREATENLY; - } else if(con->faction == FACTION_SCOWLS) { - con->faction = FACTION_APPREHENSIVE; - } else if(con->faction == FACTION_THREATENLY) { - con->faction = FACTION_DUBIOUS; - } + if(con->faction == FACTION_APPREHENSIVE) { + con->faction = FACTION_SCOWLS; + } else if(con->faction == FACTION_DUBIOUS) { + con->faction = FACTION_THREATENLY; + } else if(con->faction == FACTION_SCOWLS) { + con->faction = FACTION_APPREHENSIVE; + } else if(con->faction == FACTION_THREATENLY) { + con->faction = FACTION_DUBIOUS; + } mod_consider(tmob, con); @@ -3196,7 +3196,7 @@ void Client::Handle_OP_Death(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if(app->size != sizeof(MoveCoin_Struct)){ - LogFile->write(EQEMuLog::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + LogFile->write(EQEMuLog::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -3207,7 +3207,7 @@ void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if(app->size != sizeof(ItemViewRequest_Struct)){ - LogFile->write(EQEMuLog::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + LogFile->write(EQEMuLog::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -3264,8 +3264,8 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if(silentsaylink) { - parse->EventNPC(EVENT_SAY, GetTarget()->CastToNPC(), this, response.c_str(), 0); - parse->EventPlayer(EVENT_SAY, this, response.c_str(), 0); + parse->EventNPC(EVENT_SAY, GetTarget()->CastToNPC(), this, response.c_str(), 0); + parse->EventPlayer(EVENT_SAY, this, response.c_str(), 0); } else { @@ -3351,7 +3351,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) casting_spell_id); database.SetMQDetectionFlag(AccountName(), GetName(), detect, zone->GetShortName()); safe_delete_array(detect); - Kick(); // Kick client to prevent client and server from getting out-of-sync inventory slots + Kick(); // Kick client to prevent client and server from getting out-of-sync inventory slots return; } } @@ -3359,25 +3359,25 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) // Illegal bagslot useage checks. Currently, user only receives a message if this check is triggered. bool mi_hack = false; - if(mi->from_slot >= 251 && mi->from_slot <= 340) { + if(mi->from_slot >= 251 && mi->from_slot <= 340) { if(mi->from_slot > 330) { mi_hack = true; } - else { + else { int16 from_parent = m_inv.CalcSlotId(mi->from_slot); if(!m_inv[from_parent]) { mi_hack = true; } else if(!m_inv[from_parent]->IsType(ItemClassContainer)) { mi_hack = true; } else if(m_inv.CalcBagIdx(mi->from_slot) >= m_inv[from_parent]->GetItem()->BagSlots) { mi_hack = true; } - } - } + } + } - if(mi->to_slot >= 251 && mi->to_slot <= 340) { + if(mi->to_slot >= 251 && mi->to_slot <= 340) { if(mi->to_slot > 330) { mi_hack = true; } else { int16 to_parent = m_inv.CalcSlotId(mi->to_slot); if(!m_inv[to_parent]) { mi_hack = true; } else if(!m_inv[to_parent]->IsType(ItemClassContainer)) { mi_hack = true; } else if(m_inv.CalcBagIdx(mi->to_slot) >= m_inv[to_parent]->GetItem()->BagSlots) { mi_hack = true; } - } - } + } + } if(mi_hack) { Message(15, "Caution: Illegal use of inaccessable bag slots!"); } @@ -3469,7 +3469,7 @@ void Client::Handle_OP_FeignDeath(const EQApplicationPacket *app) void Client::Handle_OP_Sneak(const EQApplicationPacket *app) { - if(!HasSkill(SNEAK) && GetSkill(SNEAK) == 0) { + if(!HasSkill(SNEAK) && GetSkill(SNEAK) == 0) { return; //You cannot sneak if you do not have sneak } @@ -3667,7 +3667,7 @@ void Client::Handle_OP_WhoAllRequest(const EQApplicationPacket *app) void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app) { - char *FriendsString = (char*) app->pBuffer; + char *FriendsString = (char*) app->pBuffer; FriendsWho(FriendsString); return; } @@ -4618,7 +4618,7 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv ItemInst* p_inst = (ItemInst*)inst; if(parse->ItemHasQuestSub(p_inst, "EVENT_ITEM_CLICK_CAST")) { - parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), castspell->inventoryslot); + parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), castspell->inventoryslot); SendSpellBarEnable(castspell->spell_id); return; } @@ -4639,7 +4639,7 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv ItemInst* p_inst = (ItemInst*)inst; if(parse->ItemHasQuestSub(p_inst, "EVENT_ITEM_CLICK_CAST")) { - parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), castspell->inventoryslot); + parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), castspell->inventoryslot); SendSpellBarEnable(castspell->spell_id); return; } @@ -4828,7 +4828,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) const Resurrect_Struct* ra = (const Resurrect_Struct*) app->pBuffer; _log(SPELLS__REZ, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", - PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); + PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); _pkt(SPELLS__REZ, app); @@ -4875,9 +4875,9 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) tradee->CastToClient()->QueuePacket(app); } #ifndef BOTS - else if (tradee && tradee->IsNPC()) { + else if (tradee && tradee->IsNPC()) { #else - else if (tradee && (tradee->IsNPC() || tradee->IsBot())) { + else if (tradee && (tradee->IsNPC() || tradee->IsBot())) { #endif //npcs always accept trade->Start(msg->to_mob_id); @@ -5186,7 +5186,7 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) return; } if (!usedname) { - Message(13, "%s is already in use. Operation failed!", gmn->newname); + Message(13, "%s is already in use. Operation failed!", gmn->newname); return; } @@ -5414,7 +5414,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) outtcs->Approval = Customer->WithCustomer(GetID()); else { _log(TRADING__CLIENT, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" - " returned a nullptr pointer"); + " returned a nullptr pointer"); return; } @@ -5521,7 +5521,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) mco->playerid = 0; mco->command = action; // Merchant command 0x01 = open if (RuleB(Merchant, UsePriceMod)){ - mco->rate = 1/((RuleR(Merchant, BuyCostMod))*Client::CalcPriceMod(tmp,true)); // works + mco->rate = 1/((RuleR(Merchant, BuyCostMod))*Client::CalcPriceMod(tmp,true)); // works } else mco->rate = 1/(RuleR(Merchant, BuyCostMod)); @@ -5566,7 +5566,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) } return; } - else { + else { _log(TRADING__CLIENT, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); LogFile->write(EQEMuLog::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } @@ -5609,14 +5609,14 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) std::list::const_iterator itr; for(itr = merlist.begin();itr != merlist.end();itr++){ MerchantList ml = *itr; - if(GetLevel() < ml.level_required) { - continue; - } + if(GetLevel() < ml.level_required) { + continue; + } - int32 fac = tmp->GetPrimaryFaction(); - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } + int32 fac = tmp->GetPrimaryFaction(); + if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { + continue; + } if(mp->itemslot == ml.slot){ item_id = ml.item; @@ -5771,28 +5771,28 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) ServerPacket* qspack = new ServerPacket(ServerOP_QSMerchantLogTransactions, sizeof(QSMerchantLogTransaction_Struct) + sizeof(QSTransactionItems_Struct)); QSMerchantLogTransaction_Struct* qsaudit = (QSMerchantLogTransaction_Struct*)qspack->pBuffer; - qsaudit->zone_id = zone->GetZoneID(); - qsaudit->merchant_id = tmp->CastToNPC()->MerchantType; - qsaudit->merchant_money.platinum = 0; - qsaudit->merchant_money.gold = 0; - qsaudit->merchant_money.silver = 0; - qsaudit->merchant_money.copper = 0; - qsaudit->merchant_count = 1; - qsaudit->char_id = character_id; - qsaudit->char_money.platinum = (mpo->price / 1000); - qsaudit->char_money.gold = (mpo->price / 100) % 10; - qsaudit->char_money.silver = (mpo->price / 10) % 10; - qsaudit->char_money.copper = mpo->price % 10; - qsaudit->char_count = 0; + qsaudit->zone_id = zone->GetZoneID(); + qsaudit->merchant_id = tmp->CastToNPC()->MerchantType; + qsaudit->merchant_money.platinum = 0; + qsaudit->merchant_money.gold = 0; + qsaudit->merchant_money.silver = 0; + qsaudit->merchant_money.copper = 0; + qsaudit->merchant_count = 1; + qsaudit->char_id = character_id; + qsaudit->char_money.platinum = (mpo->price / 1000); + qsaudit->char_money.gold = (mpo->price / 100) % 10; + qsaudit->char_money.silver = (mpo->price / 10) % 10; + qsaudit->char_money.copper = mpo->price % 10; + qsaudit->char_count = 0; - qsaudit->items[0].char_slot = freeslotid; - qsaudit->items[0].item_id = m_inv[freeslotid]->GetID(); - qsaudit->items[0].charges = mpo->quantity; - qsaudit->items[0].aug_1 = m_inv[freeslotid]->GetAugmentItemID(1); - qsaudit->items[0].aug_2 = m_inv[freeslotid]->GetAugmentItemID(2); - qsaudit->items[0].aug_3 = m_inv[freeslotid]->GetAugmentItemID(3); - qsaudit->items[0].aug_4 = m_inv[freeslotid]->GetAugmentItemID(4); - qsaudit->items[0].aug_5 = m_inv[freeslotid]->GetAugmentItemID(5); + qsaudit->items[0].char_slot = freeslotid; + qsaudit->items[0].item_id = m_inv[freeslotid]->GetID(); + qsaudit->items[0].charges = mpo->quantity; + qsaudit->items[0].aug_1 = m_inv[freeslotid]->GetAugmentItemID(1); + qsaudit->items[0].aug_2 = m_inv[freeslotid]->GetAugmentItemID(2); + qsaudit->items[0].aug_3 = m_inv[freeslotid]->GetAugmentItemID(3); + qsaudit->items[0].aug_4 = m_inv[freeslotid]->GetAugmentItemID(4); + qsaudit->items[0].aug_5 = m_inv[freeslotid]->GetAugmentItemID(5); qspack->Deflate(); if(worldserver.Connected()) { worldserver.SendPacket(qspack); } @@ -5908,28 +5908,28 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) ServerPacket* qspack = new ServerPacket(ServerOP_QSMerchantLogTransactions, sizeof(QSMerchantLogTransaction_Struct) + sizeof(QSTransactionItems_Struct)); QSMerchantLogTransaction_Struct* qsaudit = (QSMerchantLogTransaction_Struct*)qspack->pBuffer; - qsaudit->zone_id = zone->GetZoneID(); - qsaudit->merchant_id = vendor->CastToNPC()->MerchantType; - qsaudit->merchant_money.platinum = (price / 1000); - qsaudit->merchant_money.gold = (price / 100) % 10; - qsaudit->merchant_money.silver = (price / 10) % 10; - qsaudit->merchant_money.copper = price % 10; - qsaudit->merchant_count = 0; - qsaudit->char_id = character_id; - qsaudit->char_money.platinum = 0; - qsaudit->char_money.gold = 0; - qsaudit->char_money.silver = 0; - qsaudit->char_money.copper = 0; - qsaudit->char_count = 1; + qsaudit->zone_id = zone->GetZoneID(); + qsaudit->merchant_id = vendor->CastToNPC()->MerchantType; + qsaudit->merchant_money.platinum = (price / 1000); + qsaudit->merchant_money.gold = (price / 100) % 10; + qsaudit->merchant_money.silver = (price / 10) % 10; + qsaudit->merchant_money.copper = price % 10; + qsaudit->merchant_count = 0; + qsaudit->char_id = character_id; + qsaudit->char_money.platinum = 0; + qsaudit->char_money.gold = 0; + qsaudit->char_money.silver = 0; + qsaudit->char_money.copper = 0; + qsaudit->char_count = 1; - qsaudit->items[0].char_slot = mp->itemslot; - qsaudit->items[0].item_id = itemid; - qsaudit->items[0].charges = charges; - qsaudit->items[0].aug_1 = m_inv[mp->itemslot]->GetAugmentItemID(1); - qsaudit->items[0].aug_2 = m_inv[mp->itemslot]->GetAugmentItemID(2); - qsaudit->items[0].aug_3 = m_inv[mp->itemslot]->GetAugmentItemID(3); - qsaudit->items[0].aug_4 = m_inv[mp->itemslot]->GetAugmentItemID(4); - qsaudit->items[0].aug_5 = m_inv[mp->itemslot]->GetAugmentItemID(5); + qsaudit->items[0].char_slot = mp->itemslot; + qsaudit->items[0].item_id = itemid; + qsaudit->items[0].charges = charges; + qsaudit->items[0].aug_1 = m_inv[mp->itemslot]->GetAugmentItemID(1); + qsaudit->items[0].aug_2 = m_inv[mp->itemslot]->GetAugmentItemID(2); + qsaudit->items[0].aug_3 = m_inv[mp->itemslot]->GetAugmentItemID(3); + qsaudit->items[0].aug_4 = m_inv[mp->itemslot]->GetAugmentItemID(4); + qsaudit->items[0].aug_5 = m_inv[mp->itemslot]->GetAugmentItemID(5); qspack->Deflate(); if(worldserver.Connected()) { worldserver.SendPacket(qspack); } @@ -5951,7 +5951,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) mco->price=price; QueuePacket(outapp); safe_delete(outapp); - SendMoneyUpdate(); + SendMoneyUpdate(); t1.start(); Save(1); t1.stop(); @@ -5968,7 +5968,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) //outapp->pBuffer[1] = 0x66; //QueuePacket(outapp); //safe_delete(outapp); - //Save(); + //Save(); return; } @@ -6086,7 +6086,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) LogFile->write(EQEMuLog::Debug, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); // results show that object_type is combiner type - // some_id = 0 if world combiner, item number otherwise + // some_id = 0 if world combiner, item number otherwise // make where clause segment for container(s) char containers[30]; @@ -6099,7 +6099,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) } char *query = 0; - char buf[5500]; //gotta be big enough for 500 IDs + char buf[5500]; //gotta be big enough for 500 IDs bool first = true; uint16 r; @@ -6129,7 +6129,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " " WHERE tr.id IN (%s) " - " AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " + " AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " " GROUP BY tr.id " " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " " LIMIT 100 ", CharacterID(), buf, containers); @@ -6184,7 +6184,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " " WHERE %s tr.trivial >= %u AND tr.trivial <= %u " - " AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " + " AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " " GROUP BY tr.id " " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " " LIMIT 200 " @@ -6294,13 +6294,13 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) if(!currentdoor) { Message(0,"Unable to find door, please notify a GM (DoorID: %i).",cd->doorid); - return; + return; } char buf[20]; snprintf(buf, 19, "%u %u", cd->doorid, zone->GetInstanceVersion()); buf[19] = '\0'; - parse->EventPlayer(EVENT_CLICKDOOR, this, buf, 0); + parse->EventPlayer(EVENT_CLICKDOOR, this, buf, 0); currentdoor->HandleClick(this,0); return; @@ -6393,7 +6393,7 @@ void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) #endif } else - { + { ServerPacket* pack = new ServerPacket(ServerOP_GroupInvite, sizeof(GroupInvite_Struct)); memcpy(pack->pBuffer, gis, sizeof(GroupInvite_Struct)); worldserver.SendPacket(pack); @@ -6418,7 +6418,7 @@ void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) GroupCancel_Struct* gf = (GroupCancel_Struct*) app->pBuffer; Mob* inviter = entity_list.GetClientByName(gf->name1); - if(inviter != nullptr) + if(inviter != nullptr) { if(inviter->IsClient()) inviter->CastToClient()->QueuePacket(app); @@ -6856,14 +6856,14 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { } //Fills the app sent from client. - EQApplicationPacket* outapp = app->Copy(); - InspectResponse_Struct* insr = (InspectResponse_Struct*) outapp->pBuffer; - Mob* tmp = entity_list.GetMob(insr->TargetID); - const Item_Struct* item = nullptr; + EQApplicationPacket* outapp = app->Copy(); + InspectResponse_Struct* insr = (InspectResponse_Struct*) outapp->pBuffer; + Mob* tmp = entity_list.GetMob(insr->TargetID); + const Item_Struct* item = nullptr; for (int16 L = 0; L <= 20; L++) { const ItemInst* inst = GetInv().GetItem(L); - item = inst ? inst->GetItem() : nullptr; + item = inst ? inst->GetItem() : nullptr; if(item) { strcpy(insr->itemnames[L], item->Name); @@ -7210,7 +7210,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } case PET_TAUNT: { if((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 3) || mypet->GetPetType() != petAnimation) { - Message_StringID(MT_PetResponse, PET_DO_TAUNT); + Message_StringID(MT_PetResponse, PET_DO_TAUNT); mypet->CastToNPC()->SetTaunting(true); } break; @@ -7294,7 +7294,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } - case PET_FOCUS: { + case PET_FOCUS: { if(GetAA(aaAdvancedPetDiscipline) >= 1 && mypet->IsNPC()) { if (mypet->IsFeared()) break; @@ -7308,7 +7308,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } - case PET_FOCUS_ON: { + case PET_FOCUS_ON: { if(GetAA(aaAdvancedPetDiscipline) >= 1 && mypet->IsNPC()) { if (mypet->IsFeared()) break; @@ -7319,7 +7319,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } - case PET_FOCUS_OFF: { + case PET_FOCUS_OFF: { if(GetAA(aaAdvancedPetDiscipline) >= 1 && mypet->IsNPC()) { if (mypet->IsFeared()) break; @@ -7405,7 +7405,7 @@ void Client::Handle_OP_PetitionRefresh(const EQApplicationPacket *app) { // This is When Client Asks for Petition Again and Again... // break is here because it floods the zones and causes lag if it - // Were to actually do something:P We update on our own schedule now. + // Were to actually do something:P We update on our own schedule now. return; } @@ -7456,8 +7456,8 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app) cptr = outapp->pBuffer + 2; - // not sure if live does this or not. thought it was a nice feature, but would take a lot to - // clean up grammatical and other errors. Maybe with a regex parser... + // not sure if live does this or not. thought it was a nice feature, but would take a lot to + // clean up grammatical and other errors. Maybe with a regex parser... replacestr((char *)cptr, target->GetName(), "you"); replacestr((char *)cptr, " he", " you"); replacestr((char *)cptr, " she", " you"); @@ -7642,14 +7642,14 @@ void Client::Handle_OP_Fishing(const EQApplicationPacket *app) } if (CanFish()) { - parse->EventPlayer(EVENT_FISH_START, this, "", 0); + parse->EventPlayer(EVENT_FISH_START, this, "", 0); //these will trigger GoFish() after a delay if we're able to actually fish, and if not, we won't stop the client from trying again immediately (although we may need to tell it to repop the button) p_timers.Start(pTimerFishing, FishingReuseTime-1); fishing_timer.Start(); } return; -// Changes made based on Bobs work on foraging. Now can set items in the forage database table to +// Changes made based on Bobs work on foraging. Now can set items in the forage database table to // forage for. } @@ -7704,11 +7704,11 @@ void Client::Handle_OP_Mend(const EQApplicationPacket *app) Message_StringID(4,MEND_SUCCESS); } else { /* the purpose of the following is to make the chance to worsen wounds much less common, - which is more consistent with the way eq live works. - according to my math, this should result in the following probability: - 0 skill - 25% chance to worsen - 20 skill - 23% chance to worsen - 50 skill - 16% chance to worsen */ + which is more consistent with the way eq live works. + according to my math, this should result in the following probability: + 0 skill - 25% chance to worsen + 20 skill - 23% chance to worsen + 50 skill - 16% chance to worsen */ if ((GetSkill(MEND) <= 75) && (MakeRandomInt(GetSkill(MEND),100) < 75) && (MakeRandomInt(1, 3) == 1)) { SetHP(currenthp > mendhp ? (GetHP() - mendhp) : 1); @@ -7957,10 +7957,10 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } for (uint32 i = 0; i < max_items; i++) { - if(database.GetItem(gis->Items[i])) { + if(database.GetItem(gis->Items[i])) { database.SaveTraderItem(this->CharacterID(),gis->Items[i],gis->SerialNumber[i], gis->Charges[i],ints->ItemCost[i],i); - } else { + } else { //return; //sony doesnt memset so assume done on first bad item break; } @@ -7991,7 +7991,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } else { _log(TRADING__CLIENT,"Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", - ints->Code); + ints->Code); LogFile->write(EQEMuLog::Error, "Unknown TraderStruct code of: %i\n", ints->Code); } @@ -8124,7 +8124,7 @@ void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) BindWound_Struct* bind_in = (BindWound_Struct*) app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - LogFile->write(EQEMuLog::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); + LogFile->write(EQEMuLog::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { LogFile->write(EQEMuLog::Debug, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); @@ -8176,7 +8176,7 @@ void Client::Handle_OP_TrackUnknown(const EQApplicationPacket *app) void Client::Handle_0x0193(const EQApplicationPacket *app) { - // Not sure what this opcode does. It started being sent when OP_ClientUpdate was + // Not sure what this opcode does. It started being sent when OP_ClientUpdate was // changed to pump OP_ClientUpdate back out instead of OP_MobUpdate // 2 bytes: 00 00 } @@ -8226,9 +8226,9 @@ void Client::Handle_OP_Split(const EQApplicationPacket *app) } if(!TakeMoneyFromPP(static_cast(split->copper) + - 10 * static_cast(split->silver) + - 100 * static_cast(split->gold) + - 1000 * static_cast(split->platinum))) { + 10 * static_cast(split->silver) + + 100 * static_cast(split->gold) + + 1000 * static_cast(split->platinum))) { Message(13, "You do not have enough money to do that split."); return; } @@ -8362,7 +8362,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) _pkt(TRIBUTE__IN, app); if(app->size != sizeof(StartTribute_Struct)) - printf("Error in OP_OpenTributeMaster. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size); + printf("Error in OP_OpenTributeMaster. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size); else { //Opens the tribute master window StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer; @@ -8387,7 +8387,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) _pkt(TRIBUTE__IN, app); if(app->size != sizeof(StartTribute_Struct)) - printf("Error in OP_OpenGuildTributeMaster. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size); + printf("Error in OP_OpenGuildTributeMaster. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size); else { //Opens the guild tribute master window StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer; @@ -8413,7 +8413,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) //player donates an item... if(app->size != sizeof(TributeItem_Struct)) - printf("Error in OP_TributeItem. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size); + printf("Error in OP_TributeItem. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size); else { TributeItem_Struct* t = (TributeItem_Struct*)app->pBuffer; @@ -8442,7 +8442,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) //player donates money if(app->size != sizeof(TributeMoney_Struct)) - printf("Error in OP_TributeMoney. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size); + printf("Error in OP_TributeMoney. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size); else { TributeMoney_Struct* t = (TributeMoney_Struct*)app->pBuffer; @@ -8532,7 +8532,7 @@ void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) if (boat == 0) return; // do nothing if the boat isn't valid - if(!boat->IsNPC() || (boat->GetRace() != CONTROLLED_BOAT && boat->GetRace() != 502)) + if(!boat->IsNPC() || (boat->GetRace() != CONTROLLED_BOAT && boat->GetRace() != 502)) { char *hacked_string = nullptr; MakeAnyLenString(&hacked_string, "OP_Control Boat was sent against %s which is of race %u", boat->GetName(), boat->GetRace()); @@ -8542,7 +8542,7 @@ void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) } if (cbs->TakeControl) { - // this uses the boat's target to indicate who has control of it. It has to check hate to make sure the boat isn't actually attacking anyone. + // this uses the boat's target to indicate who has control of it. It has to check hate to make sure the boat isn't actually attacking anyone. if ((boat->GetTarget() == 0) || (boat->GetTarget() == this && boat->GetHateAmount(this) == 0)) { boat->SetTarget(this); } @@ -8590,7 +8590,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app) { if(app->size != sizeof(FindPersonRequest_Struct)) - printf("Error in FindPersonRequest_Struct. Expected size of: %lu, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size); + printf("Error in FindPersonRequest_Struct. Expected size of: %lu, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size); else { FindPersonRequest_Struct* t = (FindPersonRequest_Struct*)app->pBuffer; @@ -8607,9 +8607,9 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app) } if(!RuleB(Pathing, Find) && RuleB(Bazaar, EnableWarpToTrader) && target->IsClient() && (target->CastToClient()->Trader || - target->CastToClient()->Buyer)) { + target->CastToClient()->Buyer)) { Message(15, "Moving you to Trader %s", target->GetName()); - MovePC(zone->GetZoneID(), zone->GetInstanceID(), target->GetX(), target->GetY(), target->GetZ() , 0.0f); + MovePC(zone->GetZoneID(), zone->GetInstanceID(), target->GetX(), target->GetY(), target->GetZ() , 0.0f); } else Message(13, "Found NPC '%s'\n", target->GetName()); @@ -8663,9 +8663,9 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app) } // Live appears to send the points in this order: - // Final destination. - // Current Position. - // rest of the points. + // Final destination. + // Current Position. + // rest of the points. FindPerson_Point p; int PointNumber = 0; @@ -9054,30 +9054,30 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) { UnmemSpell(z, false); } - database.LoadBuffs(this); - uint32 max_slots = GetMaxBuffSlots(); - for(int i = 0; i < max_slots; i++) { - if(buffs[i].spellid != SPELL_UNKNOWN) { - m_pp.buffs[i].spellid = buffs[i].spellid; - m_pp.buffs[i].bard_modifier = 10; - m_pp.buffs[i].slotid = 2; - m_pp.buffs[i].player_id = 0x2211; - m_pp.buffs[i].level = buffs[i].casterlevel; - m_pp.buffs[i].effect = 0; - m_pp.buffs[i].duration = buffs[i].ticsremaining; - m_pp.buffs[i].counters = buffs[i].counters; - } else { - m_pp.buffs[i].spellid = SPELLBOOK_UNKNOWN; - m_pp.buffs[i].bard_modifier = 10; - m_pp.buffs[i].slotid = 0; - m_pp.buffs[i].player_id = 0; - m_pp.buffs[i].level = 0; - m_pp.buffs[i].effect = 0; - m_pp.buffs[i].duration = 0; - m_pp.buffs[i].counters = 0; - } - } - } + database.LoadBuffs(this); + uint32 max_slots = GetMaxBuffSlots(); + for(int i = 0; i < max_slots; i++) { + if(buffs[i].spellid != SPELL_UNKNOWN) { + m_pp.buffs[i].spellid = buffs[i].spellid; + m_pp.buffs[i].bard_modifier = 10; + m_pp.buffs[i].slotid = 2; + m_pp.buffs[i].player_id = 0x2211; + m_pp.buffs[i].level = buffs[i].casterlevel; + m_pp.buffs[i].effect = 0; + m_pp.buffs[i].duration = buffs[i].ticsremaining; + m_pp.buffs[i].counters = buffs[i].counters; + } else { + m_pp.buffs[i].spellid = SPELLBOOK_UNKNOWN; + m_pp.buffs[i].bard_modifier = 10; + m_pp.buffs[i].slotid = 0; + m_pp.buffs[i].player_id = 0; + m_pp.buffs[i].level = 0; + m_pp.buffs[i].effect = 0; + m_pp.buffs[i].duration = 0; + m_pp.buffs[i].counters = 0; + } + } + } KeyRingLoad(); @@ -9442,7 +9442,7 @@ void Client::CompleteConnect() for (int x1=0; x1 < EFFECT_COUNT; x1++) { switch (spell.effectid[x1]) { - case SE_IllusionCopy: + case SE_IllusionCopy: case SE_Illusion: { if (spell.base[x1] == -1) { if (gender == 1) @@ -9523,17 +9523,17 @@ void Client::CompleteConnect() } case SE_Levitate: { - if( !zone->CanLevitate() ) - { - if(!GetGM()) - { - SendAppearancePacket(AT_Levitate, 0); - BuffFadeByEffect(SE_Levitate); - Message(13, "You can't levitate in this zone."); - } - }else{ - SendAppearancePacket(AT_Levitate, 2); - } + if( !zone->CanLevitate() ) + { + if(!GetGM()) + { + SendAppearancePacket(AT_Levitate, 0); + BuffFadeByEffect(SE_Levitate); + Message(13, "You can't levitate in this zone."); + } + }else{ + SendAppearancePacket(AT_Levitate, 2); + } break; } case SE_InvisVsUndead2: @@ -9548,7 +9548,7 @@ void Client::CompleteConnect() break; } case SE_AddMeleeProc: - case SE_WeaponProc: + case SE_WeaponProc: { AddProcToWeapon(GetProcID(buffs[j1].spellid, x1), false, 100+spells[buffs[j1].spellid].base2[x1]); break; @@ -9603,10 +9603,10 @@ void Client::CompleteConnect() if(GetGroup()) database.RefreshGroupFromDB(this); - if(RuleB(TaskSystem, EnableTaskSystem)) - TaskPeriodic_Timer.Start(); - else - TaskPeriodic_Timer.Disable(); + if(RuleB(TaskSystem, EnableTaskSystem)) + TaskPeriodic_Timer.Start(); + else + TaskPeriodic_Timer.Disable(); conn_state = ClientConnectFinished; @@ -9841,28 +9841,28 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) EQApplicationPacket *outapp=new EQApplicationPacket(OP_BankerChange,nullptr,sizeof(BankerChange_Struct)); BankerChange_Struct *bc=(BankerChange_Struct *)outapp->pBuffer; - if(m_pp.platinum < 0) - m_pp.platinum = 0; - if(m_pp.gold < 0) - m_pp.gold = 0; - if(m_pp.silver < 0) - m_pp.silver = 0; - if(m_pp.copper < 0) - m_pp.copper = 0; + if(m_pp.platinum < 0) + m_pp.platinum = 0; + if(m_pp.gold < 0) + m_pp.gold = 0; + if(m_pp.silver < 0) + m_pp.silver = 0; + if(m_pp.copper < 0) + m_pp.copper = 0; - if(m_pp.platinum_bank < 0) - m_pp.platinum_bank = 0; - if(m_pp.gold_bank < 0) - m_pp.gold_bank = 0; - if(m_pp.silver_bank < 0) - m_pp.silver_bank = 0; - if(m_pp.copper_bank < 0) - m_pp.copper_bank = 0; + if(m_pp.platinum_bank < 0) + m_pp.platinum_bank = 0; + if(m_pp.gold_bank < 0) + m_pp.gold_bank = 0; + if(m_pp.silver_bank < 0) + m_pp.silver_bank = 0; + if(m_pp.copper_bank < 0) + m_pp.copper_bank = 0; uint64 cp = static_cast(m_pp.copper) + - (static_cast(m_pp.silver) * 10) + - (static_cast(m_pp.gold) * 100) + - (static_cast(m_pp.platinum) * 1000); + (static_cast(m_pp.silver) * 10) + + (static_cast(m_pp.gold) * 100) + + (static_cast(m_pp.platinum) * 1000); m_pp.copper=cp%10; cp/=10; @@ -9873,9 +9873,9 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) m_pp.platinum=cp; cp = static_cast(m_pp.copper_bank) + - (static_cast(m_pp.silver_bank) * 10) + - (static_cast(m_pp.gold_bank) * 100) + - (static_cast(m_pp.platinum_bank) * 1000); + (static_cast(m_pp.silver_bank) * 10) + + (static_cast(m_pp.gold_bank) * 100) + + (static_cast(m_pp.platinum_bank) * 1000); m_pp.copper_bank=cp%10; cp/=10; @@ -10224,7 +10224,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) } } break; - } + } case RaidCommandDisband: { Raid *r = entity_list.GetRaidByClient(this); if(r){ @@ -10275,7 +10275,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) //} } break; - } + } case RaidCommandMoveGroup: { Raid *r = entity_list.GetRaidByClient(this); @@ -10490,7 +10490,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) default: { Message(13, "Raid command (%d) NYI", ri->action); break; - } + } } } @@ -10516,7 +10516,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { int SpellID = PendingTranslocateData.SpellID; if(parse->SpellHasQuestSub(SpellID, "EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE")) { - parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0); + parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0); } else { @@ -10524,8 +10524,9 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { // is bound in, use the GoToBind method. If we send OP_Translocate in this case, the client moves itself // to the bind coords it has from the PlayerProfile, but with the X and Y reversed. I suspect they are // reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before. - if(((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) && - zone->GetZoneID() == PendingTranslocateData.ZoneID) { + if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) && + zone->GetZoneID() == PendingTranslocateData.ZoneID) + { PendingTranslocate = false; GoToBind(); return; @@ -10571,7 +10572,7 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app) { if(app->size != sizeof(AcceptNewTask_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_AcceptNewTask expected %i got %i", - sizeof(AcceptNewTask_Struct), app->size); + sizeof(AcceptNewTask_Struct), app->size); DumpPacket(app); return; } @@ -10585,7 +10586,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) { if(app->size != sizeof(CancelTask_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_CancelTask expected %i got %i", - sizeof(CancelTask_Struct), app->size); + sizeof(CancelTask_Struct), app->size); DumpPacket(app); return; } @@ -10599,7 +10600,7 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app) { if(app->size != sizeof(TaskHistoryRequest_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", - sizeof(TaskHistoryRequest_Struct), app->size); + sizeof(TaskHistoryRequest_Struct), app->size); DumpPacket(app); return; } @@ -10615,7 +10616,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) { // if(app->size != sizeof(BandolierCreate_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_Bandolier expected %i got %i", - sizeof(BandolierCreate_Struct), app->size); + sizeof(BandolierCreate_Struct), app->size); DumpPacket(app); return; } @@ -10642,7 +10643,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { if(app->size != sizeof(PopupResponse_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_PopupResponse expected %i got %i", - sizeof(PopupResponse_Struct), app->size); + sizeof(PopupResponse_Struct), app->size); DumpPacket(app); return; } @@ -10669,7 +10670,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { Mob* Target = GetTarget(); if(Target && Target->IsNPC()) { - parse->EventNPC(EVENT_POPUPRESPONSE, Target->CastToNPC(), this, buf, 0); + parse->EventNPC(EVENT_POPUPRESPONSE, Target->CastToNPC(), this, buf, 0); } safe_delete_array(buf); @@ -10679,7 +10680,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) { if(app->size != sizeof(MovePotionToBelt_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_PotionBelt expected %i got %i", - sizeof(MovePotionToBelt_Struct), app->size); + sizeof(MovePotionToBelt_Struct), app->size); DumpPacket(app); return; } @@ -10784,7 +10785,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { worldserver.UpdateLFP(CharacterID(), lfp->Action, lfp->MatchFilter, lfp->FromLevel, lfp->ToLevel, lfp->Classes, - lfp->Comments, LFPMembers); + lfp->Comments, LFPMembers); } @@ -10979,7 +10980,7 @@ void Client::Handle_OP_VoiceMacroIn(const EQApplicationPacket *app) { if(app->size != sizeof(VoiceMacroIn_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_VoiceMacroIn expected %i got %i", - sizeof(VoiceMacroIn_Struct), app->size); + sizeof(VoiceMacroIn_Struct), app->size); DumpPacket(app); @@ -10999,7 +11000,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if(app->size != sizeof(DoGroupLeadershipAbility_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", - sizeof(DoGroupLeadershipAbility_Struct), app->size); + sizeof(DoGroupLeadershipAbility_Struct), app->size); DumpPacket(app); @@ -11048,7 +11049,7 @@ void Client::Handle_OP_ClearNPCMarks(const EQApplicationPacket *app) { if(app->size != 0) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", - app->size); + app->size); DumpPacket(app); @@ -11066,7 +11067,7 @@ void Client::Handle_OP_DelegateAbility(const EQApplicationPacket *app) { if(app->size != sizeof(DelegateAbility_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_DelegateAbility expected %i got %i", - sizeof(DelegateAbility_Struct), app->size); + sizeof(DelegateAbility_Struct), app->size); DumpPacket(app); @@ -11123,15 +11124,14 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if(!IsPoison) { mlog(SPELLS__CASTING_ERR, "Item used to cast spell effect from a poison item was missing from inventory slot %d " - "after casting, or is not a poison!", ApplyPoisonData->inventorySlot); + "after casting, or is not a poison!", ApplyPoisonData->inventorySlot); Message(0, "Error: item not found for inventory slot #%i or is not a poison", ApplyPoisonData->inventorySlot); } else if(GetClass() == ROGUE) { - if((PrimaryWeapon && PrimaryWeapon->GetItem()->ItemType == ItemTypePierce) || - (SecondaryWeapon && SecondaryWeapon->GetItem()->ItemType == ItemTypePierce)) - { + if ((PrimaryWeapon && PrimaryWeapon->GetItem()->ItemType == ItemTypePierce) || + (SecondaryWeapon && SecondaryWeapon->GetItem()->ItemType == ItemTypePierce)) { float SuccessChance = (GetSkill(APPLY_POISON) + GetLevel()) / 400.0f; double ChanceRoll = MakeRandomFloat(0, 1); @@ -11170,7 +11170,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) { if(app->size != sizeof(AugmentInfo_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_AugmentInfo expected %i got %i", - sizeof(AugmentInfo_Struct), app->size); + sizeof(AugmentInfo_Struct), app->size); DumpPacket(app); @@ -11215,7 +11215,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) if(app->size != sizeof(PVPLeaderBoardRequest_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", - sizeof(PVPLeaderBoardRequest_Struct), app->size); + sizeof(PVPLeaderBoardRequest_Struct), app->size); DumpPacket(app); @@ -11240,7 +11240,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a if(app->size != sizeof(PVPLeaderBoardDetailsRequest_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", - sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); + sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); DumpPacket(app); @@ -11270,7 +11270,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) Mob* vendor = entity_list.GetMob(ams_in->npcid); if (vendor == 0 || !vendor->IsNPC() || ((vendor->GetClass() != ADVENTUREMERCHANT) && - (vendor->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (vendor->GetClass() != DARK_REIGN_MERCHANT))) + (vendor->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (vendor->GetClass() != DARK_REIGN_MERCHANT))) { Message(13, "Vendor was not found."); return; @@ -11720,8 +11720,8 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) database.DoEscapeString(EscSearchString, gmscs->Name, strlen(gmscs->Name)); if (database.RunQuery(Query, MakeAnyLenString(&Query, "select charname, zoneid, x, y, z, timeofdeath, rezzed, IsBurried from " - "player_corpses where charname like '%%%s%%' order by charname limit %i", - EscSearchString, MaxResults), errbuf, &Result)) + "player_corpses where charname like '%%%s%%' order by charname limit %i", + EscSearchString, MaxResults), errbuf, &Result)) { int NumberOfRows = mysql_num_rows(Result); @@ -11743,8 +11743,8 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) char CharName[64], TimeOfDeath[20], Buffer[512]; string PopupText = ""; + "Rezzed"; while ((Row = mysql_fetch_row(Result))) @@ -12091,7 +12091,7 @@ void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) switch(grs->RoleNumber) { - case 1: //Main Tank + case 1: //Main Tank { if(grs->Toggle) g->DelegateMainTank(grs->Name1, grs->Toggle); @@ -12099,7 +12099,7 @@ void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) g->UnDelegateMainTank(grs->Name1, grs->Toggle); break; } - case 2: //Main Assist + case 2: //Main Assist { if(grs->Toggle) g->DelegateMainAssist(grs->Name1, grs->Toggle); @@ -12107,7 +12107,7 @@ void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) g->UnDelegateMainAssist(grs->Name1, grs->Toggle); break; } - case 3: //Puller + case 3: //Puller { if(grs->Toggle) g->DelegatePuller(grs->Name1, grs->Toggle); @@ -12127,7 +12127,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) if(app->size != sizeof(HideCorpse_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_HideCorpse expected %i got %i", - sizeof(HideCorpse_Struct), app->size); + sizeof(HideCorpse_Struct), app->size); DumpPacket(app); @@ -12139,7 +12139,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) if(hcs->Action == HideCorpseLooted) return; - if((HideCorpseMode == HideCorpseNone) && (hcs->Action == HideCorpseNone)) + if((HideCorpseMode == HideCorpseNone) && (hcs->Action == HideCorpseNone)) return; entity_list.HideCorpses(this, HideCorpseMode, hcs->Action); @@ -12152,7 +12152,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) if(app->size != sizeof(GuildUpdateURLAndChannel_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", - sizeof(GuildUpdateURLAndChannel_Struct), app->size); + sizeof(GuildUpdateURLAndChannel_Struct), app->size); DumpPacket(app); @@ -12182,7 +12182,7 @@ void Client::Handle_OP_GuildStatus(const EQApplicationPacket *app) if(app->size != sizeof(GuildStatus_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_GuildStatus expected %i got %i", - sizeof(GuildStatus_Struct), app->size); + sizeof(GuildStatus_Struct), app->size); DumpPacket(app); @@ -12242,7 +12242,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if(app->size != sizeof(BlockedBuffs_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_BlockedBuffs expected %i got %i", - sizeof(BlockedBuffs_Struct), app->size); + sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -12339,7 +12339,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) if(app->size != sizeof(BlockedBuffs_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", - sizeof(BlockedBuffs_Struct), app->size); + sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -12536,9 +12536,9 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) return; } - if((Admin() < RuleI(Guild, PlayerCreationRequiredStatus)) || - (GetLevel() < RuleI(Guild, PlayerCreationRequiredLevel)) || - (database.GetTotalTimeEntitledOnAccount(AccountID()) < (unsigned int)RuleI(Guild, PlayerCreationRequiredTime))) + if ((Admin() < RuleI(Guild, PlayerCreationRequiredStatus)) || + (GetLevel() < RuleI(Guild, PlayerCreationRequiredLevel)) || + (database.GetTotalTimeEntitledOnAccount(AccountID()) < (unsigned int)RuleI(Guild, PlayerCreationRequiredTime))) { Message(clientMessageError, "Your status, level or time playing on this account are insufficient to use this feature."); return; @@ -12604,387 +12604,387 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) } void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app) { - VERIFY_PACKET_LENGTH(OP_AltCurrencyMerchantRequest, app, uint32); + VERIFY_PACKET_LENGTH(OP_AltCurrencyMerchantRequest, app, uint32); - NPC* tar = entity_list.GetNPCByID(*((uint32*)app->pBuffer)); - if(tar) { - if(DistNoRoot(*tar) > USE_NPC_RANGE2) - return; + NPC* tar = entity_list.GetNPCByID(*((uint32*)app->pBuffer)); + if(tar) { + if(DistNoRoot(*tar) > USE_NPC_RANGE2) + return; - if(tar->GetClass() != ALT_CURRENCY_MERCHANT) { - return; - } + if(tar->GetClass() != ALT_CURRENCY_MERCHANT) { + return; + } - uint32 alt_cur_id = tar->GetAltCurrencyType(); - if(alt_cur_id == 0) { - return; - } + uint32 alt_cur_id = tar->GetAltCurrencyType(); + if(alt_cur_id == 0) { + return; + } - list::iterator altc_iter = zone->AlternateCurrencies.begin(); - bool found = false; - while(altc_iter != zone->AlternateCurrencies.end()) { - if((*altc_iter).id == alt_cur_id) { - found = true; - break; - } - altc_iter++; - } + list::iterator altc_iter = zone->AlternateCurrencies.begin(); + bool found = false; + while(altc_iter != zone->AlternateCurrencies.end()) { + if((*altc_iter).id == alt_cur_id) { + found = true; + break; + } + altc_iter++; + } - if(!found) { - return; - } + if(!found) { + return; + } - std::stringstream ss(std::stringstream::in | std::stringstream::out); - std::stringstream item_ss(std::stringstream::in | std::stringstream::out); - ss << alt_cur_id << "|1|" << alt_cur_id; - uint32 count = 0; - uint32 merchant_id = tar->MerchantType; - const Item_Struct *item = nullptr; + std::stringstream ss(std::stringstream::in | std::stringstream::out); + std::stringstream item_ss(std::stringstream::in | std::stringstream::out); + ss << alt_cur_id << "|1|" << alt_cur_id; + uint32 count = 0; + uint32 merchant_id = tar->MerchantType; + const Item_Struct *item = nullptr; - std::list merlist = zone->merchanttable[merchant_id]; - std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end() && count < 255; itr++){ - const MerchantList &ml = *itr; - if(GetLevel() < ml.level_required) { - continue; - } + std::list merlist = zone->merchanttable[merchant_id]; + std::list::const_iterator itr; + for(itr = merlist.begin(); itr != merlist.end() && count < 255; itr++){ + const MerchantList &ml = *itr; + if(GetLevel() < ml.level_required) { + continue; + } - int32 fac = tar->GetPrimaryFaction(); - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } + int32 fac = tar->GetPrimaryFaction(); + if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { + continue; + } - item = database.GetItem(ml.item); - if(item) - { - item_ss << "^" << item->Name << "|"; - item_ss << item->ID << "|"; - item_ss << ml.alt_currency_cost << "|"; - item_ss << "0|"; - item_ss << "1|"; - item_ss << item->Races << "|"; - item_ss << item->Classes; - count++; - } - } + item = database.GetItem(ml.item); + if(item) + { + item_ss << "^" << item->Name << "|"; + item_ss << item->ID << "|"; + item_ss << ml.alt_currency_cost << "|"; + item_ss << "0|"; + item_ss << "1|"; + item_ss << item->Races << "|"; + item_ss << item->Classes; + count++; + } + } - if(count > 0) { - ss << "|" << count << item_ss.str(); - } else { - ss << "|0"; - } + if(count > 0) { + ss << "|" << count << item_ss.str(); + } else { + ss << "|0"; + } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrencyMerchantReply, ss.str().length() + 1); - memcpy(outapp->pBuffer, ss.str().c_str(), ss.str().length()); - FastQueuePacket(&outapp); - } + EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrencyMerchantReply, ss.str().length() + 1); + memcpy(outapp->pBuffer, ss.str().c_str(), ss.str().length()); + FastQueuePacket(&outapp); + } } void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) { - VERIFY_PACKET_LENGTH(OP_AltCurrencySellSelection, app, AltCurrencySelectItem_Struct); + VERIFY_PACKET_LENGTH(OP_AltCurrencySellSelection, app, AltCurrencySelectItem_Struct); - AltCurrencySelectItem_Struct *select = (AltCurrencySelectItem_Struct*)app->pBuffer; - NPC* tar = entity_list.GetNPCByID(select->merchant_entity_id); - if(tar) { - if(DistNoRoot(*tar) > USE_NPC_RANGE2) - return; + AltCurrencySelectItem_Struct *select = (AltCurrencySelectItem_Struct*)app->pBuffer; + NPC* tar = entity_list.GetNPCByID(select->merchant_entity_id); + if(tar) { + if(DistNoRoot(*tar) > USE_NPC_RANGE2) + return; - if(tar->GetClass() != ALT_CURRENCY_MERCHANT) { - return; - } + if(tar->GetClass() != ALT_CURRENCY_MERCHANT) { + return; + } - uint32 alt_cur_id = tar->GetAltCurrencyType(); - if(alt_cur_id == 0) { - return; - } + uint32 alt_cur_id = tar->GetAltCurrencyType(); + if(alt_cur_id == 0) { + return; + } - ItemInst *inst = m_inv.GetItem(select->slot_id); - if(!inst) { - return; - } + ItemInst *inst = m_inv.GetItem(select->slot_id); + if(!inst) { + return; + } - const Item_Struct* item = nullptr; - uint32 cost = 0; - uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); - uint32 merchant_id = tar->MerchantType; - bool found = false; - std::list merlist = zone->merchanttable[merchant_id]; - std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end(); itr++) { - MerchantList ml = *itr; - if(GetLevel() < ml.level_required) { - continue; - } + const Item_Struct* item = nullptr; + uint32 cost = 0; + uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); + uint32 merchant_id = tar->MerchantType; + bool found = false; + std::list merlist = zone->merchanttable[merchant_id]; + std::list::const_iterator itr; + for(itr = merlist.begin(); itr != merlist.end(); itr++) { + MerchantList ml = *itr; + if(GetLevel() < ml.level_required) { + continue; + } - int32 fac = tar->GetPrimaryFaction(); - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } + int32 fac = tar->GetPrimaryFaction(); + if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { + continue; + } - item = database.GetItem(ml.item); - if(!item) - continue; + item = database.GetItem(ml.item); + if(!item) + continue; - if(item->ID == inst->GetItem()->ID) { - cost = ml.alt_currency_cost; - found = true; - break; - } - } + if(item->ID == inst->GetItem()->ID) { + cost = ml.alt_currency_cost; + found = true; + break; + } + } - if(!found) { - cost = 0; - } + if(!found) { + cost = 0; + } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrencySellSelection, sizeof(AltCurrencySelectItemReply_Struct)); - AltCurrencySelectItemReply_Struct *reply = (AltCurrencySelectItemReply_Struct*)outapp->pBuffer; - reply->unknown004 = 0xFF; - reply->unknown005 = 0xFF; - reply->unknown006 = 0xFF; - reply->unknown007 = 0xFF; - strcpy(reply->item_name, inst->GetItem()->Name); - reply->cost = cost; - FastQueuePacket(&outapp); - } + EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrencySellSelection, sizeof(AltCurrencySelectItemReply_Struct)); + AltCurrencySelectItemReply_Struct *reply = (AltCurrencySelectItemReply_Struct*)outapp->pBuffer; + reply->unknown004 = 0xFF; + reply->unknown005 = 0xFF; + reply->unknown006 = 0xFF; + reply->unknown007 = 0xFF; + strcpy(reply->item_name, inst->GetItem()->Name); + reply->cost = cost; + FastQueuePacket(&outapp); + } } void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) { - VERIFY_PACKET_LENGTH(OP_AltCurrencyPurchase, app, AltCurrencyPurchaseItem_Struct); - AltCurrencyPurchaseItem_Struct *purchase = (AltCurrencyPurchaseItem_Struct*)app->pBuffer; - NPC* tar = entity_list.GetNPCByID(purchase->merchant_entity_id); - if(tar) { - if(DistNoRoot(*tar) > USE_NPC_RANGE2) - return; + VERIFY_PACKET_LENGTH(OP_AltCurrencyPurchase, app, AltCurrencyPurchaseItem_Struct); + AltCurrencyPurchaseItem_Struct *purchase = (AltCurrencyPurchaseItem_Struct*)app->pBuffer; + NPC* tar = entity_list.GetNPCByID(purchase->merchant_entity_id); + if(tar) { + if(DistNoRoot(*tar) > USE_NPC_RANGE2) + return; - if(tar->GetClass() != ALT_CURRENCY_MERCHANT) { - return; - } + if(tar->GetClass() != ALT_CURRENCY_MERCHANT) { + return; + } - uint32 alt_cur_id = tar->GetAltCurrencyType(); - if(alt_cur_id == 0) { - return; - } + uint32 alt_cur_id = tar->GetAltCurrencyType(); + if(alt_cur_id == 0) { + return; + } - const Item_Struct* item = nullptr; - uint32 cost = 0; - uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); - uint32 merchant_id = tar->MerchantType; - bool found = false; - std::list merlist = zone->merchanttable[merchant_id]; - std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end(); itr++) { - MerchantList ml = *itr; - if(GetLevel() < ml.level_required) { - continue; - } + const Item_Struct* item = nullptr; + uint32 cost = 0; + uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); + uint32 merchant_id = tar->MerchantType; + bool found = false; + std::list merlist = zone->merchanttable[merchant_id]; + std::list::const_iterator itr; + for(itr = merlist.begin(); itr != merlist.end(); itr++) { + MerchantList ml = *itr; + if(GetLevel() < ml.level_required) { + continue; + } - int32 fac = tar->GetPrimaryFaction(); - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } + int32 fac = tar->GetPrimaryFaction(); + if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { + continue; + } - item = database.GetItem(ml.item); - if(!item) - continue; + item = database.GetItem(ml.item); + if(!item) + continue; - if(item->ID == purchase->item_id) { //This check to make sure that the item is actually on the NPC, people attempt to inject packets to get items summoned... - cost = ml.alt_currency_cost; - found = true; - break; - } - } + if(item->ID == purchase->item_id) { //This check to make sure that the item is actually on the NPC, people attempt to inject packets to get items summoned... + cost = ml.alt_currency_cost; + found = true; + break; + } + } - if (!item || !found) { - Message(13, "Error: The item you purchased does not exist!"); - return; - } + if (!item || !found) { + Message(13, "Error: The item you purchased does not exist!"); + return; + } - if(cost > current_currency) { - Message(13, "You cannot afford that item right now."); - return; - } + if(cost > current_currency) { + Message(13, "You cannot afford that item right now."); + return; + } - if(CheckLoreConflict(item)) - { - Message(15,"You can only have one of a lore item."); - return; - } + if(CheckLoreConflict(item)) + { + Message(15,"You can only have one of a lore item."); + return; + } - AddAlternateCurrencyValue(alt_cur_id, -((int32)cost)); - int16 charges = 1; - if(item->MaxCharges != 0) - charges = item->MaxCharges; + AddAlternateCurrencyValue(alt_cur_id, -((int32)cost)); + int16 charges = 1; + if(item->MaxCharges != 0) + charges = item->MaxCharges; - ItemInst *inst = database.CreateItem(item, charges); - if(!AutoPutLootInInventory(*inst, true, true)) - { - PutLootInInventory(SLOT_CURSOR, *inst); - } + ItemInst *inst = database.CreateItem(item, charges); + if(!AutoPutLootInInventory(*inst, true, true)) + { + PutLootInInventory(SLOT_CURSOR, *inst); + } - Save(1); - } + Save(1); + } } void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app) { - VERIFY_PACKET_LENGTH(OP_AltCurrencyReclaim, app, AltCurrencyReclaim_Struct); - AltCurrencyReclaim_Struct *reclaim = (AltCurrencyReclaim_Struct*)app->pBuffer; - uint32 item_id = 0; - list::iterator iter = zone->AlternateCurrencies.begin(); - while(iter != zone->AlternateCurrencies.end()) { - if((*iter).id == reclaim->currency_id) { - item_id = (*iter).item_id; - } - iter++; - } + VERIFY_PACKET_LENGTH(OP_AltCurrencyReclaim, app, AltCurrencyReclaim_Struct); + AltCurrencyReclaim_Struct *reclaim = (AltCurrencyReclaim_Struct*)app->pBuffer; + uint32 item_id = 0; + list::iterator iter = zone->AlternateCurrencies.begin(); + while(iter != zone->AlternateCurrencies.end()) { + if((*iter).id == reclaim->currency_id) { + item_id = (*iter).item_id; + } + iter++; + } - if(item_id == 0) { - return; - } + if(item_id == 0) { + return; + } - if(reclaim->reclaim_flag == 1) { //item -> altcur - uint32 removed = NukeItem(item_id, invWhereWorn | invWherePersonal | invWhereCursor); - if(removed > 0) { - AddAlternateCurrencyValue(reclaim->currency_id, removed); - } - } else { - uint32 max_currency = GetAlternateCurrencyValue(reclaim->currency_id); - if(reclaim->count > max_currency) { - SummonItem(item_id, max_currency); - SetAlternateCurrencyValue(reclaim->currency_id, 0); - } else { - SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, false, SLOT_CURSOR); - AddAlternateCurrencyValue(reclaim->currency_id, -((int32)reclaim->count)); - } - } + if(reclaim->reclaim_flag == 1) { //item -> altcur + uint32 removed = NukeItem(item_id, invWhereWorn | invWherePersonal | invWhereCursor); + if(removed > 0) { + AddAlternateCurrencyValue(reclaim->currency_id, removed); + } + } else { + uint32 max_currency = GetAlternateCurrencyValue(reclaim->currency_id); + if(reclaim->count > max_currency) { + SummonItem(item_id, max_currency); + SetAlternateCurrencyValue(reclaim->currency_id, 0); + } else { + SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, false, SLOT_CURSOR); + AddAlternateCurrencyValue(reclaim->currency_id, -((int32)reclaim->count)); + } + } } void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) { - VERIFY_PACKET_LENGTH(OP_AltCurrencySell, app, AltCurrencySellItem_Struct); - EQApplicationPacket *outapp = app->Copy(); - AltCurrencySellItem_Struct *sell = (AltCurrencySellItem_Struct*)outapp->pBuffer; + VERIFY_PACKET_LENGTH(OP_AltCurrencySell, app, AltCurrencySellItem_Struct); + EQApplicationPacket *outapp = app->Copy(); + AltCurrencySellItem_Struct *sell = (AltCurrencySellItem_Struct*)outapp->pBuffer; - NPC* tar = entity_list.GetNPCByID(sell->merchant_entity_id); - if(tar) { - if(DistNoRoot(*tar) > USE_NPC_RANGE2) - return; + NPC* tar = entity_list.GetNPCByID(sell->merchant_entity_id); + if(tar) { + if(DistNoRoot(*tar) > USE_NPC_RANGE2) + return; - if(tar->GetClass() != ALT_CURRENCY_MERCHANT) { - return; - } + if(tar->GetClass() != ALT_CURRENCY_MERCHANT) { + return; + } - uint32 alt_cur_id = tar->GetAltCurrencyType(); - if(alt_cur_id == 0) { - return; - } + uint32 alt_cur_id = tar->GetAltCurrencyType(); + if(alt_cur_id == 0) { + return; + } - ItemInst* inst = GetInv().GetItem(sell->slot_id); - if(!inst) { - return; - } + ItemInst* inst = GetInv().GetItem(sell->slot_id); + if(!inst) { + return; + } - const Item_Struct* item = nullptr; - uint32 cost = 0; - uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); - uint32 merchant_id = tar->MerchantType; - bool found = false; - std::list merlist = zone->merchanttable[merchant_id]; - std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end(); itr++) { - MerchantList ml = *itr; - if(GetLevel() < ml.level_required) { - continue; - } + const Item_Struct* item = nullptr; + uint32 cost = 0; + uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); + uint32 merchant_id = tar->MerchantType; + bool found = false; + std::list merlist = zone->merchanttable[merchant_id]; + std::list::const_iterator itr; + for(itr = merlist.begin(); itr != merlist.end(); itr++) { + MerchantList ml = *itr; + if(GetLevel() < ml.level_required) { + continue; + } - int32 fac = tar->GetPrimaryFaction(); - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } + int32 fac = tar->GetPrimaryFaction(); + if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { + continue; + } - item = database.GetItem(ml.item); - if(!item) - continue; + item = database.GetItem(ml.item); + if(!item) + continue; - if(item->ID == inst->GetItem()->ID) { - cost = ml.alt_currency_cost; - found = true; - break; - } - } + if(item->ID == inst->GetItem()->ID) { + cost = ml.alt_currency_cost; + found = true; + break; + } + } - if(!found) { - return; - } + if(!found) { + return; + } - if(!inst->IsStackable()) - { - DeleteItemInInventory(sell->slot_id, 0, false); - } - else - { - if(inst->GetCharges() < sell->charges) - { - sell->charges = inst->GetCharges(); - } + if(!inst->IsStackable()) + { + DeleteItemInInventory(sell->slot_id, 0, false); + } + else + { + if(inst->GetCharges() < sell->charges) + { + sell->charges = inst->GetCharges(); + } - if(sell->charges == 0) - { - Message(13, "Charge mismatch error."); - return; - } + if(sell->charges == 0) + { + Message(13, "Charge mismatch error."); + return; + } - DeleteItemInInventory(sell->slot_id, sell->charges, false); - cost *= sell->charges; - } + DeleteItemInInventory(sell->slot_id, sell->charges, false); + cost *= sell->charges; + } - sell->cost = cost; + sell->cost = cost; - FastQueuePacket(&outapp); - AddAlternateCurrencyValue(alt_cur_id, cost); - Save(1); - } + FastQueuePacket(&outapp); + AddAlternateCurrencyValue(alt_cur_id, cost); + Save(1); + } } void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) { - uint32 ebon = NukeItem(RuleI(Zone, EbonCrystalItemID), invWhereWorn | invWherePersonal | invWhereCursor); - uint32 radiant = NukeItem(RuleI(Zone, RadiantCrystalItemID), invWhereWorn | invWherePersonal | invWhereCursor); - if((ebon + radiant) > 0) { - AddCrystals(radiant, ebon); - } + uint32 ebon = NukeItem(RuleI(Zone, EbonCrystalItemID), invWhereWorn | invWherePersonal | invWhereCursor); + uint32 radiant = NukeItem(RuleI(Zone, RadiantCrystalItemID), invWhereWorn | invWherePersonal | invWhereCursor); + if((ebon + radiant) > 0) { + AddCrystals(radiant, ebon); + } } void Client::Handle_OP_CrystalCreate(const EQApplicationPacket *app) { - VERIFY_PACKET_LENGTH(OP_CrystalCreate, app, CrystalReclaim_Struct); - CrystalReclaim_Struct *cr = (CrystalReclaim_Struct*)app->pBuffer; + VERIFY_PACKET_LENGTH(OP_CrystalCreate, app, CrystalReclaim_Struct); + CrystalReclaim_Struct *cr = (CrystalReclaim_Struct*)app->pBuffer; - if(cr->type == 5) { - if(cr->amount > GetEbonCrystals()) { - SummonItem(RuleI(Zone, EbonCrystalItemID), GetEbonCrystals()); - m_pp.currentEbonCrystals = 0; - m_pp.careerEbonCrystals = 0; - Save(); - SendCrystalCounts(); - } else { - SummonItem(RuleI(Zone, EbonCrystalItemID), cr->amount); - m_pp.currentEbonCrystals -= cr->amount; - m_pp.careerEbonCrystals -= cr->amount; - Save(); - SendCrystalCounts(); - } - } else if(cr->type == 4) { - if(cr->amount > GetRadiantCrystals()) { - SummonItem(RuleI(Zone, RadiantCrystalItemID), GetRadiantCrystals()); - m_pp.currentRadCrystals = 0; - m_pp.careerRadCrystals = 0; - Save(); - SendCrystalCounts(); - } else { - SummonItem(RuleI(Zone, RadiantCrystalItemID), cr->amount); - m_pp.currentRadCrystals -= cr->amount; - m_pp.careerRadCrystals -= cr->amount; - Save(); - SendCrystalCounts(); - } - } + if(cr->type == 5) { + if(cr->amount > GetEbonCrystals()) { + SummonItem(RuleI(Zone, EbonCrystalItemID), GetEbonCrystals()); + m_pp.currentEbonCrystals = 0; + m_pp.careerEbonCrystals = 0; + Save(); + SendCrystalCounts(); + } else { + SummonItem(RuleI(Zone, EbonCrystalItemID), cr->amount); + m_pp.currentEbonCrystals -= cr->amount; + m_pp.careerEbonCrystals -= cr->amount; + Save(); + SendCrystalCounts(); + } + } else if(cr->type == 4) { + if(cr->amount > GetRadiantCrystals()) { + SummonItem(RuleI(Zone, RadiantCrystalItemID), GetRadiantCrystals()); + m_pp.currentRadCrystals = 0; + m_pp.careerRadCrystals = 0; + Save(); + SendCrystalCounts(); + } else { + SummonItem(RuleI(Zone, RadiantCrystalItemID), cr->amount); + m_pp.currentRadCrystals -= cr->amount; + m_pp.careerRadCrystals -= cr->amount; + Save(); + SendCrystalCounts(); + } + } } void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) @@ -12998,7 +12998,7 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) { case 0: { - VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_PlayerToggle_Struct); + VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_PlayerToggle_Struct); LFGuild_PlayerToggle_Struct *pts = (LFGuild_PlayerToggle_Struct *)app->pBuffer; if(strnlen(pts->Comment, 256) > 256) @@ -13025,7 +13025,7 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) } case 1: { - VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_GuildToggle_Struct); + VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_GuildToggle_Struct); LFGuild_GuildToggle_Struct *gts = (LFGuild_GuildToggle_Struct *)app->pBuffer; if(strnlen(gts->Comment, 256) > 256) @@ -13054,7 +13054,7 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) } case 3: { - VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_SearchPlayer_Struct); + VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_SearchPlayer_Struct); ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + 37); @@ -13078,7 +13078,7 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) } case 4: { - VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_SearchGuild_Struct); + VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_SearchGuild_Struct); ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + 33); @@ -13109,7 +13109,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) { if(app->size < 12) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); + LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); DumpPacket(app); return; } @@ -13342,7 +13342,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app) { if(app->size != 1) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); + LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); DumpPacket(app); return; } @@ -13684,12 +13684,12 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) Mob* merchant = entity_list.GetNPCByID(merchant_id); if(!CheckCanHireMerc(merchant, merc_template_id)) { - return; + return; } if(RuleB(Mercs, ChargeMercPurchaseCost)) { - uint32 cost = Merc::CalcPurchaseCost(merc_template->MercTemplateID, GetLevel()) * 100; // Cost is in gold - TakeMoneyFromPP(cost, true); + uint32 cost = Merc::CalcPurchaseCost(merc_template->MercTemplateID, GetLevel()) * 100; // Cost is in gold + TakeMoneyFromPP(cost, true); } // Set time remaining to max on Hire @@ -13885,8 +13885,8 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) } } - if(entityID > 0) { - SendMercTimerPacket(entityID, mercState, suspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + if(entityID > 0) { + SendMercTimerPacket(entityID, mercState, suspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); } } @@ -13905,8 +13905,8 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) { // RoF::struct.SlotType = {0 - Equipment, 1 - Bank, 2 - Shared Bank} // not tested beyond listed types // RoF::struct.Unknown2 = 0 // RoF::struct.MainSlot = { } - // RoF::struct.SubSlot = -1 (non-child) - // RoF::struct.AugSlot = -1 (non-child) + // RoF::struct.SubSlot = -1 (non-child) + // RoF::struct.AugSlot = -1 (non-child) // RoF::struct.Unknown1 = 141 (unsure why, but always appears to be this value..combine containers not tested) // SideNote: Watching the slot translations, Unknown1 is showing '141' as well on certain item swaps. diff --git a/zone/client_packet.h b/zone/client_packet.h index 63145391b..22e8f92f4 100644 --- a/zone/client_packet.h +++ b/zone/client_packet.h @@ -223,8 +223,8 @@ void Handle_OP_AutoFire(const EQApplicationPacket *app); void Handle_OP_Rewind(const EQApplicationPacket *app); void Handle_OP_RaidCommand(const EQApplicationPacket *app); - void Handle_OP_Translocate(const EQApplicationPacket *app); - void Handle_OP_Sacrifice(const EQApplicationPacket *app); + void Handle_OP_Translocate(const EQApplicationPacket *app); + void Handle_OP_Sacrifice(const EQApplicationPacket *app); void Handle_OP_AcceptNewTask(const EQApplicationPacket *app); void Handle_OP_CancelTask(const EQApplicationPacket *app); void Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 1e49c2f30..63d2db72a 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.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 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA client_process.cpp: Handles client login sequence and packets sent from client to zone @@ -36,7 +36,7 @@ #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #else #include #include @@ -83,7 +83,7 @@ bool Client::Process() { if(Connected() || IsLD()) { - // try to send all packets that weren't sent before + // try to send all packets that weren't sent before if(!IsLD() && zoneinpacket_timer.Check()){ SendAllPackets(); } @@ -258,7 +258,7 @@ bool Client::Process() { AI_Process(); if (bindwound_timer.Check() && bindwound_target != 0) { - BindWound(bindwound_target, false); + BindWound(bindwound_target, false); } if(KarmaUpdateTimer) @@ -409,7 +409,7 @@ bool Client::Process() { { entity_list.AEAttack(this, 30); } else { - Attack(auto_attack_target, 13); // Kaiyodo - added attacking hand to arguments + Attack(auto_attack_target, 13); // Kaiyodo - added attacking hand to arguments } ItemInst *wpn = GetInv().GetItem(SLOT_PRIMARY); TryWeaponProc(wpn, auto_attack_target, 13); @@ -430,7 +430,7 @@ bool Client::Process() { //triple attack: rangers, monks, warriors, berserkers over level 60 if((((GetClass() == MONK || GetClass() == WARRIOR || GetClass() == RANGER || GetClass() == BERSERKER) && GetLevel() >= 60) || SpecAttacks[SPECATK_TRIPLE]) - && CheckDoubleAttack(true)) + && CheckDoubleAttack(true)) { tripleAttackSuccess = true; Attack(auto_attack_target, 13, false); @@ -793,7 +793,7 @@ void Client::OnDisconnect(bool hard_disconnect) { MyRaid->MemberZoned(this); if(this->IsClient()){ - if(parse->PlayerHasQuestSub("EVENT_DISCONNECT")) { + if(parse->PlayerHasQuestSub("EVENT_DISCONNECT")) { parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); } } @@ -968,7 +968,7 @@ void Client::BulkSendInventoryItems() // LINKDEAD TRADE ITEMS // If player went LD during a trade, they have items in the trade inventory - // slots. These items are now being put into their inventory (then queue up on cursor) + // slots. These items are now being put into their inventory (then queue up on cursor) for (int16 trade_slot_id=3000; trade_slot_id<=3007; trade_slot_id++) { const ItemInst* inst = m_inv[slot_id]; if (inst) { @@ -982,7 +982,7 @@ void Client::BulkSendInventoryItems() void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { const Item_Struct* handyitem = nullptr; - uint32 numItemSlots=80; //The max number of items passed in the transaction. + uint32 numItemSlots=80; //The max number of items passed in the transaction. const Item_Struct *item; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; @@ -1000,14 +1000,14 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { uint8 handychance = 0; for(itr = merlist.begin();itr != merlist.end() && iGetPrimaryFaction() : 0; - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } + int32 fac = merch ? merch->GetPrimaryFaction() : 0; + if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { + continue; + } handychance = MakeRandomInt(0, merlist.size() + tmp_merlist.size() - 1 ); @@ -1099,16 +1099,16 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { break; default: greet_id=MERCHANT_HANDY_ITEM4; - } + } sprintf(handy_id,"%i",greet_id); if(greet_id!=MERCHANT_GREETING) Message_StringID(10,GENERIC_STRINGID_SAY,merch->GetCleanName(),handy_id,this->GetName(),handyitem->Name); - else + else Message_StringID(10,GENERIC_STRINGID_SAY,merch->GetCleanName(),handy_id,this->GetName()); merch->CastToNPC()->FaceTarget(this->CastToMob()); - } + } // safe_delete_array(cpi); } @@ -1153,8 +1153,8 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I // corpse is in has shutdown since the rez spell was cast. database.MarkCorpseAsRezzed(PendingRezzDBID); _log(SPELLS__REZ, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", - this->name, (uint16)spells[SpellID].base[0], - SpellID, ZoneID, InstanceID); + this->name, (uint16)spells[SpellID].base[0], + SpellID, ZoneID, InstanceID); this->BuffFadeAll(); int SpellEffectDescNum = GetSpellEffectDescNum(SpellID); @@ -1171,7 +1171,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I if(spells[SpellID].base[0] < 100 && spells[SpellID].base[0] > 0 && PendingRezzXP > 0) { SetEXP(((int)(GetEXP()+((float)((PendingRezzXP / 100) * spells[SpellID].base[0])))), - GetAAXP(),true); + GetAAXP(),true); } else if (spells[SpellID].base[0] == 100 && PendingRezzXP > 0) { SetEXP((GetEXP() + PendingRezzXP), GetAAXP(), true); @@ -1539,7 +1539,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app) // now we should have a from_bucket, a to_bucket, an amount_to_take // and an amount_to_add - // now we actually take it from the from bucket. if there's an error + // now we actually take it from the from bucket. if there's an error // with the destination slot, they lose their money *from_bucket -= amount_to_take; // why are intentionally inducing a crash here rather than letting the code attempt to stumble on? @@ -1614,8 +1614,8 @@ void Client::OPGMTraining(const EQApplicationPacket *app) if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) return; - SkillType sk; - for (sk = _1H_BLUNT; sk <= HIGHEST_SKILL; sk = (SkillType)(sk+1)) { + SkillType sk; + for (sk = _1H_BLUNT; sk <= HIGHEST_SKILL; sk = (SkillType)(sk+1)) { if(sk == TINKERING && GetRace() != GNOME) { gmtrain->skills[sk] = 0; //Non gnomes can't tinker! } else { @@ -2083,7 +2083,7 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse && corpse->IsCorpse()) { _log(SPELLS__REZ, "Hover Rez in zone %s for corpse %s", - zone->GetShortName(), PendingRezzCorpseName.c_str()); + zone->GetShortName(), PendingRezzCorpseName.c_str()); _log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed."); diff --git a/zone/command.cpp b/zone/command.cpp index 042950477..3c04933db 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1,34 +1,34 @@ -/* 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 */ /* To add a new command 3 things must be done: - 1. At the bottom of command.h you must add a prototype for it. - 2. Add the function in this file. - 3. In the command_init function you must add a call to command_add - for your function. If you want an alias for your command, add - a second call to command_add with the descriptin and access args - set to nullptr and 0 respectively since they aren't used when adding - an alias. The function pointers being equal is makes it an alias. - The access level you set with command_add is only a default if - the command isn't listed in the addon.ini file. + 1. At the bottom of command.h you must add a prototype for it. + 2. Add the function in this file. + 3. In the command_init function you must add a call to command_add + for your function. If you want an alias for your command, add + a second call to command_add with the descriptin and access args + set to nullptr and 0 respectively since they aren't used when adding + an alias. The function pointers being equal is makes it an alias. + The access level you set with command_add is only a default if + the command isn't listed in the addon.ini file. */ @@ -96,7 +96,7 @@ LinkedList cleanup_commandlist; * This is the default dispatch function when commands aren't loaded. * * Parameters: - * not used + * not used * */ int command_notavail(Client *c, const char *message) @@ -106,7 +106,7 @@ int command_notavail(Client *c, const char *message) } /*****************************************************************************/ -/* the rest below here could be in a dynamically loaded module eventually */ +/* the rest below here could be in a dynamically loaded module eventually */ /*****************************************************************************/ /* @@ -137,10 +137,10 @@ Access Levels: * initializes the command list, call at startup * * Parameters: - * none + * none * * When adding a command, if it's the first time that function pointer is - * used it is a new command. If that function pointer is used for another + * used it is a new command. If that function pointer is used for another * command, the command is added as an alias; description and access level * are not used and can be nullptr. * @@ -180,7 +180,7 @@ int command_init(void) { command_add("summon","[charname] - Summons your player/npc/corpse target, or charname if specified",80,command_summon) || command_add("zone","[zonename] [x] [y] [z] - Go to specified zone (coords optional)",50,command_zone) || command_add("zoneinstance","[instanceid] [x] [y] [z] - Go to specified instance zone (coords optional)",50,command_zone_instance) || - command_add("peqzone","[zonename] - Go to specified zone, if you have > 75% health",0,command_peqzone) || + command_add("peqzone","[zonename] - Go to specified zone, if you have > 75% health",0,command_peqzone) || command_add("tgczone",nullptr,0,command_peqzone) || command_add("showbuffs","- List buffs active on your target or you if no target",50,command_showbuffs) || command_add("movechar","[charname] [zonename] - Move charname to zonename",50,command_movechar) || @@ -246,8 +246,8 @@ int command_init(void) { command_add("setskillall","[value] - Set all of your target's skills to value",50,command_setskillall) || command_add("setallskill",nullptr,0,command_setskillall) || command_add("setallskills",nullptr,0,command_setskillall) || - command_add("race","[racenum] - Change your or your target's race. Use racenum 0 to return to normal",50,command_race) || - command_add("gender","[0/1/2] - Change your or your target's gender to male/female/neuter",50,command_gender) || + command_add("race","[racenum] - Change your or your target's race. Use racenum 0 to return to normal",50,command_race) || + command_add("gender","[0/1/2] - Change your or your target's gender to male/female/neuter",50,command_gender) || command_add("makepet","[level] [class] [race] [texture] - Make a pet",50,command_makepet) || command_add("level","[level] - Set your or your target's level",10,command_level) || command_add("spawn","[name] [race] [level] [material] [hp] [gender] [class] [priweapon] [secweapon] [merchantid] - Spawn an NPC",10,command_spawn) || @@ -312,7 +312,7 @@ int command_init(void) { command_add("setcrystals","[value] - Set your or your player target's available radiant or ebon crystals",100,command_setcrystals) || command_add("name","[newname] - Rename your player target",150,command_name) || command_add("tempname","[newname] - Temporarily renames your target. Leave name blank to restore the original name.",100,command_tempname) || - command_add("npcspecialattk","[flagchar] [perm] - Set NPC special attack flags. Flags are E(nrage) F(lurry) R(ampage) S(ummon).",80,command_npcspecialattk) || + command_add("npcspecialattk","[flagchar] [perm] - Set NPC special attack flags. Flags are E(nrage) F(lurry) R(ampage) S(ummon).",80,command_npcspecialattk) || command_add("npcspecialattack",nullptr,0,command_npcspecialattk) || command_add("npcspecialatk",nullptr,0,command_npcspecialattk) || command_add("kill","- Kill your target",100,command_kill) || @@ -334,7 +334,7 @@ int command_init(void) { command_add("iteminfo","- Get information about the item on your cursor",10,command_iteminfo) || command_add("uptime","[zone server id] - Get uptime of worldserver, or zone server if argument provided",10,command_uptime) || command_add("flag","[status] [acctname] - Refresh your admin status, or set an account's admin status if arguments provided",0,command_flag) || - command_add("guild","- Guild manipulation commands. Use argument help for more info.",10,command_guild) || + command_add("guild","- Guild manipulation commands. Use argument help for more info.",10,command_guild) || command_add("guilds",nullptr,0,command_guild) || command_add("zonestatus","- Show connected zoneservers, synonymous with /servers",150,command_zonestatus) || command_add("manaburn","- Use AA Wizard class skill manaburn on target",10,command_manaburn) || @@ -356,11 +356,11 @@ int command_init(void) { command_add("unscribespells","- Clear out your or your player target's spell book.",180,command_unscribespells) || command_add("scribespell", "[spellid] - Scribe specified spell in your target's spell book.", 180, command_scribespell) || command_add("unscribespell", "[spellid] - Unscribe specified spell from your target's spell book.", 180, command_unscribespell) || - command_add("interrupt","[message id] [color] - Interrupt your casting. Arguments are optional.",50,command_interrupt) || + command_add("interrupt","[message id] [color] - Interrupt your casting. Arguments are optional.",50,command_interrupt) || command_add("d1","[type] [spell] [damage] - Send an OP_Action packet with the specified values",200,command_d1) || - command_add("summonitem","[itemid] [charges] - Summon an item onto your cursor. Charges are optional.",200,command_summonitem) || + command_add("summonitem","[itemid] [charges] - Summon an item onto your cursor. Charges are optional.",200,command_summonitem) || command_add("si",nullptr,200,command_summonitem) || - command_add("giveitem","[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.",200,command_giveitem) || + command_add("giveitem","[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.",200,command_giveitem) || command_add("gi",nullptr,200,command_giveitem) || command_add("givemoney","[pp] [gp] [sp] [cp] - Gives specified amount of money to the target player.",200,command_givemoney) || command_add("itemsearch","[search criteria] - Search for an item",10,command_itemsearch) || @@ -430,7 +430,7 @@ int command_init(void) { command_add("modifynpcstat","- Modifys a NPC's stats",150,command_modifynpcstat) || command_add("undyeme","- Remove dye from all of your armor slots",0,command_undyeme) || command_add("instance","- Modify Instances",200,command_instance) || - command_add("setstartzone","[zoneid] - Set target's starting zone. Set to zero to allow the player to use /setstartcity",80,command_setstartzone) || + command_add("setstartzone","[zoneid] - Set target's starting zone. Set to zero to allow the player to use /setstartcity",80,command_setstartzone) || command_add("netstats","- Gets the network stats for a stream.",200,command_netstats) || command_add("object","List|Add|Edit|Move|Rotate|Copy|Save|Undo|Delete - Manipulate static and tradeskill objects within the zone",100,command_object) || command_add("raidloot","LEADER|GROUPLEADER|SELECTED|ALL - Sets your raid loot settings if you have permission to do so.",0,command_raidloot) || @@ -445,9 +445,9 @@ int command_init(void) { command_add("reloadallrules","Executes a reload of all rules.",80, command_reloadallrules) || command_add("reloadrulesworld","Executes a reload of all rules in world specifically.",80, command_reloadworldrules) || command_add("camerashake", "Shakes the camera on everyone's screen globally.", 80, command_camerashake) || - command_add("disarmtrap", "Analog for ldon disarm trap for the newer clients since we still don't have it working.", 0, command_disarmtrap) || - command_add("sensetrap", "Analog for ldon sense trap for the newer clients since we still don't have it working.", 0, command_sensetrap) || - command_add("picklock", "Analog for ldon pick lock for the newer clients since we still don't have it working.", 0, command_picklock) || + command_add("disarmtrap", "Analog for ldon disarm trap for the newer clients since we still don't have it working.", 0, command_disarmtrap) || + command_add("sensetrap", "Analog for ldon sense trap for the newer clients since we still don't have it working.", 0, command_sensetrap) || + command_add("picklock", "Analog for ldon pick lock for the newer clients since we still don't have it working.", 0, command_picklock) || command_add("mysql", "Mysql CLI, see 'help' for options.", 250, command_mysql) || command_add("xtargets", "Show your targets Extended Targets and optionally set how many xtargets they can have.", 250, command_xtargets) || command_add("printquestitems","Returns available quest items for multiquesting currently on the target npc.",200,command_printquestitems) || @@ -493,7 +493,7 @@ int command_init(void) { * clears the command list, freeing resources * * Parameters: - * none + * none * */ void command_deinit(void) @@ -515,10 +515,10 @@ void command_deinit(void) * adds a command to the command list; used by command_init * * Parameters: - * command_string - the command ex: "spawn" - * desc - text description of command for #help - * access - default access level required to use command - * function - pointer to function that handles command + * command_string - the command ex: "spawn" + * desc - text description of command for #help + * access - default access level required to use command + * function - pointer to function that handles command * */ int command_add(const char *command_string, const char *desc, int access, CmdFuncPtr function) @@ -572,9 +572,9 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun * adds a command to the command list, as a perl function * * Parameters: - * command_string - the command ex: "spawn" - * desc - text description of command for #help - * access - default access level required to use command + * command_string - the command ex: "spawn" + * desc - text description of command for #help + * access - default access level required to use command * */ int command_add_perl(const char *command_string, const char *desc, int access) { @@ -631,8 +631,8 @@ void command_clear_perl() { * command character (#). * * Parameters: - * c - pointer to the calling client object - * message - what the client typed + * c - pointer to the calling client object + * message - what the client typed * */ int command_realdispatch(Client *c, const char *message) @@ -640,7 +640,7 @@ int command_realdispatch(Client *c, const char *message) _ZP(command_realdispatch); - Seperator sep(message, ' ', 10, 100, true); // "three word argument" should be considered 1 arg + Seperator sep(message, ' ', 10, 100, true); // "three word argument" should be considered 1 arg command_logcommand(c, message); @@ -665,7 +665,7 @@ int command_realdispatch(Client *c, const char *message) if(cur->function == nullptr) { #ifdef EMBPERL_COMMANDS //todo reimplement this stuff - //dispatch perl command + //dispatch perl command //PerlembParser *embparse = (PerlembParser *) parse; //embparse->ExecCommand(c, &sep); #else @@ -813,7 +813,7 @@ void command_sendop(Client *c,const Seperator *sep){ */ - /* + /* if(sep->arg[1][0] && sep->arg[2][0]){ EQApplicationPacket* outapp = new EQApplicationPacket((EmuOpcode)atoi(sep->arg[1]),sizeof(GMName_Struct)); GMName_Struct* gms=(GMName_Struct*)outapp->pBuffer; @@ -826,7 +826,7 @@ void command_sendop(Client *c,const Seperator *sep){ c->QueuePacket(outapp); safe_delete(outapp); } - */ + */ /* else{ EQApplicationPacket* outapp = new EQApplicationPacket(121,atoi(sep->arg[2])); @@ -930,7 +930,7 @@ void command_help(Client *c, const Seperator *sep) if(c->Admin() < cur->second->access) continue; - commands_shown++; + commands_shown++; c->Message(0, " %c%s %s", COMMAND_CHAR, cur->first.c_str(), cur->second->desc == nullptr?"":cur->second->desc); } c->Message(0, "%d command%s listed.", commands_shown, commands_shown!=1?"s":""); @@ -1348,7 +1348,7 @@ void command_gm(Client *c, const Seperator *sep) //To whoever wrote the above: And what about /kill, /zone, /zoneserver, etc? //There is a reason for the # commands: so that admins can specifically enable certain -//commands for their users. Some might want users to #summon but not to /kill. Cant do that if they are a GM +//commands for their users. Some might want users to #summon but not to /kill. Cant do that if they are a GM void command_summon(Client *c, const Seperator *sep) { Mob *t; @@ -1423,13 +1423,13 @@ void command_summon(Client *c, const Seperator *sep) void command_zone(Client *c, const Seperator *sep) { - if(c->Admin() < commandZoneToCoords && - (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4))) { - c->Message(0, "Your status is not high enough to zone to specific coordinates."); - return; - } + if(c->Admin() < commandZoneToCoords && + (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4))) { + c->Message(0, "Your status is not high enough to zone to specific coordinates."); + return; + } - uint16 zoneid = 0; + uint16 zoneid = 0; if (sep->IsNumber(1)) { @@ -1479,11 +1479,11 @@ void command_zone(Client *c, const Seperator *sep) //todo: fix this so it checks if you're in the instance set void command_zone_instance(Client *c, const Seperator *sep) { - if(c->Admin() < commandZoneToCoords && - (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4))) { - c->Message(0, "Your status is not high enough to zone to specific coordinates."); - return; - } + if(c->Admin() < commandZoneToCoords && + (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4))) { + c->Message(0, "Your status is not high enough to zone to specific coordinates."); + return; + } if (sep->arg[1][0] == 0) { @@ -1492,7 +1492,7 @@ void command_zone_instance(Client *c, const Seperator *sep) return; } - uint16 zoneid = 0; + uint16 zoneid = 0; uint16 instanceid = 0; if(sep->IsNumber(1)) @@ -1542,72 +1542,77 @@ void command_showbuffs(Client *c, const Seperator *sep) void command_peqzone(Client *c, const Seperator *sep) { - uint32 timeleft = c->GetPTimers().GetRemainingTime(pTimerPeqzoneReuse)/60; + uint32 timeleft = c->GetPTimers().GetRemainingTime(pTimerPeqzoneReuse)/60; - if(!c->GetPTimers().Expired(&database, pTimerPeqzoneReuse, false)) { - c->Message(13,"You must wait %i minute(s) before using this ability again.", timeleft); - return; - } - if(c->GetHPRatio() < 75) { - c->Message(0, "You cannot use this command with less than 75 percent health."); - return; - } - //this isnt perfect, but its better... - if( - c->IsInvisible(c) - || c->IsRooted() - || c->IsStunned() - || c->IsMezzed() - || c->AutoAttackEnabled() - || c->GetInvul() - ) { - c->Message(0, "You cannot use this command in your current state. Settle down and wait."); - return; - } - uint16 zoneid = 0; - uint8 destzone = 0; - if (sep->IsNumber(1)) - { - zoneid = atoi(sep->arg[1]); - destzone = database.GetPEQZone(zoneid, 0); - if(destzone == 0){ - c->Message(13, "You cannot use this command to enter that zone!"); - return; - } - if(zoneid == zone->GetZoneID()) { - c->Message(13, "You cannot use this command on the zone you are in!"); - return; - } - } - else if (sep->arg[1][0] == 0 || sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4) || sep->IsNumber(5)) - { - c->Message(0, "Usage: #peqzone [zonename]"); - c->Message(0, "Optional Usage: #peqzone [zoneid]"); - return; - } else { - zoneid = database.GetZoneID(sep->arg[1]); - destzone = database.GetPEQZone(zoneid, 0); - if(zoneid == 0) { - c->Message(0, "Unable to locate zone '%s'", sep->arg[1]); - return; - } - if(destzone == 0){ - c->Message(13, "You cannot use this command to enter that zone!"); - return; - } - if(zoneid == zone->GetZoneID()) { - c->Message(13, "You cannot use this command on the zone you are in!"); - return; - } - } - if(RuleB (Zone, UsePEQZoneDebuffs)){ - c->SpellOnTarget(RuleI(Zone, PEQZoneDebuff1), c); - c->SpellOnTarget(RuleI(Zone, PEQZoneDebuff2), c); - } + if(!c->GetPTimers().Expired(&database, pTimerPeqzoneReuse, false)) { + c->Message(13,"You must wait %i minute(s) before using this ability again.", timeleft); + return; + } - //zone to safe coords - c->GetPTimers().Start(pTimerPeqzoneReuse, RuleI(Zone, PEQZoneReuseTime)); - c->MovePC(zoneid, 0.0f, 0.0f, 0.0f, 0.0f, 0, ZoneToSafeCoords); + if(c->GetHPRatio() < 75) { + c->Message(0, "You cannot use this command with less than 75 percent health."); + return; + } + + //this isnt perfect, but its better... + if( + c->IsInvisible(c) + || c->IsRooted() + || c->IsStunned() + || c->IsMezzed() + || c->AutoAttackEnabled() + || c->GetInvul() + ) { + c->Message(0, "You cannot use this command in your current state. Settle down and wait."); + return; + } + + uint16 zoneid = 0; + uint8 destzone = 0; + if (sep->IsNumber(1)) + { + zoneid = atoi(sep->arg[1]); + destzone = database.GetPEQZone(zoneid, 0); + if(destzone == 0){ + c->Message(13, "You cannot use this command to enter that zone!"); + return; + } + if(zoneid == zone->GetZoneID()) { + c->Message(13, "You cannot use this command on the zone you are in!"); + return; + } + } + else if (sep->arg[1][0] == 0 || sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4) || sep->IsNumber(5)) + { + c->Message(0, "Usage: #peqzone [zonename]"); + c->Message(0, "Optional Usage: #peqzone [zoneid]"); + return; + } + else { + zoneid = database.GetZoneID(sep->arg[1]); + destzone = database.GetPEQZone(zoneid, 0); + if(zoneid == 0) { + c->Message(0, "Unable to locate zone '%s'", sep->arg[1]); + return; + } + if(destzone == 0){ + c->Message(13, "You cannot use this command to enter that zone!"); + return; + } + if(zoneid == zone->GetZoneID()) { + c->Message(13, "You cannot use this command on the zone you are in!"); + return; + } + } + + if(RuleB (Zone, UsePEQZoneDebuffs)){ + c->SpellOnTarget(RuleI(Zone, PEQZoneDebuff1), c); + c->SpellOnTarget(RuleI(Zone, PEQZoneDebuff2), c); + } + + //zone to safe coords + c->GetPTimers().Start(pTimerPeqzoneReuse, RuleI(Zone, PEQZoneReuseTime)); + c->MovePC(zoneid, 0.0f, 0.0f, 0.0f, 0.0f, 0, ZoneToSafeCoords); } void command_movechar(Client *c, const Seperator *sep) @@ -1798,9 +1803,9 @@ void command_invul(Client *c, const Seperator *sep) void command_hideme(Client *c, const Seperator *sep) { - bool state=atobool(sep->arg[1]); + bool state=atobool(sep->arg[1]); - if(sep->arg[1][0]==0) + if(sep->arg[1][0]==0) c->Message(0, "Usage: #hideme [on/off]"); else { @@ -1933,15 +1938,15 @@ void command_zstats(Client *c, const Seperator *sep) void command_permaclass(Client *c, const Seperator *sep) { - Client *t=c; + Client *t=c; - if(c->GetTarget() && c->GetTarget()->IsClient()) - t=c->GetTarget()->CastToClient(); + if(c->GetTarget() && c->GetTarget()->IsClient()) + t=c->GetTarget()->CastToClient(); if(sep->arg[1][0]==0) { c->Message(0,"Usage: #permaclass "); } - else if(!t->IsClient()) + else if(!t->IsClient()) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's class...Sending to char select.", t->GetName()); @@ -1954,16 +1959,16 @@ void command_permaclass(Client *c, const Seperator *sep) void command_permarace(Client *c, const Seperator *sep) { - Client *t=c; + Client *t=c; - if(c->GetTarget() && c->GetTarget()->IsClient()) - t=c->GetTarget()->CastToClient(); + if(c->GetTarget() && c->GetTarget()->IsClient()) + t=c->GetTarget()->CastToClient(); if(sep->arg[1][0]==0) { c->Message(0,"Usage: #permarace "); c->Message(0,"NOTE: Not all models are global. If a model is not global, it will appear as a human on character select and in zones without the model."); } - else if(!t->IsClient()) + else if(!t->IsClient()) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's race - zone to take effect",t->GetName()); @@ -1978,16 +1983,16 @@ void command_permarace(Client *c, const Seperator *sep) void command_permagender(Client *c, const Seperator *sep) { - Client *t=c; + Client *t=c; - if(c->GetTarget() && c->GetTarget()->IsClient()) - t=c->GetTarget()->CastToClient(); + if(c->GetTarget() && c->GetTarget()->IsClient()) + t=c->GetTarget()->CastToClient(); if(sep->arg[1][0]==0) { c->Message(0,"Usage: #permagender "); c->Message(0,"Gender Numbers: 0=Male, 1=Female, 2=Neuter"); } - else if(!t->IsClient()) + else if(!t->IsClient()) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's gender - zone to take effect",t->GetName()); @@ -2512,7 +2517,7 @@ void command_mana(Client *c, const Seperator *sep) void command_flymode(Client *c, const Seperator *sep) { - Client *t=c; + Client *t=c; if (strlen(sep->arg[1]) == 1 && !(sep->arg[1][0] == '0' || sep->arg[1][0] == '1' || sep->arg[1][0] == '2')) c->Message(0, "#flymode [0/1/2]"); @@ -2727,7 +2732,7 @@ void command_setskillall(Client *c, const Seperator *sep) void command_race(Client *c, const Seperator *sep) { - Mob *t=c->CastToMob(); + Mob *t=c->CastToMob(); // Need to figure out max race for LoY/LDoN: going with upper bound of 500 now for testing if (sep->IsNumber(1) && atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 724) { @@ -2736,12 +2741,12 @@ void command_race(Client *c, const Seperator *sep) t->SendIllusionPacket(atoi(sep->arg[1])); } else - c->Message(0, "Usage: #race [0-724] (0 for back to normal)"); + c->Message(0, "Usage: #race [0-724] (0 for back to normal)"); } void command_gender(Client *c, const Seperator *sep) { - Mob *t=c->CastToMob(); + Mob *t=c->CastToMob(); if (sep->IsNumber(1) && atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 500) { if ((c->GetTarget()) && c->Admin() >= commandGenderOthers) @@ -2841,7 +2846,7 @@ void command_texture(Client *c, const Seperator *sep) } } else - c->Message(0, "Usage: #texture [texture] [helmtexture] (0-255, 255 for show equipment)"); + c->Message(0, "Usage: #texture [texture] [helmtexture] (0-255, 255 for show equipment)"); } void command_npctypespawn(Client *c, const Seperator *sep) @@ -3304,67 +3309,67 @@ void command_peekinv(Client *c, const Seperator *sep) void command_findnpctype(Client *c, const Seperator *sep) { - if(sep->arg[1][0] == 0) - c->Message(0, "Usage: #findnpctype [search criteria]"); - else - { - int id; - int count; - const int maxrows = 20; - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query; - MYSQL_RES *result; - MYSQL_ROW row; + if(sep->arg[1][0] == 0) + c->Message(0, "Usage: #findnpctype [search criteria]"); + else + { + int id; + int count; + const int maxrows = 20; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query; + MYSQL_RES *result; + MYSQL_ROW row; - query = new char[256]; + query = new char[256]; - // If id evaluates to 0, then search as if user entered a string. - if ((id = atoi((const char *)sep->arg[1])) == 0) - MakeAnyLenString(&query, - "SELECT id,name" - " FROM npc_types WHERE name LIKE '%%%s%%'", - sep->arg[1]); - // Otherwise, look for just that npc id. - else - MakeAnyLenString(&query, - "SELECT id,name FROM npc_types WHERE id=%i", id); + // If id evaluates to 0, then search as if user entered a string. + if ((id = atoi((const char *)sep->arg[1])) == 0) + MakeAnyLenString(&query, + "SELECT id,name" + " FROM npc_types WHERE name LIKE '%%%s%%'", + sep->arg[1]); + // Otherwise, look for just that npc id. + else + MakeAnyLenString(&query, + "SELECT id,name FROM npc_types WHERE id=%i", id); - // If query runs successfully. - if (database.RunQuery(query, strlen(query), errbuf, &result)) - { - count = 0; + // If query runs successfully. + if (database.RunQuery(query, strlen(query), errbuf, &result)) + { + count = 0; - // Process each row returned. - while((row = mysql_fetch_row(result))) - { - // Limit to returning maxrows rows. - if (++count > maxrows) - { - c->Message (0, - "%i npc types shown. Too many results.", maxrows); - break; - } - c->Message (0, " %s: %s", row[0], row[1]); - } + // Process each row returned. + while((row = mysql_fetch_row(result))) + { + // Limit to returning maxrows rows. + if (++count > maxrows) + { + c->Message (0, + "%i npc types shown. Too many results.", maxrows); + break; + } + c->Message (0, " %s: %s", row[0], row[1]); + } - // If we did not hit the maxrows limit. - if (count <= maxrows) - c->Message (0, "Query complete. %i rows shown.", count); - // No matches found. - else if (count == 0) - c->Message (0, "No matches found for %s.", sep->arg[1]); + // If we did not hit the maxrows limit. + if (count <= maxrows) + c->Message (0, "Query complete. %i rows shown.", count); + // No matches found. + else if (count == 0) + c->Message (0, "No matches found for %s.", sep->arg[1]); - mysql_free_result(result); - } - // If query failed. - else - { - c->Message (0, "Error querying database."); - c->Message (0, query); - } + mysql_free_result(result); + } + // If query failed. + else + { + c->Message (0, "Error querying database."); + c->Message (0, query); + } - safe_delete_array(query); - } + safe_delete_array(query); + } } void command_findzone(Client *c, const Seperator *sep) @@ -3390,7 +3395,7 @@ void command_findzone(Client *c, const Seperator *sep) database.DoEscapeString(EscName, sep->arg[1], strlen(sep->arg[1])); MakeAnyLenString(&query, "SELECT zoneidnumber,short_name,long_name FROM zone WHERE long_name rLIKE '%s' AND version=0", - EscName); + EscName); safe_delete_array(EscName); } // Otherwise, look for just that zoneidnumber. @@ -4362,7 +4367,7 @@ void command_bind(Client *c, const Seperator *sep) c->GetTarget()->CastToClient()->SetBindPoint(); else c->Message(0, "Error: target not a Player"); - } else + } else c->SetBindPoint(); } @@ -4586,7 +4591,7 @@ void command_name(Client *c, const Seperator *sep) target->Kick(); } else - c->Message(13, "ERROR: Unable to rename %s. Check that the new name '%s' isn't already taken.", oldname, sep->arg[2]); + c->Message(13, "ERROR: Unable to rename %s. Check that the new name '%s' isn't already taken.", oldname, sep->arg[2]); free(oldname); } } @@ -4776,7 +4781,7 @@ void command_spawnfix(Client *c, const Seperator *sep) { { c->Message(13, "Update failed! MySQL gave the following error:"); c->Message(13, errbuf); - } + } safe_delete_array(query); } } @@ -4812,7 +4817,7 @@ void command_iteminfo(Client *c, const Seperator *sep) c->Message(0, " Lore: %s ND: %i NS: %i Type: %i", (item->LoreFlag) ? "true":"false", item->NoDrop, item->NoRent, item->ItemClass); c->Message(0, " IDF: %s Size: %i Weight: %i icon_id: %i Price: %i", item->IDFile, item->Size, item->Weight, item->Icon, item->Price); if (c->Admin() >= 200) - c->Message(0, "MinStatus: %i", item->MinStatus); + c->Message(0, "MinStatus: %i", item->MinStatus); if (item->ItemClass==ItemClassBook) c->Message(0, " This item is a Book: %s", item->Filename); else if (item->ItemClass==ItemClassContainer) @@ -4822,7 +4827,7 @@ void command_iteminfo(Client *c, const Seperator *sep) c->Message(0, " Magic: %i SpellID: %i Proc Level: %i DBCharges: %i CurCharges: %i", item->Magic, item->Click.Effect, item->Click.Level, item->MaxCharges, inst->GetCharges()); c->Message(0, " EffectType: 0x%02x CastTime: %.2f", (uint8) item->Click.Type, (double) item->CastTime/1000); c->Message(0, " Material: 0x%02x Color: 0x%08x Skill: %i", item->Material, item->Color, item->ItemType); - c->Message(0, " Required level: %i Required skill: %i Recommended level:%i", item->ReqLevel, item->RecSkill, item->RecLevel); + c->Message(0, " Required level: %i Required skill: %i Recommended level:%i", item->ReqLevel, item->RecSkill, item->RecLevel); c->Message(0, " Skill mod: %i percent: %i", item->SkillModType, item->SkillModValue); c->Message(0, " BaneRace: %i BaneBody: %i BaneDMG: %i", item->BaneDmgRace, item->BaneDmgBody, item->BaneDmgAmt); } @@ -4922,7 +4927,7 @@ void command_guild(Client *c, const Seperator *sep) c->Message(0, " #guild remove [charname]"); c->Message(0, " #guild promote rank [charname]"); c->Message(0, " #guild demote rank [charname]"); - c->Message(0, " /guildmotd [newmotd] (use 'none' to clear)"); + c->Message(0, " /guildmotd [newmotd] (use 'none' to clear)"); c->Message(0, " #guild edit rank title newtitle"); c->Message(0, " #guild edit rank permission 0/1"); c->Message(0, " #guild leader newleader (they must be rank0)"); @@ -6128,10 +6133,10 @@ void command_wpadd(Client *c, const Seperator *sep) if (tmp_grid) t->CastToNPC()->SetGrid(tmp_grid); - t->CastToNPC()->AssignWaypoints(t->CastToNPC()->GetGrid()); + t->CastToNPC()->AssignWaypoints(t->CastToNPC()->GetGrid()); c->Message(0,"Waypoint added. Use #wpinfo to see waypoints for this NPC (may need to #repop first)."); - } - else + } + else c->Message(0,"You must target an NPC to use this."); } @@ -6167,11 +6172,11 @@ void command_summonitem(Client *c, const Seperator *sep) c->Message(0, "Usage: #summonitem [item id] [charges], charges are optional"); else { uint32 itemid = atoi(sep->arg[1]); - int16 item_status = 0; - const Item_Struct* item = database.GetItem(itemid); - if(item) { - item_status = static_cast(item->MinStatus); - } + int16 item_status = 0; + const Item_Struct* item = database.GetItem(itemid); + if(item) { + item_status = static_cast(item->MinStatus); + } if (item_status > c->Admin()) c->Message(13, "Error: Insufficient status to summon this item."); @@ -6204,11 +6209,11 @@ void command_giveitem(Client *c, const Seperator *sep) } else { Client *t = c->GetTarget()->CastToClient(); uint32 itemid = atoi(sep->arg[1]); - int16 item_status = 0; - const Item_Struct* item = database.GetItem(itemid); - if(item) { - item_status = static_cast(item->MinStatus); - } + int16 item_status = 0; + const Item_Struct* item = database.GetItem(itemid); + if(item) { + item_status = static_cast(item->MinStatus); + } if (item_status > c->Admin()) c->Message(13, "Error: Insufficient status to summon this item."); @@ -6234,7 +6239,7 @@ void command_givemoney(Client *c, const Seperator *sep) { if (!sep->IsNumber(1)) { //as long as the first one is a number, we'll just let atoi convert the rest to 0 or a number c->Message(13, "Usage: #Usage: #givemoney [pp] [gp] [sp] [cp]"); - } + } else if(c->GetTarget() == nullptr) { c->Message(13, "You must target a player to give money to."); } @@ -6405,90 +6410,90 @@ void command_stun(Client *c, const Seperator *sep) void command_embperl_plugin(Client *c, const Seperator *sep) { - if(sep->arg[1][0] == 0) - { - c->Message(0, "Usage: #plugin (subname) [arguments]"); - return; - } + if(sep->arg[1][0] == 0) + { + c->Message(0, "Usage: #plugin (subname) [arguments]"); + return; + } - Embperl * perl; - if(!parse || !(perl = ((PerlembParser *)parse)->getperl())) - { - c->Message(0, "Error: Perl module not loaded"); - return; - } + Embperl * perl; + if(!parse || !(perl = ((PerlembParser *)parse)->getperl())) + { + c->Message(0, "Error: Perl module not loaded"); + return; + } - std::string exports = "$plugin::printbuff='';$plugin::ip='"; - struct in_addr ip; ip.s_addr = c->GetIP(); - exports += inet_ntoa(ip); - exports += "';$plugin::name=qq("; - exports += c->GetName(); - exports += ");package plugin;"; - perl->eval(exports.c_str()); + std::string exports = "$plugin::printbuff='';$plugin::ip='"; + struct in_addr ip; ip.s_addr = c->GetIP(); + exports += inet_ntoa(ip); + exports += "';$plugin::name=qq("; + exports += c->GetName(); + exports += ");package plugin;"; + perl->eval(exports.c_str()); - std::string fqsubname("plugin::"); - fqsubname.append(sep->arg[1]); + std::string fqsubname("plugin::"); + fqsubname.append(sep->arg[1]); - //convert args into a vector of strings. - std::vector args; - for(int i = 2; i < sep->argnum; ++i) - { - args.push_back(sep->arg[i]); - } + //convert args into a vector of strings. + std::vector args; + for(int i = 2; i < sep->argnum; ++i) + { + args.push_back(sep->arg[i]); + } - try - { - perl->dosub(fqsubname.c_str(), &args); - std::string output = perl->getstr("$plugin::printbuff"); - if(output.length()) - c->Message(0, "%s", output.c_str()); - } - catch(const char * err) - { - c->Message(0, "Error executing plugin: %s", perl->lasterr().c_str()); - } + try + { + perl->dosub(fqsubname.c_str(), &args); + std::string output = perl->getstr("$plugin::printbuff"); + if(output.length()) + c->Message(0, "%s", output.c_str()); + } + catch(const char * err) + { + c->Message(0, "Error executing plugin: %s", perl->lasterr().c_str()); + } - perl->eval("package main;"); + perl->eval("package main;"); } void command_embperl_eval(Client *c, const Seperator *sep) { - if(sep->arg[1][0] == 0) - { - c->Message(0, "Usage: #peval (expr)"); - return; - } + if(sep->arg[1][0] == 0) + { + c->Message(0, "Usage: #peval (expr)"); + return; + } - Embperl * perl; - if(!parse || !(perl = ((PerlembParser *)parse)->getperl())) - { - c->Message(0, "Error: Perl module not loaded"); - return; - } + Embperl * perl; + if(!parse || !(perl = ((PerlembParser *)parse)->getperl())) + { + c->Message(0, "Error: Perl module not loaded"); + return; + } - std::string exports = "$plugin::printbuff='';$plugin::ip='"; - struct in_addr ip; ip.s_addr = c->GetIP(); - exports += inet_ntoa(ip); - exports += "';$plugin::name=qq("; - exports += c->GetName(); - exports += ");"; - perl->eval(exports.c_str()); + std::string exports = "$plugin::printbuff='';$plugin::ip='"; + struct in_addr ip; ip.s_addr = c->GetIP(); + exports += inet_ntoa(ip); + exports += "';$plugin::name=qq("; + exports += c->GetName(); + exports += ");"; + perl->eval(exports.c_str()); - try - { - std::string cmd = std::string("package plugin;") + std::string(sep->msg + sizeof("peval ")); - perl->eval(cmd.c_str()); - std::string output = perl->getstr("$plugin::printbuff"); - if(output.length()) - c->Message(0, "%s", output.c_str()); - } - catch(const char * err) - { - c->Message(0, "Error: %s", perl->lasterr().c_str()); - } + try + { + std::string cmd = std::string("package plugin;") + std::string(sep->msg + sizeof("peval ")); + perl->eval(cmd.c_str()); + std::string output = perl->getstr("$plugin::printbuff"); + if(output.length()) + c->Message(0, "%s", output.c_str()); + } + catch(const char * err) + { + c->Message(0, "Error: %s", perl->lasterr().c_str()); + } - perl->eval("package main;"); + perl->eval("package main;"); } @@ -6504,7 +6509,7 @@ void command_ban(Client *c, const Seperator *sep) if(sep->arg[1][0] == 0) { - c->Message(0, "Usage: #ban [charname]"); + c->Message(0, "Usage: #ban [charname]"); } else { @@ -6562,7 +6567,7 @@ void command_suspend(Client *c, const Seperator *sep) char *query = nullptr; if((sep->arg[1][0] == 0) || (sep->arg[2][0] == 0)) - c->Message(0, "Usage: #suspend (Specify 0 days to lift the suspension immediately)"); + c->Message(0, "Usage: #suspend (Specify 0 days to lift the suspension immediately)"); else { int Duration = atoi(sep->arg[2]); @@ -6579,11 +6584,11 @@ void command_suspend(Client *c, const Seperator *sep) if((AccountID = database.GetAccountIDByChar(EscName)) > 0) { database.RunQuery(query, MakeAnyLenString(&query, "UPDATE `account` SET `suspendeduntil` = DATE_ADD(NOW(), INTERVAL %i DAY)" - " WHERE `id` = %i", Duration, AccountID), errbuf, 0); + " WHERE `id` = %i", Duration, AccountID), errbuf, 0); if(Duration) c->Message(13,"Account number %i with the character %s has been temporarily suspended for %i day(s).", AccountID, sep->arg[1], - Duration); + Duration); else c->Message(13,"Account number %i with the character %s is no longer suspended.", AccountID, sep->arg[1]); @@ -6618,7 +6623,7 @@ void command_ipban(Client *c, const Seperator *sep) { if(sep->arg[1] == 0) { - c->Message(0, "Usage: #ipban [xxx.xxx.xxx.xxx]"); + c->Message(0, "Usage: #ipban [xxx.xxx.xxx.xxx]"); } else { if(database.AddBannedIP(sep->arg[1], c->GetName())) { c->Message(0, "%s has been successfully added to the Banned_IPs table by %s",sep->arg[1], c->GetName()); @@ -6635,7 +6640,7 @@ void command_revoke(Client *c, const Seperator *sep) if(sep->arg[1][0] == 0 || sep->arg[2][0] == 0) { - c->Message(0, "Usage: #revoke [charname] [1/0]"); + c->Message(0, "Usage: #revoke [charname] [1/0]"); } else { @@ -6679,7 +6684,7 @@ void command_revoke(Client *c, const Seperator *sep) void command_oocmute(Client *c, const Seperator *sep) { if(sep->arg[1][0] == 0 || !(sep->arg[1][0] == '1' || sep->arg[1][0] == '0')) - c->Message(0, "Usage: #oocmute [1/0]"); + c->Message(0, "Usage: #oocmute [1/0]"); else { ServerPacket * outapp = new ServerPacket (ServerOP_OOCMute,1); *(outapp->pBuffer)=atoi(sep->arg[1]); @@ -8086,9 +8091,9 @@ void command_bestz(Client *c, const Seperator *sep) { WaterRegionType RegionType; float z; - if(c->GetTarget()) { + if(c->GetTarget()) { z=c->GetTarget()->GetZ(); - RegionType = zone->watermap->BSPReturnRegionType(1, c->GetTarget()->GetX(), c->GetTarget()->GetY(), z); + RegionType = zone->watermap->BSPReturnRegionType(1, c->GetTarget()->GetX(), c->GetTarget()->GetY(), z); c->Message(0,"InWater returns %d", zone->watermap->InWater(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z)); c->Message(0,"InLava returns %d", zone->watermap->InLava(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z)); @@ -8106,7 +8111,7 @@ void command_bestz(Client *c, const Seperator *sep) { case RegionTypeWater: { c->Message(0,"You/your target are in Water."); break; } case RegionTypeLava: { c->Message(0,"You/your target are in Lava."); break; } case RegionTypeVWater: { c->Message(0,"You/your target are in VWater (Icy Water?)."); break; } - default: c->Message(0,"You/your target are in an unknown region type."); + default: c->Message(0,"You/your target are in an unknown region type."); } } @@ -8484,17 +8489,17 @@ void command_rules(Client *c, const Seperator *sep) { //super-command for managing rules settings if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) { c->Message(0, "Syntax: #rules [subcommand]."); - c->Message(0, "-- Rule Set Manipulation --"); + c->Message(0, "-- Rule Set Manipulation --"); c->Message(0, "...listsets - List avaliable rule sets"); c->Message(0, "...current - gives the name of the ruleset currently running in this zone"); c->Message(0, "...reload - Reload the selected ruleset in this zone"); c->Message(0, "...switch (ruleset name) - Change the selected ruleset and load it"); - c->Message(0, "...load (ruleset name) - Load a ruleset in just this zone without changing the selected set"); + c->Message(0, "...load (ruleset name) - Load a ruleset in just this zone without changing the selected set"); //too lazy to write this right now: // c->Message(0, "...wload (ruleset name) - Load a ruleset in all zones without changing the selected set"); - c->Message(0, "...store [ruleset name] - Store the running ruleset as the specified name"); + c->Message(0, "...store [ruleset name] - Store the running ruleset as the specified name"); c->Message(0, "---------------------"); - c->Message(0, "-- Running Rule Manipulation --"); + c->Message(0, "-- Running Rule Manipulation --"); c->Message(0, "...reset - Reset all rules to their default values"); c->Message(0, "...get [rule] - Get the specified rule's local value"); c->Message(0, "...set (rule) (value) - Set the specified rule to the specified value locally only"); @@ -8506,7 +8511,7 @@ void command_rules(Client *c, const Seperator *sep) { if(!strcasecmp(sep->arg[1], "current")) { c->Message(0, "Currently running ruleset '%s' (%d)", RuleManager::Instance()->GetActiveRuleset(), - RuleManager::Instance()->GetActiveRulesetID()); + RuleManager::Instance()->GetActiveRulesetID()); } else if(!strcasecmp(sep->arg[1], "listsets")) { std::map sets; if(!RuleManager::Instance()->ListRulesets(&database, sets)) { @@ -8524,7 +8529,7 @@ void command_rules(Client *c, const Seperator *sep) { } else if(!strcasecmp(sep->arg[1], "reload")) { RuleManager::Instance()->LoadRules(&database, RuleManager::Instance()->GetActiveRuleset()); c->Message(0, "The active ruleset (%s (%d)) has been reloaded", RuleManager::Instance()->GetActiveRuleset(), - RuleManager::Instance()->GetActiveRulesetID()); + RuleManager::Instance()->GetActiveRulesetID()); } else if(!strcasecmp(sep->arg[1], "switch")) { //make sure this is a valid rule set.. int rsid = RuleManager::Instance()->GetRulesetID(&database, sep->arg[2]); @@ -8672,7 +8677,7 @@ void command_task(Client *c, const Seperator *sep) { //super-command for managing tasks if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) { c->Message(0, "Syntax: #task [subcommand]."); - c->Message(0, "-- Task System Commands --"); + c->Message(0, "-- Task System Commands --"); c->Message(0, "...show - List active tasks for a client"); c->Message(0, "...update [Count]"); c->Message(0, "...reloadall - Reload all Task information from the database"); @@ -9052,163 +9057,163 @@ void command_refreshgroup(Client *c, const Seperator *sep) } void command_advnpcspawn(Client *c, const Seperator *sep) - { - Mob *target=c->GetTarget(); - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; +{ + Mob *target=c->GetTarget(); + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; uint32 last_insert_id = 0; - if (strcasecmp(sep->arg[1], "maketype") == 0){ - if(target && target->IsNPC()) - { - database.NPCSpawnDB(6, zone->GetShortName(), zone->GetInstanceVersion(), c, target->CastToNPC()); - } - else - c->Message(0, "Target Required!"); - } - else if (strcasecmp(sep->arg[1], "makegroup") == 0) { - if(sep->arg[2]) - { - if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawngroup (name,spawn_limit,dist,max_x,min_x,max_y,min_y,delay) VALUES (\"%s\",%i,%f,%f,%f,%f,%f,%i)", sep->arg[2], (sep->arg[3]?atoi(sep->arg[3]):0), (sep->arg[4]?atof(sep->arg[4]):0), (sep->arg[5]?atof(sep->arg[5]):0), (sep->arg[6]?atof(sep->arg[6]):0), (sep->arg[7]?atof(sep->arg[7]):0), (sep->arg[8]?atof(sep->arg[8]):0), (sep->arg[9]?atoi(sep->arg[9]):0)), errbuf, 0, 0, &last_insert_id)) - { - c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); - c->Message(13, errbuf); - } - else - { - c->LogSQL(query); - c->Message(0, "Group ID %i created successfully!", last_insert_id); - } - safe_delete_array(query); - } - else - { - c->Message(0, "Format: #advnpdspawn makegroup [spawn limit] [dist] [max x] [min x] [max y] [min y] [delay]"); - } - } - else if (strcasecmp(sep->arg[1], "addgroupentry") == 0) { - if(atoi(sep->arg[2]) && atoi(sep->arg[3]) && atoi(sep->arg[4])) - { - if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawnentry (spawngroupID,npcID,chance) VALUES (%i,%i,%i)", atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), errbuf, 0, 0, &last_insert_id))) - { - c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); - c->Message(13, errbuf); - } - else - { - c->LogSQL(query); - c->Message(0, "NPC %i added to group %i with %i chance!", atoi(sep->arg[3]), atoi(sep->arg[2]), atoi(sep->arg[4]) ); - } - safe_delete(query); - } - else - { - c->Message(0, "Format: #advnpdspawn addgroupentry "); - } - } - else if (strcasecmp(sep->arg[1], "editgroupbox") == 0) { - if(atof(sep->arg[2]) && atof(sep->arg[3]) && atof(sep->arg[4]) && atof(sep->arg[5]) && atof(sep->arg[6]) && atof(sep->arg[7]) && atof(sep->arg[8])) - { - if (!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawngroup SET dist='%f',max_x='%f',min_x='%f',max_y='%f',min_y='%f',delay='%i' WHERE id='%i'", atof(sep->arg[3]),atof(sep->arg[4]),atof(sep->arg[5]),atof(sep->arg[6]),atof(sep->arg[7]),atoi(sep->arg[8]),atoi(sep->arg[2]), errbuf, 0, 0, &last_insert_id))) - { - c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); - c->Message(13, errbuf); - } - else - { - c->LogSQL(query); - c->Message(0, "Group ID %i created successfully!", last_insert_id); - } - safe_delete_array(query); - } - else - { - c->Message(0, "Format: #advnpdspawn editgroupbox "); - } - } - else if (strcasecmp(sep->arg[1], "cleargroupbox") == 0) { - if(atoi(sep->arg[2])) - { - if (!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawngroup SET dist='0',max_x='0',min_x='0',max_y='0',min_y='0',delay='0' WHERE id='%i'",atoi(sep->arg[2])), errbuf, 0, 0, &last_insert_id)) - { - c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); - c->Message(13, errbuf); - } - else - { - c->LogSQL(query); - c->Message(0, "Group ID %i created successfully!", last_insert_id); - } - safe_delete_array(query); - } - else - { - c->Message(0, "Format: #advnpdspawn cleargroupbox "); - } - } - else if (strcasecmp(sep->arg[1], "addgroupspawn") == 0 && atoi(sep->arg[2])!=0) { - database.NPCSpawnDB(5, zone->GetShortName(), zone->GetInstanceVersion(), c, 0, atoi(sep->arg[2])); - c->Message(0, "Mob of group %i added successfully!", atoi(sep->arg[2])); - } - else if (strcasecmp(sep->arg[1], "removegroupspawn") == 0) { - if (!target || !target->IsNPC()) - c->Message(0, "Error: Need an NPC target."); - else { - Spawn2* s2 = target->CastToNPC()->respawn2; + if (strcasecmp(sep->arg[1], "maketype") == 0){ + if(target && target->IsNPC()) + { + database.NPCSpawnDB(6, zone->GetShortName(), zone->GetInstanceVersion(), c, target->CastToNPC()); + } + else + c->Message(0, "Target Required!"); + } + else if (strcasecmp(sep->arg[1], "makegroup") == 0) { + if(sep->arg[2]) + { + if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawngroup (name,spawn_limit,dist,max_x,min_x,max_y,min_y,delay) VALUES (\"%s\",%i,%f,%f,%f,%f,%f,%i)", sep->arg[2], (sep->arg[3]?atoi(sep->arg[3]):0), (sep->arg[4]?atof(sep->arg[4]):0), (sep->arg[5]?atof(sep->arg[5]):0), (sep->arg[6]?atof(sep->arg[6]):0), (sep->arg[7]?atof(sep->arg[7]):0), (sep->arg[8]?atof(sep->arg[8]):0), (sep->arg[9]?atoi(sep->arg[9]):0)), errbuf, 0, 0, &last_insert_id)) + { + c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); + c->Message(13, errbuf); + } + else + { + c->LogSQL(query); + c->Message(0, "Group ID %i created successfully!", last_insert_id); + } + safe_delete_array(query); + } + else + { + c->Message(0, "Format: #advnpdspawn makegroup [spawn limit] [dist] [max x] [min x] [max y] [min y] [delay]"); + } + } + else if (strcasecmp(sep->arg[1], "addgroupentry") == 0) { + if(atoi(sep->arg[2]) && atoi(sep->arg[3]) && atoi(sep->arg[4])) + { + if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawnentry (spawngroupID,npcID,chance) VALUES (%i,%i,%i)", atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), errbuf, 0, 0, &last_insert_id))) + { + c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); + c->Message(13, errbuf); + } + else + { + c->LogSQL(query); + c->Message(0, "NPC %i added to group %i with %i chance!", atoi(sep->arg[3]), atoi(sep->arg[2]), atoi(sep->arg[4]) ); + } + safe_delete(query); + } + else + { + c->Message(0, "Format: #advnpdspawn addgroupentry "); + } + } + else if (strcasecmp(sep->arg[1], "editgroupbox") == 0) { + if(atof(sep->arg[2]) && atof(sep->arg[3]) && atof(sep->arg[4]) && atof(sep->arg[5]) && atof(sep->arg[6]) && atof(sep->arg[7]) && atof(sep->arg[8])) + { + if (!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawngroup SET dist='%f',max_x='%f',min_x='%f',max_y='%f',min_y='%f',delay='%i' WHERE id='%i'", atof(sep->arg[3]),atof(sep->arg[4]),atof(sep->arg[5]),atof(sep->arg[6]),atof(sep->arg[7]),atoi(sep->arg[8]),atoi(sep->arg[2]), errbuf, 0, 0, &last_insert_id))) + { + c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); + c->Message(13, errbuf); + } + else + { + c->LogSQL(query); + c->Message(0, "Group ID %i created successfully!", last_insert_id); + } + safe_delete_array(query); + } + else + { + c->Message(0, "Format: #advnpdspawn editgroupbox "); + } + } + else if (strcasecmp(sep->arg[1], "cleargroupbox") == 0) { + if(atoi(sep->arg[2])) + { + if (!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawngroup SET dist='0',max_x='0',min_x='0',max_y='0',min_y='0',delay='0' WHERE id='%i'",atoi(sep->arg[2])), errbuf, 0, 0, &last_insert_id)) + { + c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); + c->Message(13, errbuf); + } + else + { + c->LogSQL(query); + c->Message(0, "Group ID %i created successfully!", last_insert_id); + } + safe_delete_array(query); + } + else + { + c->Message(0, "Format: #advnpdspawn cleargroupbox "); + } + } + else if (strcasecmp(sep->arg[1], "addgroupspawn") == 0 && atoi(sep->arg[2])!=0) { + database.NPCSpawnDB(5, zone->GetShortName(), zone->GetInstanceVersion(), c, 0, atoi(sep->arg[2])); + c->Message(0, "Mob of group %i added successfully!", atoi(sep->arg[2])); + } + else if (strcasecmp(sep->arg[1], "removegroupspawn") == 0) { + if (!target || !target->IsNPC()) + c->Message(0, "Error: Need an NPC target."); + else { + Spawn2* s2 = target->CastToNPC()->respawn2; - if(!s2) { - c->Message(0, "removegroupspawn FAILED -- cannot determine which spawn entry in the database this mob came from."); - } - else - { - if(database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM spawn2 WHERE id='%i'",s2->GetID()), errbuf)) - { - c->LogSQL(query); - c->Message(0, "Spawnpoint Removed successfully."); - target->Depop(false); - } - else - { - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); - } - } - } - else if (strcasecmp(sep->arg[1], "movespawn") == 0) { - if (!target || !target->IsNPC()) - c->Message(0, "Error: Need an NPC target."); - else { - Spawn2* s2 = target->CastToNPC()->respawn2; + if(!s2) { + c->Message(0, "removegroupspawn FAILED -- cannot determine which spawn entry in the database this mob came from."); + } + else + { + if(database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM spawn2 WHERE id='%i'",s2->GetID()), errbuf)) + { + c->LogSQL(query); + c->Message(0, "Spawnpoint Removed successfully."); + target->Depop(false); + } + else + { + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, errbuf); + } + safe_delete_array(query); + } + } + } + else if (strcasecmp(sep->arg[1], "movespawn") == 0) { + if (!target || !target->IsNPC()) + c->Message(0, "Error: Need an NPC target."); + else { + Spawn2* s2 = target->CastToNPC()->respawn2; - if(!s2) { - c->Message(0, "movespawn FAILED -- cannot determine which spawn entry in the database this mob came from."); - } - else - { - if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET x='%f', y='%f', z='%f', heading='%f' WHERE id='%i'",c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(),s2->GetID()), errbuf)) - { - c->LogSQL(query); - c->Message(0, "Updating coordinates successful."); - target->CastToNPC()->GMMove(c->GetX(), c->GetY(), c->GetZ(), c->GetHeading()); - target->CastToNPC()->SaveGuardSpot(true); - target->SendPosition(); - } - else - { - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); - } - } - } - else if (strcasecmp(sep->arg[1], "editrespawn") == 0) { - if (!target || !target->IsNPC()) - c->Message(0, "Error: Need an NPC target."); - else { - Spawn2* s2 = target->CastToNPC()->respawn2; + if(!s2) { + c->Message(0, "movespawn FAILED -- cannot determine which spawn entry in the database this mob came from."); + } + else + { + if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET x='%f', y='%f', z='%f', heading='%f' WHERE id='%i'",c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(),s2->GetID()), errbuf)) + { + c->LogSQL(query); + c->Message(0, "Updating coordinates successful."); + target->CastToNPC()->GMMove(c->GetX(), c->GetY(), c->GetZ(), c->GetHeading()); + target->CastToNPC()->SaveGuardSpot(true); + target->SendPosition(); + } + else + { + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, errbuf); + } + safe_delete_array(query); + } + } + } + else if (strcasecmp(sep->arg[1], "editrespawn") == 0) { + if (!target || !target->IsNPC()) + c->Message(0, "Error: Need an NPC target."); + else { + Spawn2* s2 = target->CastToNPC()->respawn2; uint32 new_rs = 0; uint32 new_var = s2->GetVariance(); @@ -9227,61 +9232,61 @@ void command_advnpcspawn(Client *c, const Seperator *sep) new_var = atoi(sep->arg[3]); } - if(!s2) { - c->Message(0, "editrespawn FAILED -- cannot determine which spawn entry in the database this mob came from."); - } - else - { - if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET respawntime=%u, variance=%u WHERE id='%i'", new_rs, new_var, s2->GetID()), errbuf)) - { - c->LogSQL(query); - c->Message(0, "Updating respawn timer successful."); + if(!s2) { + c->Message(0, "editrespawn FAILED -- cannot determine which spawn entry in the database this mob came from."); + } + else + { + if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET respawntime=%u, variance=%u WHERE id='%i'", new_rs, new_var, s2->GetID()), errbuf)) + { + c->LogSQL(query); + c->Message(0, "Updating respawn timer successful."); s2->SetRespawnTimer(new_rs); s2->SetVariance(new_var); - } - else - { - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); - } - } - } + } + else + { + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, errbuf); + } + safe_delete_array(query); + } + } + } else if (strcasecmp(sep->arg[1], "setversion") == 0) { int16 Version = 0; - if (!target || !target->IsNPC()) - c->Message(0, "Error: Need an NPC target."); - else { + if (!target || !target->IsNPC()) + c->Message(0, "Error: Need an NPC target."); + else { if(sep->IsNumber(2)){ Version = atoi(sep->arg[2]); - if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET version=%i WHERE spawngroupID='%i'", Version, c->GetTarget()->CastToNPC()->GetSp2()), errbuf)){ - c->LogSQL(query); - c->Message(0, "Version change to %i was successful from SpawnGroupID %i", Version, c->GetTarget()->CastToNPC()->GetSp2()); + if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET version=%i WHERE spawngroupID='%i'", Version, c->GetTarget()->CastToNPC()->GetSp2()), errbuf)){ + c->LogSQL(query); + c->Message(0, "Version change to %i was successful from SpawnGroupID %i", Version, c->GetTarget()->CastToNPC()->GetSp2()); c->GetTarget()->Depop(false); - } - else{ - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); + } + else{ + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, errbuf); + } + safe_delete_array(query); } else{ c->Message(0, "setversion FAILED -- You must set a version number"); return; } } - } - else if (strcasecmp(sep->arg[1], "testload") == 0 && atoi(sep->arg[2])!=0) { - database.LoadSpawnGroupsByID(atoi(sep->arg[2]),&zone->spawn_group_list); - c->Message(0, "Group %i loaded successfully!", atoi(sep->arg[2])); - } - else { - c->Message(0, "Error: #advnpcspawn: Invalid command."); - c->Message(0, "Usage: #advnpcspawn [maketype|makegroup|addgroupentry|addgroupspawn|setversion]"); - c->Message(0, "Usage: #advnpcspawn [removegroupspawn|movespawn|editrespawn|editgroupbox|cleargroupbox]"); - } - } + } + else if (strcasecmp(sep->arg[1], "testload") == 0 && atoi(sep->arg[2])!=0) { + database.LoadSpawnGroupsByID(atoi(sep->arg[2]),&zone->spawn_group_list); + c->Message(0, "Group %i loaded successfully!", atoi(sep->arg[2])); + } + else { + c->Message(0, "Error: #advnpcspawn: Invalid command."); + c->Message(0, "Usage: #advnpcspawn [maketype|makegroup|addgroupentry|addgroupspawn|setversion]"); + c->Message(0, "Usage: #advnpcspawn [removegroupspawn|movespawn|editrespawn|editgroupbox|cleargroupbox]"); + } +} void command_aggrozone(Client *c, const Seperator *sep) { if(!c) @@ -9513,7 +9518,7 @@ void command_setstartzone(Client *c, const Seperator *sep) target = c->GetTarget()->CastToClient(); else { c->Message(0, "Usage: (needs PC target) #setstartzone zonename"); - c->Message(0, "Optional Usage: Use '#setstartzone reset' or '#setstartzone 0' to clear a starting zone. A player can select a starting zone using /setstartcity"); + c->Message(0, "Optional Usage: Use '#setstartzone reset' or '#setstartzone 0' to clear a starting zone. Player can select a starting zone using /setstartcity"); return; } @@ -9654,8 +9659,8 @@ void command_object(Client *c, const Seperator *sep) " ORDER BY id", zone->GetZoneID(), zone->GetInstanceVersion(), - c->GetX() - radius, // Yes, we're actually using a bounding box instead of a radius. - c->GetX() + radius, // Much less processing power used this way. + c->GetX() - radius, // Yes, we're actually using a bounding box instead of a radius. + c->GetX() + radius, // Much less processing power used this way. c->GetY() - radius, c->GetY() + radius, c->GetZ() - radius, @@ -9856,8 +9861,8 @@ void command_object(Client *c, const Seperator *sep) "AND (posz BETWEEN %.1f AND %.1f)", zone->GetZoneID(), zone->GetInstanceVersion(), - od.x - 0.2f, od.x + 0.2f, // Yes, we're actually using a bounding box instead of a radius. - od.y - 0.2f, od.y + 0.2f, // Much less processing power used this way. + od.x - 0.2f, od.x + 0.2f, // Yes, we're actually using a bounding box instead of a radius. + od.y - 0.2f, od.y + 0.2f, // Much less processing power used this way. od.z - 0.2f, od.z + 0.2f); // It's pretty forgiving, though, allowing for close-proximity objects iObjectsFound = 0; @@ -10271,8 +10276,8 @@ void command_object(Client *c, const Seperator *sep) if ((sep->argnum < 2) || // Not enough arguments ((id = atoi(sep->arg[2])) == 0) || // ID not specified (((sep->arg[3][0] < '0') || (sep->arg[3][0] > '9')) && - ((sep->arg[3][0] & 0xDF) != 'T') && - (sep->arg[3][0] != '-') && (sep->arg[3][0] != '.'))) // Location argument not specified correctly + ((sep->arg[3][0] & 0xDF) != 'T') && + (sep->arg[3][0] != '-') && (sep->arg[3][0] != '.'))) // Location argument not specified correctly { c->Message(0, "Usage: #object Move (ObjectID) ToMe|(x y z [h])"); @@ -11038,7 +11043,7 @@ void command_emoteview(Client *c, const Seperator *sep) while(iterator.MoreElements()) { NPC_Emote_Struct* nes = iterator.GetData(); - if(emoteid == nes->emoteid) + if(emoteid == nes->emoteid) { c->Message(0, "EmoteID: %i Event: %i Type: %i Text: %s", nes->emoteid, nes->event_, nes->type, nes->text); count++; @@ -11069,7 +11074,7 @@ void command_emotesearch(Client *c, const Seperator *sep) while(iterator.MoreElements()) { NPC_Emote_Struct* nes = iterator.GetData(); - if(emoteid == nes->emoteid) + if(emoteid == nes->emoteid) { c->Message(0, "EmoteID: %i Event: %i Type: %i Text: %s", nes->emoteid, nes->event_, nes->type, nes->text); count++; @@ -11305,7 +11310,7 @@ void command_camerashake(Client *c, const Seperator *sep) { if(c) { - if(sep->arg[1][0] && sep->arg[2][0]) + if(sep->arg[1][0] && sep->arg[2][0]) { ServerPacket *pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct)); memset(pack->pBuffer, 0, sizeof(pack->pBuffer)); @@ -11439,9 +11444,9 @@ void command_mysql(Client *c, const Seperator *sep) int argnum = 3; bool Options = false, Optionh = false; bool Fail = false; while(sep->arg[argnum] && strlen(sep->arg[argnum]) > 1){ switch(sep->arg[argnum][1]){ - case 's': Options = true; break; - case 'h': Optionh = true; break; - default: c->Message(15, "%s, there is no option '%c'", c->GetName(), sep->arg[argnum][1]); Fail = true; + case 's': Options = true; break; + case 'h': Optionh = true; break; + default: c->Message(15, "%s, there is no option '%c'", c->GetName(), sep->arg[argnum][1]); Fail = true; } ++argnum; } @@ -11485,7 +11490,7 @@ void command_mysql(Client *c, const Seperator *sep) LineVec.push_back(LineText.str()); LineText.str(""); } - LineText << fields[i].name << ":" << "[" << (row[i] ? row[i] : "nullptr") << "] "; + LineText << fields[i].name << ":" << "[" << (row[i] ? row[i] : "nullptr") << "] "; } LineVec.push_back(LineText.str()); @@ -11595,11 +11600,11 @@ void command_zopp(Client *c, const Seperator *sep) return; } - int16 item_status = 0; - const Item_Struct* item = database.GetItem(itemid); - if(item) { - item_status = static_cast(item->MinStatus); - } + int16 item_status = 0; + const Item_Struct* item = database.GetItem(itemid); + if(item) { + item_status = static_cast(item->MinStatus); + } if (item_status > c->Admin()) { c->Message(13, "Error: Insufficient status to use this command."); return; @@ -11631,3 +11636,4 @@ void command_augmentitem(Client *c, const Seperator *sep) Object::HandleAugmentation(c, in_augment, c->GetTradeskillObject()); safe_delete_array(in_augment); } + diff --git a/zone/command.h b/zone/command.h index d9db1439f..fc64dfcc9 100644 --- a/zone/command.h +++ b/zone/command.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 */ @@ -32,12 +32,12 @@ typedef void (*CmdFuncPtr)(Client *,const Seperator *); // this is a command list item /*struct cl_struct { - char *command[CMDALIASES]; // the command(s) - char *desc; // description of command - CmdFuncPtr function; // the function to call - int access; // the required 'status' level + char *command[CMDALIASES]; // the command(s) + char *desc; // description of command + CmdFuncPtr function; // the function to call + int access; // the required 'status' level - struct cl_struct *next; // linked list + struct cl_struct *next; // linked list }; extern struct cl_struct *commandlist; // the head of the list diff --git a/zone/common.h b/zone/common.h index f95351e83..ddc17118f 100644 --- a/zone/common.h +++ b/zone/common.h @@ -156,16 +156,16 @@ struct Buffs_Struct { uint16 spellid; uint8 casterlevel; uint16 casterid; // Maybe change this to a pointer sometime, but gotta make sure it's 0'd when it no longer points to anything - char caster_name[64]; - int32 ticsremaining; - uint32 counters; + char caster_name[64]; + int32 ticsremaining; + uint32 counters; uint32 numhits; //the number of physical hits this buff can take before it fades away, lots of druid armor spells take advantage of this mixed with powerful effects uint32 melee_rune; uint32 magic_rune; uint8 deathSaveSuccessChance; uint8 deathsaveCasterAARank; - bool persistant_buff; - bool client; //True if the caster is a client + bool persistant_buff; + bool client; //True if the caster is a client bool UpdateClient; }; @@ -224,14 +224,14 @@ struct StatBonuses { DmgShieldType DamageShieldType; int SpellDamageShield; int SpellShield; - int ReverseDamageShield; // this is damage done to the mob when it attacks + int ReverseDamageShield; // this is damage done to the mob when it attacks uint16 ReverseDamageShieldSpellID; DmgShieldType ReverseDamageShieldType; int movementspeed; int16 haste; int16 hastetype2; int16 hastetype3; - int16 inhibitmelee; + int16 inhibitmelee; float AggroRange; // when calculate just replace original value with this float AssistRange; int16 skillmod[HIGHEST_SKILL+1]; @@ -245,65 +245,65 @@ struct StatBonuses { int8 hatemod; int32 EnduranceReduction; - int16 StrikeThrough; // PoP: Strike Through % - int16 MeleeMitigation; //i = Shielding - int16 CriticalHitChance[HIGHEST_SKILL+2]; //i - int16 CriticalSpellChance; //i - int16 SpellCritDmgIncrease; //i - int16 DotCritDmgIncrease; //i - int16 CriticalHealChance; //i - int16 CriticalHealOverTime; //i - int16 CriticalDoTChance; //i - int16 CrippBlowChance; // - int16 AvoidMeleeChance; //AvoidMeleeChance/10 == % chance i = Avoidance - int16 RiposteChance; //i - int16 DodgeChance; //i - int16 ParryChance; //i - int16 DualWieldChance; //i - int16 DoubleAttackChance; //i - int16 TripleAttackChance; //i - int16 ResistSpellChance; //i - int16 ResistFearChance; //i - bool Fearless; //i - bool IsFeared; //i - int16 StunResist; //i - int16 MeleeSkillCheck; //i - uint8 MeleeSkillCheckSkill; - int16 HitChance; //HitChance/15 == % increase i = Accuracy (Item: Accuracy) - int16 HitChanceEffect[HIGHEST_SKILL+2]; //Spell effect Chance to Hit, straight percent increase - int16 DamageModifier[HIGHEST_SKILL+2]; //i - int16 MinDamageModifier[HIGHEST_SKILL+2]; //i - int16 ProcChance; // ProcChance/10 == % increase i = CombatEffects - int16 ExtraAttackChance; + int16 StrikeThrough; // PoP: Strike Through % + int16 MeleeMitigation; //i = Shielding + int16 CriticalHitChance[HIGHEST_SKILL+2]; //i + int16 CriticalSpellChance; //i + int16 SpellCritDmgIncrease; //i + int16 DotCritDmgIncrease; //i + int16 CriticalHealChance; //i + int16 CriticalHealOverTime; //i + int16 CriticalDoTChance; //i + int16 CrippBlowChance; // + int16 AvoidMeleeChance; //AvoidMeleeChance/10 == % chance i = Avoidance + int16 RiposteChance; //i + int16 DodgeChance; //i + int16 ParryChance; //i + int16 DualWieldChance; //i + int16 DoubleAttackChance; //i + int16 TripleAttackChance; //i + int16 ResistSpellChance; //i + int16 ResistFearChance; //i + bool Fearless; //i + bool IsFeared; //i + int16 StunResist; //i + int16 MeleeSkillCheck; //i + uint8 MeleeSkillCheckSkill; + int16 HitChance; //HitChance/15 == % increase i = Accuracy (Item: Accuracy) + int16 HitChanceEffect[HIGHEST_SKILL+2]; //Spell effect Chance to Hit, straight percent increase + int16 DamageModifier[HIGHEST_SKILL+2]; //i + int16 MinDamageModifier[HIGHEST_SKILL+2]; //i + int16 ProcChance; // ProcChance/10 == % increase i = CombatEffects + int16 ExtraAttackChance; int16 DoTShielding; - int16 DivineSaveChance[2]; // Second Chance (base1 = chance, base2 = spell on trigger) + int16 DivineSaveChance[2]; // Second Chance (base1 = chance, base2 = spell on trigger) uint16 DeathSave[4]; // Death Pact [0](value = 1 partial 2 = full) [1]=slot [2]=LvLimit [3]=HealAmt - int16 FlurryChance; + int16 FlurryChance; int16 Accuracy[HIGHEST_SKILL+2]; //Accuracy/15 == % increase [Spell Effect: Accuracy) - int16 HundredHands; //extra haste, stacks with all other haste i + int16 HundredHands; //extra haste, stacks with all other haste i int8 MeleeLifetap; //i - int16 HealRate; // Spell effect that influences effectiveness of heals - int16 MaxHPChange; // Spell Effect - int16 SkillDmgTaken[HIGHEST_SKILL+2]; // All Skills + -1 - int32 HealAmt; // Item Effect - int32 SpellDmg; // Item Effect - int32 Clairvoyance; // Item Effect - int16 DSMitigation; // Item Effect - int16 DSMitigationOffHand; // Lowers damage shield from off hand attacks. - uint32 SpellTriggers[MAX_SPELL_TRIGGER]; // Innate/Spell/Item Spells that trigger when you cast - uint32 SpellOnKill[MAX_SPELL_TRIGGER*3]; // Chance to proc after killing a mob - uint32 SpellOnDeath[MAX_SPELL_TRIGGER*2]; // Chance to have effect cast when you die - int16 CritDmgMob[HIGHEST_SKILL+2]; // All Skills + -1 - int16 SkillReuseTime[HIGHEST_SKILL+1]; // Reduces skill timers - int16 SkillDamageAmount[HIGHEST_SKILL+2]; // All Skills + -1 - int16 TwoHandBluntBlock; // chance to block when wielding two hand blunt weapon - uint16 ItemManaRegenCap; // Increases the amount of mana you have can over the cap(aa effect) - int16 GravityEffect; // Indictor of spell effect + int16 HealRate; // Spell effect that influences effectiveness of heals + int16 MaxHPChange; // Spell Effect + int16 SkillDmgTaken[HIGHEST_SKILL+2]; // All Skills + -1 + int32 HealAmt; // Item Effect + int32 SpellDmg; // Item Effect + int32 Clairvoyance; // Item Effect + int16 DSMitigation; // Item Effect + int16 DSMitigationOffHand; // Lowers damage shield from off hand attacks. + uint32 SpellTriggers[MAX_SPELL_TRIGGER]; // Innate/Spell/Item Spells that trigger when you cast + uint32 SpellOnKill[MAX_SPELL_TRIGGER*3]; // Chance to proc after killing a mob + uint32 SpellOnDeath[MAX_SPELL_TRIGGER*2]; // Chance to have effect cast when you die + int16 CritDmgMob[HIGHEST_SKILL+2]; // All Skills + -1 + int16 SkillReuseTime[HIGHEST_SKILL+1]; // Reduces skill timers + int16 SkillDamageAmount[HIGHEST_SKILL+2]; // All Skills + -1 + int16 TwoHandBluntBlock; // chance to block when wielding two hand blunt weapon + uint16 ItemManaRegenCap; // Increases the amount of mana you have can over the cap(aa effect) + int16 GravityEffect; // Indictor of spell effect bool AntiGate; // spell effect that prevents gating bool MagicWeapon; // spell effect that makes weapon magical int16 IncreaseBlockChance; // overall block chance modifier uint16 PersistantCasting; // chance to continue casting through a stun - int XPRateMod; //i + int XPRateMod; //i int HPPercCap; //Spell effect that limits you to being healed/regening beyond a % of your max int ManaPercCap; // ^^ int EndPercCap; // ^^ @@ -311,19 +311,19 @@ struct StatBonuses { //uint16 BlockSpellEffect[EFFECT_COUNT]; // Prevents spells with certain effects from landing on you *no longer used bool ImmuneToFlee; // Bypass the fleeing flag uint16 VoiceGraft; // Stores the ID of the mob with which to talk through - uint16 SpellProcChance; // chance to proc from sympathetic spell effects + uint16 SpellProcChance; // chance to proc from sympathetic spell effects uint16 CharmBreakChance; // chance to break charm - int16 SongRange; // increases range of beneficial bard songs - uint16 HPToManaConvert; // Uses HP to cast spells at specific conversion - uint16 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have. + int16 SongRange; // increases range of beneficial bard songs + uint16 HPToManaConvert; // Uses HP to cast spells at specific conversion + uint16 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have. bool NegateEffects; // Check if you contain a buff with negate effect. (only spellbonuses) - int16 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage - uint16 NegateAttacks[2]; // 0 = bool HasEffect 1 = Buff Slot + int16 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage + uint16 NegateAttacks[2]; // 0 = bool HasEffect 1 = Buff Slot uint16 MitigateMeleeRune[2]; // 0 = Mitigation value 1 = Buff Slot uint16 MitigateSpellRune[2]; // 0 = Mitigation value 1 = Buff Slot uint16 ManaAbsorbPercentDamage[2]; // 0 = Mitigation value 1 = Buff Slot - int16 ShieldBlock; // Chance to Shield Block - int16 BlockBehind; // Chance to Block Behind (with our without shield) + int16 ShieldBlock; // Chance to Shield Block + int16 BlockBehind; // Chance to Block Behind (with our without shield) //bool AbsorbMagicAtt; // Magic Rune *Need to be implemented for NegateEffect //bool MeleeRune; // Melee Rune *Need to be implemented for NegateEffect @@ -336,51 +336,51 @@ struct StatBonuses { int16 DoubleSpecialAttack; // Chance to to perform a double special attack (ie flying kick 2x) int16 SpecialAttackKBProc[2]; // Chance to to do a knockback from special attacks. (0 = chance 1 = Skill) uint8 FrontalStunResist; // Chance to resist a frontal stun - int16 BindWound; // Increase amount of HP by percent. - int16 MaxBindWound; // Increase max amount of HP you can bind wound. - int16 ChannelChanceSpells; // Modify chance to channel a spell. - int16 ChannelChanceItems; // Modify chance to channel a items. + int16 BindWound; // Increase amount of HP by percent. + int16 MaxBindWound; // Increase max amount of HP you can bind wound. + int16 ChannelChanceSpells; // Modify chance to channel a spell. + int16 ChannelChanceItems; // Modify chance to channel a items. uint8 SeeInvis; // See Invs. uint8 TripleBackstab; // Chance to triple backstab bool FrontalBackstabMinDmg; // Allow frontal backstabs for min damage - uint8 FrontalBackstabChance; // Chance to backstab from the front for full damage + uint8 FrontalBackstabChance; // Chance to backstab from the front for full damage uint8 ConsumeProjectile; // Chance to not consume arrow. - uint8 ForageAdditionalItems; // Chance to forage another item. - uint8 SalvageChance; // Chance to salvage a tradeskill components on fail. - uint16 ArcheryDamageModifier; // Increase Archery Damage by percent + uint8 ForageAdditionalItems; // Chance to forage another item. + uint8 SalvageChance; // Chance to salvage a tradeskill components on fail. + uint16 ArcheryDamageModifier; // Increase Archery Damage by percent bool SecondaryDmgInc; // Allow off hand weapon to recieve damage bonus. uint16 GiveDoubleAttack; // Allow classes to double attack with a specified chance. int16 SlayUndead[2]; // Allow classes to do extra damage verse undead.(base1 = rate, base2 = damage mod) - int16 PetCriticalHit; // Allow pets to critical hit with % value. + int16 PetCriticalHit; // Allow pets to critical hit with % value. int16 PetAvoidance; // Pet avoidance chance. - int16 CombatStability; // Melee damage mitigation. - int16 GiveDoubleRiposte[3]; // 0=Regular Chance, 1=Skill Attack Chance, 2=Skill + int16 CombatStability; // Melee damage mitigation. + int16 GiveDoubleRiposte[3]; // 0=Regular Chance, 1=Skill Attack Chance, 2=Skill uint16 RaiseSkillCap[2]; // Raise a specific skill cap (1 = value, 2=skill) - int16 Ambidexterity; // Increase chance to duel wield by adding bonus 'skill'. - int16 PetMaxHP; // Increase the max hp of your pet. - int16 PetFlurry; // Chance for pet to flurry. + int16 Ambidexterity; // Increase chance to duel wield by adding bonus 'skill'. + int16 PetMaxHP; // Increase the max hp of your pet. + int16 PetFlurry; // Chance for pet to flurry. uint8 MasteryofPast; // Can not fizzle spells below this level specified in value. bool GivePetGroupTarget; // All pets to recieve group buffs. (Pet Affinity) int16 RootBreakChance; // Chance root will break; - int16 UnfailingDivinity; // Improves chance that DI will fire + increase partial heal. - int16 ItemHPRegenCap; // Increase item regen cap. - int16 SEResist[MAX_RESISTABLE_EFFECTS*2]; // Resist chance by specific spell effects. - int16 OffhandRiposteFail; // chance for opponent to fail riposte with offhand attack. + int16 UnfailingDivinity; // Improves chance that DI will fire + increase partial heal. + int16 ItemHPRegenCap; // Increase item regen cap. + int16 SEResist[MAX_RESISTABLE_EFFECTS*2]; // Resist chance by specific spell effects. + int16 OffhandRiposteFail; // chance for opponent to fail riposte with offhand attack. int16 ItemATKCap; // Raise item attack cap - int32 FinishingBlow[2]; // Chance to do a finishing blow for specified damage amount. + int32 FinishingBlow[2]; // Chance to do a finishing blow for specified damage amount. uint16 FinishingBlowLvl[2]; // Sets max level an NPC can be affected by FB. (base1 = lv, base2= ???) }; typedef struct { - uint16 spellID; - uint16 chance; - uint16 base_spellID; + uint16 spellID; + uint16 chance; + uint16 base_spellID; } tProc; struct Shielders_Struct { - uint32 shielder_id; - uint16 shielder_bonus; + uint32 shielder_id; + uint16 shielder_bonus; }; //eventually turn this into a typedef and @@ -444,44 +444,44 @@ class Mob; class Trade { public: - Trade(Mob* in_owner); - virtual ~Trade(); + Trade(Mob* in_owner); + virtual ~Trade(); - void Reset(); - void SetTradeCash(uint32 in_pp, uint32 in_gp, uint32 in_sp, uint32 in_cp); + void Reset(); + void SetTradeCash(uint32 in_pp, uint32 in_gp, uint32 in_sp, uint32 in_cp); - // Initiate a trade with another mob - // Also puts other mob into trader mode with this mob - void Start(uint32 mob_id, bool initiate_with=true); + // Initiate a trade with another mob + // Also puts other mob into trader mode with this mob + void Start(uint32 mob_id, bool initiate_with=true); - // Mob the owner is trading with - Mob* With(); + // Mob the owner is trading with + Mob* With(); - // Add item from cursor slot to trade bucket (automatically does bag data too) - void AddEntity(uint16 from_slot_id, uint16 trade_slot_id); + // Add item from cursor slot to trade bucket (automatically does bag data too) + void AddEntity(uint16 from_slot_id, uint16 trade_slot_id); - // Audit trade - void LogTrade(); + // Audit trade + void LogTrade(); - // Debug only method - #if (EQDEBUG >= 9) - void DumpTrade(); - #endif + // Debug only method + #if (EQDEBUG >= 9) + void DumpTrade(); + #endif public: - // Object state - TradeState state; - int32 pp; - int32 gp; - int32 sp; - int32 cp; + // Object state + TradeState state; + int32 pp; + int32 gp; + int32 sp; + int32 cp; private: - // Send item data for trade item to other person involved in trade - void SendItemData(const ItemInst* inst, int16 dest_slot_id); + // Send item data for trade item to other person involved in trade + void SendItemData(const ItemInst* inst, int16 dest_slot_id); - uint32 with_id; - Mob* owner; + uint32 with_id; + Mob* owner; }; #endif diff --git a/zone/doors.cpp b/zone/doors.cpp index 2124a5958..bdb07f062 100644 --- a/zone/doors.cpp +++ b/zone/doors.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 @@ -38,7 +38,7 @@ extern EntityList entity_list; extern WorldServer worldserver; Doors::Doors(const Door* door) -: close_timer(5000) +: close_timer(5000) { db_id = door->db_id; door_id = door->door_id; @@ -76,7 +76,7 @@ Doors::Doors(const Door* door) } Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, uint8 dopentype, uint16 dsize) -: close_timer(5000) +: close_timer(5000) { db_id = database.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); door_id = database.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); @@ -120,8 +120,8 @@ Doors::~Doors() bool Doors::Process() { - if(close_timer.Enabled() && close_timer.Check() && IsDoorOpen()) - { + if(close_timer.Enabled() && close_timer.Check() && IsDoorOpen()) + { if (opentype == 40 || GetTriggerType() == 1) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); @@ -135,7 +135,7 @@ bool Doors::Process() triggered=false; close_timer.Disable(); SetOpenState(false); - } + } return true; } @@ -146,7 +146,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) _log(DOORS__INFO, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); _log(DOORS__INFO, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); + EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; md->doorid = door_id; ///////////////////////////////////////////////////////////////// @@ -260,7 +260,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) } // a key is required or the door is locked but can be picked or both sender->Message(4, "This is locked..."); // debug spam - should probably go - if(sender->GetGM()) // GM can always open locks - should probably be changed to require a key + if(sender->GetGM()) // GM can always open locks - should probably be changed to require a key { sender->Message_StringID(4,DOORS_GM); if(!IsDoorOpen() || (opentype == 58)) @@ -413,7 +413,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) } } - if(((opentype == 57) || (opentype == 58)) && (strncmp(dest_zone, "NONE", strlen("NONE")) != 0)) + if(((opentype == 57) || (opentype == 58)) && (strncmp(dest_zone, "NONE", strlen("NONE")) != 0)) { // Teleport door! if (( strncmp(dest_zone,zone_name,strlen(zone_name)) == 0) && (!keyneeded)) { @@ -558,23 +558,23 @@ void Doors::ToggleState(Mob *sender) } void Doors::DumpDoor(){ - LogFile->write(EQEMuLog::Debug, - "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", - db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); - LogFile->write(EQEMuLog::Debug, + LogFile->write(EQEMuLog::Debug, + "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", + db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); + LogFile->write(EQEMuLog::Debug, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", - opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); - LogFile->write(EQEMuLog::Debug, - "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", - dest_zone, dest_x, dest_y, dest_z, dest_heading); + opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); + LogFile->write(EQEMuLog::Debug, + "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", + dest_zone, dest_x, dest_y, dest_z, dest_heading); } int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; query = new char[256]; sprintf(query, "SELECT MAX(id), count(*) FROM doors WHERE zone='%s' AND (version=%u OR version=-1)", zone_name, version); if (RunQuery(query, strlen(query), errbuf, &result)) { @@ -604,11 +604,11 @@ int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 v int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 oMaxID = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; query = new char[256]; sprintf(query, "SELECT MAX(id) FROM doors WHERE zone='%s' AND version=%u", zone_name, version); if (RunQuery(query, strlen(query), errbuf, &result)) { @@ -635,11 +635,11 @@ int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) { int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 oMaxID = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; query = new char[256]; sprintf(query, "SELECT MAX(doorid) FROM doors WHERE zone='%s' AND (version=%u OR version=-1)", zone_name, version); if (RunQuery(query, strlen(query), errbuf, &result)) { @@ -667,9 +667,9 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) { LogFile->write(EQEMuLog::Status, "Loading Doors from database..."); char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; // Door tmpDoor; MakeAnyLenString(&query, "SELECT id,doorid,zone,name,pos_x,pos_y,pos_z,heading," @@ -700,12 +700,12 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name into[r].nokeyring = atoi(row[12]); into[r].trigger_door = atoi(row[13]); into[r].trigger_type = atoi(row[14]); - strn0cpy(into[r].dest_zone, row[15], 32); + strn0cpy(into[r].dest_zone, row[15], 32); into[r].dest_instance_id = atoi(row[16]); - into[r].dest_x = (float) atof(row[17]); - into[r].dest_y = (float) atof(row[18]); - into[r].dest_z = (float) atof(row[19]); - into[r].dest_heading = (float) atof(row[20]); + into[r].dest_x = (float) atof(row[17]); + into[r].dest_y = (float) atof(row[18]); + into[r].dest_z = (float) atof(row[19]); + into[r].dest_heading = (float) atof(row[20]); into[r].door_param=atoi(row[21]); into[r].invert_state=atoi(row[22]); into[r].incline=atoi(row[23]); @@ -788,3 +788,4 @@ void Doors::CreateDatabaseEntry() } database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), GetX(), GetY(), GetZ(), GetHeading(), GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize()); } + diff --git a/zone/effects.cpp b/zone/effects.cpp index a08c14d39..4f5bdbd6d 100644 --- a/zone/effects.cpp +++ b/zone/effects.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 "masterentity.h" @@ -43,8 +43,8 @@ float Client::GetActSpellRange(uint16 spell_id, float range, bool IsBard) int32 Client::Additional_SpellDmg(uint16 spell_id, bool bufftick) { int32 spell_dmg = 0; - spell_dmg += GetFocusEffect(focusFF_Damage_Amount, spell_id); - spell_dmg += GetFocusEffect(focusSpellDamage, spell_id); + spell_dmg += GetFocusEffect(focusFF_Damage_Amount, spell_id); + spell_dmg += GetFocusEffect(focusSpellDamage, spell_id); //For DOTs you need to apply the damage over the duration of the dot to each tick (this is how live did it) if (bufftick){ @@ -89,8 +89,8 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) { if (tt == ST_UndeadAE || tt == ST_Undead || tt == ST_Summoned) { //undead/summoned spells modifier += GetFocusEffect(focusImprovedUndeadDamage, spell_id); - } else { - //damage spells. + } else { + //damage spells. modifier += GetFocusEffect(focusImprovedDamage, spell_id); modifier += GetFocusEffect(focusSpellEffectiveness, spell_id); modifier += GetFocusEffect(focusImprovedDamage2, spell_id); @@ -103,12 +103,12 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) { } //This adds the extra damage from the AA Unholy Touch, 450 per level to the AA Improved Harm TOuch. - if (spell_id == SPELL_IMP_HARM_TOUCH) { //Improved Harm Touch + if (spell_id == SPELL_IMP_HARM_TOUCH) { //Improved Harm Touch value -= GetAA(aaUnholyTouch) * 450; //Unholy Touch } // This adds the extra damage for the AA's Consumption of the Soul and Improved Consumption of the Soul, 200 per level to the AA Leech Curse for Shadowknights. - if (spell_id == SPELL_LEECH_TOUCH) { //Leech Touch + if (spell_id == SPELL_LEECH_TOUCH) { //Leech Touch value -= GetAA(aaConsumptionoftheSoul) * 200; //Consumption of the Soul value -= GetAA(aaImprovedConsumptionofSoul) * 200; //Improved Consumption of the Soul } @@ -138,7 +138,7 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) { ratio += RuleI(Spells, WizCritRatio); } if(aabonuses.SpellCritDmgIncrease > 0) // wizards get an additional bonus - ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225% + ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225% } //Improved Harm Touch is a guaranteed crit if you have at least one level of SCF. @@ -235,8 +235,8 @@ int32 Client::Additional_Heal(uint16 spell_id) { int32 heal_amt = 0; - heal_amt += GetFocusEffect(focusAdditionalHeal, spell_id); - heal_amt += GetFocusEffect(focusAdditionalHeal2, spell_id); + heal_amt += GetFocusEffect(focusAdditionalHeal, spell_id); + heal_amt += GetFocusEffect(focusAdditionalHeal2, spell_id); if (heal_amt){ int duration = CalcBuffDuration(this, this, spell_id); diff --git a/zone/embparser.cpp b/zone/embparser.cpp index b93b3072d..b27293de4 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.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 */ //extends the parser to include perl @@ -72,7 +72,7 @@ const char *QuestEventSubroutines[_LargestEventID] = { "EVENT_PROXIMITY_SAY", "EVENT_CAST", "EVENT_SCALE_CALC", - "EVENT_ITEM_ENTERZONE", + "EVENT_ITEM_ENTERZONE", "EVENT_TARGET_CHANGE", "EVENT_HATE_LIST", "EVENT_SPELL_EFFECT_CLIENT", @@ -105,7 +105,7 @@ PerlembParser::PerlembParser(void) : Parser() { perl = nullptr; eventQueueProcessing = false; - globalPlayerQuestLoaded = pQuestReadyToLoad; + globalPlayerQuestLoaded = pQuestReadyToLoad; globalNPCQuestLoaded = nQuestReadyToLoad; } @@ -244,7 +244,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d } bool isPlayerQuest = false; - bool isGlobalPlayerQuest = false; + bool isGlobalPlayerQuest = false; bool isGlobalNPC = false; bool isItemQuest = false; bool isSpellQuest = false; @@ -260,12 +260,12 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d { if(!npcmob && mob) { if(!iteminst) { - if(global) { - isGlobalPlayerQuest = true; - } else { - isPlayerQuest = true; - } - } + if(global) { + isGlobalPlayerQuest = true; + } else { + isPlayerQuest = true; + } + } else isItemQuest = true; } @@ -324,14 +324,14 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d LoadPlayerScript(zone->GetShortName()); } } - else if(isGlobalPlayerQuest) { - packagename = "global_player"; + else if(isGlobalPlayerQuest) { + packagename = "global_player"; if(!isloaded(packagename.c_str())) { LoadGlobalPlayerScript(); } - } + } else { packagename = "spell_effect_"; @@ -350,16 +350,16 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d } int charid = 0; - if (mob && mob->IsClient()) { // some events like waypoint and spawn don't have a player involved + if (mob && mob->IsClient()) { // some events like waypoint and spawn don't have a player involved charid = mob->CastToClient()->CharacterID(); } else { if(npcmob) { - charid = -npcmob->GetNPCTypeID(); // make char id negative npc id as a fudge + charid = -npcmob->GetNPCTypeID(); // make char id negative npc id as a fudge } else if(mob && mob->IsNPC()) { - charid = -mob->CastToNPC()->GetNPCTypeID(); // make char id negative npc id as a fudge + charid = -mob->CastToNPC()->GetNPCTypeID(); // make char id negative npc id as a fudge } } ExportVar(packagename.c_str(), "charid", charid); @@ -593,7 +593,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d switch (event) { case EVENT_SAY: { if (npcmob && npcmob->GetAppearance() != eaDead) - npcmob->FaceTarget(mob); + npcmob->FaceTarget(mob); ExportVar(packagename.c_str(), "data", objid); ExportVar(packagename.c_str(), "text", data); ExportVar(packagename.c_str(), "langid", extradata); @@ -601,7 +601,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d } case EVENT_ITEM: { if (npcmob->GetAppearance() != eaDead) - npcmob->FaceTarget(mob); + npcmob->FaceTarget(mob); //this is such a hack... why aren't these just set directly.. ExportVar(packagename.c_str(), "item1", GetVar("item1", objid).c_str()); ExportVar(packagename.c_str(), "item2", GetVar("item2", objid).c_str()); @@ -737,7 +737,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d break; } case EVENT_SCALE_CALC: - case EVENT_ITEM_ENTERZONE: { + case EVENT_ITEM_ENTERZONE: { ExportVar(packagename.c_str(), "itemid", objid); ExportVar(packagename.c_str(), "itemname", iteminst->GetItem()->Name); break; @@ -842,11 +842,11 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d } else if(isSpellQuest) { - if(mob) { - SendCommands(packagename.c_str(), sub_name, 0, mob, mob, nullptr); - } else { - SendCommands(packagename.c_str(), sub_name, 0, npcmob, mob, nullptr); - } + if(mob) { + SendCommands(packagename.c_str(), sub_name, 0, mob, mob, nullptr); + } else { + SendCommands(packagename.c_str(), sub_name, 0, npcmob, mob, nullptr); + } } else { SendCommands(packagename.c_str(), sub_name, objid, npcmob, mob, nullptr); @@ -857,27 +857,27 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d } void PerlembParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { - EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true); + EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true); } void PerlembParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { - EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data); + EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data); } void PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { - EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data); + EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data); } void PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { - EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true); + EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true); } void PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { - EventCommon(evt, objid, nullptr, nullptr, item, client, extra_data); + EventCommon(evt, objid, nullptr, nullptr, item, client, extra_data); } void PerlembParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { - EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data); + EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data); } void PerlembParser::ReloadQuests(bool with_timers) { @@ -915,7 +915,7 @@ void PerlembParser::ReloadQuests(bool with_timers) { hasQuests.clear(); playerQuestLoaded.clear(); globalPlayerQuestLoaded = pQuestReadyToLoad; - globalNPCQuestLoaded = nQuestReadyToLoad; + globalNPCQuestLoaded = nQuestReadyToLoad; itemQuestLoaded.clear(); spellQuestLoaded.clear(); } @@ -1142,8 +1142,8 @@ int PerlembParser::LoadScript(int npcid, const char * zone, Mob* activater) //LogFile->write(EQEMuLog::Debug, " finally settling on '%s'", filename.c_str()); // LogFile->write(EQEMuLog::Status, "Looking for quest file: '%s'", filename.c_str()); - // todo: decide whether or not to delete the package to allow for script refreshes w/o restarting the server - // remember to guard against deleting the default package, on a similar note... consider deleting packages upon zone change + // todo: decide whether or not to delete the package to allow for script refreshes w/o restarting the server + // remember to guard against deleting the default package, on a similar note... consider deleting packages upon zone change // try { perl->eval(std::string("delete_package(\"").append(packagename).append("\");").c_str()); } // catch(...) {/*perl balked at us trynig to delete a non-existant package... no big deal.*/} @@ -1192,7 +1192,7 @@ int PerlembParser::LoadGlobalNPCScript() string filename = "quests/"; filename += QUEST_TEMPLATES_DIRECTORY; - filename += "/global_npc.pl"; + filename += "/global_npc.pl"; string packagename = "global_npc"; try { @@ -1225,8 +1225,8 @@ int PerlembParser::LoadPlayerScript(const char *zone_name) string filename= "quests/"; filename += zone_name; filename += "/player_v"; - filename += itoa(zone->GetInstanceVersion()); - filename += ".pl"; + filename += itoa(zone->GetInstanceVersion()); + filename += ".pl"; string packagename = "player"; packagename += "_"; packagename += zone_name; @@ -1239,11 +1239,11 @@ int PerlembParser::LoadPlayerScript(const char *zone_name) LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err); } - if(!isloaded(packagename.c_str())) + if(!isloaded(packagename.c_str())) { filename= "quests/"; - filename += zone_name; - filename += "/player.pl"; + filename += zone_name; + filename += "/player.pl"; try { perl->eval_file(packagename.c_str(), filename.c_str()); } @@ -1253,7 +1253,7 @@ int PerlembParser::LoadPlayerScript(const char *zone_name) } } - //todo: change this to just read eval_file's %cache - duh! + //todo: change this to just read eval_file's %cache - duh! if(!isloaded(packagename.c_str())) { filename = "quests/"; @@ -1296,7 +1296,7 @@ int PerlembParser::LoadGlobalPlayerScript() string filename = "quests/"; filename += QUEST_TEMPLATES_DIRECTORY; - filename += "/global_player.pl"; + filename += "/global_player.pl"; string packagename = "global_player"; try { diff --git a/zone/embparser.h b/zone/embparser.h index 668fdb235..2181f6db0 100644 --- a/zone/embparser.h +++ b/zone/embparser.h @@ -41,13 +41,13 @@ typedef enum { pQuestLoaded = 1, pQuestUnloaded, pQuestEventCast, // player.pl loaded, has an EVENT_CAST sub - pQuestReadyToLoad + pQuestReadyToLoad } playerQuestMode; typedef enum { nQuestLoaded = 1, nQuestUnloaded, - nQuestReadyToLoad + nQuestReadyToLoad } GlobalNPCQuestMode; typedef enum { @@ -77,7 +77,7 @@ protected: //if they do not have a quest or the default. map hasQuests; //npcid -> questMode map playerQuestLoaded; //zone shortname -> playerQuestMode - playerQuestMode globalPlayerQuestLoaded; + playerQuestMode globalPlayerQuestLoaded; GlobalNPCQuestMode globalNPCQuestLoaded; map itemQuestLoaded; // package name - > itemQuestMode map spellQuestLoaded; @@ -99,29 +99,29 @@ public: //todo, consider making the following two methods static (need to check for perl!=null, first, then) bool isloaded(const char *packagename) const; - //interface stuff - virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + //interface stuff + virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); virtual void EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); - virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); + virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); + virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); - virtual bool HasQuestSub(uint32 npcid, const char *subname); + virtual bool HasQuestSub(uint32 npcid, const char *subname); virtual bool HasGlobalQuestSub(const char *subname); virtual bool PlayerHasQuestSub(const char *subname); - virtual bool GlobalPlayerHasQuestSub(const char *subname); + virtual bool GlobalPlayerHasQuestSub(const char *subname); virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname); virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname); - virtual void ReloadQuests(bool with_timers = false); - virtual void AddVar(std::string name, std::string val) { Parser::AddVar(name, val); }; - virtual uint32 GetIdentifier() { return 0xf8b05c11; } + virtual void ReloadQuests(bool with_timers = false); + virtual void AddVar(std::string name, std::string val) { Parser::AddVar(name, val); }; + virtual uint32 GetIdentifier() { return 0xf8b05c11; } - int LoadScript(int npcid, const char * zone, Mob* activater=0); + int LoadScript(int npcid, const char * zone, Mob* activater=0); int LoadGlobalNPCScript(); int LoadPlayerScript(const char *zone); - int LoadGlobalPlayerScript(); + int LoadGlobalPlayerScript(); int LoadItemScript(ItemInst* iteminst, string packagename, itemQuestMode Qtype); int LoadSpellScript(uint32 id); diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 8895b500c..5c92520f9 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -18,7 +18,7 @@ Eglin #include "embxs.h" #include "../common/features.h" #ifndef GvCV_set -#define GvCV_set(gv,cv) (GvCV(gv) = (cv)) +#define GvCV_set(gv,cv) (GvCV(gv) = (cv)) #endif #ifdef EMBPERL_XS @@ -166,19 +166,19 @@ void Embperl::DoInit() { eval_pv( "package EQEmuIO; " // "&boot_EQEmuIO;" - "sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } " - "sub WRITE { } " - //dunno why I need to shift off fmt here, but it dosent like without it - "sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } " - "sub CLOSE { my $me = shift; $me->PRINT('Closing '.$me); } " - "sub DESTROY { my $me = shift; $me->PRINT('Destroying '.$me); } " + "sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } " + "sub WRITE { } " + //dunno why I need to shift off fmt here, but it dosent like without it + "sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } " + "sub CLOSE { my $me = shift; $me->PRINT('Closing '.$me); } " + "sub DESTROY { my $me = shift; $me->PRINT('Destroying '.$me); } " //this ties us for all packages, just do it in quest since thats kinda 'our' package - "package quest;" - " if(tied *STDOUT) { untie(*STDOUT); }" - " if(tied *STDERR) { untie(*STDERR); }" - " tie *STDOUT, 'EQEmuIO';" - " tie *STDERR, 'EQEmuIO';" - ,FALSE); + "package quest;" + " if(tied *STDOUT) { untie(*STDOUT); }" + " if(tied *STDERR) { untie(*STDERR); }" + " tie *STDOUT, 'EQEmuIO';" + " tie *STDERR, 'EQEmuIO';" + ,FALSE); #endif //EMBPERL_IO_CAPTURE #ifdef EMBPERL_PLUGIN @@ -310,26 +310,26 @@ void Embperl::dosub(const char * subname, const std::vector * args, #endif in_use = true; bool err = false; - dSP; /* initialize stack pointer */ - ENTER; /* everything created after here */ - SAVETMPS; /* ...is a temporary variable. */ - PUSHMARK(SP); /* remember the stack pointer */ + dSP; /* initialize stack pointer */ + ENTER; /* everything created after here */ + SAVETMPS; /* ...is a temporary variable. */ + PUSHMARK(SP); /* remember the stack pointer */ if(args && args->size()) { for(std::vector::const_iterator i = args->begin(); i != args->end(); ++i) - {/* push the arguments onto the perl stack */ + {/* push the arguments onto the perl stack */ XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length()))); } } - PUTBACK; /* make local stack pointer global */ + PUTBACK; /* make local stack pointer global */ call_pv(subname, mode); /*eval our code*/ - SPAGAIN; /* refresh stack pointer */ + SPAGAIN; /* refresh stack pointer */ if(SvTRUE(ERRSV)) { err = true; } - FREETMPS; /* free temp values */ - LEAVE; /* ...and the XPUSHed "mortal" args.*/ + FREETMPS; /* free temp values */ + LEAVE; /* ...and the XPUSHed "mortal" args.*/ in_use = false; if(err) diff --git a/zone/embperl.h b/zone/embperl.h index 4dd9c4242..668755c25 100644 --- a/zone/embperl.h +++ b/zone/embperl.h @@ -29,10 +29,10 @@ extern "C" { //the perl headers dont do this for us... }; #endif #ifdef WIN32 -#define snprintf _snprintf +#define snprintf _snprintf #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 @@ -81,7 +81,7 @@ protected: void DoInit(); public: - Embperl(void); //This can throw errors! Buyer beware + Embperl(void); //This can throw errors! Buyer beware ~Embperl(void); void Reinit(); @@ -90,7 +90,7 @@ public: std::string lasterr(void) const { return errmsg;}; //evaluate an expression. throws string errors on fail void eval(const char * code); - //execute a subroutine. throws lasterr on failure + //execute a subroutine. throws lasterr on failure void dosub(const char * subname, const std::vector * args = nullptr, int mode = G_SCALAR|G_DISCARD|G_EVAL); //Access to perl variables @@ -130,17 +130,17 @@ public: HV *hv = get_hv(varname, TRUE); hv_clear(hv); - // Iterate through key-value pairs, storing them in hash - for (it = vals.begin(); it != vals.end(); it++) - { - int keylen = static_cast(it->first.length()); + // Iterate through key-value pairs, storing them in hash + for (it = vals.begin(); it != vals.end(); it++) + { + int keylen = static_cast(it->first.length()); - SV *val = newSVpv(it->second.c_str(), it->second.length()); + SV *val = newSVpv(it->second.c_str(), it->second.length()); - // If val was not added to hash, reset reference count - if (hv_store(hv, it->first.c_str(), keylen, val, 0) == nullptr) - val->sv_refcnt = 0; - } + // If val was not added to hash, reset reference count + if (hv_store(hv, it->first.c_str(), keylen, val, 0) == nullptr) + val->sv_refcnt = 0; + } } //loads a file and compiles it into our interpreter (assuming it hasn't already been read in) diff --git a/zone/embxs.cpp b/zone/embxs.cpp index ecdf6a80e..18be2998d 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.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 EMBPERL @@ -28,36 +28,36 @@ const char *getItemName(unsigned itemid) { - const Item_Struct* item = nullptr; - item = database.GetItem(itemid); + const Item_Struct* item = nullptr; + item = database.GetItem(itemid); - if (item) - return item->Name; - else - return nullptr; + if (item) + return item->Name; + else + return nullptr; } XS(XS_qc_getItemName); /* prototype to pass -Wmissing-prototypes */ XS(XS_qc_getItemName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getItemName(itemid)"); - { - unsigned itemid = (unsigned)SvUV(ST(0)); - const char * RETVAL; - dXSTARG; - RETVAL = getItemName(itemid); - sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; - } - XSRETURN(1); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: quest::getItemName(itemid)"); + { + unsigned itemid = (unsigned)SvUV(ST(0)); + const char * RETVAL; + dXSTARG; + RETVAL = getItemName(itemid); + sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; + } + XSRETURN(1); } EXTERN_C XS(boot_qc); /* prototype to pass -Wmissing-prototypes */ EXTERN_C XS(boot_qc) { - dXSARGS; + dXSARGS; char file[256]; strncpy(file, __FILE__, 256); file[255] = '\0'; @@ -69,11 +69,11 @@ EXTERN_C XS(boot_qc) //add the strcpy stuff to get rid of const warnings.... - XS_VERSION_BOOTCHECK ; + XS_VERSION_BOOTCHECK ; - newXS(strcpy(buf, "quest::getItemName"), XS_qc_getItemName, file); + newXS(strcpy(buf, "quest::getItemName"), XS_qc_getItemName, file); - XSRETURN_YES; + XSRETURN_YES; } #ifdef EMBPERL_IO_CAPTURE @@ -81,10 +81,10 @@ EXTERN_C XS(boot_qc) XS(XS_EQEmuIO_PRINT); /* prototype to pass -Wmissing-prototypes */ XS(XS_EQEmuIO_PRINT) { - dXSARGS; - if (items < 2) - return; -// Perl_croak(aTHX_ "Usage: EQEmuIO::PRINT(@strings)"); + dXSARGS; + if (items < 2) + return; + //Perl_croak(aTHX_ "Usage: EQEmuIO::PRINT(@strings)"); int r; for(r = 1; r < items; r++) { @@ -106,9 +106,9 @@ XS(XS_EQEmuIO_PRINT) if(len > 0) { LogFile->writebuf(EQEMuLog::Quest, str + pos, 1, len); } - } + } - XSRETURN_EMPTY; + XSRETURN_EMPTY; } #endif //EMBPERL_IO_CAPTURE @@ -118,9 +118,9 @@ XS(XS_EQEmuIO_PRINT) XS(XS_command_add); /* prototype to pass -Wmissing-prototypes */ XS(XS_command_add) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: commands::command_add(name, desc, access)"); + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: commands::command_add(name, desc, access)"); char *name = SvPV_nolen(ST(0)); char *desc = SvPV_nolen(ST(1)); @@ -128,7 +128,7 @@ XS(XS_command_add) command_add_perl(name, desc, access); - XSRETURN_EMPTY; + XSRETURN_EMPTY; } #endif //EMBPERL_COMMANDS diff --git a/zone/entity.cpp b/zone/entity.cpp index a4d5889d0..bfe12c17f 100644 --- a/zone/entity.cpp +++ b/zone/entity.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 @@ -65,7 +65,7 @@ extern uint32 numclients; extern PetitionList petition_list; extern DBAsync *dbasync; -extern char errorname[32]; +extern char errorname[32]; extern uint16 adverrornum; Entity::Entity() { @@ -300,24 +300,24 @@ EntityList::~EntityList() { } bool EntityList::CanAddHateForMob(Mob *p) { - LinkedListIterator iterator(npc_list); - int count = 0; + LinkedListIterator iterator(npc_list); + int count = 0; - iterator.Reset(); - while( iterator.MoreElements()) - { - NPC *npc=iterator.GetData(); - if (npc->IsOnHatelist(p)) - count++; - // no need to continue if we already hit the limit - if (count > 3) - return false; - iterator.Advance(); - } + iterator.Reset(); + while( iterator.MoreElements()) + { + NPC *npc=iterator.GetData(); + if (npc->IsOnHatelist(p)) + count++; + // no need to continue if we already hit the limit + if (count > 3) + return false; + iterator.Advance(); + } - if (count <= 2) - return true; - return false; + if (count <= 2) + return true; + return false; } void EntityList::AddClient(Client* client) { @@ -619,7 +619,7 @@ void EntityList::AddCorpse(Corpse* corpse, uint32 in_id) { void EntityList::AddNPC(NPC* npc, bool SendSpawnPacket, bool dontqueue) { npc->SetID(GetFreeID()); - parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0); + parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0); uint16 emoteid = npc->GetEmoteID(); if(emoteid != 0) @@ -671,7 +671,7 @@ void EntityList::AddMerc(Merc* merc, bool SendSpawnPacket, bool dontqueue) { safe_delete(ns); } - //parse->EventMERC(EVENT_SPAWN, merc, nullptr, "", 0); + //parse->EventMERC(EVENT_SPAWN, merc, nullptr, "", 0); } merc_list.Insert(merc); @@ -1469,9 +1469,9 @@ void EntityList::ReplaceWithTarget(Mob* pOldMob, Mob*pNewTarget) iterator.Reset(); while(iterator.MoreElements()) { if (iterator.GetData()->IsAIControlled()) { - // replace the old mob with the new one + // replace the old mob with the new one if (iterator.GetData()->RemoveFromHateList(pOldMob)) - iterator.GetData()->AddToHateList(pNewTarget, 1, 0); + iterator.GetData()->AddToHateList(pNewTarget, 1, 0); } iterator.Advance(); } @@ -1587,7 +1587,7 @@ void EntityList::RefreshClientXTargets(Client *c) } void EntityList::QueueClientsByTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender, Mob* SkipThisMob, bool ackreq, bool HoTT, - uint32 ClientVersionBits) + uint32 ClientVersionBits) { LinkedListIterator iterator(client_list); @@ -1678,8 +1678,8 @@ void EntityList::QueueCloseClients(Mob* sender, const EQApplicationPacket* app, if ((!ignore_sender || ent != sender) && (ent != SkipThisMob)) { eqFilterMode filter2 = ent->GetFilter(filter); if(ent->Connected() && - ( filter==FilterNone - || filter2 == FilterShow + (filter==FilterNone + || filter2 == FilterShow || (filter2 == FilterShowGroupOnly && (sender == ent || (ent->GetGroup() && ent->GetGroup()->IsGroupMember(sender)))) || (filter2 == FilterShowSelfOnly && ent==sender)) @@ -1732,13 +1732,13 @@ void EntityList::FilterQueueCloseClients(uint8 filter, uint8 required, Mob* send required=1; if(filterval==required){ if ((!ignore_sender || ent != sender) && (ent != SkipThisMob) - ) { + ) { #ifdef PACKET_UPDATE_MANAGER if(ent->Connected()) { ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender)); } #else - if(ent->Connected() && (ent->DistNoRoot(*sender) <= dist2 || dist == 0)) { + if(ent->Connected() && (ent->DistNoRoot(*sender) <= dist2 || dist == 0)) { ent->QueuePacket(app, ackreq); } #endif @@ -1778,8 +1778,8 @@ void EntityList::QueueCloseClients(Mob* sender, const EQApplicationPacket* app, if(ent->Connected() && (filter==0 || (filter2==1 || (filter2==99 && entity_list.GetGroupByClient(ent)!=0 && - entity_list.GetGroupByClient(ent)->IsGroupMember(sender)) - || (filter2==98 && ent==sender))) + entity_list.GetGroupByClient(ent)->IsGroupMember(sender)) + || (filter2==98 && ent==sender))) #ifdef PACKET_UPDATE_MANAGER ) { ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender)); @@ -3309,7 +3309,7 @@ void EntityList::DoubleAggro(Mob* who) while(iterator.MoreElements()) { if (iterator.GetData()->CheckAggro(who)) - iterator.GetData()->SetHate(who,iterator.GetData()->CastToNPC()->GetHateAmount(who),iterator.GetData()->CastToNPC()->GetHateAmount(who)*2); + iterator.GetData()->SetHate(who,iterator.GetData()->CastToNPC()->GetHateAmount(who),iterator.GetData()->CastToNPC()->GetHateAmount(who)*2); iterator.Advance(); } } @@ -3321,7 +3321,7 @@ void EntityList::HalveAggro(Mob* who) while(iterator.MoreElements()) { if (iterator.GetData()->CastToNPC()->CheckAggro(who)) - iterator.GetData()->CastToNPC()->SetHate(who,iterator.GetData()->CastToNPC()->GetHateAmount(who)/2); + iterator.GetData()->CastToNPC()->SetHate(who,iterator.GetData()->CastToNPC()->GetHateAmount(who)/2); iterator.Advance(); } } @@ -3728,7 +3728,7 @@ void EntityList::ProcessMove(Client *c, float x, float y, float z) { //This is done to address the issue of this code not being reentrant //because perl can call clear_proximity() while we're still iterating through the list - //This causes our list to become invalid but we don't know it. On GCC it's basic heap + //This causes our list to become invalid but we don't know it. On GCC it's basic heap //corruption and it doesn't appear to catch it at all. //MSVC it's a crash with 0xfeeefeee debug address (freed memory off the heap) std::list::iterator iter = skip_ids.begin(); @@ -3752,20 +3752,20 @@ void EntityList::ProcessMove(Client *c, float x, float y, float z) { //cross a boundary, send the event. bool old_in = true; bool new_in = true; - if( last_x < l->min_x || last_x > l->max_x - || last_y < l->min_y || last_y > l->max_y - || last_z < l->min_z || last_z > l->max_z ) { + if(last_x < l->min_x || last_x > l->max_x + || last_y < l->min_y || last_y > l->max_y + || last_z < l->min_z || last_z > l->max_z ) { old_in = false; } - if( x < l->min_x || x > l->max_x - || y < l->min_y || y > l->max_y - || z < l->min_z || z > l->max_z ) { + if(x < l->min_x || x > l->max_x + || y < l->min_y || y > l->max_y + || z < l->min_z || z > l->max_z ) { new_in = false; } if(old_in && !new_in) { //we were in the proximity, we are no longer, send event exit - parse->EventNPC(EVENT_EXIT, d, c, "", 0); + parse->EventNPC(EVENT_EXIT, d, c, "", 0); //Reentrant fix iterator.Reset(); @@ -3795,12 +3795,12 @@ void EntityList::ProcessProximitySay(const char *Message, Client *c, uint8 langu if(l == nullptr || !l->say) continue; - if( c->GetX() < l->min_x || c->GetX() > l->max_x - || c->GetY() < l->min_y || c->GetY() > l->max_y - || c->GetZ() < l->min_z || c->GetZ() > l->max_z ) + if(c->GetX() < l->min_x || c->GetX() > l->max_x + || c->GetY() < l->min_y || c->GetY() > l->max_y + || c->GetZ() < l->min_z || c->GetZ() > l->max_z ) continue; - parse->EventNPC(EVENT_PROXIMITY_SAY, d, c, Message, language); + parse->EventNPC(EVENT_PROXIMITY_SAY, d, c, Message, language); } } @@ -4066,25 +4066,24 @@ bool Entity::CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z, float void EntityList::QuestJournalledSayClose(Mob *sender, Client *QuestInitiator, float dist, const char* mobname, const char* message) { - Client *c; - LinkedListIterator iterator(client_list); - float dist2 = dist * dist; + Client *c; + LinkedListIterator iterator(client_list); + float dist2 = dist * dist; - // Send the message to the quest initiator such that the client will enter it into the NPC Quest Journal - if(QuestInitiator) { - - char *buf = new char[strlen(mobname) + strlen(message) + 10]; - sprintf(buf, "%s says, '%s'", mobname, message); - QuestInitiator->QuestJournalledMessage(mobname, buf); - safe_delete_array(buf); - } - // Use the old method for all other nearby clients - for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) - { - c = iterator.GetData(); - if(c && (c != QuestInitiator) && c->DistNoRoot(*sender) <= dist2) - c->Message_StringID(10, GENERIC_SAY, mobname, message); - } + // Send the message to the quest initiator such that the client will enter it into the NPC Quest Journal + if(QuestInitiator) { + char *buf = new char[strlen(mobname) + strlen(message) + 10]; + sprintf(buf, "%s says, '%s'", mobname, message); + QuestInitiator->QuestJournalledMessage(mobname, buf); + safe_delete_array(buf); + } + // Use the old method for all other nearby clients + for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) + { + c = iterator.GetData(); + if(c && (c != QuestInitiator) && c->DistNoRoot(*sender) <= dist2) + c->Message_StringID(10, GENERIC_SAY, mobname, message); + } } Corpse* EntityList::GetClosestCorpse(Mob* sender, const char* Name) @@ -4110,7 +4109,7 @@ Corpse* EntityList::GetClosestCorpse(Mob* sender, const char* Name) continue; CurrentDistance = ((CurrentCorpse->GetY() - sender->GetY()) * (CurrentCorpse->GetY() - sender->GetY())) + - ((CurrentCorpse->GetX() - sender->GetX()) * (CurrentCorpse->GetX() - sender->GetX())); + ((CurrentCorpse->GetX() - sender->GetX()) * (CurrentCorpse->GetX() - sender->GetX())); if(CurrentDistance < ClosestDistance) { @@ -4303,7 +4302,7 @@ Mob* EntityList::GetTargetForMez(Mob* caster) if(!caster->CheckLosFN(d)){ //this is wasteful but can't really think of another way to do it iterator.Advance(); //that wont have us trying to los the same target every time - continue; //it's only in combat so it's impact should be minimal.. but stil. + continue; //it's only in combat so it's impact should be minimal.. but stil. } return d; } @@ -4394,8 +4393,8 @@ void EntityList::SendUntargetable(Client *c) continue; } if(!cur->IsTargetable()) { - cur->SendTargetable(false, c); - } + cur->SendTargetable(false, c); + } } iterator.Advance(); } @@ -4415,7 +4414,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) { iterator.Reset(); - while(iterator.MoreElements()) { + while(iterator.MoreElements()) { Client *ClientEntry = iterator.GetData(); @@ -4451,7 +4450,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) { } if(WhomLength && strncasecmp(Who->whom, ClientEntry->GetName(), WhomLength) && - strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength)) + strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength)) continue; Entries++; @@ -4541,7 +4540,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) { } if(WhomLength && strncasecmp(Who->whom, ClientEntry->GetName(), WhomLength) && - strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength)) + strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength)) continue; string GuildName; @@ -4619,7 +4618,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) { WAPP3->Class_ = PlayerClass; - WAPP3->Level = PlayerLevel; + WAPP3->Level = PlayerLevel; WAPP3->Race = PlayerRace; @@ -4668,12 +4667,12 @@ void EntityList::UnMarkNPC(uint16 ID) uint32 EntityList::CheckNPCsClose(Mob *center) { - LinkedListIterator iterator(npc_list); - uint32 count = 0; + LinkedListIterator iterator(npc_list); + uint32 count = 0; - iterator.Reset(); - while(iterator.MoreElements()) - { + iterator.Reset(); + while(iterator.MoreElements()) + { NPC *current = iterator.GetData(); if(!current) { @@ -5011,7 +5010,7 @@ void EntityList::HideCorpses(Client *c, uint8 CurrentMode, uint8 NewMode) if((NewMode == HideCorpseAll) || ((NewMode == HideCorpseNPC) && (b->IsNPCCorpse()))) { EQApplicationPacket outapp; - b->CreateDespawnPacket(&outapp, false); + b->CreateDespawnPacket(&outapp, false); c->QueuePacket(&outapp); } else if(NewMode == HideCorpseAllButGroup) @@ -5019,13 +5018,13 @@ void EntityList::HideCorpses(Client *c, uint8 CurrentMode, uint8 NewMode) if(!g->IsGroupMember(b->GetOwnerName())) { EQApplicationPacket outapp; - b->CreateDespawnPacket(&outapp, false); + b->CreateDespawnPacket(&outapp, false); c->QueuePacket(&outapp); } else if((CurrentMode == HideCorpseAll)) { EQApplicationPacket outapp; - b->CreateSpawnPacket(&outapp); + b->CreateSpawnPacket(&outapp); c->QueuePacket(&outapp); } } @@ -5194,7 +5193,7 @@ Mob* EntityList::GetClosestMobByBodyType(Mob* sender, bodyType BodyType) continue; CurrentDistance = ((CurrentMob->GetY() - sender->GetY()) * (CurrentMob->GetY() - sender->GetY())) + - ((CurrentMob->GetX() - sender->GetX()) * (CurrentMob->GetX() - sender->GetX())); + ((CurrentMob->GetX() - sender->GetX()) * (CurrentMob->GetX() - sender->GetX())); if(CurrentDistance < ClosestDistance) { @@ -5306,3 +5305,4 @@ Mob* EntityList::GetTargetForVirus(Mob* spreader) return TargetsInRange[MakeRandomInt(0, TargetsInRange.size() - 1)]; } + diff --git a/zone/entity.h b/zone/entity.h index be0befbf4..4b26b45d8 100644 --- a/zone/entity.h +++ b/zone/entity.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 ENTITY_H #define ENTITY_H @@ -81,14 +81,14 @@ public: virtual bool IsTrap() const { return false; } virtual bool IsBeacon() const { return false; } - virtual bool Process() { return false; } + virtual bool Process() { return false; } virtual bool Save() { return true; } virtual void Depop(bool StartSpawnTimer = false) {} Client* CastToClient(); - NPC* CastToNPC(); - Mob* CastToMob(); - Merc* CastToMerc(); + NPC* CastToNPC(); + Mob* CastToMob(); + Merc* CastToMerc(); Corpse* CastToCorpse(); Object* CastToObject(); Doors* CastToDoors(); @@ -96,14 +96,14 @@ public: Beacon* CastToBeacon(); const Client* CastToClient() const; - const NPC* CastToNPC() const; - const Mob* CastToMob() const; - const Merc* CastToMerc() const; + const NPC* CastToNPC() const; + const Mob* CastToMob() const; + const Merc* CastToMerc() const; const Corpse* CastToCorpse() const; - const Object* CastToObject() const; + const Object* CastToObject() const; // const Group* CastToGroup() const; const Doors* CastToDoors() const; - const Trap* CastToTrap() const; + const Trap* CastToTrap() const; const Beacon* CastToBeacon() const; inline const uint16& GetID() const{ return id; } @@ -148,8 +148,8 @@ public: Client* GetRandomClient(float x, float y, float z, float Distance, Client *ExcludeClient = nullptr); Group* GetGroupByMob(Mob* mob); Group* GetGroupByClient(Client* client); - Group* GetGroupByID(uint32 id); - Group* GetGroupByLeaderName(char* leader); + Group* GetGroupByID(uint32 id); + Group* GetGroupByLeaderName(char* leader); Raid* GetRaidByMob(Mob* mob); Raid* GetRaidByClient(Client* client); Raid* GetRaidByID(uint32 id); @@ -173,12 +173,12 @@ public: int RezzAllCorpsesByCharID(uint32 charid); bool IsMobInZone(Mob *who); void ClearClientPetitionQueue(); - bool CanAddHateForMob(Mob *p); - void SendGuildMOTD(uint32 guild_id); - void SendGuildSpawnAppearance(uint32 guild_id); - void SendGuildMembers(uint32 guild_id); - void RefreshAllGuildInfo(uint32 guild_id); - void SendGuildList(); + bool CanAddHateForMob(Mob *p); + void SendGuildMOTD(uint32 guild_id); + void SendGuildSpawnAppearance(uint32 guild_id); + void SendGuildMembers(uint32 guild_id); + void RefreshAllGuildInfo(uint32 guild_id); + void SendGuildList(); // void SendGuildJoin(GuildJoin_Struct* gj); // Check group list for nullptr entries void CheckGroupList (const char *fname, const int fline); @@ -197,17 +197,17 @@ public: Object* FindObject(uint32 object_id); Object* FindNearbyObject(float x, float y, float z, float radius); bool MakeDoorSpawnPacket(EQApplicationPacket* app, Client *client); - bool MakeTrackPacket(Client* client); + bool MakeTrackPacket(Client* client); void SendTraders(Client* client); - void AddClient(Client*); - void AddNPC(NPC*, bool SendSpawnPacket = true, bool dontqueue = false); + void AddClient(Client*); + void AddNPC(NPC*, bool SendSpawnPacket = true, bool dontqueue = false); void AddMerc(Merc*, bool SendSpawnPacket = true, bool dontqueue = false); void AddCorpse(Corpse* pc, uint32 in_id = 0xFFFFFFFF); - void AddObject(Object*, bool SendSpawnPacket = true); - void AddGroup(Group*); - void AddGroup(Group*, uint32 id); + void AddObject(Object*, bool SendSpawnPacket = true); + void AddGroup(Group*); + void AddGroup(Group*, uint32 id); void AddRaid(Raid *raid); - void AddRaid(Raid*, uint32 id); + void AddRaid(Raid*, uint32 id); void AddDoor(Doors* door); void AddTrap(Trap* trap); void AddBeacon(Beacon *beacon); @@ -259,39 +259,39 @@ public: void Message_StringID(Mob *sender, bool skipsender, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0); void MessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0); void ChannelMessageFromWorld(const char* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, const char* message); - void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, const char* message, ...); - void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); + void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, const char* message, ...); + void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); void ChannelMessageSend(Mob* to, uint8 chan_num, uint8 language, const char* message, ...); - void SendZoneSpawns(Client*); + void SendZoneSpawns(Client*); void SendZonePVPUpdates(Client *); void SendZoneSpawnsBulk(Client* client); - void Save(); - void SendZoneCorpses(Client*); - void SendZoneCorpsesBulk(Client*); - void SendZoneObjects(Client* client); + void Save(); + void SendZoneCorpses(Client*); + void SendZoneCorpsesBulk(Client*); + void SendZoneObjects(Client* client); void SendZoneAppearance(Client *c); void SendNimbusEffects(Client *c); - void SendUntargetable(Client *c); + void SendUntargetable(Client *c); void DuelMessage(Mob* winner, Mob* loser, bool flee); - void QuestJournalledSayClose(Mob *sender, Client *QuestIntiator, float dist, const char* mobname, const char* message); + void QuestJournalledSayClose(Mob *sender, Client *QuestIntiator, float dist, const char* mobname, const char* message); void GroupMessage(uint32 gid, const char *from, const char *message); void ExpeditionWarning(uint32 minutes_left); - void RemoveFromTargets(Mob* mob, bool RemoveFromXTargets = false); - void RemoveFromXTargets(Mob* mob); - void RemoveFromAutoXTargets(Mob* mob); - void ReplaceWithTarget(Mob* pOldMob, Mob*pNewTarget); + void RemoveFromTargets(Mob* mob, bool RemoveFromXTargets = false); + void RemoveFromXTargets(Mob* mob); + void RemoveFromAutoXTargets(Mob* mob); + void ReplaceWithTarget(Mob* pOldMob, Mob*pNewTarget); void QueueCloseClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, float dist=200, Mob* SkipThisMob = 0, bool ackreq = true,eqFilterType filter=FilterNone); - void QueueClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true); + void QueueClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true); void QueueClientsStatus(Mob* sender, const EQApplicationPacket* app, bool ignore_sender = false, uint8 minstatus = 0, uint8 maxstatus = 0); void QueueClientsGuild(Mob* sender, const EQApplicationPacket* app, bool ignore_sender = false, uint32 guildeqid = 0); void QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struct *gbius, uint32 GuildID); void QueueClientsByTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender = true, Mob* SkipThisMob = 0, bool ackreq = true, - bool HoTT = true, uint32 ClientVersionBits = 0xFFFFFFFF); + bool HoTT = true, uint32 ClientVersionBits = 0xFFFFFFFF); void QueueClientsByXTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender = true); void QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app); - void QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true); + void QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true); void AEAttack(Mob *attacker, float dist, int Hand = 13, int count = 0, bool IsFromSpell = false); void AETaunt(Client *caster, float range = 0); @@ -299,7 +299,7 @@ public: void MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true); void AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true); - void RadialSetLogging(Mob *around, bool enabled, bool clients, bool non_clients, float range = 0); + void RadialSetLogging(Mob *around, bool enabled, bool clients, bool non_clients, float range = 0); //trap stuff Mob* GetTrapTrigger(Trap* trap); @@ -316,7 +316,7 @@ public: void SignalMobsByNPCID(uint32 npc_type, int signal_id); void CountNPC(uint32* NPCCount, uint32* NPCLootCount, uint32* gmspawntype_count); void DoZoneDump(ZSDump_Spawn2* spawn2dump, ZSDump_NPC* npcdump, ZSDump_NPC_Loot* npclootdump, NPCType* gmspawntype_dump); - void RemoveEntity(uint16 id); + void RemoveEntity(uint16 id); void SendPetitionToAdmins(Petition* pet); void SendPetitionToAdmins(); void AddLootToNPCS(uint32 item_id, uint32 count); @@ -333,14 +333,14 @@ public: void Evade(Mob *who); void UpdateHoTT(Mob* target); - void Process(); + void Process(); void ClearAggro(Mob* targ); void ClearFeignAggro(Mob* targ); void ClearZoneFeignAggro(Client* targ); void AggroZone(Mob* who, int hate = 0); bool Fighting(Mob* targ); - void RemoveFromHateLists(Mob* mob, bool settoone = false); + void RemoveFromHateLists(Mob* mob, bool settoone = false); void RemoveDebuffs(Mob* caster); @@ -370,8 +370,8 @@ public: void SendGroupLeave(uint32 gid, const char *name); void SendGroupJoin(uint32 gid, const char *name); - void SaveAllClientsTaskState(); - void ReloadAllClientsTaskState(int TaskID=0); + void SaveAllClientsTaskState(); + void ReloadAllClientsTaskState(int TaskID=0); uint16 CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time = 300000); uint16 CreateGroundObjectFromModel(const char *model, float x, float y, float z, float heading, uint8 type = 0x00, uint32 decay_time = 0); @@ -398,7 +398,7 @@ public: void DepopAll(int NPCTypeID, bool StartSpawnTimer = true); - uint16 GetFreeID(); + uint16 GetFreeID(); void RefreshAutoXTargets(Client *c); void RefreshClientXTargets(Client *c); @@ -443,8 +443,8 @@ private: Bot* GetBotByBotName(std::string botName); list GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID); - bool Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint16 iSpellTypes); // TODO: Evaluate this closesly in hopes to eliminate - void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff + bool Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint16 iSpellTypes); // TODO: Evaluate this closesly in hopes to eliminate + void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff private: std::list bot_list; #endif diff --git a/zone/errmsg.h b/zone/errmsg.h index 03863ec61..0b65671a1 100644 --- a/zone/errmsg.h +++ b/zone/errmsg.h @@ -1,19 +1,19 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* 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 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. + 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 */ + 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 */ @@ -57,3 +57,4 @@ extern const char *client_errors[]; /* Error messages */ #define CR_NAMEDPIPESETSTATE_ERROR 2018 #define CR_CANT_READ_CHARSET 2019 #define CR_NET_PACKET_TOO_LARGE 2020 + diff --git a/zone/event_codes.h b/zone/event_codes.h index 3a6d9363b..95bc77368 100644 --- a/zone/event_codes.h +++ b/zone/event_codes.h @@ -36,7 +36,7 @@ typedef enum { EVENT_PROXIMITY_SAY, EVENT_CAST, EVENT_SCALE_CALC, - EVENT_ITEM_ENTERZONE, + EVENT_ITEM_ENTERZONE, EVENT_TARGET_CHANGE, //target selected, target changed, or target removed EVENT_HATE_LIST, EVENT_SPELL_EFFECT_CLIENT, diff --git a/zone/exp.cpp b/zone/exp.cpp index 0af39c061..853bc555e 100644 --- a/zone/exp.cpp +++ b/zone/exp.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/features.h" @@ -134,7 +134,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { if(GetGroup()) { if((m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel())) - && (RuleI(Character, KillsPerGroupLeadershipAA) > 0)) + && (RuleI(Character, KillsPerGroupLeadershipAA) > 0)) { AddLeadershipEXP(GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA), 0); Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); @@ -145,7 +145,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { else { if((m_pp.raid_leadership_points < MaxBankedRaidLeadershipPoints(GetLevel())) - && (RuleI(Character, KillsPerRaidLeadershipAA) > 0)) + && (RuleI(Character, KillsPerRaidLeadershipAA) > 0)) { AddLeadershipEXP(0, RAID_EXP_PER_POINT / RuleI(Character, KillsPerRaidLeadershipAA)); Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_EXP); @@ -278,7 +278,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { //Message(15, "You have gained %d skill points!!", m_pp.aapoints - last_unspentAA); char val1[20]={0}; - Message_StringID(MT_Experience, GAIN_ABILITY_POINT,ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2. + Message_StringID(MT_Experience, GAIN_ABILITY_POINT,ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2. //Message(15, "You now have %d skill points available to spend.", m_pp.aapoints); } @@ -307,7 +307,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { uint32 expneeded = GetEXPForLevel(MaxLevel); if(set_exp > expneeded) { - set_exp = expneeded; + set_exp = expneeded; } } } @@ -334,7 +334,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { uint32 expneeded = GetEXPForLevel(maxlevel); if(set_exp > expneeded) { - set_exp = expneeded; + set_exp = expneeded; } } @@ -370,77 +370,77 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetLevel(uint8 set_level, bool command) { - if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { - LogFile->write(EQEMuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); - return; - } + if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { + LogFile->write(EQEMuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); + return; + } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct)); - LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer; - lu->level = set_level; - if(m_pp.level2 != 0) - lu->level_old = m_pp.level2; - else - lu->level_old = level; + EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct)); + LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer; + lu->level = set_level; + if(m_pp.level2 != 0) + lu->level_old = m_pp.level2; + else + lu->level_old = level; - level = set_level; + level = set_level; - if(IsRaidGrouped()) - { - Raid *r = this->GetRaid(); - if(r){ - r->UpdateLevel(GetName(), set_level); - } - } - if(set_level > m_pp.level2) - { - if(m_pp.level2 == 0) - m_pp.points += 5; - else - m_pp.points += (5 * (set_level - m_pp.level2)); + if(IsRaidGrouped()) + { + Raid *r = this->GetRaid(); + if(r){ + r->UpdateLevel(GetName(), set_level); + } + } + if(set_level > m_pp.level2) + { + if(m_pp.level2 == 0) + m_pp.points += 5; + else + m_pp.points += (5 * (set_level - m_pp.level2)); - m_pp.level2 = set_level; - } - if(set_level > m_pp.level) { - parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0); - } + m_pp.level2 = set_level; + } + if(set_level > m_pp.level) { + parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0); + } - m_pp.level = set_level; - if (command){ - m_pp.exp = GetEXPForLevel(set_level); - Message(15, "Welcome to level %i!", set_level); - lu->exp = 0; - } - else { - float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) / - ( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel())); - lu->exp = (uint32)(330.0f * tmpxp); - } - QueuePacket(outapp); - safe_delete(outapp); - this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change + m_pp.level = set_level; + if (command){ + m_pp.exp = GetEXPForLevel(set_level); + Message(15, "Welcome to level %i!", set_level); + lu->exp = 0; + } + else { + float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) / + ( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel())); + lu->exp = (uint32)(330.0f * tmpxp); + } + QueuePacket(outapp); + safe_delete(outapp); + this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change LogFile->write(EQEMuLog::Normal,"Setting Level for %s to %i", GetName(), set_level); - CalcBonuses(); - if(!RuleB(Character, HealOnLevel)) - { - int mhp = CalcMaxHP(); - if(GetHP() > mhp) - SetHP(mhp); - } - else - { - SetHP(CalcMaxHP()); // Why not, lets give them a free heal - } + CalcBonuses(); + if(!RuleB(Character, HealOnLevel)) + { + int mhp = CalcMaxHP(); + if(GetHP() > mhp) + SetHP(mhp); + } + else + { + SetHP(CalcMaxHP()); // Why not, lets give them a free heal + } DoTributeUpdate(); - SendHPUpdate(); - SetMana(CalcMaxMana()); - UpdateWho(); + SendHPUpdate(); + SetMana(CalcMaxMana()); + UpdateWho(); if(GetMerc()) UpdateMercLevel(); - Save(); + Save(); } // Note: The client calculates exp separately, we cant change this function @@ -507,7 +507,7 @@ void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level) { void Group::SplitExp(uint32 exp, Mob* other) { if( other->CastToNPC()->MerchantType != 0 ) // Ensure NPC isn't a merchant - return; + return; if(other->GetOwner() && other->GetOwner()->IsClient()) // Ensure owner isn't pc return; @@ -549,7 +549,7 @@ void Group::SplitExp(uint32 exp, Mob* other) { if (membercount == 0) return; - for (i = 0; i < MAX_GROUP_MEMBERS; i++) { + for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (members[i] != nullptr && members[i]->IsClient()) // If Group Member is Client { Client *cmember = members[i]->CastToClient(); @@ -596,7 +596,7 @@ void Raid::SplitExp(uint32 exp, Mob* other) { if (membercount == 0) return; - for (unsigned int x = 0; x < MAX_RAID_MEMBERS; x++) { + for (unsigned int x = 0; x < MAX_RAID_MEMBERS; x++) { if (members[x].member != nullptr) // If Group Member is Client { Client *cmember = members[x].member; @@ -672,5 +672,5 @@ uint32 Client::GetCharMaxLevelFromQGlobal() { ++gcount; } - return false; // Default is false + return false; // Default is false } diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 87a9b4317..82c2ff31c 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.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 "../common/debug.h" @@ -92,9 +92,9 @@ void Mob::CheckFlee() { } if(ratio < run_ratio) { - if( RuleB(Combat, FleeIfNotAlone) - || ( !RuleB(Combat, FleeIfNotAlone) - && (entity_list.GetHatedCount(hate_top, this) == 0))) + if (RuleB(Combat, FleeIfNotAlone) || + (!RuleB(Combat, FleeIfNotAlone) && + (entity_list.GetHatedCount(hate_top, this) == 0))) StartFleeing(); } @@ -127,10 +127,10 @@ void Mob::ProcessFlee() { } float Mob::GetFearSpeed() { - if(flee_mode) { - //we know ratio < FLEE_HP_RATIO - float speed = GetRunspeed(); - float ratio = GetHPRatio(); + if(flee_mode) { + //we know ratio < FLEE_HP_RATIO + float speed = GetRunspeed(); + float ratio = GetHPRatio(); // mob's movement will halt with a decent snare at HP specified by rule. if (ratio <= RuleI(Combat, FleeSnareHPRatio) && GetSnaredAmount() > 40) { @@ -140,11 +140,11 @@ float Mob::GetFearSpeed() { if (ratio < FLEE_HP_MINSPEED) ratio = FLEE_HP_MINSPEED; - speed = speed * 0.5 * ratio / 100; + speed = speed * 0.5 * ratio / 100; - return(speed); - } - return(GetRunspeed()); + return(speed); + } + return(GetRunspeed()); } void Mob::CalculateNewFearpoint() @@ -251,7 +251,7 @@ void Mob::CalculateNewFearpoint() fear_path_state = new MobFearState(); if(zone->pathing->FindNearestFear(fear_path_state, GetX(), GetY(), GetZ())) { #ifdef FEAR_PATHING_DEBUG - LogFile->write(EQEMuLog::Debug, "Fear Pathing Start: found path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)", + LogFile->write(EQEMuLog::Debug, "Fear Pathing Start: found path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)", GetX(), GetY(), GetZ(), fear_path_state->x, fear_path_state->y, fear_path_state->z); #endif //we found a fear node... were on our way.. @@ -373,7 +373,7 @@ void Mob::CalculateFearPosition() { return; } #ifdef FEAR_PATHING_DEBUG - LogFile->write(EQEMuLog::Debug, "Fear Pathing: on path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)", + LogFile->write(EQEMuLog::Debug, "Fear Pathing: on path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)", GetX(), GetY(), GetZ(), fear_path_state->x, fear_path_state->y, fear_path_state->z); #endif //we found a fear node... were on our way.. @@ -400,7 +400,7 @@ void Mob::CalculateFearPosition() { if(zone->pathing->FindNearestFear(fear_path_state, GetX(), GetY(), GetZ())) { #ifdef FEAR_PATHING_DEBUG - LogFile->write(EQEMuLog::Debug, "Fear Pathing: ran to find path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)", + LogFile->write(EQEMuLog::Debug, "Fear Pathing: ran to find path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)", GetX(), GetY(), GetZ(), fear_path_state->x, fear_path_state->y, fear_path_state->z); #endif //we found a fear node... were on our way.. @@ -422,7 +422,7 @@ void Mob::CalculateFearPosition() { //do not force a path if we are fleeing if(!flee_mode && zone->pathing->FindNearestFear(fear_path_state, GetX(), GetY(), GetZ(), false)) { #ifdef FEAR_PATHING_DEBUG - LogFile->write(EQEMuLog::Debug, "Fear Pathing: Bullshit Path from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)", + LogFile->write(EQEMuLog::Debug, "Fear Pathing: Bullshit Path from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)", GetX(), GetY(), GetZ(), fear_path_state->x, fear_path_state->y, fear_path_state->z); #endif //we found a fear node... were on our way.. diff --git a/zone/forage.cpp b/zone/forage.cpp index e7aa48ce0..54ac3b971 100644 --- a/zone/forage.cpp +++ b/zone/forage.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 @@ -86,16 +86,16 @@ CREATE TABLE fishing ( // This allows EqEmu to have zone specific foraging - BoB uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; uint8 index = 0; uint32 item[FORAGE_ITEM_LIMIT]; uint32 chance[FORAGE_ITEM_LIMIT]; uint32 ret; - for (int c=0; c < FORAGE_ITEM_LIMIT; c++) { + for (int c=0; c < FORAGE_ITEM_LIMIT; c++) { item[c] = 0; } @@ -104,7 +104,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { if (RunQuery(query, MakeAnyLenString(&query, "SELECT itemid,chance FROM forage WHERE zoneid= '%i' and level <= '%i' LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT), errbuf, &result)) { safe_delete_array(query); - while ((row = mysql_fetch_row(result)) && (index < FORAGE_ITEM_LIMIT)) { + while ((row = mysql_fetch_row(result)) && (index < FORAGE_ITEM_LIMIT)) { item[index] = atoi(row[0]); chance[index] = atoi(row[1])+chancepool; LogFile->write(EQEMuLog::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); @@ -144,9 +144,9 @@ LogFile->write(EQEMuLog::Error, "Possible Forage: %d with a %d chance", item[ind uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint8 &npc_chance) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; uint8 index = 0; uint32 item[50]; @@ -156,7 +156,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint32 chancepool = 0; uint32 ret = 0; - for (int c=0; c<50; c++) { + for (int c=0; c<50; c++) { item[c]=0; chance[c]=0; } @@ -164,7 +164,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, if (RunQuery(query, MakeAnyLenString(&query, "SELECT itemid,chance,npc_id,npc_chance FROM fishing WHERE (zoneid= '%i' || zoneid = 0) and skill_level <= '%i'",ZoneID, skill ), errbuf, &result)) { safe_delete_array(query); - while ((row = mysql_fetch_row(result))&&(index<50)) { + while ((row = mysql_fetch_row(result))&&(index<50)) { item[index] = atoi(row[0]); chance[index] = atoi(row[1])+chancepool; chancepool = chance[index]; @@ -286,9 +286,9 @@ void Client::GoFish() 13019, // Fresh Fish 13076, // Fish Scales 13076, // Fish Scales - 7007, // Rusty Dagger 7007, // Rusty Dagger - 7007 // Rusty Dagger + 7007, // Rusty Dagger + 7007 // Rusty Dagger }; @@ -316,7 +316,7 @@ void Client::GoFish() uint32 food_id = 0; //25% chance to fish an item. - if (MakeRandomInt(0, 399) <= fishing_skill ) { + if (MakeRandomInt(0, 399) <= fishing_skill ) { uint32 npc_id = 0; uint8 npc_chance = 0; food_id = database.GetZoneFishing(m_pp.zone_id, fishing_skill, npc_id, npc_chance); @@ -366,7 +366,7 @@ void Client::GoFish() safe_delete(inst); } - parse->EventPlayer(EVENT_FISH_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0); + parse->EventPlayer(EVENT_FISH_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0); } else { @@ -382,7 +382,7 @@ void Client::GoFish() Message_StringID(MT_Skills, FISHING_FAILED); //You didn't catch anything. } - parse->EventPlayer(EVENT_FISH_FAILURE, this, "", 0); + parse->EventPlayer(EVENT_FISH_FAILURE, this, "", 0); } //chance to break fishing pole... @@ -475,19 +475,20 @@ void Client::ForageItem(bool guarantee) { safe_delete(inst); } - parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0); + parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0); - int ChanceSecondForage = aabonuses.ForageAdditionalItems + itembonuses.ForageAdditionalItems + spellbonuses.ForageAdditionalItems; - if(!guarantee && MakeRandomInt(0,99) < ChanceSecondForage) { - this->Message_StringID(MT_Skills, FORAGE_MASTERY); - this->ForageItem(true); - } + int ChanceSecondForage = aabonuses.ForageAdditionalItems + itembonuses.ForageAdditionalItems + spellbonuses.ForageAdditionalItems; + if(!guarantee && MakeRandomInt(0,99) < ChanceSecondForage) { + this->Message_StringID(MT_Skills, FORAGE_MASTERY); + this->ForageItem(true); + } } else { Message_StringID(MT_Skills, FORAGE_FAILED); - parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0); - } + parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0); + } CheckIncreaseSkill(FORAGE, nullptr, 5); } + diff --git a/zone/forage.h b/zone/forage.h index 1ec559a25..c2f852fd8 100644 --- a/zone/forage.h +++ b/zone/forage.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 FORAGE_H diff --git a/zone/groups.cpp b/zone/groups.cpp index b2ce46c13..85d75ff0d 100644 --- a/zone/groups.cpp +++ b/zone/groups.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 "masterentity.h" @@ -116,253 +116,252 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu if(copper == 0 && silver == 0 && gold == 0 && platinum == 0) return; - uint32 i; - uint8 membercount = 0; - for (i = 0; i < MAX_GROUP_MEMBERS; i++) { - if (members[i] != nullptr) { + uint32 i; + uint8 membercount = 0; + for (i = 0; i < MAX_GROUP_MEMBERS; i++) { + if (members[i] != nullptr) { + membercount++; + } + } - membercount++; - } - } + if (membercount == 0) + return; - if (membercount == 0) - return; + uint32 mod; + //try to handle round off error a little better + if(membercount > 1) { + mod = platinum % membercount; + if((mod) > 0) { + platinum -= mod; + gold += 10 * mod; + } + mod = gold % membercount; + if((mod) > 0) { + gold -= mod; + silver += 10 * mod; + } + mod = silver % membercount; + if((mod) > 0) { + silver -= mod; + copper += 10 * mod; + } + } - uint32 mod; - //try to handle round off error a little better - if(membercount > 1) { - mod = platinum % membercount; - if((mod) > 0) { - platinum -= mod; - gold += 10 * mod; - } - mod = gold % membercount; - if((mod) > 0) { - gold -= mod; - silver += 10 * mod; - } - mod = silver % membercount; - if((mod) > 0) { - silver -= mod; - copper += 10 * mod; - } - } + //calculate the splits + //We can still round off copper pieces, but I dont care + uint32 sc; + uint32 cpsplit = copper / membercount; + sc = copper % membercount; + uint32 spsplit = silver / membercount; + uint32 gpsplit = gold / membercount; + uint32 ppsplit = platinum / membercount; - //calculate the splits - //We can still round off copper pieces, but I dont care - uint32 sc; - uint32 cpsplit = copper / membercount; - sc = copper % membercount; - uint32 spsplit = silver / membercount; - uint32 gpsplit = gold / membercount; - uint32 ppsplit = platinum / membercount; + char buf[128]; + buf[63] = '\0'; + string msg = "You receive"; + bool one = false; - char buf[128]; - buf[63] = '\0'; - string msg = "You receive"; - bool one = false; + if(ppsplit > 0) { + snprintf(buf, 63, " %u platinum", ppsplit); + msg += buf; + one = true; + } + if(gpsplit > 0) { + if(one) + msg += ","; + snprintf(buf, 63, " %u gold", gpsplit); + msg += buf; + one = true; + } + if(spsplit > 0) { + if(one) + msg += ","; + snprintf(buf, 63, " %u silver", spsplit); + msg += buf; + one = true; + } + if(cpsplit > 0) { + if(one) + msg += ","; + //this message is not 100% accurate for the splitter + //if they are receiving any roundoff + snprintf(buf, 63, " %u copper", cpsplit); + msg += buf; + one = true; + } + msg += " as your split"; - if(ppsplit > 0) { - snprintf(buf, 63, " %u platinum", ppsplit); - msg += buf; - one = true; - } - if(gpsplit > 0) { - if(one) - msg += ","; - snprintf(buf, 63, " %u gold", gpsplit); - msg += buf; - one = true; - } - if(spsplit > 0) { - if(one) - msg += ","; - snprintf(buf, 63, " %u silver", spsplit); - msg += buf; - one = true; - } - if(cpsplit > 0) { - if(one) - msg += ","; - //this message is not 100% accurate for the splitter - //if they are receiving any roundoff - snprintf(buf, 63, " %u copper", cpsplit); - msg += buf; - one = true; - } - msg += " as your split"; - - for (i = 0; i < MAX_GROUP_MEMBERS; i++) { - if (members[i] != nullptr && members[i]->IsClient()) { // If Group Member is Client - Client *c = members[i]->CastToClient(); + for (i = 0; i < MAX_GROUP_MEMBERS; i++) { + if (members[i] != nullptr && members[i]->IsClient()) { // If Group Member is Client + Client *c = members[i]->CastToClient(); //I could not get MoneyOnCorpse to work, so we use this c->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true); c->Message(2, msg.c_str()); - } - } + } + } } bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 CharacterID) { - bool InZone = true; - bool ismerc = false; + bool InZone = true; + bool ismerc = false; - // This method should either be passed a Mob*, if the new member is in this zone, or a nullptr Mob* - // and the name and CharacterID of the new member, if they are out of zone. - // - if(!newmember && !NewMemberName) - return false; + // This method should either be passed a Mob*, if the new member is in this zone, or a nullptr Mob* + // and the name and CharacterID of the new member, if they are out of zone. + // + if(!newmember && !NewMemberName) + return false; - if(GroupCount() >= MAX_GROUP_MEMBERS) //Sanity check for merging groups together. + if(GroupCount() >= MAX_GROUP_MEMBERS) //Sanity check for merging groups together. + return false; + + if(!newmember) + InZone = false; + else + { + NewMemberName = newmember->GetCleanName(); + + if(newmember->IsClient()) + CharacterID = newmember->CastToClient()->CharacterID(); + if(newmember->IsMerc()) + { + Client* owner = newmember->CastToMerc()->GetMercOwner(); + if(owner) + { + CharacterID = owner->CastToClient()->CharacterID(); + NewMemberName = newmember->GetName(); + ismerc = true; + } + } + } + + uint32 i = 0; + + // See if they are already in the group + // + for (i = 0; i < MAX_GROUP_MEMBERS; ++i) + if(!strcasecmp(membername[i], NewMemberName)) return false; - if(!newmember) - InZone = false; - else - { - NewMemberName = newmember->GetCleanName(); + // Put them in the group + for (i = 0; i < MAX_GROUP_MEMBERS; ++i) + { + if (membername[i][0] == '\0') + { + if(InZone) + members[i] = newmember; - if(newmember->IsClient()) - CharacterID = newmember->CastToClient()->CharacterID(); - if(newmember->IsMerc()) - { - Client* owner = newmember->CastToMerc()->GetMercOwner(); - if(owner) - { - CharacterID = owner->CastToClient()->CharacterID(); - NewMemberName = newmember->GetName(); - ismerc = true; - } - } - } + break; + } + } - uint32 i = 0; + if (i == MAX_GROUP_MEMBERS) + return false; - // See if they are already in the group - // - for (i = 0; i < MAX_GROUP_MEMBERS; ++i) - if(!strcasecmp(membername[i], NewMemberName)) - return false; - - // Put them in the group - for (i = 0; i < MAX_GROUP_MEMBERS; ++i) - { - if (membername[i][0] == '\0') - { - if(InZone) - members[i] = newmember; - - break; - } - } - - if (i == MAX_GROUP_MEMBERS) - return false; - - strcpy(membername[i], NewMemberName); + strcpy(membername[i], NewMemberName); MemberRoles[i] = 0; - int x=1; + int x=1; - //build the template join packet - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); - GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer; - strcpy(gj->membername, NewMemberName); - gj->action = groupActJoin; + //build the template join packet + EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer; + strcpy(gj->membername, NewMemberName); + gj->action = groupActJoin; - gj->leader_aas = LeaderAbilities; + gj->leader_aas = LeaderAbilities; - for (i = 0;i < MAX_GROUP_MEMBERS; i++) { - if (members[i] != nullptr && members[i] != newmember) { - //fill in group join & send it - if(members[i]->IsMerc()) - { - strcpy(gj->yourname, members[i]->GetName()); - } - else - { - strcpy(gj->yourname, members[i]->GetCleanName()); - } - if(members[i]->IsClient()) { - members[i]->CastToClient()->QueuePacket(outapp); + for (i = 0;i < MAX_GROUP_MEMBERS; i++) { + if (members[i] != nullptr && members[i] != newmember) { + //fill in group join & send it + if(members[i]->IsMerc()) + { + strcpy(gj->yourname, members[i]->GetName()); + } + else + { + strcpy(gj->yourname, members[i]->GetCleanName()); + } + if(members[i]->IsClient()) { + members[i]->CastToClient()->QueuePacket(outapp); - //put new member into existing person's list - strcpy(members[i]->CastToClient()->GetPP().groupMembers[this->GroupCount()-1], NewMemberName); - } + //put new member into existing person's list + strcpy(members[i]->CastToClient()->GetPP().groupMembers[this->GroupCount()-1], NewMemberName); + } - //put this existing person into the new member's list - if(InZone && newmember->IsClient()) { - if(IsLeader(members[i])) - strcpy(newmember->CastToClient()->GetPP().groupMembers[0], members[i]->GetCleanName()); - else { - strcpy(newmember->CastToClient()->GetPP().groupMembers[x], members[i]->GetCleanName()); - x++; - } - } - } - } - - if(InZone) - { - //put new member in his own list. - newmember->SetGrouped(true); - - if(newmember->IsClient()) - { - strcpy(newmember->CastToClient()->GetPP().groupMembers[x], NewMemberName); - newmember->CastToClient()->Save(); - database.SetGroupID(NewMemberName, GetID(), newmember->CastToClient()->CharacterID(), false); - SendMarkedNPCsToMember(newmember->CastToClient()); - - NotifyMainTank(newmember->CastToClient(), 1); - NotifyMainAssist(newmember->CastToClient(), 1); - NotifyPuller(newmember->CastToClient(), 1); - } - - if(newmember->IsMerc()) - { - Client* owner = newmember->CastToMerc()->GetMercOwner(); - if(owner) - { - database.SetGroupID(newmember->GetName(), GetID(), owner->CharacterID(), true); - } + //put this existing person into the new member's list + if(InZone && newmember->IsClient()) { + if(IsLeader(members[i])) + strcpy(newmember->CastToClient()->GetPP().groupMembers[0], members[i]->GetCleanName()); + else { + strcpy(newmember->CastToClient()->GetPP().groupMembers[x], members[i]->GetCleanName()); + x++; } + } + } + } + + if(InZone) + { + //put new member in his own list. + newmember->SetGrouped(true); + + if(newmember->IsClient()) + { + strcpy(newmember->CastToClient()->GetPP().groupMembers[x], NewMemberName); + newmember->CastToClient()->Save(); + database.SetGroupID(NewMemberName, GetID(), newmember->CastToClient()->CharacterID(), false); + SendMarkedNPCsToMember(newmember->CastToClient()); + + NotifyMainTank(newmember->CastToClient(), 1); + NotifyMainAssist(newmember->CastToClient(), 1); + NotifyPuller(newmember->CastToClient(), 1); + } + + if(newmember->IsMerc()) + { + Client* owner = newmember->CastToMerc()->GetMercOwner(); + if(owner) + { + database.SetGroupID(newmember->GetName(), GetID(), owner->CharacterID(), true); + } + } #ifdef BOTS - for (i = 0;i < MAX_GROUP_MEMBERS; i++) { - if (members[i] != nullptr && members[i]->IsBot()) { - members[i]->CastToBot()->CalcChanceToCast(); - } - } + for (i = 0;i < MAX_GROUP_MEMBERS; i++) { + if (members[i] != nullptr && members[i]->IsBot()) { + members[i]->CastToBot()->CalcChanceToCast(); + } + } #endif //BOTS - } - else - database.SetGroupID(NewMemberName, GetID(), CharacterID, ismerc); + } + else + database.SetGroupID(NewMemberName, GetID(), CharacterID, ismerc); - safe_delete(outapp); + safe_delete(outapp); - return true; + return true; } void Group::AddMember(const char *NewMemberName) { - // This method should be called when both the new member and the group leader are in a different zone to this one. - // - for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) - if(!strcasecmp(membername[i], NewMemberName)) - { - return; - } + // This method should be called when both the new member and the group leader are in a different zone to this one. + // + for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) + if(!strcasecmp(membername[i], NewMemberName)) + { + return; + } - for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) - { - if (membername[i][0] == '\0') - { - strcpy(membername[i], NewMemberName); + for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) + { + if (membername[i][0] == '\0') + { + strcpy(membername[i], NewMemberName); MemberRoles[i] = 0; - break; - } - } + break; + } + } } @@ -374,7 +373,7 @@ void Group::QueuePacket(const EQApplicationPacket *app, bool ack_req) members[i]->CastToClient()->QueuePacket(app, ack_req); } -// solar: sends the rest of the group's hps to member. this is useful when +// solar: sends the rest of the group's hps to member. this is useful when // someone first joins a group, but otherwise there shouldn't be a need to // call it void Group::SendHPPacketsTo(Mob *member) @@ -413,7 +412,7 @@ void Group::SendHPPacketsFrom(Mob *member) if(!member) return; - member->CreateHPPacket(&hp_app); + member->CreateHPPacket(&hp_app); EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); uint32 i; @@ -482,26 +481,26 @@ void Group::MemberZoned(Mob* removemob) { if(removemob == GetLeader()) SetLeader(nullptr); - for (i = 0; i < MAX_GROUP_MEMBERS; i++) { - if (members[i] == removemob) { + for (i = 0; i < MAX_GROUP_MEMBERS; i++) { + if (members[i] == removemob) { members[i] = nullptr; //should NOT clear the name, it is used for world communication. break; - } + } #ifdef BOTS if (members[i] != nullptr && members[i]->IsBot()) { members[i]->CastToBot()->CalcChanceToCast(); } #endif //BOTS - } - if(removemob->IsClient() && HasRole(removemob, RoleAssist)) - SetGroupAssistTarget(0); + } + if(removemob->IsClient() && HasRole(removemob, RoleAssist)) + SetGroupAssistTarget(0); - if(removemob->IsClient() && HasRole(removemob, RoleTank)) - SetGroupTankTarget(0); + if(removemob->IsClient() && HasRole(removemob, RoleTank)) + SetGroupTankTarget(0); - if(removemob->IsClient() && HasRole(removemob, RolePuller)) - SetGroupPullerTarget(0); + if(removemob->IsClient() && HasRole(removemob, RolePuller)) + SetGroupPullerTarget(0); } bool Group::DelMemberOOZ(const char *Name) { @@ -550,7 +549,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) memset(membername[i],0,64); MemberRoles[i] = 0; break; - } + } } //handle leader quitting group gracefully @@ -604,7 +603,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) if(oldmember->IsClient()) oldmember->CastToClient()->QueuePacket(outapp); - } + } if(oldmember->IsClient()) database.SetGroupID(oldmember->GetCleanName(), 0, oldmember->CastToClient()->CharacterID()); @@ -622,7 +621,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) if(HasRole(oldmember, RoleAssist)) { - SetGroupAssistTarget(0); + SetGroupAssistTarget(0); UnDelegateMainAssist(oldmember->GetName()); } @@ -771,7 +770,7 @@ void Group::GroupMessage(Mob* sender, uint8 language, uint8 lang_skill, const ch } uint32 Group::GetTotalGroupDamage(Mob* other) { - uint32 total = 0; + uint32 total = 0; uint32 i; for (i = 0; i < MAX_GROUP_MEMBERS; i++) { @@ -825,7 +824,7 @@ void Group::DisbandGroup() { entity_list.RemoveGroup(GetID()); if(GetID() != 0) - database.ClearGroup(GetID()); + database.ClearGroup(GetID()); if(Leader && (Leader->IsLFP())) { Leader->UpdateLFP(); @@ -920,12 +919,12 @@ uint32 Group::GetHighestLevel() uint32 level = 1; uint32 i; for (i = 0; i < MAX_GROUP_MEMBERS; i++) - { + { if (members[i]) - { + { if(members[i]->GetLevel() > level) level = members[i]->GetLevel(); - } + } } return level; } @@ -934,12 +933,12 @@ uint32 Group::GetLowestLevel() uint32 level = 255; uint32 i; for (i = 0; i < MAX_GROUP_MEMBERS; i++) - { + { if (members[i]) - { + { if(members[i]->GetLevel() < level) level = members[i]->GetLevel(); - } + } } return level; } @@ -947,10 +946,10 @@ uint32 i; void Group::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float x, float y, float z, float heading) { uint32 i; - for (i = 0; i < MAX_GROUP_MEMBERS; i++) - { + for (i = 0; i < MAX_GROUP_MEMBERS; i++) + { if (members[i] != nullptr && members[i]->IsClient() && members[i] != sender) - { + { members[i]->CastToClient()->MovePC(zoneID, instance_id, x, y, z, heading, 0, ZoneSolicited); } } @@ -958,11 +957,11 @@ void Group::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float bool Group::LearnMembers() { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; MYSQL_ROW row; if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT name FROM group_id WHERE groupid=%lu", (unsigned long)GetID()), - errbuf,&result)){ + errbuf,&result)){ safe_delete_array(query); if(mysql_num_rows(result) < 1) { //could prolly be 2 mysql_free_result(result); @@ -1102,7 +1101,7 @@ void Group::BalanceHP(int32 penalty) { if(members[gi]){ if((members[gi]->GetMaxHP() - dmgtaken) < 1){ //this way the ability will never kill someone - members[gi]->SetHP(1); //but it will come darn close + members[gi]->SetHP(1); //but it will come darn close members[gi]->SendHPUpdate(); } else{ @@ -1277,7 +1276,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) char *Query = nullptr; if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET maintank='%s' WHERE gid=%i LIMIT 1", - MainTankName.c_str(), GetID()), errbuff)) + MainTankName.c_str(), GetID()), errbuff)) LogFile->write(EQEMuLog::Error, "Unable to set group main tank: %s\n", errbuff); safe_delete_array(Query); @@ -1326,7 +1325,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) char *Query = nullptr; if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET assist='%s' WHERE gid=%i LIMIT 1", - MainAssistName.c_str(), GetID()), errbuff)) + MainAssistName.c_str(), GetID()), errbuff)) LogFile->write(EQEMuLog::Error, "Unable to set group main assist: %s\n", errbuff); safe_delete_array(Query); @@ -1375,7 +1374,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) char *Query = nullptr; if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET puller='%s' WHERE gid=%i LIMIT 1", - PullerName.c_str(), GetID()), errbuff)) + PullerName.c_str(), GetID()), errbuff)) LogFile->write(EQEMuLog::Error, "Unable to set group main puller: %s\n", errbuff); safe_delete_array(Query); @@ -1529,7 +1528,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) char *Query = 0; if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET maintank='' WHERE gid=%i LIMIT 1", - GetID()), errbuff)) + GetID()), errbuff)) LogFile->write(EQEMuLog::Error, "Unable to clear group main tank: %s\n", errbuff); safe_delete_array(Query); @@ -1583,7 +1582,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) char *Query = 0; if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET assist='' WHERE gid=%i LIMIT 1", - GetID()), errbuff)) + GetID()), errbuff)) LogFile->write(EQEMuLog::Error, "Unable to clear group main assist: %s\n", errbuff); safe_delete_array(Query); @@ -1615,7 +1614,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) char *Query = 0; if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET puller='' WHERE gid=%i LIMIT 1", - GetID()), errbuff)) + GetID()), errbuff)) LogFile->write(EQEMuLog::Error, "Unable to clear group main puller: %s\n", errbuff); safe_delete_array(Query); @@ -1758,7 +1757,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) char *Query = 0; if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET marknpc='%s' WHERE gid=%i LIMIT 1", - NewNPCMarkerName, GetID()), errbuff)) + NewNPCMarkerName, GetID()), errbuff)) LogFile->write(EQEMuLog::Error, "Unable to set group mark npc: %s\n", errbuff); safe_delete_array(Query); @@ -1844,7 +1843,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) char *Query = 0; if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET marknpc='' WHERE gid=%i LIMIT 1", - GetID()), errbuff)) + GetID()), errbuff)) LogFile->write(EQEMuLog::Error, "Unable to clear group marknpc: %s\n", errbuff); safe_delete_array(Query); @@ -2135,3 +2134,4 @@ bool Group::HasRole(Mob *m, uint8 Role) } return false; } + diff --git a/zone/groups.h b/zone/groups.h index a8b7955b5..ddcb3fb21 100644 --- a/zone/groups.h +++ b/zone/groups.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 GROUPS_H #define GROUPS_H @@ -125,7 +125,7 @@ public: void SetNPCMarker(const char *NewNPCMarkerName); void UnMarkNPC(uint16 ID); void SendMarkedNPCsToMember(Client *c, bool Clear = false); - inline int GetLeadershipAA(int AAID) { return LeaderAbilities.ranks[AAID]; } + inline int GetLeadershipAA(int AAID) { return LeaderAbilities.ranks[AAID]; } void ClearAllNPCMarks(); void QueueHPPacketsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app); void ChangeLeader(Mob* newleader); diff --git a/zone/guild.cpp b/zone/guild.cpp index 29538128a..3be3f6fdd 100644 --- a/zone/guild.cpp +++ b/zone/guild.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 "masterentity.h" @@ -382,7 +382,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid,uint16 guild_id,const char* zone) MYSQL_ROW row; char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - MYSQL_RES *result; + MYSQL_RES *result; if (!RunQuery(query, MakeAnyLenString(&query, "SELECT guild FROM doors where doorid=%i AND zone='%s'", doorid-128, zone), errbuf, &result)) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index a8603f0b6..0e4690cee 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.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 "../common/debug.h" #include "guild_mgr.h" @@ -388,7 +388,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if(pack->size != sizeof(ServerGuildRankUpdate_Struct)) { _log(GUILDS__ERROR, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", - pack->size, sizeof(ServerGuildRankUpdate_Struct)); + pack->size, sizeof(ServerGuildRankUpdate_Struct)); return; } @@ -461,7 +461,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { char *Buffer = (char *)pack->pBuffer; uint32 FromID = VARSTRUCT_DECODE_TYPE(uint32, Buffer); - uint32 Count = VARSTRUCT_DECODE_TYPE(uint32, Buffer); + uint32 Count = VARSTRUCT_DECODE_TYPE(uint32, Buffer); Client *c = entity_list.GetClientByCharID(FromID); if (!c || !c->IsInAGuild()) @@ -647,7 +647,7 @@ GuildBankManager::~GuildBankManager() bool GuildBankManager::Load(uint32 GuildID) { - const char *LoadQuery = "SELECT `area`, `slot`, `itemid`, `qty`, `donator`, `permissions`, `whofor` from `guild_bank` " + const char *LoadQuery = "SELECT `area`, `slot`, `itemid`, `qty`, `donator`, `permissions`, `whofor` from `guild_bank` " "WHERE `guildid` = %i"; char errbuf[MYSQL_ERRMSG_SIZE]; @@ -784,15 +784,15 @@ void GuildBankManager::SendGuildBank(Client *c) if(!Item->Stackable) gbius->Init(GuildBankItemUpdate, 1, i, GuildBankDepositArea, 1, Item->ID, Item->Icon, 1, - (*Iterator)->Items.DepositArea[i].Permissions, 0, 0); + (*Iterator)->Items.DepositArea[i].Permissions, 0, 0); else { if((*Iterator)->Items.DepositArea[i].Quantity == Item->StackSize) gbius->Init(GuildBankItemUpdate, 1, i, GuildBankDepositArea, 1, Item->ID, Item->Icon, - (*Iterator)->Items.DepositArea[i].Quantity, (*Iterator)->Items.DepositArea[i].Permissions, 0, 0); + (*Iterator)->Items.DepositArea[i].Quantity, (*Iterator)->Items.DepositArea[i].Permissions, 0, 0); else gbius->Init(GuildBankItemUpdate, 1, i, GuildBankDepositArea, 1, Item->ID, Item->Icon, - (*Iterator)->Items.DepositArea[i].Quantity, (*Iterator)->Items.DepositArea[i].Permissions, 1, 0); + (*Iterator)->Items.DepositArea[i].Quantity, (*Iterator)->Items.DepositArea[i].Permissions, 1, 0); } strn0cpy(gbius->ItemName, Item->Name, sizeof(gbius->ItemName)); @@ -822,15 +822,15 @@ void GuildBankManager::SendGuildBank(Client *c) if(!Item->Stackable) gbius->Init(GuildBankItemUpdate, 1, i, GuildBankMainArea, 1, Item->ID, Item->Icon, 1, - (*Iterator)->Items.MainArea[i].Permissions, 0, Useable); + (*Iterator)->Items.MainArea[i].Permissions, 0, Useable); else { if((*Iterator)->Items.MainArea[i].Quantity == Item->StackSize) gbius->Init(GuildBankItemUpdate, 1, i, GuildBankMainArea, 1, Item->ID, Item->Icon, - (*Iterator)->Items.MainArea[i].Quantity, (*Iterator)->Items.MainArea[i].Permissions, 0, Useable); + (*Iterator)->Items.MainArea[i].Quantity, (*Iterator)->Items.MainArea[i].Permissions, 0, Useable); else gbius->Init(GuildBankItemUpdate, 1, i, GuildBankMainArea, 1, Item->ID, Item->Icon, - (*Iterator)->Items.MainArea[i].Quantity, (*Iterator)->Items.MainArea[i].Permissions, 1, Useable); + (*Iterator)->Items.MainArea[i].Quantity, (*Iterator)->Items.MainArea[i].Permissions, 1, Useable); } strn0cpy(gbius->ItemName, Item->Name, sizeof(gbius->ItemName)); @@ -932,7 +932,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 } const char *Query="INSERT INTO `guild_bank` (`guildid`, `area`, `slot`, `itemid`, `qty`, `donator`, `permissions`, `WhoFor`) " - "VALUES (%i, %i, %i, %i, %i, '%s', %i, '%s')"; + "VALUES (%i, %i, %i, %i, %i, '%s', %i, '%s')"; char errbuf[MYSQL_ERRMSG_SIZE]; @@ -1014,7 +1014,7 @@ int GuildBankManager::Promote(uint32 GuildID, int SlotID) strn0cpy((*Iterator)->Items.MainArea[MainSlot].WhoFor, (*Iterator)->Items.DepositArea[SlotID].WhoFor, sizeof((*Iterator)->Items.MainArea[MainSlot].WhoFor)); - const char *Query="UPDATE `guild_bank` SET `area` = 1, `slot` = %i WHERE `guildid` = %i AND `area` = 0 AND `slot` = %i LIMIT 1"; + const char *Query="UPDATE `guild_bank` SET `area` = 1, `slot` = %i WHERE `guildid` = %i AND `area` = 0 AND `slot` = %i LIMIT 1"; char errbuf[MYSQL_ERRMSG_SIZE]; @@ -1043,10 +1043,10 @@ int GuildBankManager::Promote(uint32 GuildID, int SlotID) { if((*Iterator)->Items.MainArea[MainSlot].Quantity == Item->StackSize) gbius.Init(GuildBankItemUpdate, 1, MainSlot, GuildBankMainArea, 1, Item->ID, Item->Icon, - (*Iterator)->Items.MainArea[MainSlot].Quantity, 0, 0, 0); + (*Iterator)->Items.MainArea[MainSlot].Quantity, 0, 0, 0); else gbius.Init(GuildBankItemUpdate, 1, MainSlot, GuildBankMainArea, 1, Item->ID, Item->Icon, - (*Iterator)->Items.MainArea[MainSlot].Quantity, 0, 1, 0); + (*Iterator)->Items.MainArea[MainSlot].Quantity, 0, 1, 0); } strn0cpy(gbius.ItemName, Item->Name, sizeof(gbius.ItemName)); @@ -1077,7 +1077,7 @@ void GuildBankManager::SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Perm return; } - const char *Query="UPDATE `guild_bank` SET `permissions` = %i, `whofor` = '%s' WHERE `guildid` = %i AND `area` = 1 AND `slot` = %i LIMIT 1"; + const char *Query="UPDATE `guild_bank` SET `permissions` = %i, `whofor` = '%s' WHERE `guildid` = %i AND `area` = 1 AND `slot` = %i LIMIT 1"; char errbuf[MYSQL_ERRMSG_SIZE]; @@ -1112,10 +1112,10 @@ void GuildBankManager::SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Perm { if((*Iterator)->Items.MainArea[SlotID].Quantity == Item->StackSize) gbius.Init(GuildBankItemUpdate, 1, SlotID, GuildBankMainArea, 1, Item->ID, Item->Icon, - (*Iterator)->Items.MainArea[SlotID].Quantity, (*Iterator)->Items.MainArea[SlotID].Permissions, 0, 0); + (*Iterator)->Items.MainArea[SlotID].Quantity, (*Iterator)->Items.MainArea[SlotID].Permissions, 0, 0); else gbius.Init(GuildBankItemUpdate, 1, SlotID, GuildBankMainArea, 1, Item->ID, Item->Icon, - (*Iterator)->Items.MainArea[SlotID].Quantity, (*Iterator)->Items.MainArea[SlotID].Permissions, 1, 0); + (*Iterator)->Items.MainArea[SlotID].Quantity, (*Iterator)->Items.MainArea[SlotID].Permissions, 1, 0); } @@ -1126,7 +1126,7 @@ void GuildBankManager::SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Perm entity_list.QueueClientsGuildBankItemUpdate(&gbius, GuildID); } -ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity) +ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity) { std::list::iterator Iterator = GetGuildBank(GuildID); @@ -1264,7 +1264,7 @@ bool GuildBankManager::DeleteItem(uint32 GuildID, uint16 Area, uint16 SlotID, ui const char *Query = "UPDATE `guild_bank` SET `qty` = %i where `guildid` = %i AND `area` = %i AND `slot` = %i LIMIT 1"; if(!database.RunQuery(query, MakeAnyLenString(&query, Query, BankArea[SlotID].Quantity - Quantity, - GuildID, Area, SlotID), errbuf)) + GuildID, Area, SlotID), errbuf)) { _log(GUILDS__BANK_ERROR, "Update item failed. %s : %s", query, errbuf); @@ -1481,7 +1481,7 @@ bool GuildApproval::ProcessApproval() { if(owner && owner->GuildID() != 0) { - owner->Message(10,"You are already in a guild! Guild request deleted."); + owner->Message(10,"You are already in a guild! Guild request deleted."); return false; } if(deletion_timer->Check() || !owner) @@ -1611,3 +1611,4 @@ void GuildApproval::GuildApproved() owner->Message(0, "Your guild was created."); owner = 0; } + diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 2450d5a91..491edc525 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.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" @@ -44,14 +44,14 @@ HateList::~HateList() // checks if target still is in frenzy mode void HateList::CheckFrenzyHate() { - LinkedListIterator iterator(list); - iterator.Reset(); + LinkedListIterator iterator(list); + iterator.Reset(); while(iterator.MoreElements()) - { - if (iterator.GetData()->ent->GetHPRatio() >= 20) - iterator.GetData()->bFrenzy = false; - iterator.Advance(); - } + { + if (iterator.GetData()->ent->GetHPRatio() >= 20) + iterator.GetData()->bFrenzy = false; + iterator.Advance(); + } } void HateList::Wipe() @@ -62,8 +62,8 @@ void HateList::Wipe() while(iterator.MoreElements()) { Mob* m = iterator.GetData()->ent; - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0); - iterator.RemoveCurrent(); + parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0); + iterator.RemoveCurrent(); if(m->IsClient()) m->CastToClient()->DecrementAggroCount(); @@ -80,27 +80,27 @@ bool HateList::IsOnHateList(Mob *mob) tHateEntry *HateList::Find(Mob *ent) { _ZP(HateList_Find); - LinkedListIterator iterator(list); - iterator.Reset(); + LinkedListIterator iterator(list); + iterator.Reset(); while(iterator.MoreElements()) - { - if(iterator.GetData()->ent == ent) - return iterator.GetData(); - iterator.Advance(); - } + { + if(iterator.GetData()->ent == ent) + return iterator.GetData(); + iterator.Advance(); + } return nullptr; } void HateList::Set(Mob* other, uint32 in_hate, uint32 in_dam) { - tHateEntry *p = Find(other); - if(p) - { + tHateEntry *p = Find(other); + if(p) + { if(in_dam > 0) - p->damage = in_dam; + p->damage = in_dam; if(in_hate > 0) - p->hate = in_hate; - } + p->hate = in_hate; + } } Mob* HateList::GetDamageTop(Mob* hater) @@ -111,10 +111,10 @@ Mob* HateList::GetDamageTop(Mob* hater) Raid* r = nullptr; uint32 dmg_amt = 0; - LinkedListIterator iterator(list); - iterator.Reset(); + LinkedListIterator iterator(list); + iterator.Reset(); while(iterator.MoreElements()) - { + { grp = nullptr; r = nullptr; @@ -122,7 +122,7 @@ Mob* HateList::GetDamageTop(Mob* hater) r = entity_list.GetRaidByClient(iterator.GetData()->ent->CastToClient()); } - grp = entity_list.GetGroupByMob(iterator.GetData()->ent); + grp = entity_list.GetGroupByMob(iterator.GetData()->ent); if(iterator.GetData()->ent && r){ if(r->GetTotalRaidDamage(hater) >= dmg_amt) @@ -132,20 +132,20 @@ Mob* HateList::GetDamageTop(Mob* hater) } } else if (iterator.GetData()->ent != nullptr && grp != nullptr) - { + { if (grp->GetTotalGroupDamage(hater) >= dmg_amt) - { + { current = iterator.GetData()->ent; dmg_amt = grp->GetTotalGroupDamage(hater); - } - } - else if (iterator.GetData()->ent != nullptr && (uint32)iterator.GetData()->damage >= dmg_amt) - { + } + } + else if (iterator.GetData()->ent != nullptr && (uint32)iterator.GetData()->damage >= dmg_amt) + { current = iterator.GetData()->ent; dmg_amt = iterator.GetData()->damage; - } - iterator.Advance(); - } + } + iterator.Advance(); + } return current; } @@ -155,15 +155,15 @@ Mob* HateList::GetClosest(Mob *hater) { float closedist = 99999.9f; float thisdist; - LinkedListIterator iterator(list); - iterator.Reset(); + LinkedListIterator iterator(list); + iterator.Reset(); while(iterator.MoreElements()) { thisdist = iterator.GetData()->ent->DistNoRootNoZ(*hater); if(iterator.GetData()->ent != nullptr && thisdist <= closedist) { closedist = thisdist; close = iterator.GetData()->ent; } - iterator.Advance(); + iterator.Advance(); } if (close == 0 && hater->IsNPC()) @@ -177,7 +177,7 @@ Mob* HateList::GetClosest(Mob *hater) { void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAddIfNotExist) { if(!ent) - return; + return; if(ent->IsCorpse()) return; @@ -193,17 +193,17 @@ void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAd p->bFrenzy = bFrenzy; } else if (iAddIfNotExist) { - p = new tHateEntry; - p->ent = ent; - p->damage = (in_dam>=0)?in_dam:0; - p->hate = in_hate; - p->bFrenzy = bFrenzy; - list.Append(p); + p = new tHateEntry; + p->ent = ent; + p->damage = (in_dam>=0)?in_dam:0; + p->hate = in_hate; + p->bFrenzy = bFrenzy; + list.Append(p); parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0); if(ent->IsClient()) ent->CastToClient()->IncrementAggroCount(); - } + } } bool HateList::RemoveEnt(Mob *ent) @@ -216,14 +216,14 @@ bool HateList::RemoveEnt(Mob *ent) { if(iterator.GetData()->ent == ent) { - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0); + parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0); iterator.RemoveCurrent(); found = true; if(ent->IsClient()) ent->CastToClient()->DecrementAggroCount(); - } + } else iterator.Advance(); } @@ -234,21 +234,21 @@ void HateList::DoFactionHits(int32 nfl_id) { _ZP(HateList_DoFactionHits); if (nfl_id <= 0) return; - LinkedListIterator iterator(list); - iterator.Reset(); + LinkedListIterator iterator(list); + iterator.Reset(); while(iterator.MoreElements()) - { - Client *p; + { + Client *p; - if (iterator.GetData()->ent && iterator.GetData()->ent->IsClient()) - p = iterator.GetData()->ent->CastToClient(); - else - p = nullptr; + if (iterator.GetData()->ent && iterator.GetData()->ent->IsClient()) + p = iterator.GetData()->ent->CastToClient(); + else + p = nullptr; - if (p) + if (p) p->SetFactionLevel(p->CharacterID(), nfl_id, p->GetBaseClass(), p->GetBaseRace(), p->GetDeity()); - iterator.Advance(); - } + iterator.Advance(); + } } Mob *HateList::GetTop(Mob *center) @@ -260,13 +260,13 @@ Mob *HateList::GetTop(Mob *center) if (RuleB(Aggro,SmartAggroList)){ Mob* topClientTypeInRange = nullptr; int32 hateClientTypeInRange = -1; - int skipped_count = 0; + int skipped_count = 0; LinkedListIterator iterator(list); iterator.Reset(); while(iterator.MoreElements()) { - tHateEntry *cur = iterator.GetData(); + tHateEntry *cur = iterator.GetData(); int16 aggroMod = 0; if(!cur){ @@ -279,13 +279,13 @@ Mob *HateList::GetTop(Mob *center) continue; } - if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) { - skipped_count++; - iterator.Advance(); - continue; - } - } + if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { + if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) { + skipped_count++; + iterator.Advance(); + continue; + } + } if(cur->ent->DivineAura() || cur->ent->IsMezzed() || cur->ent->IsFeared()){ if(hate == -1) @@ -362,7 +362,7 @@ Mob *HateList::GetTop(Mob *center) } #endif //BOTS - if(!isTopClientType) { + if(!isTopClientType) { if(top->IsMerc()) { isTopClientType = true; topClientTypeInRange = top; @@ -373,28 +373,28 @@ Mob *HateList::GetTop(Mob *center) return topClientTypeInRange; return top; - } + } else { if(top == nullptr && skipped_count > 0) { - return center->GetTarget(); - } + return center->GetTarget(); + } return top; - } + } } else{ LinkedListIterator iterator(list); iterator.Reset(); - int skipped_count = 0; + int skipped_count = 0; while(iterator.MoreElements()) { - tHateEntry *cur = iterator.GetData(); - if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) { - skipped_count++; - iterator.Advance(); - continue; - } - } + tHateEntry *cur = iterator.GetData(); + if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { + if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) { + skipped_count++; + iterator.Advance(); + continue; + } + } if(cur->ent != nullptr && ((cur->hate > hate) || cur->bFrenzy )) { @@ -404,8 +404,8 @@ Mob *HateList::GetTop(Mob *center) iterator.Advance(); } if(top == nullptr && skipped_count > 0) { - return center->GetTarget(); - } + return center->GetTarget(); + } return top; } } @@ -434,32 +434,32 @@ Mob *HateList::GetMostHate(){ Mob *HateList::GetRandom() { - int count = 0; - LinkedListIterator iterator(list); - iterator.Reset(); + int count = 0; + LinkedListIterator iterator(list); + iterator.Reset(); while(iterator.MoreElements()) - { - iterator.Advance(); - count++; - } + { + iterator.Advance(); + count++; + } if(!count) return nullptr; - int random = MakeRandomInt(0, count-1); - iterator.Reset(); - for (int i = 0; i < random; i++) - iterator.Advance(); - return iterator.GetData()->ent; + int random = MakeRandomInt(0, count-1); + iterator.Reset(); + for (int i = 0; i < random; i++) + iterator.Advance(); + return iterator.GetData()->ent; } int32 HateList::GetEntHate(Mob *ent, bool damage) { tHateEntry *p; - p = Find(ent); + p = Find(ent); if ( p && damage) - return p->damage; + return p->damage; else if (p) return p->hate; else diff --git a/zone/hate_list.h b/zone/hate_list.h index 07c2dd16a..72dfc106b 100644 --- a/zone/hate_list.h +++ b/zone/hate_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 HATELIST_H @@ -22,41 +22,41 @@ class tHateEntry { public: - Mob *ent; - int32 damage, hate; - bool bFrenzy; + Mob *ent; + int32 damage, hate; + bool bFrenzy; }; class HateList { public: - HateList(); - ~HateList(); + HateList(); + ~HateList(); - // adds a mob to the hatelist - void Add(Mob *ent, int32 in_hate=0, int32 in_dam=0, bool bFrenzy = false, bool iAddIfNotExist = true); - // sets existing hate - void Set(Mob *other, uint32 in_hate, uint32 in_dam); - // removes mobs from hatelist - bool RemoveEnt(Mob *ent); - // Remove all - void Wipe(); - // ??? - void DoFactionHits(int32 nfl_id); - // Gets Hate amount for mob - int32 GetEntHate(Mob *ent, bool damage = false); - // gets top hated mob - Mob *GetTop(Mob *center); - // gets any on the list - Mob *GetRandom(); - // get closest mob or nullptr if list empty - Mob *GetClosest(Mob *hater); - // gets top mob or nullptr if hate list empty - Mob *GetDamageTop(Mob *hater); - // used to check if mob is on hatelist - bool IsOnHateList(Mob *); - // used to remove or add frenzy hate - void CheckFrenzyHate(); + // adds a mob to the hatelist + void Add(Mob *ent, int32 in_hate=0, int32 in_dam=0, bool bFrenzy = false, bool iAddIfNotExist = true); + // sets existing hate + void Set(Mob *other, uint32 in_hate, uint32 in_dam); + // removes mobs from hatelist + bool RemoveEnt(Mob *ent); + // Remove all + void Wipe(); + // ??? + void DoFactionHits(int32 nfl_id); + // Gets Hate amount for mob + int32 GetEntHate(Mob *ent, bool damage = false); + // gets top hated mob + Mob *GetTop(Mob *center); + // gets any on the list + Mob *GetRandom(); + // get closest mob or nullptr if list empty + Mob *GetClosest(Mob *hater); + // gets top mob or nullptr if hate list empty + Mob *GetDamageTop(Mob *hater); + // used to check if mob is on hatelist + bool IsOnHateList(Mob *); + // used to remove or add frenzy hate + void CheckFrenzyHate(); //Gets the target with the most hate regardless of things like frenzy etc. Mob* GetMostHate(); @@ -64,7 +64,7 @@ public: void SpellCast(Mob *caster, uint32 spell_id, float range); - bool IsEmpty(); + bool IsEmpty(); void PrintToClient(Client *c); //For accessing the hate list via perl; don't use for anything else @@ -74,9 +74,9 @@ public: void SetOwner(Mob *newOwner) { owner = newOwner; } protected: - tHateEntry *Find(Mob *ent); + tHateEntry *Find(Mob *ent); private: - LinkedList list; + LinkedList list; Mob *owner; }; diff --git a/zone/horse.cpp b/zone/horse.cpp index a7c904ebf..ef4b23812 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -1,23 +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 */ - - #include "../common/debug.h" #include "masterentity.h" #include "../common/Item.h" @@ -127,18 +125,16 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { return nullptr; } else { - LogFile->write(EQEMuLog::Error, "Error in Mount query '%s': %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "Error in Mount query '%s': %s", query, errbuf); safe_delete_array(query); return nullptr; } } - - void Client::SummonHorse(uint16 spell_id) { if (GetHorseId() != 0) { - Message(13,"You already have a Horse. Get off, Fatbutt!"); + Message(13,"You already have a Horse. Get off, Fatbutt!"); return; } if(!Horse::IsHorseSpell(spell_id)) { @@ -205,4 +201,3 @@ void Mob::CreateHorseSpawnPacket(EQApplicationPacket* app, const char* ownername #endif } - diff --git a/zone/horse.h b/zone/horse.h index a9915edf0..c9ecaaac7 100644 --- a/zone/horse.h +++ b/zone/horse.h @@ -1,24 +1,23 @@ -/* 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 HORSES_H #define HORSES_H - #include "../common/debug.h" #include "npc.h" @@ -42,7 +41,4 @@ protected: static const NPCType *BuildHorseType(uint16 spell_id); }; - - - #endif diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 0a7d070d6..b20a0f4e2 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.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 "masterentity.h" @@ -41,145 +41,145 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { ItemInst *cur = nullptr; int i; - if(where_to_check & invWhereWorn) { - for (i=0; i<=21; i++) { // Equipped - if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { - cur = m_inv.GetItem(i); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + if(where_to_check & invWhereWorn) { + for (i=0; i<=21; i++) { // Equipped + if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { + cur = m_inv.GetItem(i); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(i, 0, true); - } - } + DeleteItemInInventory(i, 0, true); + } + } - // Power Source Slot - if (GetItemIDAt(9999) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(9999) != INVALID_ID)) { - cur = m_inv.GetItem(9999); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + // Power Source Slot + if (GetItemIDAt(9999) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(9999) != INVALID_ID)) { + cur = m_inv.GetItem(9999); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - if (GetClientVersion() >= EQClientSoF) - DeleteItemInInventory(9999, 0, true); - else - DeleteItemInInventory(9999, 0, false); // Prevents Titanium crash - } - } + if (GetClientVersion() >= EQClientSoF) + DeleteItemInInventory(9999, 0, true); + else + DeleteItemInInventory(9999, 0, false); // Prevents Titanium crash + } + } - if(where_to_check & invWhereCursor) { - if (GetItemIDAt(30) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(30) != INVALID_ID)) { - cur = m_inv.GetItem(30); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + if(where_to_check & invWhereCursor) { + if (GetItemIDAt(30) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(30) != INVALID_ID)) { + cur = m_inv.GetItem(30); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(30, 0, true); - } + DeleteItemInInventory(30, 0, true); + } - for (i=331; i<=340; i++) { // cursor's containers - if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { - cur = m_inv.GetItem(i); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + for (i=331; i<=340; i++) { // cursor's containers + if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { + cur = m_inv.GetItem(i); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(i, 0, true); - } - } - } + DeleteItemInInventory(i, 0, true); + } + } + } - if(where_to_check & invWherePersonal) { - for (i=22; i<=29; i++) { // Equipped - if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { - cur = m_inv.GetItem(i); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + if(where_to_check & invWherePersonal) { + for (i=22; i<=29; i++) { // Equipped + if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { + cur = m_inv.GetItem(i); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(i, 0, true); - } - } + DeleteItemInInventory(i, 0, true); + } + } - for (i=251; i<=330; i++) { // Main inventory's containers - if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { - cur = m_inv.GetItem(i); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + for (i=251; i<=330; i++) { // Main inventory's containers + if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { + cur = m_inv.GetItem(i); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(i, 0, true); - } - } - } + DeleteItemInInventory(i, 0, true); + } + } + } - if(where_to_check & invWhereBank) { - for (i=2000; i<=2023; i++) { // Bank slots - if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { - cur = m_inv.GetItem(i); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + if(where_to_check & invWhereBank) { + for (i=2000; i<=2023; i++) { // Bank slots + if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { + cur = m_inv.GetItem(i); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(i, 0, true); - } - } + DeleteItemInInventory(i, 0, true); + } + } - for (i=2031; i<=2270; i++) { // Bank's containers - if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { - cur = m_inv.GetItem(i); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + for (i=2031; i<=2270; i++) { // Bank's containers + if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { + cur = m_inv.GetItem(i); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(i, 0, true); - } - } - } + DeleteItemInInventory(i, 0, true); + } + } + } - if(where_to_check & invWhereSharedBank) { - for (i=2500; i<=2501; i++) { // Shared bank - if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { - cur = m_inv.GetItem(i); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + if(where_to_check & invWhereSharedBank) { + for (i=2500; i<=2501; i++) { // Shared bank + if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { + cur = m_inv.GetItem(i); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(i, 0, true); - } - } + DeleteItemInInventory(i, 0, true); + } + } - for (i=2531; i<=2550; i++) { // Shared bank's containers - if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { - cur = m_inv.GetItem(i); - if(cur && cur->GetItem()->Stackable) { - x += cur->GetCharges(); - } else { - x++; - } + for (i=2531; i<=2550; i++) { // Shared bank's containers + if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { + cur = m_inv.GetItem(i); + if(cur && cur->GetItem()->Stackable) { + x += cur->GetCharges(); + } else { + x++; + } - DeleteItemInInventory(i, 0, true); - } - } - } + DeleteItemInInventory(i, 0, true); + } + } + } return x; } @@ -305,7 +305,7 @@ void Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, } } } - else { // Item was already in inventory & is a LORE item or was a GM only item. Give them a message about it. + else { // Item was already in inventory & is a LORE item or was a GM only item. Give them a message about it. if (foundlore){ DuplicateLoreMessage(item_id); //Message(0, "You already have a %s (%i) in your inventory!", item->Name, item_id); @@ -447,14 +447,14 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd if(bagitem) { int16 bagslot_id = Inventory::CalcSlotId(slot_id, bag_idx); - qsaudit->items[++parent_offset].char_slot = bagslot_id; - qsaudit->items[parent_offset].item_id = bagitem->GetID(); - qsaudit->items[parent_offset].charges = bagitem->GetCharges(); - qsaudit->items[parent_offset].aug_1 = bagitem->GetAugmentItemID(1); - qsaudit->items[parent_offset].aug_2 = bagitem->GetAugmentItemID(2); - qsaudit->items[parent_offset].aug_3 = bagitem->GetAugmentItemID(3); - qsaudit->items[parent_offset].aug_4 = bagitem->GetAugmentItemID(4); - qsaudit->items[parent_offset].aug_5 = bagitem->GetAugmentItemID(5); + qsaudit->items[++parent_offset].char_slot = bagslot_id; + qsaudit->items[parent_offset].item_id = bagitem->GetID(); + qsaudit->items[parent_offset].charges = bagitem->GetCharges(); + qsaudit->items[parent_offset].aug_1 = bagitem->GetAugmentItemID(1); + qsaudit->items[parent_offset].aug_2 = bagitem->GetAugmentItemID(2); + qsaudit->items[parent_offset].aug_3 = bagitem->GetAugmentItemID(3); + qsaudit->items[parent_offset].aug_4 = bagitem->GetAugmentItemID(4); + qsaudit->items[parent_offset].aug_5 = bagitem->GetAugmentItemID(5); } } } @@ -470,14 +470,14 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd const ItemInst* inst=nullptr; if (slot_id==SLOT_CURSOR) { list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); - if(update_db) - database.SaveCursor(character_id, s, e); + if(update_db) + database.SaveCursor(character_id, s, e); } else { // Save change to database inst = m_inv[slot_id]; - if(update_db) - database.SaveInventory(character_id, inst, slot_id); + if(update_db) + database.SaveInventory(character_id, inst, slot_id); } if(client_update && IsValidSlot(slot_id)) { @@ -958,10 +958,10 @@ bool Client::IsValidSlot(uint32 slot) bool Client::IsBankSlot(uint32 slot) { - if((slot >= 2000 && slot <= 2023) || // Bank - (slot >= 2031 && slot <= 2270) || // Bank bags - (slot >= 2500 && slot <= 2501) || // Shared bank - (slot >= 2531 && slot <= 2550)) // Shared bank bags + if ((slot >= 2000 && slot <= 2023) || // Bank + (slot >= 2031 && slot <= 2270) || // Bank bags + (slot >= 2500 && slot <= 2501) || // Shared bank + (slot >= 2531 && slot <= 2550)) // Shared bank bags { return true; } @@ -1464,30 +1464,30 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { const ItemInst* from_inst = m_inv[postaction_call?to_slot_id:from_slot_id]; if(from_inst) { - qsaudit->items[move_count].from_slot = from_slot_id; - qsaudit->items[move_count].to_slot = to_slot_id; - qsaudit->items[move_count].item_id = from_inst->GetID(); - qsaudit->items[move_count].charges = from_inst->GetCharges(); - qsaudit->items[move_count].aug_1 = from_inst->GetAugmentItemID(1); - qsaudit->items[move_count].aug_2 = from_inst->GetAugmentItemID(2); - qsaudit->items[move_count].aug_3 = from_inst->GetAugmentItemID(3); - qsaudit->items[move_count].aug_4 = from_inst->GetAugmentItemID(4); - qsaudit->items[move_count++].aug_5 = from_inst->GetAugmentItemID(5); + qsaudit->items[move_count].from_slot = from_slot_id; + qsaudit->items[move_count].to_slot = to_slot_id; + qsaudit->items[move_count].item_id = from_inst->GetID(); + qsaudit->items[move_count].charges = from_inst->GetCharges(); + qsaudit->items[move_count].aug_1 = from_inst->GetAugmentItemID(1); + qsaudit->items[move_count].aug_2 = from_inst->GetAugmentItemID(2); + qsaudit->items[move_count].aug_3 = from_inst->GetAugmentItemID(3); + qsaudit->items[move_count].aug_4 = from_inst->GetAugmentItemID(4); + qsaudit->items[move_count++].aug_5 = from_inst->GetAugmentItemID(5); if(from_inst->IsType(ItemClassContainer)) { for(uint8 bag_idx = 0; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) { const ItemInst* from_baginst = from_inst->GetItem(bag_idx); if(from_baginst) { - qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); - qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); - qsaudit->items[move_count].item_id = from_baginst->GetID(); - qsaudit->items[move_count].charges = from_baginst->GetCharges(); - qsaudit->items[move_count].aug_1 = from_baginst->GetAugmentItemID(1); - qsaudit->items[move_count].aug_2 = from_baginst->GetAugmentItemID(2); - qsaudit->items[move_count].aug_3 = from_baginst->GetAugmentItemID(3); - qsaudit->items[move_count].aug_4 = from_baginst->GetAugmentItemID(4); - qsaudit->items[move_count++].aug_5 = from_baginst->GetAugmentItemID(5); + qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); + qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); + qsaudit->items[move_count].item_id = from_baginst->GetID(); + qsaudit->items[move_count].charges = from_baginst->GetCharges(); + qsaudit->items[move_count].aug_1 = from_baginst->GetAugmentItemID(1); + qsaudit->items[move_count].aug_2 = from_baginst->GetAugmentItemID(2); + qsaudit->items[move_count].aug_3 = from_baginst->GetAugmentItemID(3); + qsaudit->items[move_count].aug_4 = from_baginst->GetAugmentItemID(4); + qsaudit->items[move_count++].aug_5 = from_baginst->GetAugmentItemID(5); } } } @@ -1497,30 +1497,30 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { const ItemInst* to_inst = m_inv[postaction_call?from_slot_id:to_slot_id]; if(to_inst) { - qsaudit->items[move_count].from_slot = to_slot_id; - qsaudit->items[move_count].to_slot = from_slot_id; - qsaudit->items[move_count].item_id = to_inst->GetID(); - qsaudit->items[move_count].charges = to_inst->GetCharges(); - qsaudit->items[move_count].aug_1 = to_inst->GetAugmentItemID(1); - qsaudit->items[move_count].aug_2 = to_inst->GetAugmentItemID(2); - qsaudit->items[move_count].aug_3 = to_inst->GetAugmentItemID(3); - qsaudit->items[move_count].aug_4 = to_inst->GetAugmentItemID(4); - qsaudit->items[move_count++].aug_5 = to_inst->GetAugmentItemID(5); + qsaudit->items[move_count].from_slot = to_slot_id; + qsaudit->items[move_count].to_slot = from_slot_id; + qsaudit->items[move_count].item_id = to_inst->GetID(); + qsaudit->items[move_count].charges = to_inst->GetCharges(); + qsaudit->items[move_count].aug_1 = to_inst->GetAugmentItemID(1); + qsaudit->items[move_count].aug_2 = to_inst->GetAugmentItemID(2); + qsaudit->items[move_count].aug_3 = to_inst->GetAugmentItemID(3); + qsaudit->items[move_count].aug_4 = to_inst->GetAugmentItemID(4); + qsaudit->items[move_count++].aug_5 = to_inst->GetAugmentItemID(5); if(to_inst->IsType(ItemClassContainer)) { for(uint8 bag_idx = 0; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) { const ItemInst* to_baginst = to_inst->GetItem(bag_idx); if(to_baginst) { - qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); - qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); - qsaudit->items[move_count].item_id = to_baginst->GetID(); - qsaudit->items[move_count].charges = to_baginst->GetCharges(); - qsaudit->items[move_count].aug_1 = to_baginst->GetAugmentItemID(1); - qsaudit->items[move_count].aug_2 = to_baginst->GetAugmentItemID(2); - qsaudit->items[move_count].aug_3 = to_baginst->GetAugmentItemID(3); - qsaudit->items[move_count].aug_4 = to_baginst->GetAugmentItemID(4); - qsaudit->items[move_count++].aug_5 = to_baginst->GetAugmentItemID(5); + qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); + qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); + qsaudit->items[move_count].item_id = to_baginst->GetID(); + qsaudit->items[move_count].charges = to_baginst->GetCharges(); + qsaudit->items[move_count].aug_1 = to_baginst->GetAugmentItemID(1); + qsaudit->items[move_count].aug_2 = to_baginst->GetAugmentItemID(2); + qsaudit->items[move_count].aug_3 = to_baginst->GetAugmentItemID(3); + qsaudit->items[move_count].aug_4 = to_baginst->GetAugmentItemID(4); + qsaudit->items[move_count++].aug_5 = to_baginst->GetAugmentItemID(5); } } } @@ -1913,7 +1913,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const return 0; } -bool Client::LootToStack(uint32 itemid) { //Loots stackable items to existing stacks - Wiz +bool Client::LootToStack(uint32 itemid) { //Loots stackable items to existing stacks - Wiz // @merth: Need to do loot code with new inventory struct /* const Item_Struct* item; @@ -2079,7 +2079,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { _log(INVENTORY__BANDOLIER, "Char: %s activating set %i", GetName(), bss->number); int16 slot; int16 WeaponSlot; - ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory + ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory // First we pull the items for this bandolier set out of their inventory, this makes space to put the // currently equipped items back. @@ -2091,7 +2091,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // Check if the player has the item specified in the bandolier set on them. // slot = m_inv.HasItem(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id, 1, - invWhereWorn|invWherePersonal); + invWhereWorn|invWherePersonal); // removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here if (slot == SLOT_INVALID) { @@ -2121,7 +2121,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // the client does. if(((BandolierSlot == bandolierAmmo) || (BandolierSlot == bandolierRange)) && - BandolierItems[BandolierSlot] && BandolierItems[BandolierSlot]->IsStackable()){ + BandolierItems[BandolierSlot] && BandolierItems[BandolierSlot]->IsStackable()){ int Charges = BandolierItems[BandolierSlot]->GetCharges(); // If there is more than one charge if(Charges > 1) { @@ -2145,12 +2145,12 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(InvItem) { // If there was an item in that weapon slot, put it in the inventory _log(INVENTORY__BANDOLIER, "returning item %s in weapon slot %i to inventory", - InvItem->GetItem()->Name, WeaponSlot); + InvItem->GetItem()->Name, WeaponSlot); if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), - InvItem->GetItem()->Name); + InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2185,7 +2185,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // If there was already an item in that weapon slot that we replaced, find a place to put it if(!MoveItemToInventory(InvItem)) _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), - InvItem->GetItem()->Name); + InvItem->GetItem()->Name); safe_delete(InvItem); } } @@ -2196,13 +2196,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) { ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { _log(INVENTORY__BANDOLIER, "Bandolier has no item for slot %i, returning item %s to inventory", - WeaponSlot, InvItem->GetItem()->Name); + WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), - InvItem->GetItem()->Name); + InvItem->GetItem()->Name); safe_delete(InvItem); } } @@ -2249,7 +2249,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft ? ItemToReturn->GetCharges() : - ChargeSlotsLeft; + ChargeSlotsLeft; InvItem->SetCharges(InvItem->GetCharges() + ChargesToMove); @@ -2274,22 +2274,22 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { uint8 BagSlot; for (BagSlot=0; BagSlotGetItem()->ID == ItemID) && - (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { + if (InvItem && (InvItem->GetItem()->ID == ItemID) && + (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft - ? ItemToReturn->GetCharges() : ChargeSlotsLeft; + ? ItemToReturn->GetCharges() : ChargeSlotsLeft; InvItem->SetCharges(InvItem->GetCharges() + ChargesToMove); if(UpdateClient) SendItemPacket(BaseSlotID + BagSlot, m_inv.GetItem(BaseSlotID + BagSlot), - ItemPacketTrade); + ItemPacketTrade); database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), - BaseSlotID + BagSlot); + BaseSlotID + BagSlot); ItemToReturn->SetCharges(ItemToReturn->GetCharges() - ChargesToMove); @@ -2357,41 +2357,42 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { } void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) { - ItemInst *inst = GetItem(slot_id); - if(inst) { - inst->SetCustomData(identifier, value); - database.SaveInventory(character_id, inst, slot_id); - } + ItemInst *inst = GetItem(slot_id); + if(inst) { + inst->SetCustomData(identifier, value); + database.SaveInventory(character_id, inst, slot_id); + } } void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value) { - ItemInst *inst = GetItem(slot_id); - if(inst) { - inst->SetCustomData(identifier, value); - database.SaveInventory(character_id, inst, slot_id); - } + ItemInst *inst = GetItem(slot_id); + if(inst) { + inst->SetCustomData(identifier, value); + database.SaveInventory(character_id, inst, slot_id); + } } void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value) { - ItemInst *inst = GetItem(slot_id); - if(inst) { - inst->SetCustomData(identifier, value); - database.SaveInventory(character_id, inst, slot_id); - } + ItemInst *inst = GetItem(slot_id); + if(inst) { + inst->SetCustomData(identifier, value); + database.SaveInventory(character_id, inst, slot_id); + } } void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value) { - ItemInst *inst = GetItem(slot_id); - if(inst) { - inst->SetCustomData(identifier, value); - database.SaveInventory(character_id, inst, slot_id); - } + ItemInst *inst = GetItem(slot_id); + if(inst) { + inst->SetCustomData(identifier, value); + database.SaveInventory(character_id, inst, slot_id); + } } std::string Inventory::GetCustomItemData(int16 slot_id, std::string identifier) { - ItemInst *inst = GetItem(slot_id); - if(inst) { - return inst->GetCustomData(identifier); - } - return ""; + ItemInst *inst = GetItem(slot_id); + if(inst) { + return inst->GetCustomData(identifier); + } + return ""; } + diff --git a/zone/loottables.cpp b/zone/loottables.cpp index d211d3e4d..875d5d762 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.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 @@ -61,15 +61,15 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite *copper = MakeRandomInt(mincoin, maxcoin); *silver = MakeRandomInt(mincoin, maxcoin); *gold = MakeRandomInt(mincoin, maxcoin); - if(*copper > cash) { *copper = cash; } - cash -= *copper; - if(*silver>(cash/10)) { *silver = (cash/10); } - cash -= *silver*10; - if(*gold > (cash/100)) { *gold = (cash/100); } - cash -= *gold*100; - } - if (cash < 0) { - cash = 0; + if(*copper > cash) { *copper = cash; } + cash -= *copper; + if(*silver>(cash/10)) { *silver = (cash/10); } + cash -= *silver*10; + if(*gold > (cash/100)) { *gold = (cash/100); } + cash -= *gold*100; + } + if (cash < 0) { + cash = 0; } *plat = cash / 1000; cash -= *plat * 1000; @@ -86,21 +86,21 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite // Do items for (uint32 i=0; iNumEntries; i++) { for (uint32 k = 1; k <= lts->Entries[i].multiplier; k++) { - uint8 droplimit = lts->Entries[i].droplimit; - uint8 mindrop = lts->Entries[i].mindrop; + uint8 droplimit = lts->Entries[i].droplimit; + uint8 mindrop = lts->Entries[i].mindrop; - //LootTable Entry probability - float ltchance = 0.0f; - ltchance = lts->Entries[i].probability; + //LootTable Entry probability + float ltchance = 0.0f; + ltchance = lts->Entries[i].probability; - float drop_chance = 0.0f; - if(ltchance > 0.0 && ltchance < 100.0) { - drop_chance = MakeRandomFloat(0.0, 100.0); - } + float drop_chance = 0.0f; + if(ltchance > 0.0 && ltchance < 100.0) { + drop_chance = MakeRandomFloat(0.0, 100.0); + } - if (ltchance != 0.0 && (ltchance == 100.0 || drop_chance < ltchance)) { - AddLootDropToNPC(npc,lts->Entries[i].lootdrop_id, itemlist, droplimit, mindrop); - } + if (ltchance != 0.0 && (ltchance == 100.0 || drop_chance < ltchance)) { + AddLootDropToNPC(npc,lts->Entries[i].lootdrop_id, itemlist, droplimit, mindrop); + } } } } @@ -216,11 +216,11 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge // Equip rules are as follows: // If the item has the NoPet flag set it will not be equipped. // An empty slot takes priority. The first empty one that an item can - // fit into will be the one picked for the item. + // fit into will be the one picked for the item. // AC is the primary choice for which item gets picked for a slot. // If AC is identical HP is considered next. // If an item can fit into multiple slots we'll pick the last one where - // it is an improvement. + // it is an improvement. if (!item2->NoPet) { for (int i=0; !found && i=0, y<0 */ -enum { //node flags +enum { //node flags nodeFinal = 0x01 //7 more bits if theres something to use them for... }; @@ -120,7 +120,7 @@ typedef uint16 NodeRef; nodeHeader head; unsigned int * pfaces; char mask; - struct _node * node1, *node2, *node3, *node4; + struct _node * node1, *node2, *node3, *node4; }NODE, *PNODE;*/ class Map { diff --git a/zone/masterentity.h b/zone/masterentity.h index f4199c168..3764028d4 100644 --- a/zone/masterentity.h +++ b/zone/masterentity.h @@ -1,5 +1,5 @@ -//Trumpcard: EntityLists are composed of multiple list types. This is the -//master that includes all types. When entity.h is required, many of these are as well. +//Trumpcard: EntityLists are composed of multiple list types. This is the +//master that includes all types. When entity.h is required, many of these are as well. #include "entity.h" #include "groups.h" diff --git a/zone/merc.cpp b/zone/merc.cpp index 1a2ff67e7..e1a4d0ec6 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -61,7 +61,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) skills[r] = database.GetSkillCap(GetClass(),(SkillType)r,GetLevel()); } - GetMercSize(); + GetMercSize(); CalcBonuses(); SetHP(GetMaxHP()); @@ -1367,11 +1367,11 @@ bool Merc::Process() } if (GetDepop()) - { + { SetMercCharacterID(0); SetOwnerID(0); return false; - } + } if(!GetMercOwner()) { //p_depop = true; //this was causing a crash - removed merc from entity list, but not group @@ -1417,7 +1417,7 @@ bool Merc::Process() } if(confidence_timer.Check()) { - _check_confidence = true; + _check_confidence = true; } if (sendhpupdate_timer.Check()) { @@ -1521,50 +1521,50 @@ void Merc::AI_Process() { if(DivineAura()) return; - int hateCount = entity_list.GetHatedCount(this, nullptr); - if(GetHatedCount() < hateCount) { - SetHatedCount(hateCount); + int hateCount = entity_list.GetHatedCount(this, nullptr); + if(GetHatedCount() < hateCount) { + SetHatedCount(hateCount); if(!CheckConfidence()) { if(!confidence_timer.Enabled()) { confidence_timer.Start(10000); } } - } + } //Check specific conditions for merc to lose confidence and flee (or regain confidence once fleeing) - if(_check_confidence) { - //not already running - if(!_lost_confidence) { - //and fail confidence check - if(!CheckConfidence()) { - _lost_confidence = true; + if(_check_confidence) { + //not already running + if(!_lost_confidence) { + //and fail confidence check + if(!CheckConfidence()) { + _lost_confidence = true; - //move to bottom of hate lists? - //Iterate though hatelist - // SetHate(other, hate, damage) + //move to bottom of hate lists? + //Iterate though hatelist + // SetHate(other, hate, damage) - if(RuleB(Combat, EnableFearPathing)) { - CalculateNewFearpoint(); - if(curfp) { - return; - } - } - else { - Stun(12000 - (6000 - tic_timer.GetRemainingTime())); - } - } - } - else { //are fleeing due to lost confidence - if(CheckConfidence()) { //passed test - regain confidence - _lost_confidence = false; - } - } + if(RuleB(Combat, EnableFearPathing)) { + CalculateNewFearpoint(); + if(curfp) { + return; + } + } + else { + Stun(12000 - (6000 - tic_timer.GetRemainingTime())); + } + } + } + else { //are fleeing due to lost confidence + if(CheckConfidence()) { //passed test - regain confidence + _lost_confidence = false; + } + } - //they are in flee mode - if(_lost_confidence) - return; - } + //they are in flee mode + if(_lost_confidence) + return; + } // Let's check if we have a los with our target. // If we don't, our hate_list is wiped. @@ -1795,10 +1795,10 @@ void Merc::AI_Process() { //TODO: Implement passive stances. //if(GetStance() != MercStancePassive) { if(!AI_IdleCastCheck() && !IsCasting()) { - if(GetArchetype() == ARCHETYPE_CASTER) { - MercMeditate(true); - } - } + if(GetArchetype() == ARCHETYPE_CASTER) { + MercMeditate(true); + } + } } if(AImovement_timer->Check()) { @@ -1944,9 +1944,9 @@ bool Merc::AI_IdleCastCheck() { if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Cure)) { if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Heal)) { if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Resurrect)) { - if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Buff)) { - failedToCast = true; - } + if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Buff)) { + failedToCast = true; + } } } } @@ -1954,7 +1954,7 @@ bool Merc::AI_IdleCastCheck() { break; case MELEEDPS: if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Buff)) { - failedToCast = true; + failedToCast = true; } break; case CASTERDPS: @@ -2000,28 +2000,28 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, int8 mercCasterClass = caster->GetClass(); if(caster->HasGroup()) { - if( mercCasterClass == HEALER) { - if( iSpellTypes == SpellType_Heal ) { - if(caster->AICastSpell(100, SpellType_Heal)) - return true; - } + if( mercCasterClass == HEALER) { + if( iSpellTypes == SpellType_Heal ) { + if(caster->AICastSpell(100, SpellType_Heal)) + return true; + } - if( iSpellTypes == SpellType_Cure ) { - if(caster->AICastSpell(100, SpellType_Cure)) - return true; - } + if( iSpellTypes == SpellType_Cure ) { + if(caster->AICastSpell(100, SpellType_Cure)) + return true; + } - if( iSpellTypes == SpellType_Resurrect ) { - if(caster->AICastSpell(100, SpellType_Resurrect)) - return true; - } - } + if( iSpellTypes == SpellType_Resurrect ) { + if(caster->AICastSpell(100, SpellType_Resurrect)) + return true; + } + } - //Ok for the buffs.. - if( iSpellTypes == SpellType_Buff) { - if(caster->AICastSpell(100, SpellType_Buff)) - return true; - } + //Ok for the buffs.. + if( iSpellTypes == SpellType_Buff) { + if(caster->AICastSpell(100, SpellType_Buff)) + return true; + } } return false; @@ -2071,7 +2071,7 @@ bool Merc::AIDoSpellCast(uint16 spellid, Mob* tar, int32 mana_cost, uint32* oDon SetMana(hasMana); extraMana = false; } - else { //handle spell recast and recast timers + else { //handle spell recast and recast timers SetSpellTimeCanCast(mercSpell.spellid, spells[spellid].recast_time); if(spells[spellid].EndurTimerIndex > 0) { @@ -2114,15 +2114,15 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { selectedMercSpell.time_cancast = 0; switch(mercClass) - { - case TANK: + { + case TANK: case MELEEDPS: isDiscipline = true; break; default: - isDiscipline = false; + isDiscipline = false; break; - } + } switch (iSpellTypes) { case SpellType_Heal: { @@ -2373,25 +2373,25 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { selectedMercSpell = GetBestMercSpellForAENuke(this, tar); - if(selectedMercSpell.spellid == 0 && !tar->SpecAttacks[UNSTUNABLE] && !tar->IsStunned()) { - uint8 stunChance = 15; - if(MakeRandomInt(1, 100) <= stunChance) { - selectedMercSpell = GetBestMercSpellForStun(this); - } - } + if(selectedMercSpell.spellid == 0 && !tar->SpecAttacks[UNSTUNABLE] && !tar->IsStunned()) { + uint8 stunChance = 15; + if(MakeRandomInt(1, 100) <= stunChance) { + selectedMercSpell = GetBestMercSpellForStun(this); + } + } - if(selectedMercSpell.spellid == 0) { - uint8 lureChance = 25; - if(MakeRandomInt(1, 100) <= lureChance) { - selectedMercSpell = GetBestMercSpellForNukeByTargetResists(this, tar); - } - } + if(selectedMercSpell.spellid == 0) { + uint8 lureChance = 25; + if(MakeRandomInt(1, 100) <= lureChance) { + selectedMercSpell = GetBestMercSpellForNukeByTargetResists(this, tar); + } + } - if(selectedMercSpell.spellid == 0) { - selectedMercSpell = GetBestMercSpellForNuke(this); - } + if(selectedMercSpell.spellid == 0) { + selectedMercSpell = GetBestMercSpellForNuke(this); + } - break; + break; } if(selectedMercSpell.spellid > 0) { @@ -2486,48 +2486,48 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { break; } case SpellType_Resurrect: { - Corpse *corpse = GetGroupMemberCorpse(); + Corpse *corpse = GetGroupMemberCorpse(); - if(corpse) { - selectedMercSpell = GetFirstMercSpellBySpellType(this, SpellType_Resurrect); + if(corpse) { + selectedMercSpell = GetFirstMercSpellBySpellType(this, SpellType_Resurrect); - if(selectedMercSpell.spellid == 0) + if(selectedMercSpell.spellid == 0) break; - uint32 TempDontRootMeBeforeTime = corpse->DontRootMeBefore(); + uint32 TempDontRootMeBeforeTime = corpse->DontRootMeBefore(); castedSpell = AIDoSpellCast(selectedMercSpell.spellid, corpse, spells[selectedMercSpell.spellid].mana, &TempDontRootMeBeforeTime); //CastSpell(selectedMercSpell.spellid, corpse->GetID(), 1, -1, -1, &TempDontRootMeBeforeTime); - corpse->SetDontRootMeBefore(TempDontRootMeBeforeTime); - } + corpse->SetDontRootMeBefore(TempDontRootMeBeforeTime); + } break; } case SpellType_Escape: { Mob* tar = GetTarget(); - uint8 hpr = (uint8)GetHPRatio(); - bool mayGetAggro = false; + uint8 hpr = (uint8)GetHPRatio(); + bool mayGetAggro = false; - if(tar && (mercClass == CASTERDPS) || (mercClass == MELEEDPS)) { - mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells + if(tar && (mercClass == CASTERDPS) || (mercClass == MELEEDPS)) { + mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells - if (mayGetAggro) { - selectedMercSpell = GetFirstMercSpellBySpellType(this, SpellType_Escape); + if (mayGetAggro) { + selectedMercSpell = GetFirstMercSpellBySpellType(this, SpellType_Escape); - if(selectedMercSpell.spellid == 0) - break; + if(selectedMercSpell.spellid == 0) + break; - if(isDiscipline) { - castedSpell = UseDiscipline(selectedMercSpell.spellid, tar->GetID()); - } - else { - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, -1); - } - } - } - break; - } + if(isDiscipline) { + castedSpell = UseDiscipline(selectedMercSpell.spellid, tar->GetID()); + } + else { + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, -1); + } + } + } + break; + } } } } @@ -2614,12 +2614,12 @@ bool Merc::HasOrMayGetAggro() { Mob *topHate = GetTarget()->GetHateTop(); if(topHate == this) - mayGetAggro = true; //I currently have aggro + mayGetAggro = true; //I currently have aggro else { uint32 myHateAmt = GetTarget()->GetHateAmount(this); uint32 topHateAmt = GetTarget()->GetHateAmount(topHate); - if(myHateAmt > 0 && topHateAmt > 0 && (uint8)((myHateAmt/topHateAmt)*100) > 90) //I have 90% as much hate as top, next action may give me aggro + if(myHateAmt > 0 && topHateAmt > 0 && (uint8)((myHateAmt/topHateAmt)*100) > 90) //I have 90% as much hate as top, next action may give me aggro mayGetAggro = true; } } @@ -2677,7 +2677,7 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { int16 focus_max_real = 0; //item focus - for(int x =0; x < MAX_WORN_INVENTORY; ++x) + for(int x =0; x < MAX_WORN_INVENTORY; ++x) { TempItem = nullptr; if (equipment[x] == 0) @@ -2728,8 +2728,8 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { int buff_tracker = -1; int buff_slot = 0; - uint16 focusspellid = 0; - uint16 focusspell_tracker = 0; + uint16 focusspellid = 0; + uint16 focusspell_tracker = 0; uint32 buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { focusspellid = buffs[buff_slot].spellid; @@ -2811,8 +2811,8 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { int32 Merc::Additional_SpellDmg(uint16 spell_id, bool bufftick) { int32 spell_dmg = 0; - spell_dmg += GetFocusEffect(focusFF_Damage_Amount, spell_id); - spell_dmg += GetFocusEffect(focusSpellDamage, spell_id); + spell_dmg += GetFocusEffect(focusFF_Damage_Amount, spell_id); + spell_dmg += GetFocusEffect(focusSpellDamage, spell_id); //For DOTs you need to apply the damage over the duration of the dot to each tick (this is how live did it) if (bufftick){ @@ -2845,8 +2845,8 @@ int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value) { if (tt == ST_UndeadAE || tt == ST_Undead || tt == ST_Summoned) { //undead/summoned spells modifier += GetFocusEffect(focusImprovedUndeadDamage, spell_id); - } else { - //damage spells. + } else { + //damage spells. modifier += GetFocusEffect(focusImprovedDamage, spell_id); modifier += GetFocusEffect(focusSpellEffectiveness, spell_id); modifier += GetFocusEffect(focusImprovedDamage2, spell_id); @@ -2877,7 +2877,7 @@ int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value) { ratio += RuleI(Spells, WizCritRatio); } if(aabonuses.SpellCritDmgIncrease > 0) // wizards get an additional bonus - ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225% + ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225% } @@ -2903,8 +2903,8 @@ int32 Merc::Additional_Heal(uint16 spell_id) { int32 heal_amt = 0; - heal_amt += GetFocusEffect(focusAdditionalHeal, spell_id); - heal_amt += GetFocusEffect(focusAdditionalHeal2, spell_id); + heal_amt += GetFocusEffect(focusAdditionalHeal, spell_id); + heal_amt += GetFocusEffect(focusAdditionalHeal2, spell_id); if (heal_amt){ int duration = CalcBuffDuration(this, this, spell_id); @@ -2945,17 +2945,17 @@ int32 Merc::GetActSpellHealing(uint16 spell_id, int32 value) { if(MakeRandomInt(0,99) < chance) { entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s performs an exceptional heal! (%d)", GetName(), ((value * modifier / 50) + heal_amt*2)); - heal_amt = ((value * modifier / 50) + heal_amt*2); + heal_amt = ((value * modifier / 50) + heal_amt*2); } else{ - heal_amt = ((value * modifier / 100) + heal_amt); + heal_amt = ((value * modifier / 100) + heal_amt); } } // Hots else { chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance; if(MakeRandomInt(0,99) < chance) - heal_amt = ((value * modifier / 50) + heal_amt*2); + heal_amt = ((value * modifier / 50) + heal_amt*2); } heal_amt = (heal_amt * GetHealScale() / 100); @@ -3031,119 +3031,119 @@ int8 Merc::GetChanceToCastBySpellType(int16 spellType) { switch (spellType) { case SpellType_Nuke: { switch(mercClass) - { - case TANK: { - chance = 100; - break; - } - case HEALER:{ - break; - } - case MELEEDPS:{ + { + case TANK: { chance = 100; - break; - } - case CASTERDPS:{ - chance = 100; - break; - } - } + break; + } + case HEALER:{ + break; + } + case MELEEDPS:{ + chance = 100; + break; + } + case CASTERDPS:{ + chance = 100; + break; + } + } break; } case SpellType_Heal: { switch(mercClass) - { - case TANK: { - break; - } - case HEALER:{ - chance = 100; - break; - } - case MELEEDPS:{ - break; - } - case CASTERDPS:{ - break; - } - } + { + case TANK: { + break; + } + case HEALER:{ + chance = 100; + break; + } + case MELEEDPS:{ + break; + } + case CASTERDPS:{ + break; + } + } break; } case SpellType_Root: { switch(mercClass) - { - case TANK: { - break; - } - case HEALER:{ - break; - } - case MELEEDPS:{ - break; - } - case CASTERDPS:{ - break; - } - } + { + case TANK: { + break; + } + case HEALER:{ + break; + } + case MELEEDPS:{ + break; + } + case CASTERDPS:{ + break; + } + } break; } case SpellType_Buff: { switch(mercClass) - { - case TANK: { - break; - } - case HEALER:{ - chance = IsEngaged() ? 0 : 100; - break; - } - case MELEEDPS:{ - break; - } - case CASTERDPS:{ - break; - } - } + { + case TANK: { + break; + } + case HEALER:{ + chance = IsEngaged() ? 0 : 100; + break; + } + case MELEEDPS:{ + break; + } + case CASTERDPS:{ + break; + } + } break; } case SpellType_InCombatBuff: { switch(mercClass) - { - case TANK: { - chance = 50; - break; - } - case HEALER:{ - break; - } - case MELEEDPS:{ + { + case TANK: { chance = 50; - break; - } - case CASTERDPS:{ - break; - } - } + break; + } + case HEALER:{ + break; + } + case MELEEDPS:{ + chance = 50; + break; + } + case CASTERDPS:{ + break; + } + } break; } case SpellType_Escape: { switch(mercClass) - { - case TANK: { - break; - } - case HEALER:{ - break; - } - case MELEEDPS:{ + { + case TANK: { + break; + } + case HEALER:{ + break; + } + case MELEEDPS:{ chance = 100; - break; - } - case CASTERDPS:{ + break; + } + case CASTERDPS:{ chance = 100; - break; - } - } + break; + } + } break; } default: @@ -3156,8 +3156,8 @@ int8 Merc::GetChanceToCastBySpellType(int16 spellType) { bool Merc::CheckStance(int16 stance) { - //checks of current stance matches stances listed as valid for spell in database - //stance = 0 for all stances, stance # for only that stance & -stance# for all but that stance + //checks of current stance matches stances listed as valid for spell in database + //stance = 0 for all stances, stance # for only that stance & -stance# for all but that stance if(stance == 0 || (stance > 0 && stance == GetStance()) || (stance < 0 && abs(stance) != GetStance())) { @@ -3536,48 +3536,48 @@ MercSpell Merc::GetFirstMercSpellForSingleTargetHeal(Merc* caster) { } MercSpell Merc::GetBestMercSpellForGroupHeal(Merc* caster) { - MercSpell result; + MercSpell result; - result.spellid = 0; + result.spellid = 0; result.stance = 0; result.type = 0; result.slot = 0; result.proc_chance = 0; result.time_cancast = 0; - if(caster) { - std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); + if(caster) { + std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { - // Assuming all the spells have been loaded into this list by level and in descending order - if(IsRegularGroupHealSpell(mercSpellListItr->spellid) - && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + // Assuming all the spells have been loaded into this list by level and in descending order + if(IsRegularGroupHealSpell(mercSpellListItr->spellid) + && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; - } + break; } - } + } + } - return result; + return result; } MercSpell Merc::GetBestMercSpellForGroupHealOverTime(Merc* caster) { - MercSpell result; + MercSpell result; - result.spellid = 0; + result.spellid = 0; result.stance = 0; result.type = 0; result.slot = 0; result.proc_chance = 0; result.time_cancast = 0; - if(caster) { + if(caster) { std::list mercHoTSpellList = GetMercSpellsForSpellEffect(caster, SE_HealOverTime); for(std::list::iterator mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); mercSpellListItr++) { @@ -3602,39 +3602,39 @@ MercSpell Merc::GetBestMercSpellForGroupHealOverTime(Merc* caster) { break; } } - } + } - return result; + return result; } MercSpell Merc::GetBestMercSpellForGroupCompleteHeal(Merc* caster) { - MercSpell result; + MercSpell result; - result.spellid = 0; + result.spellid = 0; result.stance = 0; result.type = 0; result.slot = 0; result.proc_chance = 0; result.time_cancast = 0; - if(caster) { - std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CompleteHeal); + if(caster) { + std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CompleteHeal); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { - // Assuming all the spells have been loaded into this list by level and in descending order - if(IsGroupCompleteHealSpell(mercSpellListItr->spellid) - && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + // Assuming all the spells have been loaded into this list by level and in descending order + if(IsGroupCompleteHealSpell(mercSpellListItr->spellid) + && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; - } + break; } - } + } + } return result; } @@ -4304,10 +4304,10 @@ int32 Merc::GetSpellRecastTimer(Merc *caster, uint16 timer_id) { bool Merc::CheckSpellRecastTimers(Merc *caster, uint16 spell_id) { if(caster) { - MercSpell mercSpell = GetMercSpellBySpellID(caster, spell_id); - if(mercSpell.spellid > 0 && mercSpell.time_cancast < Timer::GetCurrentTime()) { //checks spell recast - if(GetSpellRecastTimer(caster, spells[spell_id].EndurTimerIndex) < Timer::GetCurrentTime()) { //checks for spells on the same timer - return true; //can cast spell + MercSpell mercSpell = GetMercSpellBySpellID(caster, spell_id); + if(mercSpell.spellid > 0 && mercSpell.time_cancast < Timer::GetCurrentTime()) { //checks spell recast + if(GetSpellRecastTimer(caster, spells[spell_id].EndurTimerIndex) < Timer::GetCurrentTime()) { //checks for spells on the same timer + return true; //can cast spell } } } @@ -4338,7 +4338,7 @@ int32 Merc::GetDisciplineRecastTimer(Merc *caster, uint16 timer_id) { int32 Merc::GetDisciplineRemainingTime(Merc *caster, uint16 timer_id) { int32 result = 0; if(caster && timer_id > 0) { - int32 time_cancast = GetDisciplineRecastTimer(caster, timer_id); + int32 time_cancast = GetDisciplineRecastTimer(caster, timer_id); if(time_cancast > Timer::GetCurrentTime()) result = time_cancast - Timer::GetCurrentTime(); } @@ -4348,9 +4348,9 @@ int32 Merc::GetDisciplineRemainingTime(Merc *caster, uint16 timer_id) { bool Merc::CheckDisciplineRecastTimers(Merc *caster, uint16 spell_id, uint16 timer_id) { if(caster) { MercSpell mercSpell = GetMercSpellBySpellID(caster, spell_id); - if(mercSpell.spellid > 0 && mercSpell.time_cancast < Timer::GetCurrentTime()) { //checks spell recast - if(timer_id > 0 && !(GetDisciplineRecastTimer(caster, timer_id) < Timer::GetCurrentTime())) { //checks for spells on the same timer - return false; //can't cast spell + if(mercSpell.spellid > 0 && mercSpell.time_cancast < Timer::GetCurrentTime()) { //checks spell recast + if(timer_id > 0 && !(GetDisciplineRecastTimer(caster, timer_id) < Timer::GetCurrentTime())) { //checks for spells on the same timer + return false; //can't cast spell } return true; } @@ -4399,7 +4399,7 @@ bool Merc::CheckAETaunt() { if(g) { for(int i = 0; i < g->GroupCount(); i++) { - //if(npc->IsOnHatelist(g->members[i]) && g->members[i]->GetTarget() != npc && g->members[i]->IsEngaged()) { + //if(npc->IsOnHatelist(g->members[i]) && g->members[i]->GetTarget() != npc && g->members[i]->IsEngaged()) { if(GetTarget() != npc && g->members[i]->GetTarget() != npc && npc->IsOnHatelist(g->members[i])) { result++; } @@ -4411,61 +4411,61 @@ bool Merc::CheckAETaunt() { } if(result >= 1) { - if(MERC_DEBUG > 0) - Message(7, "%s: Attempting AE Taunt", GetCleanName()); - return true; + if(MERC_DEBUG > 0) + Message(7, "%s: Attempting AE Taunt", GetCleanName()); + return true; } } return false; } Corpse* Merc::GetGroupMemberCorpse() { - Corpse* corpse = nullptr; + Corpse* corpse = nullptr; - if(HasGroup()) { - Group* g = GetGroup(); + if(HasGroup()) { + Group* g = GetGroup(); - if(g) { - for(int i = 0; i < g->GroupCount(); i++) { - if(g->members[i] && g->members[i]->IsClient()) { - corpse = entity_list.GetCorpseByOwnerWithinRange(g->members[i]->CastToClient(), this, RuleI(Mercs, ResurrectRadius)); + if(g) { + for(int i = 0; i < g->GroupCount(); i++) { + if(g->members[i] && g->members[i]->IsClient()) { + corpse = entity_list.GetCorpseByOwnerWithinRange(g->members[i]->CastToClient(), this, RuleI(Mercs, ResurrectRadius)); - if(corpse && !corpse->Rezzed()) { - return corpse; - } - } - } - } - } - return 0; + if(corpse && !corpse->Rezzed()) { + return corpse; + } + } + } + } + } + return 0; } bool Merc::TryHide() { - if(GetClass() != MELEEDPS) { - return false; - } + if(GetClass() != MELEEDPS) { + return false; + } - //don't hide if already hidden - if(hidden == true) { - return false; - } + //don't hide if already hidden + if(hidden == true) { + return false; + } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; sa_out->parameter = 1; entity_list.QueueClients(this, outapp, true); safe_delete(outapp); - hidden = true; + hidden = true; - return true; + return true; } //Checks if Merc still has confidence. Can be checked to begin fleeing, or to regain confidence after confidence loss - true = confident, false = confidence loss bool Merc::CheckConfidence() { - bool result = true; - int ConfidenceLossChance = 0; + bool result = true; + int ConfidenceLossChance = 0; float ConfidenceCheck = 0; int ConfidenceRating = 2 * GetProficiencyID(); @@ -4474,8 +4474,8 @@ bool Merc::CheckConfidence() { for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); itr++) { NPC* mob = *itr; - float ConRating = 1.0; - int CurrentCon = 0; + float ConRating = 1.0; + int CurrentCon = 0; if(!mob) continue; @@ -4494,7 +4494,7 @@ bool Merc::CheckConfidence() { if(mob->DistNoRoot(*this) > AggroRange) continue; CurrentCon = this->GetLevelCon(mob->GetLevel()); - switch(CurrentCon) { + switch(CurrentCon) { case CON_GREEN: { ConRating = 0; @@ -4509,9 +4509,9 @@ bool Merc::CheckConfidence() { case CON_BLUE: { ConRating = 0.6; break; - } + } - case CON_WHITE: { + case CON_WHITE: { ConRating = 1.0; break; } @@ -4530,20 +4530,20 @@ bool Merc::CheckConfidence() { ConRating = 0; break; } - } + } ConfidenceCheck += ConRating; } - if(ConfidenceRating < ConfidenceCheck) { - ConfidenceLossChance = 25 - ( 5 * (GetTierID() - 1)); - } + if(ConfidenceRating < ConfidenceCheck) { + ConfidenceLossChance = 25 - ( 5 * (GetTierID() - 1)); + } - if(MakeRandomInt(0 ,100) < ConfidenceLossChance) { - result = false; - } + if(MakeRandomInt(0 ,100) < ConfidenceLossChance) { + result = false; + } - return result; + return result; } void Merc::MercMeditate(bool isSitting) { @@ -5021,9 +5021,9 @@ bool Merc::LoadMercSpells() { GetMercOwner()->Message(7, "Mercenary Debug: Spell list for merc."); for (int i = merc_spells.size() - 1; i >= 0; i--) { - GetMercOwner()->Message(7, "%i] Slot: %i, SpellID: %i, Type: %i, Stance: %i, Proc Chance: %i", i, merc_spells[i].slot, merc_spells[i].spellid, merc_spells[i].type, merc_spells[i].stance, merc_spells[i].proc_chance); + GetMercOwner()->Message(7, "%i] Slot: %i, SpellID: %i, Type: %i, Stance: %i, Proc Chance: %i", i, merc_spells[i].slot, merc_spells[i].spellid, merc_spells[i].type, merc_spells[i].stance, merc_spells[i].proc_chance); }*/ - } + } return true; } @@ -5107,7 +5107,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, merc->drakkin_heritage = c->GetMercInfo().drakkinHeritage; merc->drakkin_tattoo = c->GetMercInfo().drakkinTattoo; merc->drakkin_details = c->GetMercInfo().drakkinDetails; - } + } if(merc->GetMercID()) { database.LoadMercBuffs(merc); @@ -5157,7 +5157,7 @@ void Merc::UpdateMercStats(Client *c) { level = npc_type->level; max_dmg = (npc_type->max_dmg * npc_type->scalerate) / 100; min_dmg = (npc_type->min_dmg * npc_type->scalerate) / 100; - _baseSTR = (npc_type->STR * npc_type->scalerate) / 100; + _baseSTR = (npc_type->STR * npc_type->scalerate) / 100; _baseSTA = (npc_type->STA * npc_type->scalerate) / 100; _baseDEX = (npc_type->DEX * npc_type->scalerate) / 100; _baseAGI = (npc_type->AGI * npc_type->scalerate) / 100; @@ -5165,13 +5165,13 @@ void Merc::UpdateMercStats(Client *c) { _baseINT = (npc_type->INT * npc_type->scalerate) / 100; _baseCHA = (npc_type->CHA * npc_type->scalerate) / 100; _baseATK = (npc_type->ATK * npc_type->scalerate) / 100; - _baseMR = (npc_type->MR * npc_type->scalerate) / 100; - _baseFR = (npc_type->FR * npc_type->scalerate) / 100; - _baseDR = (npc_type->DR * npc_type->scalerate) / 100; - _basePR = (npc_type->PR * npc_type->scalerate) / 100; - _baseCR = (npc_type->CR * npc_type->scalerate) / 100; - _baseCorrup = (npc_type->Corrup * npc_type->scalerate) / 100; - _baseAC = (npc_type->AC * npc_type->scalerate) / 100; + _baseMR = (npc_type->MR * npc_type->scalerate) / 100; + _baseFR = (npc_type->FR * npc_type->scalerate) / 100; + _baseDR = (npc_type->DR * npc_type->scalerate) / 100; + _basePR = (npc_type->PR * npc_type->scalerate) / 100; + _baseCR = (npc_type->CR * npc_type->scalerate) / 100; + _baseCorrup = (npc_type->Corrup * npc_type->scalerate) / 100; + _baseAC = (npc_type->AC * npc_type->scalerate) / 100; attack_speed = npc_type->attack_speed; attack_count = npc_type->attack_count; spellscale = npc_type->spellscale; @@ -5190,7 +5190,7 @@ void Merc::UpdateMercAppearance(Client *c) { } void Merc::AddItem(uint8 slot, uint32 item_id) { - equipment[slot] = item_id; + equipment[slot] = item_id; } bool Merc::Spawn(Client *owner) { @@ -5230,7 +5230,7 @@ bool Merc::Spawn(Client *owner) { void Client::UpdateMercTimer() { - Merc *merc = GetMerc(); + Merc *merc = GetMerc(); if(merc && !merc->IsSuspended()) { @@ -5240,7 +5240,7 @@ void Client::UpdateMercTimer() if(CheckCanRetainMerc(upkeep)) { if(RuleB(Mercs, ChargeMercUpkeepCost)) { - TakeMoneyFromPP((upkeep * 100), true); + TakeMoneyFromPP((upkeep * 100), true); } } else { @@ -5319,7 +5319,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) { //check for sufficient funds if(RuleB(Mercs, ChargeMercPurchaseCost)) { - uint32 cost = Merc::CalcPurchaseCost(template_id, GetLevel()) * 100; // Cost is in gold + uint32 cost = Merc::CalcPurchaseCost(template_id, GetLevel()) * 100; // Cost is in gold if(cost > 0 && !HasMoney(cost)) { SendMercMerchantResponsePacket(1); return false; @@ -5422,7 +5422,7 @@ bool Client::CheckCanUnsuspendMerc() { if (GetClientVersion() < EQClientRoF) SendMercMerchantResponsePacket(4); // ?? else - SendMercMerchantResponsePacket(4); // ?? + SendMercMerchantResponsePacket(4); // ?? return false; } @@ -5493,7 +5493,7 @@ void Client::SuspendMercCommand() Merc* CurrentMerc = GetMerc(); if(CurrentMerc && GetMercID()) { - //CurrentMerc->Save(); + //CurrentMerc->Save(); CurrentMerc->Suspend(); } } diff --git a/zone/merc.h b/zone/merc.h index 4ed6e6332..21e372f7e 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -8,9 +8,9 @@ using namespace std; #define MAXMERCS 1 #define MERC_DEBUG 0 #define TANK 1 -#define HEALER 2 +#define HEALER 2 #define MELEEDPS 9 -#define CASTERDPS 12 +#define CASTERDPS 12 const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this enum MercStanceType { @@ -30,7 +30,7 @@ struct MercSpell { uint32 type; // 0 = never, must be one (and only one) of the defined values int16 stance; // 0 = all, + = only this stance, - = all except this stance int16 slot; - uint16 proc_chance; + uint16 proc_chance; uint32 time_cancast; // when we can cast this spell next }; @@ -156,12 +156,12 @@ public: uint32 GetMercTemplateID() { return _MercTemplateID; } uint32 GetMercType() { return _MercType; } uint32 GetMercSubType() { return _MercSubType; } - uint8 GetProficiencyID() { return _ProficiencyID; } - uint8 GetTierID() { return _TierID; } + uint8 GetProficiencyID() { return _ProficiencyID; } + uint8 GetTierID() { return _TierID; } uint32 GetCostFormula() { return _CostFormula; } uint32 GetMercNameType() { return _NameType; } uint32 GetStance() { return _currentStance; } - int GetHatedCount() { return _hatedCount; } + int GetHatedCount() { return _hatedCount; } inline const uint8 GetClientVersion() const { return _OwnerClientVersion; } @@ -174,8 +174,8 @@ public: void CheckHateList(); bool CheckTaunt(); bool CheckAETaunt(); - bool CheckConfidence(); - bool TryHide(); + bool CheckConfidence(); + bool TryHide(); // stat functions virtual void CalcBonuses(); @@ -267,15 +267,15 @@ public: protected: void CalcItemBonuses(StatBonuses* newbon); void AddItemBonuses(const Item_Struct *item, StatBonuses* newbon); - int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); + int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); int16 GetFocusEffect(focusType type, uint16 spell_id); std::vector merc_spells; std::map timers; - uint16 skills[HIGHEST_SKILL+1]; - uint32 equipment[MAX_WORN_INVENTORY]; //this is an array of item IDs + uint16 skills[HIGHEST_SKILL+1]; + uint32 equipment[MAX_WORN_INVENTORY]; //this is an array of item IDs uint16 d_meele_texture1; //this is an item Material value uint16 d_meele_texture2; //this is an item Material value (offhand) uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation @@ -283,22 +283,22 @@ protected: private: - int16 CalcAC(); - int16 GetACMit(); - int16 GetACAvoid(); - int16 acmod(); - int16 CalcATK(); - //int CalcHaste(); + int16 CalcAC(); + int16 GetACMit(); + int16 GetACAvoid(); + int16 acmod(); + int16 CalcATK(); + //int CalcHaste(); - int16 CalcSTR(); - int16 CalcSTA(); - int16 CalcDEX(); - int16 CalcAGI(); - int16 CalcINT(); - int16 CalcWIS(); - int16 CalcCHA(); + int16 CalcSTR(); + int16 CalcSTA(); + int16 CalcDEX(); + int16 CalcAGI(); + int16 CalcINT(); + int16 CalcWIS(); + int16 CalcCHA(); - int16 CalcMR(); + int16 CalcMR(); int16 CalcFR(); int16 CalcDR(); int16 CalcPR(); @@ -323,10 +323,10 @@ private: void DoEnduranceUpkeep(); //does the endurance upkeep void CalcRestState(); - int GroupLeadershipAAHealthEnhancement(); - int GroupLeadershipAAManaEnhancement(); + int GroupLeadershipAAHealthEnhancement(); + int GroupLeadershipAAManaEnhancement(); int GroupLeadershipAAHealthRegeneration(); - int GroupLeadershipAAOffenseEnhancement(); + int GroupLeadershipAAOffenseEnhancement(); void GetMercSize(); void GenerateAppearance(); @@ -362,8 +362,8 @@ private: uint32 _MercTemplateID; uint32 _MercType; uint32 _MercSubType; - uint8 _ProficiencyID; - uint8 _TierID; + uint8 _ProficiencyID; + uint8 _TierID; uint8 _CostFormula; uint8 _NameType; uint8 _OwnerClientVersion; @@ -375,9 +375,9 @@ private: bool _medding; bool _suspended; bool p_depop; - bool _check_confidence; - bool _lost_confidence; - int _hatedCount; + bool _check_confidence; + bool _lost_confidence; + int _hatedCount; uint32 owner_char_id; Timer endupkeep_timer; Timer rest_timer; diff --git a/zone/mob.cpp b/zone/mob.cpp index 7daaad8cf..3ec74db43 100644 --- a/zone/mob.cpp +++ b/zone/mob.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 "masterentity.h" @@ -31,59 +31,59 @@ extern EntityList entity_list; extern Zone* zone; extern WorldServer worldserver; -Mob::Mob(const char* in_name, - const char* in_lastname, - int32 in_cur_hp, - int32 in_max_hp, - uint8 in_gender, - uint16 in_race, - uint8 in_class, - bodyType in_bodytype, - uint8 in_deity, - uint8 in_level, - uint32 in_npctype_id, - float in_size, - float in_runspeed, - float in_heading, - float in_x_pos, - float in_y_pos, - float in_z_pos, +Mob::Mob(const char* in_name, + const char* in_lastname, + int32 in_cur_hp, + int32 in_max_hp, + uint8 in_gender, + uint16 in_race, + uint8 in_class, + bodyType in_bodytype, + uint8 in_deity, + uint8 in_level, + uint32 in_npctype_id, + float in_size, + float in_runspeed, + float in_heading, + float in_x_pos, + float in_y_pos, + float in_z_pos, - uint8 in_light, - uint8 in_texture, - uint8 in_helmtexture, - uint16 in_ac, - uint16 in_atk, - uint16 in_str, - uint16 in_sta, - uint16 in_dex, - uint16 in_agi, - uint16 in_int, - uint16 in_wis, - uint16 in_cha, - uint8 in_haircolor, - uint8 in_beardcolor, - uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye? - uint8 in_eyecolor2, - uint8 in_hairstyle, - uint8 in_luclinface, - uint8 in_beard, - uint32 in_drakkin_heritage, - uint32 in_drakkin_tattoo, - uint32 in_drakkin_details, - uint32 in_armor_tint[MAX_MATERIALS], + uint8 in_light, + uint8 in_texture, + uint8 in_helmtexture, + uint16 in_ac, + uint16 in_atk, + uint16 in_str, + uint16 in_sta, + uint16 in_dex, + uint16 in_agi, + uint16 in_int, + uint16 in_wis, + uint16 in_cha, + uint8 in_haircolor, + uint8 in_beardcolor, + uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye? + uint8 in_eyecolor2, + uint8 in_hairstyle, + uint8 in_luclinface, + uint8 in_beard, + uint32 in_drakkin_heritage, + uint32 in_drakkin_tattoo, + uint32 in_drakkin_details, + uint32 in_armor_tint[MAX_MATERIALS], - uint8 in_aa_title, - uint8 in_see_invis, // see through invis/ivu - uint8 in_see_invis_undead, - uint8 in_see_hide, - uint8 in_see_improved_hide, - int32 in_hp_regen, - int32 in_mana_regen, - uint8 in_qglobal, - uint8 in_maxlevel, - uint32 in_scalerate - ) : + uint8 in_aa_title, + uint8 in_see_invis, // see through invis/ivu + uint8 in_see_invis_undead, + uint8 in_see_hide, + uint8 in_see_improved_hide, + int32 in_hp_regen, + int32 in_mana_regen, + uint8 in_qglobal, + uint8 in_maxlevel, + uint32 in_scalerate + ) : attack_timer(2000), attack_dw_timer(2000), ranged_timer(2000), @@ -117,9 +117,9 @@ Mob::Mob(const char* in_name, AI_Init(); SetMoving(false); moved=false; - rewind_x = 0; //Stored x_pos for /rewind - rewind_y = 0; //Stored y_pos for /rewind - rewind_z = 0; //Stored z_pos for /rewind + rewind_x = 0; //Stored x_pos for /rewind + rewind_y = 0; //Stored y_pos for /rewind + rewind_z = 0; //Stored z_pos for /rewind move_tic_count = 0; _egnode = nullptr; @@ -142,19 +142,19 @@ Mob::Mob(const char* in_name, base_gender = in_gender; base_race = in_race; class_ = in_class; - bodytype = in_bodytype; + bodytype = in_bodytype; orig_bodytype = in_bodytype; deity = in_deity; level = in_level; npctype_id = in_npctype_id; size = in_size; base_size = size; - runspeed = in_runspeed; + runspeed = in_runspeed; - // sanity check - if (runspeed < 0 || runspeed > 20) - runspeed = 1.25f; + // sanity check + if (runspeed < 0 || runspeed > 20) + runspeed = 1.25f; heading = in_heading; x_pos = in_x_pos; @@ -216,15 +216,15 @@ Mob::Mob(const char* in_name, InitializeBuffSlots(); - // clear the proc arrays + // clear the proc arrays int i; int j; for (j = 0; j < MAX_PROCS; j++) - { - PermaProcs[j].spellID = SPELL_UNKNOWN; - PermaProcs[j].chance = 0; - PermaProcs[j].base_spellID = SPELL_UNKNOWN; - SpellProcs[j].spellID = SPELL_UNKNOWN; + { + PermaProcs[j].spellID = SPELL_UNKNOWN; + PermaProcs[j].chance = 0; + PermaProcs[j].base_spellID = SPELL_UNKNOWN; + SpellProcs[j].spellID = SPELL_UNKNOWN; DefensiveProcs[j].spellID = SPELL_UNKNOWN; DefensiveProcs[j].chance = 0; @@ -235,7 +235,7 @@ Mob::Mob(const char* in_name, SkillProcs[j].spellID = SPELL_UNKNOWN; SkillProcs[j].chance = 0; SkillProcs[j].base_spellID = SPELL_UNKNOWN; - } + } for (i = 0; i < MAX_MATERIALS; i++) { @@ -262,7 +262,7 @@ Mob::Mob(const char* in_name, _appearance = eaStanding; pRunAnimSpeed = 0; - spellend_timer.Disable(); + spellend_timer.Disable(); bardsong_timer.Disable(); bardsong = 0; bardsong_target_id = 0; @@ -292,7 +292,7 @@ Mob::Mob(const char* in_name, silenced = false; amnesiad = false; inWater = false; - int m; + int m; for (m = 0; m < MAX_SHIELDERS; m++) { shielder[m].shielder_id = 0; @@ -360,7 +360,7 @@ Mob::Mob(const char* in_name, nimbus_effect1 = 0; nimbus_effect2 = 0; nimbus_effect3 = 0; - m_targetable = true; + m_targetable = true; flymode = FlyMode3; // Pathing @@ -412,14 +412,14 @@ Mob::~Mob() entity_list.RemoveFromTargets(this, true); - if(trade) { - Mob *with = trade->With(); - if(with && with->IsClient()) { - with->CastToClient()->FinishTrade(with); - with->trade->Reset(); - } - delete trade; - } + if(trade) { + Mob *with = trade->With(); + if(with && with->IsClient()) { + with->CastToClient()->FinishTrade(with); + with->trade->Reset(); + } + delete trade; + } if(HadTempPets()){ entity_list.DestroyTempPets(this); @@ -460,15 +460,15 @@ void Mob::SetInvisible(uint8 state) { invisible = state; SendAppearancePacket(AT_Invis, invisible); - // Invis and hide breaks charms + // Invis and hide breaks charms - if ((this->GetPetType() == petCharmed) && (invisible || hidden || improved_hidden)) - { - Mob* formerpet = this->GetPet(); + if ((this->GetPetType() == petCharmed) && (invisible || hidden || improved_hidden)) + { + Mob* formerpet = this->GetPet(); - if(formerpet) - formerpet->BuffFadeByEffect(SE_Charm); - } + if(formerpet) + formerpet->BuffFadeByEffect(SE_Charm); + } } //check to see if `this` is invisible to `other` @@ -519,7 +519,7 @@ bool Mob::IsInvisible(Mob* other) const } float Mob::_GetMovementSpeed(int mod) const { - // List of movement speed modifiers, including AAs & spells: + // List of movement speed modifiers, including AAs & spells: // http://everquest.allakhazam.com/db/item.html?item=1721;page=1;howmany=50#m10822246245352 if (IsRooted()) return 0.0f; @@ -788,9 +788,9 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) strcpy(ns->spawn.name, name); if(IsClient()) - { + { strn0cpy(ns->spawn.lastName,lastname,sizeof(ns->spawn.lastName)); - } + } ns->spawn.heading = FloatToEQ19(heading); ns->spawn.x = FloatToEQ19(x_pos);//((int32)x_pos)<<3; ns->spawn.y = FloatToEQ19(y_pos);//((int32)y_pos)<<3; @@ -827,10 +827,9 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.drakkin_heritage = drakkin_heritage; ns->spawn.drakkin_tattoo = drakkin_tattoo; ns->spawn.drakkin_details = drakkin_details; - ns->spawn.equip_chest2 = texture; + ns->spawn.equip_chest2 = texture; -// ns->spawn.invis2 = 0xff;//this used to be labeled beard.. if its not FF it will turn - //mob invis +// ns->spawn.invis2 = 0xff;//this used to be labeled beard.. if its not FF it will turn mob invis if(helmtexture && helmtexture != 0xFF) { @@ -847,7 +846,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) // 1 - Same as #flymode 1 // 2 - Same as #flymode 2 // 3 - Mobs in water do not sink. A value of 3 in this field appears to be the default setting for all mobs - // (in water or not) according to 6.2 era packet collects. + // (in water or not) according to 6.2 era packet collects. if(IsClient()) { ns->spawn.flymode = FindType(SE_Levitate) ? 2 : 0; @@ -897,7 +896,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.DestructibleUnk1 = 0x00000224; // Was 0x000001f5; // These next 4 are mostly always sequential // Originally they were 633, 634, 635, 636 - // Changing them all to 633 - no visible effect. + // Changing them all to 633 - no visible effect. // Changing them all to 636 - no visible effect. // Reversing the order of these four numbers and then using #appearance gain had no visible change. // Setting these four ids to zero had no visible effect when the catapult spawned, nor when #appearance was used. @@ -961,7 +960,7 @@ void Mob::CreateHPPacket(EQApplicationPacket* app) snprintf(buf, 9, "%i", GetNextHPEvent()); buf[9] = '\0'; SetNextHPEvent(-1); - parse->EventNPC(EVENT_HP, CastToNPC(), nullptr, buf, 0); + parse->EventNPC(EVENT_HP, CastToNPC(), nullptr, buf, 0); } } @@ -973,7 +972,7 @@ void Mob::CreateHPPacket(EQApplicationPacket* app) snprintf(buf, 9, "%i", GetNextIncHPEvent()); buf[9] = '\0'; SetNextIncHPEvent(-1); - parse->EventNPC(EVENT_HP, CastToNPC(), nullptr, buf, 1); + parse->EventNPC(EVENT_HP, CastToNPC(), nullptr, buf, 1); } } } @@ -999,7 +998,7 @@ void Mob::SendHPUpdate() if(IsGrouped()) { group = entity_list.GetGroupByMob(this); - if(group) //not sure why this might be null, but it happens + if(group) //not sure why this might be null, but it happens group->SendHPPacketsFrom(this); } @@ -1027,7 +1026,7 @@ void Mob::SendHPUpdate() { GetPet()->CastToClient()->QueuePacket(&hp_app, false); } -#endif //MANAGE_HP_PACKETS +#endif //MANAGE_HP_PACKETS // Update the damage state of destructible objects if(IsNPC() && IsDestructibleObject()) @@ -1110,7 +1109,7 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) { #ifdef PACKET_UPDATE_MANAGER entity_list.QueueManaged(this, app, (iSendToSelf==0),false); #else - if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount)) + if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount)) { entity_list.QueueClients(this, app, (iSendToSelf==0), false); move_tic_count = 0; @@ -1470,7 +1469,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, } uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) { -//cout << "Gender in: " << (int)in_gender << endl; +//cout << "Gender in: " << (int)in_gender << endl; if ((in_race > 0 && in_race <= GNOME ) || in_race == IKSAR || in_race == VAHSHIR || in_race == FROGLOK || in_race == DRAKKIN || in_race == 15 || in_race == 50 || in_race == 57 || in_race == 70 || in_race == 98 || in_race == 118) { @@ -1565,12 +1564,12 @@ void Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 } void Mob::SendTargetable(bool on, Client *specific_target) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Untargetable, sizeof(Untargetable_Struct)); - Untargetable_Struct *ut = (Untargetable_Struct*)outapp->pBuffer; - ut->id = GetID(); - ut->targetable_flag = on == true ? 1 : 0; + EQApplicationPacket* outapp = new EQApplicationPacket(OP_Untargetable, sizeof(Untargetable_Struct)); + Untargetable_Struct *ut = (Untargetable_Struct*)outapp->pBuffer; + ut->id = GetID(); + ut->targetable_flag = on == true ? 1 : 0; - if(specific_target == nullptr) { + if(specific_target == nullptr) { entity_list.QueueClients(this, outapp); } else if (specific_target->IsClient()) { @@ -1694,10 +1693,10 @@ void Mob::TempName(const char *newname) } void Mob::SetTargetable(bool on) { - if(m_targetable != on) { - m_targetable = on; - SendTargetable(on); - } + if(m_targetable != on) { + m_targetable = on; + SendTargetable(on); + } } const int32& Mob::SetMana(int32 amount) @@ -1802,8 +1801,8 @@ void Mob::SetOwnerID(uint16 NewOwnerID) { //heko: for backstab bool Mob::BehindMob(Mob* other, float playerx, float playery) const { - if (!other) - return true; // sure your behind your invisible friend?? (fall thru for sneak) + if (!other) + return true; // sure your behind your invisible friend?? (fall thru for sneak) //see if player is behind mob float angle, lengthb, vectorx, vectory; float mobx = -(other->GetX()); // mob xlocation (inverse because eq is confused) @@ -1953,7 +1952,7 @@ void Mob::SetAttackTimer() { int speed = (int)((36 *(100+DelayMod)/100)*(100.0f+attack_speed)*PermaHaste); if(speed < RuleI(Combat, MinHastedDelay) && IsClient()) //lower bound speed = RuleI(Combat, MinHastedDelay); - TimerToUse->SetAtTrigger(speed, true); // Hand to hand, non-monk 2/36 + TimerToUse->SetAtTrigger(speed, true); // Hand to hand, non-monk 2/36 } } else { //we have a weapon, use its delay @@ -2001,8 +2000,8 @@ void Mob::SetAttackTimer() { bool Mob::CanThisClassDualWield(void) const { if (!IsClient()) { - return(GetSkill(DUAL_WIELD) > 0); - } else { + return(GetSkill(DUAL_WIELD) > 0); + } else { const ItemInst* inst = CastToClient()->GetInv().GetItem(SLOT_PRIMARY); // 2HS, 2HB, or 2HP if (inst && inst->IsType(ItemClassCommon)) { @@ -2013,8 +2012,8 @@ bool Mob::CanThisClassDualWield(void) const //No weapon in hand... using hand-to-hand... //only monks and beastlords? can dual wield their fists. if(class_ != MONK && class_ != MONKGM && class_ != BEASTLORD && class_ != BEASTLORDGM) { - return false; - } + return false; + } } return (CastToClient()->HasSkill(DUAL_WIELD)); // No skill = no chance @@ -2023,14 +2022,14 @@ bool Mob::CanThisClassDualWield(void) const bool Mob::CanThisClassDoubleAttack(void) const { - if(!IsClient()) { - return(GetSkill(DOUBLE_ATTACK) > 0); - } else { - if(aabonuses.GiveDoubleAttack || itembonuses.GiveDoubleAttack || spellbonuses.GiveDoubleAttack) { + if(!IsClient()) { + return(GetSkill(DOUBLE_ATTACK) > 0); + } else { + if(aabonuses.GiveDoubleAttack || itembonuses.GiveDoubleAttack || spellbonuses.GiveDoubleAttack) { return true; } - return(CastToClient()->HasSkill(DOUBLE_ATTACK)); - } + return(CastToClient()->HasSkill(DOUBLE_ATTACK)); + } } bool Mob::IsWarriorClass(void) const @@ -2068,38 +2067,38 @@ bool Mob::IsWarriorClass(void) const bool Mob::CanThisClassParry(void) const { - if(!IsClient()) { - return(GetSkill(PARRY) > 0); - } else { - return(CastToClient()->HasSkill(PARRY)); - } + if(!IsClient()) { + return(GetSkill(PARRY) > 0); + } else { + return(CastToClient()->HasSkill(PARRY)); + } } bool Mob::CanThisClassDodge(void) const { - if(!IsClient()) { - return(GetSkill(DODGE) > 0); - } else { - return(CastToClient()->HasSkill(DODGE)); - } + if(!IsClient()) { + return(GetSkill(DODGE) > 0); + } else { + return(CastToClient()->HasSkill(DODGE)); + } } bool Mob::CanThisClassRiposte(void) const { - if(!IsClient()) { - return(GetSkill(RIPOSTE) > 0); - } else { - return(CastToClient()->HasSkill(RIPOSTE)); - } + if(!IsClient()) { + return(GetSkill(RIPOSTE) > 0); + } else { + return(CastToClient()->HasSkill(RIPOSTE)); + } } bool Mob::CanThisClassBlock(void) const { if(!IsClient()) { - return(GetSkill(BLOCKSKILL) > 0); - } else { - return(CastToClient()->HasSkill(BLOCKSKILL)); - } + return(GetSkill(BLOCKSKILL) > 0); + } else { + return(CastToClient()->HasSkill(BLOCKSKILL)); + } } float Mob::Dist(const Mob &other) const { @@ -2109,8 +2108,8 @@ float Mob::Dist(const Mob &other) const { float zDiff = other.z_pos - z_pos; return sqrtf( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); + + (yDiff * yDiff) + + (zDiff * zDiff) ); } float Mob::DistNoZ(const Mob &other) const { @@ -2119,7 +2118,7 @@ float Mob::DistNoZ(const Mob &other) const { float yDiff = other.y_pos - y_pos; return sqrtf( (xDiff * xDiff) - + (yDiff * yDiff) ); + + (yDiff * yDiff) ); } float Mob::DistNoRoot(const Mob &other) const { @@ -2129,8 +2128,8 @@ float Mob::DistNoRoot(const Mob &other) const { float zDiff = other.z_pos - z_pos; return ( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); + + (yDiff * yDiff) + + (zDiff * zDiff) ); } float Mob::DistNoRoot(float x, float y, float z) const { @@ -2140,8 +2139,8 @@ float Mob::DistNoRoot(float x, float y, float z) const { float zDiff = z - z_pos; return ( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); + + (yDiff * yDiff) + + (zDiff * zDiff) ); } float Mob::DistNoRootNoZ(float x, float y) const { @@ -2149,8 +2148,7 @@ float Mob::DistNoRootNoZ(float x, float y) const { float xDiff = x - x_pos; float yDiff = y - y_pos; - return ( (xDiff * xDiff) - + (yDiff * yDiff) ); + return ( (xDiff * xDiff) + (yDiff * yDiff) ); } float Mob::DistNoRootNoZ(const Mob &other) const { @@ -2169,7 +2167,7 @@ float Mob::GetReciprocalHeading(Mob* target) { float h = (target->GetHeading() / 256.0f) * 6.283184f; // Calculate the reciprocal heading in radians - Result = h + 3.141592f; + Result = h + 3.141592f; // Convert back to eq heading from radians Result = (Result / 6.283184f) * 256.0f; @@ -2255,8 +2253,8 @@ bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, fl } bool Mob::HateSummon() { - // check if mob has ability to summon - // 97% is the offical % that summoning starts on live, not 94 + // check if mob has ability to summon + // 97% is the offical % that summoning starts on live, not 94 // if the mob can summon and is charmed, it can only summon mobs it has LoS to Mob* mob_owner = nullptr; if(GetOwnerID()) @@ -2264,23 +2262,23 @@ bool Mob::HateSummon() { if (GetHPRatio() >= 98 || SpecAttacks[SPECATK_SUMMON] == false || !GetTarget() || (mob_owner && mob_owner->IsClient() && !CheckLosFN(GetTarget()))) - return false; + return false; - // now validate the timer - if (!SpecAttackTimers[SPECATK_SUMMON]) - { - SpecAttackTimers[SPECATK_SUMMON] = new Timer(6000); - SpecAttackTimers[SPECATK_SUMMON]->Start(); - } + // now validate the timer + if (!SpecAttackTimers[SPECATK_SUMMON]) + { + SpecAttackTimers[SPECATK_SUMMON] = new Timer(6000); + SpecAttackTimers[SPECATK_SUMMON]->Start(); + } - // now check the timer - if (!SpecAttackTimers[SPECATK_SUMMON]->Check()) - return false; + // now check the timer + if (!SpecAttackTimers[SPECATK_SUMMON]->Check()) + return false; - // get summon target - SetTarget(GetHateTop()); - if(target) - { + // get summon target + SetTarget(GetHateTop()); + if(target) + { if (target->IsClient()) target->CastToClient()->Message(15,"You have been summoned!"); entity_list.MessageClose(this, true, 500, 10, "%s says,'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() ); @@ -2303,7 +2301,7 @@ bool Mob::HateSummon() { target->GMMove(x_pos, y_pos, z_pos, target->GetHeading()); } - return true; + return true; } return false; } @@ -2331,10 +2329,10 @@ void Mob::FaceTarget(Mob* MobToFace) { } } - if(IsNPC() && !IsEngaged()) { - CastToNPC()->GetRefaceTimer()->Start(15000); - CastToNPC()->GetRefaceTimer()->Enable(); - } + if(IsNPC() && !IsEngaged()) { + CastToNPC()->GetRefaceTimer()->Start(15000); + CastToNPC()->GetRefaceTimer()->Enable(); + } } bool Mob::RemoveFromHateList(Mob* mob) @@ -2367,10 +2365,10 @@ void Mob::WipeHateList() } uint32 Mob::RandomTimer(int min,int max) { - int r = 14000; + int r = 14000; if(min != 0 && max != 0 && min < max) { - r = MakeRandomInt(min, max); + r = MakeRandomInt(min, max); } return r; } @@ -2593,7 +2591,7 @@ void Mob::Emote(const char *format, ...) void Mob::QuestJournalledSay(Client *QuestInitiator, const char *str) { - entity_list.QuestJournalledSayClose(this, QuestInitiator, 200, GetCleanName(), str); + entity_list.QuestJournalledSayClose(this, QuestInitiator, 200, GetCleanName(), str); } const char *Mob::GetCleanName() @@ -2619,17 +2617,16 @@ void Mob::SetNextIncHPEvent( int inchpevent ) //warp for quest function,from sandy void Mob::Warp( float x, float y, float z ) { - x_pos = x; - y_pos = y; - z_pos = z; + x_pos = x; + y_pos = y; + z_pos = z; - Mob* target = GetTarget(); - if ( target ) { - FaceTarget( target ); - } - - SendPosition(); + Mob* target = GetTarget(); + if (target) { + FaceTarget( target ); + } + SendPosition(); } bool Mob::DivineAura() const @@ -2757,7 +2754,7 @@ void Mob::ExecWeaponProc(uint16 spell_id, Mob *on) { int32 twinproc_chance = 0; if(IsClient()) - twinproc_chance = CastToClient()->GetFocusEffect(focusTwincast, spell_id); + twinproc_chance = CastToClient()->GetFocusEffect(focusTwincast, spell_id); if(twinproc_chance && (MakeRandomInt(0,99) < twinproc_chance)) twinproc = true; @@ -2819,7 +2816,7 @@ void Mob::SetTarget(Mob* mob) { if(IsNPC()) parse->EventNPC(EVENT_TARGET_CHANGE, CastToNPC(), mob, "", 0); //parse->Event(EVENT_TARGET_CHANGE, this->GetNPCTypeID(), 0, this->CastToNPC(), mob); else if (IsClient()) - parse->EventPlayer(EVENT_TARGET_CHANGE, CastToClient(), "", 0); //parse->Event(EVENT_TARGET_CHANGE, 0, "", (NPC*)nullptr, this->CastToClient()); + parse->EventPlayer(EVENT_TARGET_CHANGE, CastToClient(), "", 0); //parse->Event(EVENT_TARGET_CHANGE, 0, "", (NPC*)nullptr, this->CastToClient()); if(IsPet() && GetOwner() && GetOwner()->IsClient()) GetOwner()->CastToClient()->UpdateXTargetType(MyPetTarget, mob); @@ -3751,10 +3748,10 @@ void Mob::DelGlobal(const char *varname) { } if (!database.RunQuery(query, - MakeAnyLenString(&query, - "DELETE FROM quest_globals WHERE name='%s'" - " && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)", - varname,qgNpcid,qgCharid,qgZoneid),errbuf)) + MakeAnyLenString(&query, + "DELETE FROM quest_globals WHERE name='%s'" + " && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)", + varname,qgNpcid,qgCharid,qgZoneid),errbuf)) { //_log(QUESTS, "DelGlobal error deleting %s : %s", varname, errbuf); } @@ -4024,7 +4021,7 @@ bool Mob::TrySpellOnDeath() } if(spellbonuses.SpellOnDeath[i]) { - if(MakeRandomInt(0, 99) < static_cast(spellbonuses.SpellOnDeath[i + 1])) { + if(MakeRandomInt(0, 99) < static_cast(spellbonuses.SpellOnDeath[i + 1])) { SpellFinished(spellbonuses.SpellOnDeath[i], this); } } @@ -4061,7 +4058,7 @@ void Mob::SetGrouped(bool v) if(IsClient()) { - parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0); + parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0); if(!v) CastToClient()->RemoveGroupXTargets(); @@ -4078,7 +4075,7 @@ void Mob::SetRaidGrouped(bool v) if(IsClient()) { - parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0); + parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0); } } @@ -4117,7 +4114,7 @@ int16 Mob::GetMeleeMinDamageMod_SE(uint16 skill) { int dmg_mod = 0; - dmg_mod = itembonuses.MinDamageModifier[skill] + spellbonuses.MinDamageModifier[skill] + + dmg_mod = itembonuses.MinDamageModifier[skill] + spellbonuses.MinDamageModifier[skill] + itembonuses.MinDamageModifier[HIGHEST_SKILL+1] + spellbonuses.MinDamageModifier[HIGHEST_SKILL+1]; if(dmg_mod < -100) @@ -4151,16 +4148,16 @@ int16 Mob::GetSkillDmgAmt(uint16 skill) // All skill dmg(only spells do this) + Skill specific skill_dmg += spellbonuses.SkillDamageAmount[HIGHEST_SKILL+1] + itembonuses.SkillDamageAmount[HIGHEST_SKILL+1] + aabonuses.SkillDamageAmount[HIGHEST_SKILL+1] - + itembonuses.SkillDamageAmount[skill] + spellbonuses.SkillDamageAmount[skill] + aabonuses.SkillDamageAmount[skill]; + + itembonuses.SkillDamageAmount[skill] + spellbonuses.SkillDamageAmount[skill] + aabonuses.SkillDamageAmount[skill]; skill_dmg += spellbonuses.SkillDamageAmount2[HIGHEST_SKILL+1] + itembonuses.SkillDamageAmount2[HIGHEST_SKILL+1] - + itembonuses.SkillDamageAmount2[skill] + spellbonuses.SkillDamageAmount2[skill]; + + itembonuses.SkillDamageAmount2[skill] + spellbonuses.SkillDamageAmount2[skill]; // Deplete the buff if needed - if (spellbonuses.SkillDamageAmount[HIGHEST_SKILL+1] || spellbonuses.SkillDamageAmount[skill]) + if (spellbonuses.SkillDamageAmount[HIGHEST_SKILL+1] || spellbonuses.SkillDamageAmount[skill]) CheckHitsRemaining(0, false,false, SE_SkillDamageAmount,0,true,skill); - if (spellbonuses.SkillDamageAmount2[HIGHEST_SKILL+1] || spellbonuses.SkillDamageAmount2[skill]) + if (spellbonuses.SkillDamageAmount2[HIGHEST_SKILL+1] || spellbonuses.SkillDamageAmount2[skill]) CheckHitsRemaining(0, false,false, SE_SkillDamageAmount2,0,true,skill); return skill_dmg; @@ -4302,32 +4299,32 @@ void Mob::RemoveNimbusEffect(int effectid) } bool Mob::IsBoat() const { - return (race == 72 || race == 73 || race == 114 || race == 404 || race == 550 || race == 551 || race == 552); + return (race == 72 || race == 73 || race == 114 || race == 404 || race == 550 || race == 551 || race == 552); } void Mob::SetBodyType(bodyType new_body, bool overwrite_orig) { - bool needs_spawn_packet = false; - if(bodytype == 11 || bodytype >= 65 || new_body == 11 || new_body >= 65) { - needs_spawn_packet = true; - } + bool needs_spawn_packet = false; + if(bodytype == 11 || bodytype >= 65 || new_body == 11 || new_body >= 65) { + needs_spawn_packet = true; + } - if(overwrite_orig) { - orig_bodytype = new_body; - } - bodytype = new_body; + if(overwrite_orig) { + orig_bodytype = new_body; + } + bodytype = new_body; - if(needs_spawn_packet) { - EQApplicationPacket* app = new EQApplicationPacket; - CreateDespawnPacket(app, true); - entity_list.QueueClients(this, app); - CreateSpawnPacket(app, this); - entity_list.QueueClients(this, app); - safe_delete(app); - } + if(needs_spawn_packet) { + EQApplicationPacket* app = new EQApplicationPacket; + CreateDespawnPacket(app, true); + entity_list.QueueClients(this, app); + CreateSpawnPacket(app, this); + entity_list.QueueClients(this, app); + safe_delete(app); + } } -void Mob::ModSkillDmgTaken(SkillType skill_num, int value) +void Mob::ModSkillDmgTaken(SkillType skill_num, int value) { if (skill_num <= HIGHEST_SKILL) SkillDmgTaken_Mod[skill_num] = value; @@ -4490,7 +4487,7 @@ bool Mob::PassLimitToSkill(uint16 spell_id, uint16 skill) { // Faction Mods for Alliance type spells void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) { - map :: const_iterator faction_bonus; + map :: const_iterator faction_bonus; typedef std::pair NewFactionBonus; faction_bonus = faction_bonuses.find(pFactionID); @@ -4510,7 +4507,7 @@ void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) { // Faction Mods from items void Mob::AddItemFactionBonus(uint32 pFactionID,int32 bonus) { - map :: const_iterator faction_bonus; + map :: const_iterator faction_bonus; typedef std::pair NewFactionBonus; faction_bonus = item_faction_bonuses.find(pFactionID); @@ -4529,7 +4526,7 @@ void Mob::AddItemFactionBonus(uint32 pFactionID,int32 bonus) { } int32 Mob::GetFactionBonus(uint32 pFactionID) { - map :: const_iterator faction_bonus; + map :: const_iterator faction_bonus; faction_bonus = faction_bonuses.find(pFactionID); if(faction_bonus != faction_bonuses.end()) { @@ -4539,7 +4536,7 @@ int32 Mob::GetFactionBonus(uint32 pFactionID) { } int32 Mob::GetItemFactionBonus(uint32 pFactionID) { - map :: const_iterator faction_bonus; + map :: const_iterator faction_bonus; faction_bonus = item_faction_bonuses.find(pFactionID); if(faction_bonus != item_faction_bonuses.end()) { diff --git a/zone/mob.h b/zone/mob.h index 95a16a854..b300eb9b6 100644 --- a/zone/mob.h +++ b/zone/mob.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 - 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 MOB_H #define MOB_H @@ -33,758 +33,758 @@ class EGNode; class MobFearState; class Mob : public Entity { public: - enum CLIENT_CONN_STATUS { CLIENT_CONNECTING, CLIENT_CONNECTED, CLIENT_LINKDEAD, - CLIENT_KICKED, DISCONNECTED, CLIENT_ERROR, CLIENT_CONNECTINGALL }; - enum eStandingPetOrder { SPO_Follow, SPO_Sit, SPO_Guard }; + enum CLIENT_CONN_STATUS { CLIENT_CONNECTING, CLIENT_CONNECTED, CLIENT_LINKDEAD, + CLIENT_KICKED, DISCONNECTED, CLIENT_ERROR, CLIENT_CONNECTINGALL }; + enum eStandingPetOrder { SPO_Follow, SPO_Sit, SPO_Guard }; - Mob(const char* in_name, - const char* in_lastname, - int32 in_cur_hp, - int32 in_max_hp, - uint8 in_gender, - uint16 in_race, - uint8 in_class, - bodyType in_bodytype, - uint8 in_deity, - uint8 in_level, - uint32 in_npctype_id, - float in_size, - float in_runspeed, - float in_heading, - float in_x_pos, - float in_y_pos, - float in_z_pos, - uint8 in_light, - uint8 in_texture, - uint8 in_helmtexture, - uint16 in_ac, - uint16 in_atk, - uint16 in_str, - uint16 in_sta, - uint16 in_dex, - uint16 in_agi, - uint16 in_int, - uint16 in_wis, - uint16 in_cha, - uint8 in_haircolor, - uint8 in_beardcolor, - uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye? - uint8 in_eyecolor2, - uint8 in_hairstyle, - uint8 in_luclinface, - uint8 in_beard, - uint32 in_drakkin_heritage, - uint32 in_drakkin_tattoo, - uint32 in_drakkin_details, - uint32 in_armor_tint[MAX_MATERIALS], - uint8 in_aa_title, - uint8 in_see_invis, // see through invis - uint8 in_see_invis_undead, // see through invis vs. undead - uint8 in_see_hide, - uint8 in_see_improved_hide, - int32 in_hp_regen, - int32 in_mana_regen, - uint8 in_qglobal, - uint8 in_maxlevel, - uint32 in_scalerate - ); - virtual ~Mob(); + Mob(const char* in_name, + const char* in_lastname, + int32 in_cur_hp, + int32 in_max_hp, + uint8 in_gender, + uint16 in_race, + uint8 in_class, + bodyType in_bodytype, + uint8 in_deity, + uint8 in_level, + uint32 in_npctype_id, + float in_size, + float in_runspeed, + float in_heading, + float in_x_pos, + float in_y_pos, + float in_z_pos, + uint8 in_light, + uint8 in_texture, + uint8 in_helmtexture, + uint16 in_ac, + uint16 in_atk, + uint16 in_str, + uint16 in_sta, + uint16 in_dex, + uint16 in_agi, + uint16 in_int, + uint16 in_wis, + uint16 in_cha, + uint8 in_haircolor, + uint8 in_beardcolor, + uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye? + uint8 in_eyecolor2, + uint8 in_hairstyle, + uint8 in_luclinface, + uint8 in_beard, + uint32 in_drakkin_heritage, + uint32 in_drakkin_tattoo, + uint32 in_drakkin_details, + uint32 in_armor_tint[MAX_MATERIALS], + uint8 in_aa_title, + uint8 in_see_invis, // see through invis + uint8 in_see_invis_undead, // see through invis vs. undead + uint8 in_see_hide, + uint8 in_see_improved_hide, + int32 in_hp_regen, + int32 in_mana_regen, + uint8 in_qglobal, + uint8 in_maxlevel, + uint32 in_scalerate + ); + virtual ~Mob(); - inline virtual bool IsMob() const { return true; } - inline virtual bool InZone() const { return true; } + inline virtual bool IsMob() const { return true; } + inline virtual bool InZone() const { return true; } - //Somewhat sorted: needs documenting! + //Somewhat sorted: needs documenting! - //Attack - virtual void RogueBackstab(Mob* other, bool min_damage = false, int ReuseTime = 10); - virtual void RogueAssassinate(Mob* other); // solar - bool BehindMob(Mob* other = 0, float playerx = 0.0f, float playery = 0.0f) const; - virtual void RangedAttack(Mob* other) { } - virtual void ThrowingAttack(Mob* other) { } - uint16 GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg); - // 13 = Primary (default), 14 = secondary - virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, - bool IsFromSpell = false) = 0; - int MonkSpecialAttack(Mob* other, uint8 skill_used); - virtual void TryBackstab(Mob *other,int ReuseTime = 10); - void TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand = 13, int damage = 0); - virtual bool AvoidDamage(Mob* attacker, int32 &damage, bool CanRiposte = true); - virtual bool CheckHitChance(Mob* attacker, SkillType skillinuse, int Hand, int16 chance_mod = 0); - virtual void TryCriticalHit(Mob *defender, uint16 skill, int32 &damage); - void TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage); - virtual bool TryFinishingBlow(Mob *defender, SkillType skillinuse); - virtual bool TryHeadShot(Mob* defender, SkillType skillInUse); - virtual void DoRiposte(Mob* defender); - void ApplyMeleeDamageBonus(uint16 skill, int32 &damage); - virtual void MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit); - bool CombatRange(Mob* other); + //Attack + virtual void RogueBackstab(Mob* other, bool min_damage = false, int ReuseTime = 10); + virtual void RogueAssassinate(Mob* other); // solar + bool BehindMob(Mob* other = 0, float playerx = 0.0f, float playery = 0.0f) const; + virtual void RangedAttack(Mob* other) { } + virtual void ThrowingAttack(Mob* other) { } + uint16 GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg); + // 13 = Primary (default), 14 = secondary + virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, + bool IsFromSpell = false) = 0; + int MonkSpecialAttack(Mob* other, uint8 skill_used); + virtual void TryBackstab(Mob *other,int ReuseTime = 10); + void TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand = 13, int damage = 0); + virtual bool AvoidDamage(Mob* attacker, int32 &damage, bool CanRiposte = true); + virtual bool CheckHitChance(Mob* attacker, SkillType skillinuse, int Hand, int16 chance_mod = 0); + virtual void TryCriticalHit(Mob *defender, uint16 skill, int32 &damage); + void TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage); + virtual bool TryFinishingBlow(Mob *defender, SkillType skillinuse); + virtual bool TryHeadShot(Mob* defender, SkillType skillInUse); + virtual void DoRiposte(Mob* defender); + void ApplyMeleeDamageBonus(uint16 skill, int32 &damage); + virtual void MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit); + bool CombatRange(Mob* other); - //Appearance - void SendLevelAppearance(); - void SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5, - Client *specific_target=nullptr); - void SendTargetable(bool on, Client *specific_target = nullptr); - virtual void SendWearChange(uint8 material_slot); - virtual void SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model = 0, uint32 elite_material = 0, - uint32 unknown06 = 0, uint32 unknown18 = 0); - virtual void SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint); - virtual void WearChange(uint8 material_slot, uint16 texture, uint32 color); - void DoAnim(const int animnum, int type=0, bool ackreq = true, eqFilterType filter = FilterNone); - void ProjectileAnimation(Mob* to, uint16 item_id, bool IsArrow = false, float speed = 0, - float angle = 0, float tilt = 0, float arc = 0); - void ChangeSize(float in_size, bool bNoRestriction = false); - inline uint8 SeeInvisible() const { return see_invis; } - inline bool SeeInvisibleUndead() const { return see_invis_undead; } - inline bool SeeHide() const { return see_hide; } - inline bool SeeImprovedHide() const { return see_improved_hide; } - bool IsInvisible(Mob* other = 0) const; - void SetInvisible(uint8 state); - bool AttackAnimation(SkillType &skillinuse, int Hand, const ItemInst* weapon); + //Appearance + void SendLevelAppearance(); + void SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5, + Client *specific_target=nullptr); + void SendTargetable(bool on, Client *specific_target = nullptr); + virtual void SendWearChange(uint8 material_slot); + virtual void SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model = 0, uint32 elite_material = 0, + uint32 unknown06 = 0, uint32 unknown18 = 0); + virtual void SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint); + virtual void WearChange(uint8 material_slot, uint16 texture, uint32 color); + void DoAnim(const int animnum, int type=0, bool ackreq = true, eqFilterType filter = FilterNone); + void ProjectileAnimation(Mob* to, uint16 item_id, bool IsArrow = false, float speed = 0, + float angle = 0, float tilt = 0, float arc = 0); + void ChangeSize(float in_size, bool bNoRestriction = false); + inline uint8 SeeInvisible() const { return see_invis; } + inline bool SeeInvisibleUndead() const { return see_invis_undead; } + inline bool SeeHide() const { return see_hide; } + inline bool SeeImprovedHide() const { return see_improved_hide; } + bool IsInvisible(Mob* other = 0) const; + void SetInvisible(uint8 state); + bool AttackAnimation(SkillType &skillinuse, int Hand, const ItemInst* weapon); - //Song - bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); - bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot); - void BardPulse(uint16 spell_id, Mob *caster); + //Song + bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); + bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot); + void BardPulse(uint16 spell_id, Mob *caster); - //Spell - void SendSpellEffect(uint32 effectid, uint32 duration, uint32 finish_delay, bool zone_wide, - uint32 unk020, bool perm_effect = false, Client *c = nullptr); - bool IsBeneficialAllowed(Mob *target); - virtual int GetCasterLevel(uint16 spell_id); - void ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* newbon, uint16 casterID = 0, - bool item_bonus = false, uint32 ticsremaining = 0, int buffslot = -1); - void NegateSpellsBonuses(uint16 spell_id); - virtual float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false) { return range;} - virtual int32 GetActSpellDamage(uint16 spell_id, int32 value) { return value; } - virtual int32 GetActSpellHealing(uint16 spell_id, int32 value) { return value; } - virtual int32 GetActSpellCost(uint16 spell_id, int32 cost){ return cost;} - virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration){ return duration;} - virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime); - float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false, - int resist_override = 0, bool CharismaCheck = false); - uint16 GetSpecializeSkillValue(uint16 spell_id) const; - void SendSpellBarDisable(); - void SendSpellBarEnable(uint16 spellid); - void ZeroCastingVars(); - virtual void SpellProcess(); - virtual bool CastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1, - int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, - uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 type = 0, int16 *resist_adjust = nullptr); - virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1, - int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, - uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 type = 0, int16 resist_adjust = 0); - void CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, uint16 mana_used, - uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0); - bool SpellFinished(uint16 spell_id, Mob *target, uint16 slot = 10, uint16 mana_used = 0, - uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0, bool isproc = false); - virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false, - bool use_resist_adjust = false, int16 resist_adjust = 0, bool isproc = false); - virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100); - virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, - CastAction_type &CastAction); - virtual bool CheckFizzle(uint16 spell_id); - virtual bool IsImmuneToSpell(uint16 spell_id, Mob *caster); - virtual float GetAOERange(uint16 spell_id); - void InterruptSpell(uint16 spellid = SPELL_UNKNOWN); - void InterruptSpell(uint16, uint16, uint16 spellid = SPELL_UNKNOWN); - inline bool IsCasting() const { return((casting_spell_id != 0)); } - uint16 CastingSpellID() const { return casting_spell_id; } + //Spell + void SendSpellEffect(uint32 effectid, uint32 duration, uint32 finish_delay, bool zone_wide, + uint32 unk020, bool perm_effect = false, Client *c = nullptr); + bool IsBeneficialAllowed(Mob *target); + virtual int GetCasterLevel(uint16 spell_id); + void ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* newbon, uint16 casterID = 0, + bool item_bonus = false, uint32 ticsremaining = 0, int buffslot = -1); + void NegateSpellsBonuses(uint16 spell_id); + virtual float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false) { return range;} + virtual int32 GetActSpellDamage(uint16 spell_id, int32 value) { return value; } + virtual int32 GetActSpellHealing(uint16 spell_id, int32 value) { return value; } + virtual int32 GetActSpellCost(uint16 spell_id, int32 cost){ return cost;} + virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration){ return duration;} + virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime); + float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false, + int resist_override = 0, bool CharismaCheck = false); + uint16 GetSpecializeSkillValue(uint16 spell_id) const; + void SendSpellBarDisable(); + void SendSpellBarEnable(uint16 spellid); + void ZeroCastingVars(); + virtual void SpellProcess(); + virtual bool CastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1, + int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, + uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 type = 0, int16 *resist_adjust = nullptr); + virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1, + int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, + uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 type = 0, int16 resist_adjust = 0); + void CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, uint16 mana_used, + uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0); + bool SpellFinished(uint16 spell_id, Mob *target, uint16 slot = 10, uint16 mana_used = 0, + uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0, bool isproc = false); + virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false, + bool use_resist_adjust = false, int16 resist_adjust = 0, bool isproc = false); + virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100); + virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, + CastAction_type &CastAction); + virtual bool CheckFizzle(uint16 spell_id); + virtual bool IsImmuneToSpell(uint16 spell_id, Mob *caster); + virtual float GetAOERange(uint16 spell_id); + void InterruptSpell(uint16 spellid = SPELL_UNKNOWN); + void InterruptSpell(uint16, uint16, uint16 spellid = SPELL_UNKNOWN); + inline bool IsCasting() const { return((casting_spell_id != 0)); } + uint16 CastingSpellID() const { return casting_spell_id; } - //Buff - void BuffProcess(); - virtual void DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, Mob* caster = 0); - void BuffFadeBySpellID(uint16 spell_id); - void BuffFadeByEffect(int effectid, int skipslot = -1); - void BuffFadeAll(); - void BuffFadeDetrimental(); - void BuffFadeBySlot(int slot, bool iRecalcBonuses = true); - void BuffFadeDetrimentalByCaster(Mob *caster); - void BuffFadeBySitModifier(); - void BuffModifyDurationBySpellID(uint16 spell_id, int32 newDuration); - int AddBuff(Mob *caster, const uint16 spell_id, int duration = 0, int32 level_override = -1); - int CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite = false); - int CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caster_level_override = -1); - void SendPetBuffsToClient(); - virtual int GetCurrentBuffSlots() const { return 0; } - virtual int GetCurrentSongSlots() const { return 0; } - virtual int GetCurrentDiscSlots() const { return 0; } - virtual int GetMaxBuffSlots() const { return 0; } - virtual int GetMaxSongSlots() const { return 0; } - virtual int GetMaxDiscSlots() const { return 0; } - virtual int GetMaxTotalSlots() const { return 0; } - virtual void InitializeBuffSlots() { buffs = nullptr; current_buff_count = 0; } - virtual void UninitializeBuffSlots() { } - inline bool HasRune() const { return m_hasRune; } - inline bool HasSpellRune() const { return m_hasSpellRune; } - inline bool HasPartialMeleeRune() const { return m_hasPartialMeleeRune; } - inline bool HasPartialSpellRune() const { return m_hasPartialSpellRune; } - inline void SetHasRune(bool hasRune) { m_hasRune = hasRune; } - inline void SetHasSpellRune(bool hasSpellRune) { m_hasSpellRune = hasSpellRune; } - inline void SetHasPartialMeleeRune(bool hasPartialMeleeRune) { m_hasPartialMeleeRune = hasPartialMeleeRune; } - inline void SetHasPartialSpellRune(bool hasPartialSpellRune) { m_hasPartialSpellRune = hasPartialSpellRune; } - EQApplicationPacket *MakeBuffsPacket(bool for_target = true); - void SendBuffsToClient(Client *c); - inline Buffs_Struct* GetBuffs() { return buffs; } - void DoGravityEffect(); - void DamageShield(Mob* other, bool spell_ds = false); - int32 RuneAbsorb(int32 damage, uint16 type); - bool FindBuff(uint16 spellid); - bool FindType(uint16 type, bool bOffensive = false, uint16 threshold = 100); - int16 GetBuffSlotFromType(uint16 type); - uint16 GetSpellIDFromSlot(uint8 slot); - int CountDispellableBuffs(); - bool HasBuffIcon(Mob* caster, Mob* target, uint16 spell_id); - bool CheckHitsRemaining(uint32 buff_slot, bool when_spell_done=false, bool negate=false,uint16 type=0, - uint16 spell_id=0, bool use_skill=false,uint16 skill=0); - void SpreadVirus(uint16 spell_id, uint16 casterID); - bool IsNimbusEffectActive(uint32 nimbus_effect); - void SetNimbusEffect(uint32 nimbus_effect); - inline virtual uint32 GetNimbusEffect1() const { return nimbus_effect1; } - inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; } - inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; } - void RemoveNimbusEffect(int effectid); + //Buff + void BuffProcess(); + virtual void DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, Mob* caster = 0); + void BuffFadeBySpellID(uint16 spell_id); + void BuffFadeByEffect(int effectid, int skipslot = -1); + void BuffFadeAll(); + void BuffFadeDetrimental(); + void BuffFadeBySlot(int slot, bool iRecalcBonuses = true); + void BuffFadeDetrimentalByCaster(Mob *caster); + void BuffFadeBySitModifier(); + void BuffModifyDurationBySpellID(uint16 spell_id, int32 newDuration); + int AddBuff(Mob *caster, const uint16 spell_id, int duration = 0, int32 level_override = -1); + int CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite = false); + int CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caster_level_override = -1); + void SendPetBuffsToClient(); + virtual int GetCurrentBuffSlots() const { return 0; } + virtual int GetCurrentSongSlots() const { return 0; } + virtual int GetCurrentDiscSlots() const { return 0; } + virtual int GetMaxBuffSlots() const { return 0; } + virtual int GetMaxSongSlots() const { return 0; } + virtual int GetMaxDiscSlots() const { return 0; } + virtual int GetMaxTotalSlots() const { return 0; } + virtual void InitializeBuffSlots() { buffs = nullptr; current_buff_count = 0; } + virtual void UninitializeBuffSlots() { } + inline bool HasRune() const { return m_hasRune; } + inline bool HasSpellRune() const { return m_hasSpellRune; } + inline bool HasPartialMeleeRune() const { return m_hasPartialMeleeRune; } + inline bool HasPartialSpellRune() const { return m_hasPartialSpellRune; } + inline void SetHasRune(bool hasRune) { m_hasRune = hasRune; } + inline void SetHasSpellRune(bool hasSpellRune) { m_hasSpellRune = hasSpellRune; } + inline void SetHasPartialMeleeRune(bool hasPartialMeleeRune) { m_hasPartialMeleeRune = hasPartialMeleeRune; } + inline void SetHasPartialSpellRune(bool hasPartialSpellRune) { m_hasPartialSpellRune = hasPartialSpellRune; } + EQApplicationPacket *MakeBuffsPacket(bool for_target = true); + void SendBuffsToClient(Client *c); + inline Buffs_Struct* GetBuffs() { return buffs; } + void DoGravityEffect(); + void DamageShield(Mob* other, bool spell_ds = false); + int32 RuneAbsorb(int32 damage, uint16 type); + bool FindBuff(uint16 spellid); + bool FindType(uint16 type, bool bOffensive = false, uint16 threshold = 100); + int16 GetBuffSlotFromType(uint16 type); + uint16 GetSpellIDFromSlot(uint8 slot); + int CountDispellableBuffs(); + bool HasBuffIcon(Mob* caster, Mob* target, uint16 spell_id); + bool CheckHitsRemaining(uint32 buff_slot, bool when_spell_done=false, bool negate=false,uint16 type=0, + uint16 spell_id=0, bool use_skill=false,uint16 skill=0); + void SpreadVirus(uint16 spell_id, uint16 casterID); + bool IsNimbusEffectActive(uint32 nimbus_effect); + void SetNimbusEffect(uint32 nimbus_effect); + inline virtual uint32 GetNimbusEffect1() const { return nimbus_effect1; } + inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; } + inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; } + void RemoveNimbusEffect(int effectid); - //Basic Stats/Inventory - virtual void SetLevel(uint8 in_level, bool command = false) { level = in_level; } - void TempName(const char *newname = nullptr); - void SetTargetable(bool on); - bool IsTargetable() const { return m_targetable; } - virtual uint16 GetSkill(SkillType skill_num) const { return 0; } - virtual uint32 GetEquipment(uint8 material_slot) const { return(0); } - virtual int32 GetEquipmentMaterial(uint8 material_slot) const; - virtual uint32 GetEquipmentColor(uint8 material_slot) const; - virtual uint32 IsEliteMaterialItem(uint8 material_slot) const; - bool AffectedBySpellExcludingSlot(int slot, int effect); - virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) = 0; - virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, - bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) = 0; - inline virtual void SetHP(int32 hp) { if (hp >= max_hp) cur_hp = max_hp; else cur_hp = hp;} - bool ChangeHP(Mob* other, int32 amount, uint16 spell_id = 0, int8 buffslot = -1, bool iBuffTic = false); - inline void SetOOCRegen(int32 newoocregen) {oocregen = newoocregen;} - virtual void Heal(); - virtual void HealDamage(uint32 ammount, Mob* caster = nullptr); - virtual void SetMaxHP() { cur_hp = max_hp; } - virtual inline uint16 GetBaseRace() const { return base_race; } - virtual inline uint8 GetBaseGender() const { return base_gender; } - virtual inline uint16 GetDeity() const { return deity; } - inline uint16 GetRace() const { return race; } - inline uint8 GetGender() const { return gender; } - inline uint8 GetTexture() const { return texture; } - inline uint8 GetHelmTexture() const { return helmtexture; } - inline uint8 GetHairColor() const { return haircolor; } - inline uint8 GetBeardColor() const { return beardcolor; } - inline uint8 GetEyeColor1() const { return eyecolor1; } - inline uint8 GetEyeColor2() const { return eyecolor2; } - inline uint8 GetHairStyle() const { return hairstyle; } - inline uint8 GetLuclinFace() const { return luclinface; } - inline uint8 GetBeard() const { return beard; } - inline uint8 GetDrakkinHeritage() const { return drakkin_heritage; } - inline uint8 GetDrakkinTattoo() const { return drakkin_tattoo; } - inline uint8 GetDrakkinDetails() const { return drakkin_details; } - inline uint32 GetArmorTint(uint8 i) const { return armor_tint[(i < MAX_MATERIALS) ? i : 0]; } - inline uint8 GetClass() const { return class_; } - inline uint8 GetLevel() const { return level; } - inline const char* GetName() const { return name; } - inline const char* GetOrigName() const { return orig_name; } - inline const char* GetLastName() const { return lastname; } - const char *GetCleanName(); - virtual void SetName(const char *new_name = nullptr) { new_name ? strn0cpy(name, new_name, 64) : - strn0cpy(name, GetName(), 64); return; }; - inline Mob* GetTarget() const { return target; } - virtual void SetTarget(Mob* mob); - virtual inline float GetHPRatio() const { return max_hp == 0 ? 0 : ((float)cur_hp/max_hp*100); } - inline virtual int16 GetAC() const { return AC + itembonuses.AC + spellbonuses.AC; } - inline virtual int16 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK; } - inline virtual int16 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } - inline virtual int16 GetSTR() const { return STR + itembonuses.STR + spellbonuses.STR; } - inline virtual int16 GetSTA() const { return STA + itembonuses.STA + spellbonuses.STA; } - inline virtual int16 GetDEX() const { return DEX + itembonuses.DEX + spellbonuses.DEX; } - inline virtual int16 GetAGI() const { return AGI + itembonuses.AGI + spellbonuses.AGI; } - inline virtual int16 GetINT() const { return INT + itembonuses.INT + spellbonuses.INT; } - inline virtual int16 GetWIS() const { return WIS + itembonuses.WIS + spellbonuses.WIS; } - inline virtual int16 GetCHA() const { return CHA + itembonuses.CHA + spellbonuses.CHA; } - inline virtual int16 GetMR() const { return MR + itembonuses.MR + spellbonuses.MR; } - inline virtual int16 GetFR() const { return FR + itembonuses.FR + spellbonuses.FR; } - inline virtual int16 GetDR() const { return DR + itembonuses.DR + spellbonuses.DR; } - inline virtual int16 GetPR() const { return PR + itembonuses.PR + spellbonuses.PR; } - inline virtual int16 GetCR() const { return CR + itembonuses.CR + spellbonuses.CR; } - inline virtual int16 GetCorrup() const { return Corrup + itembonuses.Corrup + spellbonuses.Corrup; } - inline StatBonuses GetItemBonuses() const { return itembonuses; } - inline StatBonuses GetSpellBonuses() const { return spellbonuses; } - inline StatBonuses GetAABonuses() const { return aabonuses; } - inline virtual int16 GetMaxSTR() const { return GetSTR(); } - inline virtual int16 GetMaxSTA() const { return GetSTA(); } - inline virtual int16 GetMaxDEX() const { return GetDEX(); } - inline virtual int16 GetMaxAGI() const { return GetAGI(); } - inline virtual int16 GetMaxINT() const { return GetINT(); } - inline virtual int16 GetMaxWIS() const { return GetWIS(); } - inline virtual int16 GetMaxCHA() const { return GetCHA(); } - inline virtual int16 GetMaxMR() const { return 255; } - inline virtual int16 GetMaxPR() const { return 255; } - inline virtual int16 GetMaxDR() const { return 255; } - inline virtual int16 GetMaxCR() const { return 255; } - inline virtual int16 GetMaxFR() const { return 255; } - inline virtual int16 GetDelayDeath() const { return 0; } - inline int32 GetHP() const { return cur_hp; } - inline int32 GetMaxHP() const { return max_hp; } - virtual int32 CalcMaxHP(); - inline int32 GetMaxMana() const { return max_mana; } - inline int32 GetMana() const { return cur_mana; } - int32 GetItemHPBonuses(); - int32 GetSpellHPBonuses(); - virtual const int32& SetMana(int32 amount); - inline float GetManaRatio() const { return max_mana == 0 ? 100 : - ((static_cast(cur_mana) / max_mana) * 100); } - virtual int32 CalcMaxMana(); - uint32 GetNPCTypeID() const { return npctype_id; } - inline const float GetX() const { return x_pos; } - inline const float GetY() const { return y_pos; } - inline const float GetZ() const { return z_pos; } - inline const float GetHeading() const { return heading; } - inline const float GetSize() const { return size; } - inline const float GetBaseSize() const { return base_size; } - inline const float GetTarX() const { return tarx; } - inline const float GetTarY() const { return tary; } - inline const float GetTarZ() const { return tarz; } - inline const float GetTarVX() const { return tar_vx; } - inline const float GetTarVY() const { return tar_vy; } - inline const float GetTarVZ() const { return tar_vz; } - inline const float GetTarVector() const { return tar_vector; } - inline const uint8 GetTarNDX() const { return tar_ndx; } - bool IsBoat() const; + //Basic Stats/Inventory + virtual void SetLevel(uint8 in_level, bool command = false) { level = in_level; } + void TempName(const char *newname = nullptr); + void SetTargetable(bool on); + bool IsTargetable() const { return m_targetable; } + virtual uint16 GetSkill(SkillType skill_num) const { return 0; } + virtual uint32 GetEquipment(uint8 material_slot) const { return(0); } + virtual int32 GetEquipmentMaterial(uint8 material_slot) const; + virtual uint32 GetEquipmentColor(uint8 material_slot) const; + virtual uint32 IsEliteMaterialItem(uint8 material_slot) const; + bool AffectedBySpellExcludingSlot(int slot, int effect); + virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) = 0; + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, + bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) = 0; + inline virtual void SetHP(int32 hp) { if (hp >= max_hp) cur_hp = max_hp; else cur_hp = hp;} + bool ChangeHP(Mob* other, int32 amount, uint16 spell_id = 0, int8 buffslot = -1, bool iBuffTic = false); + inline void SetOOCRegen(int32 newoocregen) {oocregen = newoocregen;} + virtual void Heal(); + virtual void HealDamage(uint32 ammount, Mob* caster = nullptr); + virtual void SetMaxHP() { cur_hp = max_hp; } + virtual inline uint16 GetBaseRace() const { return base_race; } + virtual inline uint8 GetBaseGender() const { return base_gender; } + virtual inline uint16 GetDeity() const { return deity; } + inline uint16 GetRace() const { return race; } + inline uint8 GetGender() const { return gender; } + inline uint8 GetTexture() const { return texture; } + inline uint8 GetHelmTexture() const { return helmtexture; } + inline uint8 GetHairColor() const { return haircolor; } + inline uint8 GetBeardColor() const { return beardcolor; } + inline uint8 GetEyeColor1() const { return eyecolor1; } + inline uint8 GetEyeColor2() const { return eyecolor2; } + inline uint8 GetHairStyle() const { return hairstyle; } + inline uint8 GetLuclinFace() const { return luclinface; } + inline uint8 GetBeard() const { return beard; } + inline uint8 GetDrakkinHeritage() const { return drakkin_heritage; } + inline uint8 GetDrakkinTattoo() const { return drakkin_tattoo; } + inline uint8 GetDrakkinDetails() const { return drakkin_details; } + inline uint32 GetArmorTint(uint8 i) const { return armor_tint[(i < MAX_MATERIALS) ? i : 0]; } + inline uint8 GetClass() const { return class_; } + inline uint8 GetLevel() const { return level; } + inline const char* GetName() const { return name; } + inline const char* GetOrigName() const { return orig_name; } + inline const char* GetLastName() const { return lastname; } + const char *GetCleanName(); + virtual void SetName(const char *new_name = nullptr) { new_name ? strn0cpy(name, new_name, 64) : + strn0cpy(name, GetName(), 64); return; }; + inline Mob* GetTarget() const { return target; } + virtual void SetTarget(Mob* mob); + virtual inline float GetHPRatio() const { return max_hp == 0 ? 0 : ((float)cur_hp/max_hp*100); } + inline virtual int16 GetAC() const { return AC + itembonuses.AC + spellbonuses.AC; } + inline virtual int16 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK; } + inline virtual int16 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } + inline virtual int16 GetSTR() const { return STR + itembonuses.STR + spellbonuses.STR; } + inline virtual int16 GetSTA() const { return STA + itembonuses.STA + spellbonuses.STA; } + inline virtual int16 GetDEX() const { return DEX + itembonuses.DEX + spellbonuses.DEX; } + inline virtual int16 GetAGI() const { return AGI + itembonuses.AGI + spellbonuses.AGI; } + inline virtual int16 GetINT() const { return INT + itembonuses.INT + spellbonuses.INT; } + inline virtual int16 GetWIS() const { return WIS + itembonuses.WIS + spellbonuses.WIS; } + inline virtual int16 GetCHA() const { return CHA + itembonuses.CHA + spellbonuses.CHA; } + inline virtual int16 GetMR() const { return MR + itembonuses.MR + spellbonuses.MR; } + inline virtual int16 GetFR() const { return FR + itembonuses.FR + spellbonuses.FR; } + inline virtual int16 GetDR() const { return DR + itembonuses.DR + spellbonuses.DR; } + inline virtual int16 GetPR() const { return PR + itembonuses.PR + spellbonuses.PR; } + inline virtual int16 GetCR() const { return CR + itembonuses.CR + spellbonuses.CR; } + inline virtual int16 GetCorrup() const { return Corrup + itembonuses.Corrup + spellbonuses.Corrup; } + inline StatBonuses GetItemBonuses() const { return itembonuses; } + inline StatBonuses GetSpellBonuses() const { return spellbonuses; } + inline StatBonuses GetAABonuses() const { return aabonuses; } + inline virtual int16 GetMaxSTR() const { return GetSTR(); } + inline virtual int16 GetMaxSTA() const { return GetSTA(); } + inline virtual int16 GetMaxDEX() const { return GetDEX(); } + inline virtual int16 GetMaxAGI() const { return GetAGI(); } + inline virtual int16 GetMaxINT() const { return GetINT(); } + inline virtual int16 GetMaxWIS() const { return GetWIS(); } + inline virtual int16 GetMaxCHA() const { return GetCHA(); } + inline virtual int16 GetMaxMR() const { return 255; } + inline virtual int16 GetMaxPR() const { return 255; } + inline virtual int16 GetMaxDR() const { return 255; } + inline virtual int16 GetMaxCR() const { return 255; } + inline virtual int16 GetMaxFR() const { return 255; } + inline virtual int16 GetDelayDeath() const { return 0; } + inline int32 GetHP() const { return cur_hp; } + inline int32 GetMaxHP() const { return max_hp; } + virtual int32 CalcMaxHP(); + inline int32 GetMaxMana() const { return max_mana; } + inline int32 GetMana() const { return cur_mana; } + int32 GetItemHPBonuses(); + int32 GetSpellHPBonuses(); + virtual const int32& SetMana(int32 amount); + inline float GetManaRatio() const { return max_mana == 0 ? 100 : + ((static_cast(cur_mana) / max_mana) * 100); } + virtual int32 CalcMaxMana(); + uint32 GetNPCTypeID() const { return npctype_id; } + inline const float GetX() const { return x_pos; } + inline const float GetY() const { return y_pos; } + inline const float GetZ() const { return z_pos; } + inline const float GetHeading() const { return heading; } + inline const float GetSize() const { return size; } + inline const float GetBaseSize() const { return base_size; } + inline const float GetTarX() const { return tarx; } + inline const float GetTarY() const { return tary; } + inline const float GetTarZ() const { return tarz; } + inline const float GetTarVX() const { return tar_vx; } + inline const float GetTarVY() const { return tar_vy; } + inline const float GetTarVZ() const { return tar_vz; } + inline const float GetTarVector() const { return tar_vector; } + inline const uint8 GetTarNDX() const { return tar_ndx; } + bool IsBoat() const; - //Group - virtual bool HasRaid() = 0; - virtual bool HasGroup() = 0; - virtual Raid* GetRaid() = 0; - virtual Group* GetGroup() = 0; + //Group + virtual bool HasRaid() = 0; + virtual bool HasGroup() = 0; + virtual Raid* GetRaid() = 0; + virtual Group* GetGroup() = 0; - //Faction - virtual inline int32 GetPrimaryFaction() const { return 0; } + //Faction + virtual inline int32 GetPrimaryFaction() const { return 0; } - //Movement - void Warp( float x, float y, float z ); - inline bool IsMoving() const { return moving; } - virtual void SetMoving(bool move) { moving = move; delta_x = 0; delta_y = 0; delta_z = 0; delta_heading = 0; } - virtual void GoToBind(uint8 bindnum = 0) { } - virtual void Gate(); - float GetWalkspeed() const { return(_GetMovementSpeed(-47)); } - float GetRunspeed() const { return(_GetMovementSpeed(0)); } - float GetBaseRunspeed() const { return runspeed; } - float GetMovespeed() const { return IsRunning() ? GetRunspeed() : GetWalkspeed(); } - bool IsRunning() const { return m_is_running; } - void SetRunning(bool val) { m_is_running = val; } - virtual void GMMove(float x, float y, float z, float heading = 0.01, bool SendUpdate = true); - void SetDeltas(float delta_x, float delta_y, float delta_z, float delta_h); - void SetTargetDestSteps(uint8 target_steps) { tar_ndx = target_steps; } - void SendPosUpdate(uint8 iSendToSelf = 0); - void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu); - void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu); - void SendPosition(); - void SetFlyMode(uint8 flymode); - inline void Teleport(VERTEX NewPosition) { x_pos = NewPosition.x; y_pos = NewPosition.y; - z_pos = NewPosition.z; }; + //Movement + void Warp( float x, float y, float z ); + inline bool IsMoving() const { return moving; } + virtual void SetMoving(bool move) { moving = move; delta_x = 0; delta_y = 0; delta_z = 0; delta_heading = 0; } + virtual void GoToBind(uint8 bindnum = 0) { } + virtual void Gate(); + float GetWalkspeed() const { return(_GetMovementSpeed(-47)); } + float GetRunspeed() const { return(_GetMovementSpeed(0)); } + float GetBaseRunspeed() const { return runspeed; } + float GetMovespeed() const { return IsRunning() ? GetRunspeed() : GetWalkspeed(); } + bool IsRunning() const { return m_is_running; } + void SetRunning(bool val) { m_is_running = val; } + virtual void GMMove(float x, float y, float z, float heading = 0.01, bool SendUpdate = true); + void SetDeltas(float delta_x, float delta_y, float delta_z, float delta_h); + void SetTargetDestSteps(uint8 target_steps) { tar_ndx = target_steps; } + void SendPosUpdate(uint8 iSendToSelf = 0); + void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu); + void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu); + void SendPosition(); + void SetFlyMode(uint8 flymode); + inline void Teleport(VERTEX NewPosition) { x_pos = NewPosition.x; y_pos = NewPosition.y; + z_pos = NewPosition.z; }; - //AI - static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel); - inline uint32 GetLevelCon(uint8 iOtherLevel) const { - return this ? GetLevelCon(GetLevel(), iOtherLevel) : CON_GREEN; } - virtual void AddToHateList(Mob* other, int32 hate = 0, int32 damage = 0, bool iYellForHelp = true, - bool bFrenzy = false, bool iBuffTic = false); - bool RemoveFromHateList(Mob* mob); - void SetHate(Mob* other, int32 hate = 0, int32 damage = 0) { hate_list.Set(other,hate,damage);} - uint32 GetHateAmount(Mob* tmob, bool is_dam = false) { return hate_list.GetEntHate(tmob,is_dam);} - uint32 GetDamageAmount(Mob* tmob) { return hate_list.GetEntHate(tmob, true);} - Mob* GetHateTop() { return hate_list.GetTop(this);} - Mob* GetHateDamageTop(Mob* other) { return hate_list.GetDamageTop(other);} - Mob* GetHateRandom() { return hate_list.GetRandom();} - Mob* GetHateMost() { return hate_list.GetMostHate();} - bool IsEngaged() { return(!hate_list.IsEmpty()); } - bool HateSummon(); - void FaceTarget(Mob* MobToFace = 0); - void SetHeading(float iHeading) { if(heading != iHeading) { pLastChange = Timer::GetCurrentTime(); - heading = iHeading; } } - void WipeHateList(); - void AddFeignMemory(Client* attacker); - void RemoveFromFeignMemory(Client* attacker); - void ClearFeignMemory(); - void PrintHateListToClient(Client *who) { hate_list.PrintToClient(who); } - void GetHateList(std::list &h_list) { return hate_list.GetHateList(h_list); } - bool CheckLos(Mob* other); - bool CheckLosFN(Mob* other); - bool CheckLosFN(float posX, float posY, float posZ, float mobSize); - inline void SetChanged() { pLastChange = Timer::GetCurrentTime(); } - inline const uint32 LastChange() const { return pLastChange; } + //AI + static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel); + inline uint32 GetLevelCon(uint8 iOtherLevel) const { + return this ? GetLevelCon(GetLevel(), iOtherLevel) : CON_GREEN; } + virtual void AddToHateList(Mob* other, int32 hate = 0, int32 damage = 0, bool iYellForHelp = true, + bool bFrenzy = false, bool iBuffTic = false); + bool RemoveFromHateList(Mob* mob); + void SetHate(Mob* other, int32 hate = 0, int32 damage = 0) { hate_list.Set(other,hate,damage);} + uint32 GetHateAmount(Mob* tmob, bool is_dam = false) { return hate_list.GetEntHate(tmob,is_dam);} + uint32 GetDamageAmount(Mob* tmob) { return hate_list.GetEntHate(tmob, true);} + Mob* GetHateTop() { return hate_list.GetTop(this);} + Mob* GetHateDamageTop(Mob* other) { return hate_list.GetDamageTop(other);} + Mob* GetHateRandom() { return hate_list.GetRandom();} + Mob* GetHateMost() { return hate_list.GetMostHate();} + bool IsEngaged() { return(!hate_list.IsEmpty()); } + bool HateSummon(); + void FaceTarget(Mob* MobToFace = 0); + void SetHeading(float iHeading) { if(heading != iHeading) { pLastChange = Timer::GetCurrentTime(); + heading = iHeading; } } + void WipeHateList(); + void AddFeignMemory(Client* attacker); + void RemoveFromFeignMemory(Client* attacker); + void ClearFeignMemory(); + void PrintHateListToClient(Client *who) { hate_list.PrintToClient(who); } + void GetHateList(std::list &h_list) { return hate_list.GetHateList(h_list); } + bool CheckLos(Mob* other); + bool CheckLosFN(Mob* other); + bool CheckLosFN(float posX, float posY, float posZ, float mobSize); + inline void SetChanged() { pLastChange = Timer::GetCurrentTime(); } + inline const uint32 LastChange() const { return pLastChange; } - //Quest - void QuestReward(Client *c = nullptr, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0); - void CameraEffect(uint32 duration, uint32 intensity, Client *c = nullptr, bool global = false); - inline bool GetQglobal() const { return qglobal; } + //Quest + void QuestReward(Client *c = nullptr, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0); + void CameraEffect(uint32 duration, uint32 intensity, Client *c = nullptr, bool global = false); + inline bool GetQglobal() const { return qglobal; } - //Other Packet - void CreateDespawnPacket(EQApplicationPacket* app, bool Decay); - void CreateHorseSpawnPacket(EQApplicationPacket* app, const char* ownername, uint16 ownerid, Mob* ForWho = 0); - void CreateSpawnPacket(EQApplicationPacket* app, Mob* ForWho = 0); - virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); - void CreateHPPacket(EQApplicationPacket* app); - void SendHPUpdate(); + //Other Packet + void CreateDespawnPacket(EQApplicationPacket* app, bool Decay); + void CreateHorseSpawnPacket(EQApplicationPacket* app, const char* ownername, uint16 ownerid, Mob* ForWho = 0); + void CreateSpawnPacket(EQApplicationPacket* app, Mob* ForWho = 0); + virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); + void CreateHPPacket(EQApplicationPacket* app); + void SendHPUpdate(); - //Util - static uint32 RandomTimer(int min, int max); - static uint8 GetDefaultGender(uint16 in_race, uint8 in_gender = 0xFF); - static void CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns); - uint16 GetSkillByItemType(int ItemType); - virtual void MakePet(uint16 spell_id, const char* pettype, const char *petname = nullptr); - virtual void MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const char *petname = nullptr); - bool IsWarriorClass() const; - char GetCasterClass() const; - uint8 GetArchetype() const; - void SetZone(uint32 zone_id, uint32 instance_id); - void ShowStats(Client* client); - void ShowBuffs(Client* client); - void ShowBuffList(Client* client); - float Dist(const Mob &) const; - float DistNoZ(const Mob &) const; - float DistNoRoot(const Mob &) const; - float DistNoRoot(float x, float y, float z) const; - float DistNoRootNoZ(float x, float y) const; - float DistNoRootNoZ(const Mob &) const; - static float GetReciprocalHeading(Mob* target); - bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, - bool lookForAftArc = true); + //Util + static uint32 RandomTimer(int min, int max); + static uint8 GetDefaultGender(uint16 in_race, uint8 in_gender = 0xFF); + static void CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns); + uint16 GetSkillByItemType(int ItemType); + virtual void MakePet(uint16 spell_id, const char* pettype, const char *petname = nullptr); + virtual void MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const char *petname = nullptr); + bool IsWarriorClass() const; + char GetCasterClass() const; + uint8 GetArchetype() const; + void SetZone(uint32 zone_id, uint32 instance_id); + void ShowStats(Client* client); + void ShowBuffs(Client* client); + void ShowBuffList(Client* client); + float Dist(const Mob &) const; + float DistNoZ(const Mob &) const; + float DistNoRoot(const Mob &) const; + float DistNoRoot(float x, float y, float z) const; + float DistNoRootNoZ(float x, float y) const; + float DistNoRootNoZ(const Mob &) const; + static float GetReciprocalHeading(Mob* target); + bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, + bool lookForAftArc = true); - //Procs - bool AddRangedProc(uint16 spell_id, uint16 iChance = 3, uint16 base_spell_id = SPELL_UNKNOWN); - bool RemoveRangedProc(uint16 spell_id, bool bAll = false); - bool HasRangedProcs() const; - bool AddDefensiveProc(uint16 spell_id, uint16 iChance = 3, uint16 base_spell_id = SPELL_UNKNOWN); - bool RemoveDefensiveProc(uint16 spell_id, bool bAll = false); - bool HasDefensiveProcs() const; - bool AddSkillProc(uint16 spell_id, uint16 iChance = 3, uint16 base_spell_id = SPELL_UNKNOWN); - bool RemoveSkillProc(uint16 spell_id, bool bAll = false); - bool HasSkillProcs() const; - bool AddProcToWeapon(uint16 spell_id, bool bPerma = false, uint16 iChance = 3); - bool RemoveProcFromWeapon(uint16 spell_id, bool bAll = false); - bool HasProcs() const; + //Procs + bool AddRangedProc(uint16 spell_id, uint16 iChance = 3, uint16 base_spell_id = SPELL_UNKNOWN); + bool RemoveRangedProc(uint16 spell_id, bool bAll = false); + bool HasRangedProcs() const; + bool AddDefensiveProc(uint16 spell_id, uint16 iChance = 3, uint16 base_spell_id = SPELL_UNKNOWN); + bool RemoveDefensiveProc(uint16 spell_id, bool bAll = false); + bool HasDefensiveProcs() const; + bool AddSkillProc(uint16 spell_id, uint16 iChance = 3, uint16 base_spell_id = SPELL_UNKNOWN); + bool RemoveSkillProc(uint16 spell_id, bool bAll = false); + bool HasSkillProcs() const; + bool AddProcToWeapon(uint16 spell_id, bool bPerma = false, uint16 iChance = 3); + bool RemoveProcFromWeapon(uint16 spell_id, bool bAll = false); + bool HasProcs() const; - //Logging - bool IsLoggingEnabled() const { return(logging_enabled); } - void EnableLogging() { logging_enabled = true; } - void DisableLogging() { logging_enabled = false; } + //Logging + bool IsLoggingEnabled() const { return(logging_enabled); } + void EnableLogging() { logging_enabled = true; } + void DisableLogging() { logging_enabled = false; } - //More stuff to sort: - virtual bool IsAttackAllowed(Mob *target, bool isSpellAttack = false); - bool IsTargeted() const { return (targeted > 0); } - inline void IsTargeted(int in_tar) { targeted += in_tar; if(targeted < 0) targeted = 0;} - void SetFollowID(uint32 id) { follow = id; } - void SetFollowDistance(uint32 dist) { follow_dist = dist; } - uint32 GetFollowID() const { return follow; } - uint32 GetFollowDistance() const { return follow_dist; } + //More stuff to sort: + virtual bool IsAttackAllowed(Mob *target, bool isSpellAttack = false); + bool IsTargeted() const { return (targeted > 0); } + inline void IsTargeted(int in_tar) { targeted += in_tar; if(targeted < 0) targeted = 0;} + void SetFollowID(uint32 id) { follow = id; } + void SetFollowDistance(uint32 dist) { follow_dist = dist; } + uint32 GetFollowID() const { return follow; } + uint32 GetFollowDistance() const { return follow_dist; } - virtual void Message(uint32 type, const char* message, ...) { } - virtual void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0) { } - virtual void Message_StringID(uint32 type, uint32 string_id, const char* message, const char* message2 = 0, - const char* message3 = 0, const char* message4 = 0, const char* message5 = 0, const char* message6 = 0, - const char* message7 = 0, const char* message8 = 0, const char* message9 = 0, uint32 distance = 0) { } - void Say(const char *format, ...); - void Say_StringID(uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0, - const char *message6 = 0, const char *message7 = 0, const char *message8 = 0, const char *message9 = 0); - void Say_StringID(uint32 type, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0, - const char *message6 = 0, const char *message7 = 0, const char *message8 = 0, const char *message9 = 0); - void Shout(const char *format, ...); - void Emote(const char *format, ...); - void QuestJournalledSay(Client *QuestInitiator, const char *str); - uint32 GetItemStat(uint32 itemid, const char *identifier); + virtual void Message(uint32 type, const char* message, ...) { } + virtual void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0) { } + virtual void Message_StringID(uint32 type, uint32 string_id, const char* message, const char* message2 = 0, + const char* message3 = 0, const char* message4 = 0, const char* message5 = 0, const char* message6 = 0, + const char* message7 = 0, const char* message8 = 0, const char* message9 = 0, uint32 distance = 0) { } + void Say(const char *format, ...); + void Say_StringID(uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0, + const char *message6 = 0, const char *message7 = 0, const char *message8 = 0, const char *message9 = 0); + void Say_StringID(uint32 type, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0, + const char *message6 = 0, const char *message7 = 0, const char *message8 = 0, const char *message9 = 0); + void Shout(const char *format, ...); + void Emote(const char *format, ...); + void QuestJournalledSay(Client *QuestInitiator, const char *str); + uint32 GetItemStat(uint32 itemid, const char *identifier); - int16 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false); - uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0); - void SendIllusionPacket(uint16 in_race, uint8 in_gender = 0xFF, uint8 in_texture = 0xFF, uint8 in_helmtexture = 0xFF, uint8 in_haircolor = 0xFF, uint8 in_beardcolor = 0xFF, uint8 in_eyecolor1 = 0xFF, uint8 in_eyecolor2 = 0xFF, uint8 in_hairstyle = 0xFF, uint8 in_luclinface = 0xFF, uint8 in_beard = 0xFF, uint8 in_aa_title = 0xFF, uint32 in_drakkin_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF, uint32 in_drakkin_details = 0xFFFFFFFF, float in_size = 0xFFFFFFFF); - virtual void Stun(int duration); - virtual void UnStun(); - inline void Silence(bool newval) { silenced = newval; } - inline void Amnesia(bool newval) { amnesiad = newval; } - void TemporaryPets(uint16 spell_id, Mob *target, const char *name_override = nullptr, uint32 duration_override = 0); - void TypesTemporaryPets(uint32 typesid, Mob *target, const char *name_override = nullptr, uint32 duration_override = 0, bool followme = false); - void WakeTheDead(uint16 spell_id, Mob *target, uint32 duration); - void Spin(); - void Kill(); - bool PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id); - bool TryDeathSave(); - bool TryDivineSave(); - void DoBuffWearOffEffect(uint32 index); - void TryTriggerOnCast(uint32 spell_id, bool aa_trigger); - void TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger); - void TrySpellTrigger(Mob *target, uint32 spell_id); - void TryApplyEffect(Mob *target, uint32 spell_id); - void TryTwincast(Mob *caster, Mob *target, uint32 spell_id); - void TrySympatheticProc(Mob *target, uint32 spell_id); - bool TryFadeEffect(int slot); - uint16 GetSpellEffectResistChance(uint16 spell_id); - int16 GetHealRate(uint16 spell_id); - int16 GetCriticalHealRate(uint16 spell_id); - int32 GetVulnerability(int32 damage, Mob *caster, uint32 spell_id, uint32 ticsremaining); - int32 GetAdditionalDamage(Mob *caster, uint32 spell_id, bool use_skill = false, uint16 skill=0); - int16 GetSkillDmgTaken(const SkillType skill_used); - void DoKnockback(Mob *caster, uint32 pushback, uint32 pushup); - int16 CalcResistChanceBonus(); - int16 CalcFearResistChance(); - void TrySpellOnKill(uint8 level, uint16 spell_id); - bool TrySpellOnDeath(); - void CastOnCurer(uint32 spell_id); - void CastOnCure(uint32 spell_id); - void CastOnNumHitFade(uint32 spell_id); - int SlowMitigation(bool slow_msg=false, Mob *caster = nullptr,int slow_value = 0); - int16 GetCritDmgMob(uint16 skill); - int16 GetMeleeDamageMod_SE(uint16 skill); - int16 GetMeleeMinDamageMod_SE(uint16 skill); - int16 GetCrippBlowChance(); - int16 GetSkillReuseTime(uint16 skill); - int16 GetCriticalChanceBonus(uint16 skill); - int16 GetSkillDmgAmt(uint16 skill); - bool TryReflectSpell(uint32 spell_id); - bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); } - bool DoHPToManaCovert(uint16 mana_cost = 0); - int32 ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard = false); + int16 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false); + uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0); + void SendIllusionPacket(uint16 in_race, uint8 in_gender = 0xFF, uint8 in_texture = 0xFF, uint8 in_helmtexture = 0xFF, uint8 in_haircolor = 0xFF, uint8 in_beardcolor = 0xFF, uint8 in_eyecolor1 = 0xFF, uint8 in_eyecolor2 = 0xFF, uint8 in_hairstyle = 0xFF, uint8 in_luclinface = 0xFF, uint8 in_beard = 0xFF, uint8 in_aa_title = 0xFF, uint32 in_drakkin_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF, uint32 in_drakkin_details = 0xFFFFFFFF, float in_size = 0xFFFFFFFF); + virtual void Stun(int duration); + virtual void UnStun(); + inline void Silence(bool newval) { silenced = newval; } + inline void Amnesia(bool newval) { amnesiad = newval; } + void TemporaryPets(uint16 spell_id, Mob *target, const char *name_override = nullptr, uint32 duration_override = 0); + void TypesTemporaryPets(uint32 typesid, Mob *target, const char *name_override = nullptr, uint32 duration_override = 0, bool followme = false); + void WakeTheDead(uint16 spell_id, Mob *target, uint32 duration); + void Spin(); + void Kill(); + bool PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id); + bool TryDeathSave(); + bool TryDivineSave(); + void DoBuffWearOffEffect(uint32 index); + void TryTriggerOnCast(uint32 spell_id, bool aa_trigger); + void TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger); + void TrySpellTrigger(Mob *target, uint32 spell_id); + void TryApplyEffect(Mob *target, uint32 spell_id); + void TryTwincast(Mob *caster, Mob *target, uint32 spell_id); + void TrySympatheticProc(Mob *target, uint32 spell_id); + bool TryFadeEffect(int slot); + uint16 GetSpellEffectResistChance(uint16 spell_id); + int16 GetHealRate(uint16 spell_id); + int16 GetCriticalHealRate(uint16 spell_id); + int32 GetVulnerability(int32 damage, Mob *caster, uint32 spell_id, uint32 ticsremaining); + int32 GetAdditionalDamage(Mob *caster, uint32 spell_id, bool use_skill = false, uint16 skill=0); + int16 GetSkillDmgTaken(const SkillType skill_used); + void DoKnockback(Mob *caster, uint32 pushback, uint32 pushup); + int16 CalcResistChanceBonus(); + int16 CalcFearResistChance(); + void TrySpellOnKill(uint8 level, uint16 spell_id); + bool TrySpellOnDeath(); + void CastOnCurer(uint32 spell_id); + void CastOnCure(uint32 spell_id); + void CastOnNumHitFade(uint32 spell_id); + int SlowMitigation(bool slow_msg=false, Mob *caster = nullptr,int slow_value = 0); + int16 GetCritDmgMob(uint16 skill); + int16 GetMeleeDamageMod_SE(uint16 skill); + int16 GetMeleeMinDamageMod_SE(uint16 skill); + int16 GetCrippBlowChance(); + int16 GetSkillReuseTime(uint16 skill); + int16 GetCriticalChanceBonus(uint16 skill); + int16 GetSkillDmgAmt(uint16 skill); + bool TryReflectSpell(uint32 spell_id); + bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); } + bool DoHPToManaCovert(uint16 mana_cost = 0); + int32 ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard = false); - void ModSkillDmgTaken(SkillType skill_num, int value); - int16 GetModSkillDmgTaken(const SkillType skill_num); - void ModVulnerability(uint8 resist, int16 value); - int16 GetModVulnerability(const uint8 resist); + void ModSkillDmgTaken(SkillType skill_num, int value); + int16 GetModSkillDmgTaken(const SkillType skill_num); + void ModVulnerability(uint8 resist, int16 value); + int16 GetModVulnerability(const uint8 resist); - void SetAllowBeneficial(bool value) { m_AllowBeneficial = value; } - bool GetAllowBeneficial() { return m_AllowBeneficial; } - void SetDisableMelee(bool value) { m_DisableMelee = value; } - bool IsMeleeDisabled() { return m_DisableMelee; } + void SetAllowBeneficial(bool value) { m_AllowBeneficial = value; } + bool GetAllowBeneficial() { return m_AllowBeneficial; } + void SetDisableMelee(bool value) { m_DisableMelee = value; } + bool IsMeleeDisabled() { return m_DisableMelee; } - bool IsOffHandAtk() const { return offhand; } - inline void OffHandAtk(bool val) { offhand = val; } + bool IsOffHandAtk() const { return offhand; } + inline void OffHandAtk(bool val) { offhand = val; } - inline void SetFlurryChance(uint8 value) { NPC_FlurryChance = value;} - uint8 GetFlurryChance() { return NPC_FlurryChance; } + inline void SetFlurryChance(uint8 value) { NPC_FlurryChance = value;} + uint8 GetFlurryChance() { return NPC_FlurryChance; } - static uint32 GetAppearanceValue(EmuAppearance iAppearance); - void SendAppearancePacket(uint32 type, uint32 value, bool WholeZone = true, bool iIgnoreSelf = false, Client *specific_target=nullptr); - void SetAppearance(EmuAppearance app, bool iIgnoreSelf = true); - inline EmuAppearance GetAppearance() const { return _appearance; } - inline const uint8 GetRunAnimSpeed() const { return pRunAnimSpeed; } - inline void SetRunAnimSpeed(int8 in) { if (pRunAnimSpeed != in) { pRunAnimSpeed = in; pLastChange = Timer::GetCurrentTime(); } } - bool IsDestructibleObject() { return destructibleobject; } - void SetDestructibleObject(bool in) { destructibleobject = in; } + static uint32 GetAppearanceValue(EmuAppearance iAppearance); + void SendAppearancePacket(uint32 type, uint32 value, bool WholeZone = true, bool iIgnoreSelf = false, Client *specific_target=nullptr); + void SetAppearance(EmuAppearance app, bool iIgnoreSelf = true); + inline EmuAppearance GetAppearance() const { return _appearance; } + inline const uint8 GetRunAnimSpeed() const { return pRunAnimSpeed; } + inline void SetRunAnimSpeed(int8 in) { if (pRunAnimSpeed != in) { pRunAnimSpeed = in; pLastChange = Timer::GetCurrentTime(); } } + bool IsDestructibleObject() { return destructibleobject; } + void SetDestructibleObject(bool in) { destructibleobject = in; } - Mob* GetPet(); - void SetPet(Mob* newpet); - virtual Mob* GetOwner(); - virtual Mob* GetOwnerOrSelf(); - Mob* GetUltimateOwner(); - void SetPetID(uint16 NewPetID); - inline uint16 GetPetID() const { return petid; } - inline PetType GetPetType() const { return typeofpet; } - void SetPetType(PetType p) { typeofpet = p; } - inline int16 GetPetPower() const { return (petpower < 0) ? 0 : petpower; } - void SetPetPower(int16 p) { if (p < 0) petpower = 0; else petpower = p; } - bool IsFamiliar() const { return(typeofpet == petFamiliar); } - bool IsAnimation() const { return(typeofpet == petAnimation); } - bool IsCharmed() const { return(typeofpet == petCharmed); } - void SetOwnerID(uint16 NewOwnerID); - inline uint16 GetOwnerID() const { return ownerid; } - inline virtual bool HasOwner() { if(GetOwnerID()==0){return false;} return( entity_list.GetMob(GetOwnerID()) != 0); } - inline virtual bool IsPet() { return(HasOwner() && !IsMerc()); } - inline bool HasPet() const { if(GetPetID()==0){return false;} return (entity_list.GetMob(GetPetID()) != 0);} - bool HadTempPets() const { return(hasTempPet); } - void TempPets(bool i) { hasTempPet = i; } - bool HasPetAffinity() { if (aabonuses.GivePetGroupTarget || itembonuses.GivePetGroupTarget || spellbonuses.GivePetGroupTarget) return true; return false; } + Mob* GetPet(); + void SetPet(Mob* newpet); + virtual Mob* GetOwner(); + virtual Mob* GetOwnerOrSelf(); + Mob* GetUltimateOwner(); + void SetPetID(uint16 NewPetID); + inline uint16 GetPetID() const { return petid; } + inline PetType GetPetType() const { return typeofpet; } + void SetPetType(PetType p) { typeofpet = p; } + inline int16 GetPetPower() const { return (petpower < 0) ? 0 : petpower; } + void SetPetPower(int16 p) { if (p < 0) petpower = 0; else petpower = p; } + bool IsFamiliar() const { return(typeofpet == petFamiliar); } + bool IsAnimation() const { return(typeofpet == petAnimation); } + bool IsCharmed() const { return(typeofpet == petCharmed); } + void SetOwnerID(uint16 NewOwnerID); + inline uint16 GetOwnerID() const { return ownerid; } + inline virtual bool HasOwner() { if(GetOwnerID()==0){return false;} return( entity_list.GetMob(GetOwnerID()) != 0); } + inline virtual bool IsPet() { return(HasOwner() && !IsMerc()); } + inline bool HasPet() const { if(GetPetID()==0){return false;} return (entity_list.GetMob(GetPetID()) != 0);} + bool HadTempPets() const { return(hasTempPet); } + void TempPets(bool i) { hasTempPet = i; } + bool HasPetAffinity() { if (aabonuses.GivePetGroupTarget || itembonuses.GivePetGroupTarget || spellbonuses.GivePetGroupTarget) return true; return false; } - inline const bodyType GetBodyType() const { return bodytype; } - inline const bodyType GetOrigBodyType() const { return orig_bodytype; } - void SetBodyType(bodyType new_body, bool overwrite_orig); + inline const bodyType GetBodyType() const { return bodytype; } + inline const bodyType GetOrigBodyType() const { return orig_bodytype; } + void SetBodyType(bodyType new_body, bool overwrite_orig); - uint8 invisible, see_invis; - bool invulnerable, invisible_undead, invisible_animals, sneaking, hidden, improved_hidden; - bool see_invis_undead, see_hide, see_improved_hide; - bool qglobal; + uint8 invisible, see_invis; + bool invulnerable, invisible_undead, invisible_animals, sneaking, hidden, improved_hidden; + bool see_invis_undead, see_hide, see_improved_hide; + bool qglobal; - virtual void SetAttackTimer(); - inline void SetInvul(bool invul) { invulnerable=invul; } - inline bool GetInvul(void) { return invulnerable; } - inline void SetExtraHaste(int Haste) { ExtraHaste = Haste; } - virtual int GetHaste(); + virtual void SetAttackTimer(); + inline void SetInvul(bool invul) { invulnerable=invul; } + inline bool GetInvul(void) { return invulnerable; } + inline void SetExtraHaste(int Haste) { ExtraHaste = Haste; } + virtual int GetHaste(); - uint8 GetWeaponDamageBonus(const Item_Struct* Weapon); - uint16 GetDamageTable(SkillType skillinuse); - virtual int GetMonkHandToHandDamage(void); + uint8 GetWeaponDamageBonus(const Item_Struct* Weapon); + uint16 GetDamageTable(SkillType skillinuse); + virtual int GetMonkHandToHandDamage(void); - bool CanThisClassDoubleAttack(void) const; - bool CanThisClassDualWield(void) const; - bool CanThisClassRiposte(void) const; - bool CanThisClassDodge(void) const; - bool CanThisClassParry(void) const; - bool CanThisClassBlock(void) const; + bool CanThisClassDoubleAttack(void) const; + bool CanThisClassDualWield(void) const; + bool CanThisClassRiposte(void) const; + bool CanThisClassDodge(void) const; + bool CanThisClassParry(void) const; + bool CanThisClassBlock(void) const; - int GetMonkHandToHandDelay(void); - uint16 GetClassLevelFactor(); - void Mesmerize(); - inline bool IsMezzed() const { return mezzed; } - inline bool IsStunned() const { return stunned; } - inline bool IsSilenced() const { return silenced; } - inline bool IsAmnesiad() const { return amnesiad; } - inline uint16 GetErrorNumber() const {return adverrorinfo;} + int GetMonkHandToHandDelay(void); + uint16 GetClassLevelFactor(); + void Mesmerize(); + inline bool IsMezzed() const { return mezzed; } + inline bool IsStunned() const { return stunned; } + inline bool IsSilenced() const { return silenced; } + inline bool IsAmnesiad() const { return amnesiad; } + inline uint16 GetErrorNumber() const {return adverrorinfo;} - int32 ReduceDamage(int32 damage); - int32 AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTic, Mob* attacker); + int32 ReduceDamage(int32 damage); + int32 AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTic, Mob* attacker); - virtual void DoSpecialAttackDamage(Mob *who, SkillType skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false); - virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* item=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0); - virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillType skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false); - virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0); - bool CanDoSpecialAttack(Mob *other); - bool Flurry(); - bool Rampage(); - bool AddRampage(Mob*); - void ClearRampage(); - void AreaRampage(); + virtual void DoSpecialAttackDamage(Mob *who, SkillType skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false); + virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* item=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0); + virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillType skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false); + virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0); + bool CanDoSpecialAttack(Mob *other); + bool Flurry(); + bool Rampage(); + bool AddRampage(Mob*); + void ClearRampage(); + void AreaRampage(); - void StartEnrage(); - void ProcessEnrage(); - bool IsEnraged(); - void Taunt(NPC* who, bool always_succeed, float chance_bonus = 0); + void StartEnrage(); + void ProcessEnrage(); + bool IsEnraged(); + void Taunt(NPC* who, bool always_succeed, float chance_bonus = 0); - virtual void AI_Init(); - virtual void AI_Start(uint32 iMoveDelay = 0); - virtual void AI_Stop(); - virtual void AI_Process(); + virtual void AI_Init(); + virtual void AI_Start(uint32 iMoveDelay = 0); + virtual void AI_Stop(); + virtual void AI_Process(); - const char* GetEntityVariable(const char *id); - void SetEntityVariable(const char *id, const char *m_var); - bool EntityVariableExists(const char *id); + const char* GetEntityVariable(const char *id); + void SetEntityVariable(const char *id, const char *m_var); + bool EntityVariableExists(const char *id); - void AI_Event_Engaged(Mob* attacker, bool iYellForHelp = true); - void AI_Event_NoLongerEngaged(); + void AI_Event_Engaged(Mob* attacker, bool iYellForHelp = true); + void AI_Event_NoLongerEngaged(); - FACTION_VALUE GetSpecialFactionCon(Mob* iOther); - inline const bool IsAIControlled() const { return pAIControlled; } - inline const float GetAggroRange() const { return (spellbonuses.AggroRange == -1) ? pAggroRange : spellbonuses.AggroRange; } - inline const float GetAssistRange() const { return (spellbonuses.AssistRange == -1) ? pAssistRange : spellbonuses.AssistRange; } + FACTION_VALUE GetSpecialFactionCon(Mob* iOther); + inline const bool IsAIControlled() const { return pAIControlled; } + inline const float GetAggroRange() const { return (spellbonuses.AggroRange == -1) ? pAggroRange : spellbonuses.AggroRange; } + inline const float GetAssistRange() const { return (spellbonuses.AssistRange == -1) ? pAssistRange : spellbonuses.AssistRange; } - inline void SetPetOrder(eStandingPetOrder i) { pStandingPetOrder = i; } - inline const eStandingPetOrder GetPetOrder() const { return pStandingPetOrder; } - inline void SetHeld(bool nState) { held = nState; } - inline const bool IsHeld() const { return held; } - inline void SetNoCast(bool nState) { nocast = nState; } - inline const bool IsNoCast() const { return nocast; } - inline void SetFocused(bool nState) { focused = nState; } - inline const bool IsFocused() const { return focused; } - inline const bool IsRoamer() const { return roamer; } - inline const bool IsRooted() const { return rooted || permarooted; } - inline const bool HasVirus() const { return has_virus; } - int GetSnaredAmount(); + inline void SetPetOrder(eStandingPetOrder i) { pStandingPetOrder = i; } + inline const eStandingPetOrder GetPetOrder() const { return pStandingPetOrder; } + inline void SetHeld(bool nState) { held = nState; } + inline const bool IsHeld() const { return held; } + inline void SetNoCast(bool nState) { nocast = nState; } + inline const bool IsNoCast() const { return nocast; } + inline void SetFocused(bool nState) { focused = nState; } + inline const bool IsFocused() const { return focused; } + inline const bool IsRoamer() const { return roamer; } + inline const bool IsRooted() const { return rooted || permarooted; } + inline const bool HasVirus() const { return has_virus; } + int GetSnaredAmount(); - int GetCurWp() { return cur_wp; } + int GetCurWp() { return cur_wp; } - //old fear function - //void SetFeared(Mob *caster, uint32 duration, bool flee = false); - float GetFearSpeed(); - bool IsFeared() { return curfp; } // This returns true if the mob is feared or fleeing due to low HP - //old fear: inline void StartFleeing() { SetFeared(GetHateTop(), FLEE_RUN_DURATION, true); } - inline void StartFleeing() { flee_mode = true; CalculateNewFearpoint(); } - void ProcessFlee(); - void CheckFlee(); + //old fear function + //void SetFeared(Mob *caster, uint32 duration, bool flee = false); + float GetFearSpeed(); + bool IsFeared() { return curfp; } // This returns true if the mob is feared or fleeing due to low HP + //old fear: inline void StartFleeing() { SetFeared(GetHateTop(), FLEE_RUN_DURATION, true); } + inline void StartFleeing() { flee_mode = true; CalculateNewFearpoint(); } + void ProcessFlee(); + void CheckFlee(); - inline bool CheckAggro(Mob* other) {return hate_list.IsOnHateList(other);} - float CalculateHeadingToTarget(float in_x, float in_y); - bool CalculateNewPosition(float x, float y, float z, float speed, bool checkZ = false); - virtual bool CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ = true); - float CalculateDistance(float x, float y, float z); - float GetGroundZ(float new_x, float new_y, float z_offset=0.0); - void SendTo(float new_x, float new_y, float new_z); - void SendToFixZ(float new_x, float new_y, float new_z); - void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false); - inline uint32 DontHealMeBefore() const { return pDontHealMeBefore; } - inline uint32 DontBuffMeBefore() const { return pDontBuffMeBefore; } - inline uint32 DontDotMeBefore() const { return pDontDotMeBefore; } - inline uint32 DontRootMeBefore() const { return pDontRootMeBefore; } - inline uint32 DontSnareMeBefore() const { return pDontSnareMeBefore; } - inline uint32 DontCureMeBefore() const { return pDontCureMeBefore; } - void SetDontRootMeBefore(uint32 time) { pDontRootMeBefore = time; } - void SetDontHealMeBefore(uint32 time) { pDontHealMeBefore = time; } - void SetDontBuffMeBefore(uint32 time) { pDontBuffMeBefore = time; } - void SetDontDotMeBefore(uint32 time) { pDontDotMeBefore = time; } - void SetDontSnareMeBefore(uint32 time) { pDontSnareMeBefore = time; } - void SetDontCureMeBefore(uint32 time) { pDontCureMeBefore = time; } + inline bool CheckAggro(Mob* other) {return hate_list.IsOnHateList(other);} + float CalculateHeadingToTarget(float in_x, float in_y); + bool CalculateNewPosition(float x, float y, float z, float speed, bool checkZ = false); + virtual bool CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ = true); + float CalculateDistance(float x, float y, float z); + float GetGroundZ(float new_x, float new_y, float z_offset=0.0); + void SendTo(float new_x, float new_y, float new_z); + void SendToFixZ(float new_x, float new_y, float new_z); + void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false); + inline uint32 DontHealMeBefore() const { return pDontHealMeBefore; } + inline uint32 DontBuffMeBefore() const { return pDontBuffMeBefore; } + inline uint32 DontDotMeBefore() const { return pDontDotMeBefore; } + inline uint32 DontRootMeBefore() const { return pDontRootMeBefore; } + inline uint32 DontSnareMeBefore() const { return pDontSnareMeBefore; } + inline uint32 DontCureMeBefore() const { return pDontCureMeBefore; } + void SetDontRootMeBefore(uint32 time) { pDontRootMeBefore = time; } + void SetDontHealMeBefore(uint32 time) { pDontHealMeBefore = time; } + void SetDontBuffMeBefore(uint32 time) { pDontBuffMeBefore = time; } + void SetDontDotMeBefore(uint32 time) { pDontDotMeBefore = time; } + void SetDontSnareMeBefore(uint32 time) { pDontSnareMeBefore = time; } + void SetDontCureMeBefore(uint32 time) { pDontCureMeBefore = time; } - // calculate interruption of spell via movement of mob - void SaveSpellLoc() {spell_x = x_pos; spell_y = y_pos; spell_z = z_pos; } - inline float GetSpellX() const {return spell_x;} - inline float GetSpellY() const {return spell_y;} - inline float GetSpellZ() const {return spell_z;} - inline bool IsGrouped() const { return isgrouped; } - void SetGrouped(bool v); - inline bool IsRaidGrouped() const { return israidgrouped; } - void SetRaidGrouped(bool v); - inline bool IsLooting() const { return islooting; } - void SetLooting(bool val) { islooting = val; } + // calculate interruption of spell via movement of mob + void SaveSpellLoc() {spell_x = x_pos; spell_y = y_pos; spell_z = z_pos; } + inline float GetSpellX() const {return spell_x;} + inline float GetSpellY() const {return spell_y;} + inline float GetSpellZ() const {return spell_z;} + inline bool IsGrouped() const { return isgrouped; } + void SetGrouped(bool v); + inline bool IsRaidGrouped() const { return israidgrouped; } + void SetRaidGrouped(bool v); + inline bool IsLooting() const { return islooting; } + void SetLooting(bool val) { islooting = val; } - bool CheckWillAggro(Mob *mob); + bool CheckWillAggro(Mob *mob); - void InstillDoubt(Mob *who); - int16 GetResist(uint8 type) const; - Mob* GetShieldTarget() const { return shield_target; } - void SetShieldTarget(Mob* mob) { shield_target = mob; } - bool HasActiveSong() const { return(bardsong != 0); } - bool Charmed() const { return charmed; } - static uint32 GetLevelHP(uint8 tlevel); - uint32 GetZoneID() const; //for perl - virtual int32 CheckAggroAmount(uint16 spellid, bool isproc = false); - virtual int32 CheckHealAggroAmount(uint16 spellid, uint32 heal_possible = 0); - virtual uint32 GetAA(uint32 aa_id) const { return(0); } + void InstillDoubt(Mob *who); + int16 GetResist(uint8 type) const; + Mob* GetShieldTarget() const { return shield_target; } + void SetShieldTarget(Mob* mob) { shield_target = mob; } + bool HasActiveSong() const { return(bardsong != 0); } + bool Charmed() const { return charmed; } + static uint32 GetLevelHP(uint8 tlevel); + uint32 GetZoneID() const; //for perl + virtual int32 CheckAggroAmount(uint16 spellid, bool isproc = false); + virtual int32 CheckHealAggroAmount(uint16 spellid, uint32 heal_possible = 0); + virtual uint32 GetAA(uint32 aa_id) const { return(0); } - uint16 GetInstrumentMod(uint16 spell_id) const; - int CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level = 1, Mob *caster = nullptr, int ticsremaining = 0); - int CalcSpellEffectValue_formula(int formula, int base, int max, int caster_level, uint16 spell_id, int ticsremaining = 0); - virtual int CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int caster_level2, Mob* caster1 = nullptr, Mob* caster2 = nullptr); - uint32 GetCastedSpellInvSlot() const { return casting_spell_inventory_slot; } + uint16 GetInstrumentMod(uint16 spell_id) const; + int CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level = 1, Mob *caster = nullptr, int ticsremaining = 0); + int CalcSpellEffectValue_formula(int formula, int base, int max, int caster_level, uint16 spell_id, int ticsremaining = 0); + virtual int CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int caster_level2, Mob* caster1 = nullptr, Mob* caster2 = nullptr); + uint32 GetCastedSpellInvSlot() const { return casting_spell_inventory_slot; } - // HP Event - inline int GetNextHPEvent() const { return nexthpevent; } - void SetNextHPEvent( int hpevent ); - void SendItemAnimation(Mob *to, const Item_Struct *item, SkillType skillInUse); - inline int& GetNextIncHPEvent() { return nextinchpevent; } - void SetNextIncHPEvent( int inchpevent ); + // HP Event + inline int GetNextHPEvent() const { return nexthpevent; } + void SetNextHPEvent( int hpevent ); + void SendItemAnimation(Mob *to, const Item_Struct *item, SkillType skillInUse); + inline int& GetNextIncHPEvent() { return nextinchpevent; } + void SetNextIncHPEvent( int inchpevent ); - bool DivineAura() const; - bool SpecAttacks[SPECATK_MAXNUM]; - bool HasNPCSpecialAtk(const char* parse); - Shielders_Struct shielder[MAX_SHIELDERS]; - Trade* trade; + bool DivineAura() const; + bool SpecAttacks[SPECATK_MAXNUM]; + bool HasNPCSpecialAtk(const char* parse); + Shielders_Struct shielder[MAX_SHIELDERS]; + Trade* trade; - inline float GetCWPX() const { return(cur_wp_x); } - inline float GetCWPY() const { return(cur_wp_y); } - inline float GetCWPZ() const { return(cur_wp_z); } - inline float GetCWPH() const { return(cur_wp_heading); } - inline float GetCWPP() const { return(static_cast(cur_wp_pause)); } - inline int GetCWP() const { return(cur_wp); } - void SetCurrentWP(uint16 waypoint) { cur_wp = waypoint; } - virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther) { return FACTION_INDIFFERENT; } + inline float GetCWPX() const { return(cur_wp_x); } + inline float GetCWPY() const { return(cur_wp_y); } + inline float GetCWPZ() const { return(cur_wp_z); } + inline float GetCWPH() const { return(cur_wp_heading); } + inline float GetCWPP() const { return(static_cast(cur_wp_pause)); } + inline int GetCWP() const { return(cur_wp); } + void SetCurrentWP(uint16 waypoint) { cur_wp = waypoint; } + virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther) { return FACTION_INDIFFERENT; } - inline bool IsTrackable() const { return(trackable); } - Timer* GetAIThinkTimer() { return AIthink_timer; } - Timer* GetAIMovementTimer() { return AImovement_timer; } - Timer GetAttackTimer() { return attack_timer; } - Timer GetAttackDWTimer() { return attack_dw_timer; } - inline bool IsFindable() { return findable; } - inline uint8 GetManaPercent() { return (uint8)((float)cur_mana / (float)max_mana * 100.0f); } - virtual uint8 GetEndurancePercent() { return 0; } + inline bool IsTrackable() const { return(trackable); } + Timer* GetAIThinkTimer() { return AIthink_timer; } + Timer* GetAIMovementTimer() { return AImovement_timer; } + Timer GetAttackTimer() { return attack_timer; } + Timer GetAttackDWTimer() { return attack_dw_timer; } + inline bool IsFindable() { return findable; } + inline uint8 GetManaPercent() { return (uint8)((float)cur_mana / (float)max_mana * 100.0f); } + virtual uint8 GetEndurancePercent() { return 0; } - inline virtual bool IsBlockedBuff(int16 SpellID) { return false; } - inline virtual bool IsBlockedPetBuff(int16 SpellID) { return false; } + inline virtual bool IsBlockedBuff(int16 SpellID) { return false; } + inline virtual bool IsBlockedPetBuff(int16 SpellID) { return false; } - void SetGlobal(const char *varname, const char *newvalue, int options, const char *duration, Mob *other = nullptr); - void TarGlobal(const char *varname, const char *value, const char *duration, int npcid, int charid, int zoneid); - void DelGlobal(const char *varname); + void SetGlobal(const char *varname, const char *newvalue, int options, const char *duration, Mob *other = nullptr); + void TarGlobal(const char *varname, const char *value, const char *duration, int npcid, int charid, int zoneid); + void DelGlobal(const char *varname); inline void SetEmoteID(uint16 emote) { emoteid = emote; } inline uint16 GetEmoteID() { return emoteid; } @@ -814,336 +814,336 @@ public: int mod_spell_resist(int resist_chance, int level_mod, int resist_modifier, int target_resist, uint8 resist_type, uint16 spell_id, Mob* caster); protected: - void CommonDamage(Mob* other, int32 &damage, const uint16 spell_id, const SkillType attack_skill, bool &avoidable, const int8 buffslot, const bool iBuffTic); - static uint16 GetProcID(uint16 spell_id, uint8 effect_index); - float _GetMovementSpeed(int mod) const; - virtual bool MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, bool checkZ); + void CommonDamage(Mob* other, int32 &damage, const uint16 spell_id, const SkillType attack_skill, bool &avoidable, const int8 buffslot, const bool iBuffTic); + static uint16 GetProcID(uint16 spell_id, uint8 effect_index); + float _GetMovementSpeed(int mod) const; + virtual bool MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, bool checkZ); - virtual bool AI_EngagedCastCheck() { return(false); } - virtual bool AI_PursueCastCheck() { return(false); } - virtual bool AI_IdleCastCheck() { return(false); } + virtual bool AI_EngagedCastCheck() { return(false); } + virtual bool AI_PursueCastCheck() { return(false); } + virtual bool AI_IdleCastCheck() { return(false); } - bool IsFullHP; - bool moved; + bool IsFullHP; + bool moved; - std::vector RampageArray; - std::map m_EntityVariables; + std::vector RampageArray; + std::map m_EntityVariables; - int16 SkillDmgTaken_Mod[HIGHEST_SKILL+2]; - int16 Vulnerability_Mod[HIGHEST_RESIST+2]; - bool m_AllowBeneficial; - bool m_DisableMelee; - uint8 NPC_FlurryChance; + int16 SkillDmgTaken_Mod[HIGHEST_SKILL+2]; + int16 Vulnerability_Mod[HIGHEST_RESIST+2]; + bool m_AllowBeneficial; + bool m_DisableMelee; + uint8 NPC_FlurryChance; - bool isgrouped; - bool israidgrouped; - bool pendinggroup; - bool islooting; - uint8 texture; - uint8 helmtexture; + bool isgrouped; + bool israidgrouped; + bool pendinggroup; + bool islooting; + uint8 texture; + uint8 helmtexture; - int AC; - int16 ATK; - int16 STR; - int16 STA; - int16 DEX; - int16 AGI; - int16 INT; - int16 WIS; - int16 CHA; - int16 MR; - int16 CR; - int16 FR; - int16 DR; - int16 PR; - int16 Corrup; - bool moving; - int targeted; - bool findable; - bool trackable; - int32 cur_hp; - int32 max_hp; - int32 base_hp; - int32 cur_mana; - int32 max_mana; - int32 hp_regen; - int32 mana_regen; - int32 oocregen; - uint8 maxlevel; - uint32 scalerate; - Buffs_Struct *buffs; - uint32 current_buff_count; - Timer *buff_tic_timer; - StatBonuses itembonuses; - StatBonuses spellbonuses; - StatBonuses aabonuses; - uint16 petid; - uint16 ownerid; - PetType typeofpet; - int16 petpower; - uint32 follow; - uint32 follow_dist; + int AC; + int16 ATK; + int16 STR; + int16 STA; + int16 DEX; + int16 AGI; + int16 INT; + int16 WIS; + int16 CHA; + int16 MR; + int16 CR; + int16 FR; + int16 DR; + int16 PR; + int16 Corrup; + bool moving; + int targeted; + bool findable; + bool trackable; + int32 cur_hp; + int32 max_hp; + int32 base_hp; + int32 cur_mana; + int32 max_mana; + int32 hp_regen; + int32 mana_regen; + int32 oocregen; + uint8 maxlevel; + uint32 scalerate; + Buffs_Struct *buffs; + uint32 current_buff_count; + Timer *buff_tic_timer; + StatBonuses itembonuses; + StatBonuses spellbonuses; + StatBonuses aabonuses; + uint16 petid; + uint16 ownerid; + PetType typeofpet; + int16 petpower; + uint32 follow; + uint32 follow_dist; - uint8 gender; - uint16 race; - uint8 base_gender; - uint16 base_race; - uint8 class_; - bodyType bodytype; - bodyType orig_bodytype; - uint16 deity; - uint8 level; - uint32 npctype_id; - float x_pos; - float y_pos; - float z_pos; - float heading; - uint16 animation; - float base_size; - float size; - float runspeed; - uint32 pLastChange; - bool held; - bool nocast; - bool focused; - void CalcSpellBonuses(StatBonuses* newbon); - virtual void CalcBonuses(); - void TrySkillProc(Mob *on, uint16 skill, float chance); - bool PassLimitToSkill(uint16 spell_id, uint16 skill); - bool PassLimitClass(uint32 Classes_, uint16 Class_); - void TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand = 13, int damage=0); - void TryWeaponProc(const Item_Struct* weapon, Mob *on, uint16 hand = 13); - void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = 13); - void ExecWeaponProc(uint16 spell_id, Mob *on); - virtual float GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed = 30, uint16 hand = 13); - virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed = 30, uint16 hand = 13); - int GetWeaponDamage(Mob *against, const Item_Struct *weapon_item); - int GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate = nullptr); - int GetKickDamage(); - int GetBashDamage(); - virtual void ApplySpecialAttackMod(SkillType skill, int32 &dmg, int32 &mindmg); - bool HasDied(); - void CalculateNewFearpoint(); - float FindGroundZ(float new_x, float new_y, float z_offset=0.0); - VERTEX UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &WaypointChange, bool &NodeReached); - void PrintRoute(); - void UpdateRuneFlags(); + uint8 gender; + uint16 race; + uint8 base_gender; + uint16 base_race; + uint8 class_; + bodyType bodytype; + bodyType orig_bodytype; + uint16 deity; + uint8 level; + uint32 npctype_id; + float x_pos; + float y_pos; + float z_pos; + float heading; + uint16 animation; + float base_size; + float size; + float runspeed; + uint32 pLastChange; + bool held; + bool nocast; + bool focused; + void CalcSpellBonuses(StatBonuses* newbon); + virtual void CalcBonuses(); + void TrySkillProc(Mob *on, uint16 skill, float chance); + bool PassLimitToSkill(uint16 spell_id, uint16 skill); + bool PassLimitClass(uint32 Classes_, uint16 Class_); + void TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand = 13, int damage=0); + void TryWeaponProc(const Item_Struct* weapon, Mob *on, uint16 hand = 13); + void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = 13); + void ExecWeaponProc(uint16 spell_id, Mob *on); + virtual float GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed = 30, uint16 hand = 13); + virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed = 30, uint16 hand = 13); + int GetWeaponDamage(Mob *against, const Item_Struct *weapon_item); + int GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate = nullptr); + int GetKickDamage(); + int GetBashDamage(); + virtual void ApplySpecialAttackMod(SkillType skill, int32 &dmg, int32 &mindmg); + bool HasDied(); + void CalculateNewFearpoint(); + float FindGroundZ(float new_x, float new_y, float z_offset=0.0); + VERTEX UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &WaypointChange, bool &NodeReached); + void PrintRoute(); + void UpdateRuneFlags(); - virtual float GetSympatheticProcChances(float &ProcBonus, float &ProcChance, int32 cast_time, int16 ProcRateMod); + virtual float GetSympatheticProcChances(float &ProcBonus, float &ProcChance, int32 cast_time, int16 ProcRateMod); - enum {MAX_PROCS = 4}; - tProc PermaProcs[MAX_PROCS]; - tProc SpellProcs[MAX_PROCS]; - tProc DefensiveProcs[MAX_PROCS]; - tProc RangedProcs[MAX_PROCS]; - tProc SkillProcs[MAX_PROCS]; + enum {MAX_PROCS = 4}; + tProc PermaProcs[MAX_PROCS]; + tProc SpellProcs[MAX_PROCS]; + tProc DefensiveProcs[MAX_PROCS]; + tProc RangedProcs[MAX_PROCS]; + tProc SkillProcs[MAX_PROCS]; - char name[64]; - char orig_name[64]; - char clean_name[64]; - char lastname[64]; + char name[64]; + char orig_name[64]; + char clean_name[64]; + char lastname[64]; - bool bEnraged; - Timer *SpecAttackTimers[SPECATK_MAXNUM]; - bool destructibleobject; + bool bEnraged; + Timer *SpecAttackTimers[SPECATK_MAXNUM]; + bool destructibleobject; - int32 delta_heading; - float delta_x; - float delta_y; - float delta_z; + int32 delta_heading; + float delta_x; + float delta_y; + float delta_z; - uint8 light; + uint8 light; - float fixedZ; - EmuAppearance _appearance; - uint8 pRunAnimSpeed; - bool m_is_running; + float fixedZ; + EmuAppearance _appearance; + uint8 pRunAnimSpeed; + bool m_is_running; - Timer attack_timer; - Timer attack_dw_timer; - Timer ranged_timer; - float attack_speed; //% increase/decrease in attack speed (not haste) - float slow_mitigation; // Allows for a slow mitigation based on a % in decimal form. IE, 1 = 100% mitigation, .5 is 50% - Timer tic_timer; - Timer mana_timer; + Timer attack_timer; + Timer attack_dw_timer; + Timer ranged_timer; + float attack_speed; //% increase/decrease in attack speed (not haste) + float slow_mitigation; // Allows for a slow mitigation based on a % in decimal form. IE, 1 = 100% mitigation, .5 is 50% + Timer tic_timer; + Timer mana_timer; - float rewind_x; - float rewind_y; - float rewind_z; - Timer rewind_timer; + float rewind_x; + float rewind_y; + float rewind_z; + Timer rewind_timer; - //spell casting vars - Timer spellend_timer; - uint16 casting_spell_id; - float spell_x, spell_y, spell_z; - int attacked_count; - bool delaytimer; - uint16 casting_spell_targetid; - uint16 casting_spell_slot; - uint16 casting_spell_mana; - uint32 casting_spell_inventory_slot; - uint32 casting_spell_timer; - uint32 casting_spell_timer_duration; - uint32 casting_spell_type; - int16 casting_spell_resist_adjust; - uint16 bardsong; - uint8 bardsong_slot; - uint32 bardsong_target_id; + //spell casting vars + Timer spellend_timer; + uint16 casting_spell_id; + float spell_x, spell_y, spell_z; + int attacked_count; + bool delaytimer; + uint16 casting_spell_targetid; + uint16 casting_spell_slot; + uint16 casting_spell_mana; + uint32 casting_spell_inventory_slot; + uint32 casting_spell_timer; + uint32 casting_spell_timer_duration; + uint32 casting_spell_type; + int16 casting_spell_resist_adjust; + uint16 bardsong; + uint8 bardsong_slot; + uint32 bardsong_target_id; - // Currently 3 max nimbus particle effects at a time - uint32 nimbus_effect1; - uint32 nimbus_effect2; - uint32 nimbus_effect3; + // Currently 3 max nimbus particle effects at a time + uint32 nimbus_effect1; + uint32 nimbus_effect2; + uint32 nimbus_effect3; - uint8 haircolor; - uint8 beardcolor; - uint8 eyecolor1; // the eyecolors always seem to be the same, maybe left and right eye? - uint8 eyecolor2; - uint8 hairstyle; - uint8 luclinface; // - uint8 beard; - uint32 drakkin_heritage; - uint32 drakkin_tattoo; - uint32 drakkin_details; - uint32 armor_tint[MAX_MATERIALS]; + uint8 haircolor; + uint8 beardcolor; + uint8 eyecolor1; // the eyecolors always seem to be the same, maybe left and right eye? + uint8 eyecolor2; + uint8 hairstyle; + uint8 luclinface; // + uint8 beard; + uint32 drakkin_heritage; + uint32 drakkin_tattoo; + uint32 drakkin_details; + uint32 armor_tint[MAX_MATERIALS]; - uint8 aa_title; + uint8 aa_title; - Mob* shield_target; + Mob* shield_target; - int ExtraHaste; // for the #haste command - bool mezzed; - bool stunned; - bool charmed; //this isnt fully implemented yet - bool rooted; - bool silenced; - bool amnesiad; - bool inWater; // Set to true or false by Water Detection code if enabled by rules - bool has_virus; // whether this mob has a viral spell on them - uint16 viral_spells[MAX_SPELL_TRIGGER*2]; // Stores the spell ids of the viruses on target and caster ids - int16 rooted_mod; //Modifier to root break chance, defined when root is cast on a target. - bool offhand; + int ExtraHaste; // for the #haste command + bool mezzed; + bool stunned; + bool charmed; //this isnt fully implemented yet + bool rooted; + bool silenced; + bool amnesiad; + bool inWater; // Set to true or false by Water Detection code if enabled by rules + bool has_virus; // whether this mob has a viral spell on them + uint16 viral_spells[MAX_SPELL_TRIGGER*2]; // Stores the spell ids of the viruses on target and caster ids + int16 rooted_mod; //Modifier to root break chance, defined when root is cast on a target. + bool offhand; - Timer stunned_timer; - Timer spun_timer; - Timer bardsong_timer; - Timer gravity_timer; - Timer viral_timer; - uint8 viral_timer_counter; - uint16 adverrorinfo; + Timer stunned_timer; + Timer spun_timer; + Timer bardsong_timer; + Timer gravity_timer; + Timer viral_timer; + uint8 viral_timer_counter; + uint16 adverrorinfo; - // MobAI stuff - eStandingPetOrder pStandingPetOrder; - uint32 minLastFightingDelayMoving; - uint32 maxLastFightingDelayMoving; - float pAggroRange; - float pAssistRange; - Timer* AIthink_timer; - Timer* AImovement_timer; - Timer* AItarget_check_timer; - bool movetimercompleted; - bool permarooted; - Timer* AIscanarea_timer; - Timer* AIwalking_timer; - Timer* AIfeignremember_timer; - uint32 pLastFightingDelayMoving; - HateList hate_list; - std::set feign_memory_list; - // This is to keep track of mobs we cast faction mod spells on - std::map faction_bonuses; // Primary FactionID, Bonus - void AddFactionBonus(uint32 pFactionID,int32 bonus); - int32 GetFactionBonus(uint32 pFactionID); - // This is to keep track of item faction modifiers - std::map item_faction_bonuses; // Primary FactionID, Bonus - void AddItemFactionBonus(uint32 pFactionID,int32 bonus); - int32 GetItemFactionBonus(uint32 pFactionID); - void ClearItemFactionBonuses(); + // MobAI stuff + eStandingPetOrder pStandingPetOrder; + uint32 minLastFightingDelayMoving; + uint32 maxLastFightingDelayMoving; + float pAggroRange; + float pAssistRange; + Timer* AIthink_timer; + Timer* AImovement_timer; + Timer* AItarget_check_timer; + bool movetimercompleted; + bool permarooted; + Timer* AIscanarea_timer; + Timer* AIwalking_timer; + Timer* AIfeignremember_timer; + uint32 pLastFightingDelayMoving; + HateList hate_list; + std::set feign_memory_list; + // This is to keep track of mobs we cast faction mod spells on + std::map faction_bonuses; // Primary FactionID, Bonus + void AddFactionBonus(uint32 pFactionID,int32 bonus); + int32 GetFactionBonus(uint32 pFactionID); + // This is to keep track of item faction modifiers + std::map item_faction_bonuses; // Primary FactionID, Bonus + void AddItemFactionBonus(uint32 pFactionID,int32 bonus); + int32 GetItemFactionBonus(uint32 pFactionID); + void ClearItemFactionBonuses(); - void CalculateFearPosition(); - uint32 move_tic_count; + void CalculateFearPosition(); + uint32 move_tic_count; - bool flee_mode; - Timer flee_timer; + bool flee_mode; + Timer flee_timer; - bool pAIControlled; - bool roamer; - bool logging_enabled; + bool pAIControlled; + bool roamer; + bool logging_enabled; - int wandertype; - int pausetype; + int wandertype; + int pausetype; - int cur_wp; - float cur_wp_x; - float cur_wp_y; - float cur_wp_z; - int cur_wp_pause; - float cur_wp_heading; + int cur_wp; + float cur_wp_x; + float cur_wp_y; + float cur_wp_z; + int cur_wp_pause; + float cur_wp_heading; - int patrol; - float fear_walkto_x; - float fear_walkto_y; - float fear_walkto_z; - bool curfp; + int patrol; + float fear_walkto_x; + float fear_walkto_y; + float fear_walkto_z; + bool curfp; - // Pathing - // - VERTEX PathingDestination; - VERTEX PathingLastPosition; - int PathingLoopCount; - int PathingLastNodeVisited; - list Route; - LOSType PathingLOSState; - Timer *PathingLOSCheckTimer; - Timer *PathingRouteUpdateTimerShort; - Timer *PathingRouteUpdateTimerLong; - bool DistractedFromGrid; - int PathingTraversedNodes; + // Pathing + // + VERTEX PathingDestination; + VERTEX PathingLastPosition; + int PathingLoopCount; + int PathingLastNodeVisited; + list Route; + LOSType PathingLOSState; + Timer *PathingLOSCheckTimer; + Timer *PathingRouteUpdateTimerShort; + Timer *PathingRouteUpdateTimerLong; + bool DistractedFromGrid; + int PathingTraversedNodes; - uint32 pDontHealMeBefore; - uint32 pDontBuffMeBefore; - uint32 pDontDotMeBefore; - uint32 pDontRootMeBefore; - uint32 pDontSnareMeBefore; - uint32 pDontCureMeBefore; + uint32 pDontHealMeBefore; + uint32 pDontBuffMeBefore; + uint32 pDontDotMeBefore; + uint32 pDontRootMeBefore; + uint32 pDontSnareMeBefore; + uint32 pDontCureMeBefore; - // Bind wound - Timer bindwound_timer; - Mob* bindwound_target; - // hp event - int nexthpevent; - int nextinchpevent; + // Bind wound + Timer bindwound_timer; + Mob* bindwound_target; + // hp event + int nexthpevent; + int nextinchpevent; - //temppet - bool hasTempPet; + //temppet + bool hasTempPet; - EGNode *_egnode; //the EG node we are in - float tarx; - float tary; - float tarz; - uint8 tar_ndx; - float tar_vector; - float tar_vx; - float tar_vy; - float tar_vz; - float test_vector; + EGNode *_egnode; //the EG node we are in + float tarx; + float tary; + float tarz; + uint8 tar_ndx; + float tar_vector; + float tar_vx; + float tar_vy; + float tar_vz; + float test_vector; - bool m_hasRune; - bool m_hasSpellRune; - bool m_hasPartialMeleeRune; - bool m_hasPartialSpellRune; - bool m_hasDeathSaveChance; - uint32 m_spellHitsLeft[38]; // Used to track which spells will have their numhits incremented when spell finishes casting, 38 Buffslots - int flymode; - bool m_targetable; - int QGVarDuration(const char *fmt); - void InsertQuestGlobal(int charid, int npcid, int zoneid, const char *name, const char *value, int expdate); + bool m_hasRune; + bool m_hasSpellRune; + bool m_hasPartialMeleeRune; + bool m_hasPartialSpellRune; + bool m_hasDeathSaveChance; + uint32 m_spellHitsLeft[38]; // Used to track which spells will have their numhits incremented when spell finishes casting, 38 Buffslots + int flymode; + bool m_targetable; + int QGVarDuration(const char *fmt); + void InsertQuestGlobal(int charid, int npcid, int zoneid, const char *name, const char *value, int expdate); uint16 emoteid; private: - void _StopSong(); //this is not what you think it is - Mob* target; + void _StopSong(); //this is not what you think it is + Mob* target; }; #endif diff --git a/zone/net.cpp b/zone/net.cpp index ec54148a5..60e891b23 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -1,20 +1,20 @@ #define DONT_SHARED_OPCODES -/* 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/features.h" @@ -40,7 +40,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #endif volatile bool RunLoops = true; @@ -115,8 +115,8 @@ void Shutdown(); extern void MapOpcodes(); int main(int argc, char** argv) { - RegisterExecutablePlatform(ExePlatformZone); - set_exception_handler(); + RegisterExecutablePlatform(ExePlatformZone); + set_exception_handler(); const char *zone_name; @@ -183,8 +183,8 @@ int main(int argc, char** argv) { _log(ZONE__INIT, "CURRENT_VERSION: %s", CURRENT_VERSION); /* - * Setup nice signal handlers - */ + * Setup nice signal handlers + */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { _log(ZONE__INIT_ERR, "Could not set signal handler"); return 0; @@ -215,7 +215,7 @@ int main(int argc, char** argv) { _log(ZONE__INIT, "Loading items"); if (!database.LoadItems()) { _log(ZONE__INIT_ERR, "Loading items FAILED!"); - _log(ZONE__INIT, "Failed. But ignoring error and going on..."); + _log(ZONE__INIT, "Failed. But ignoring error and going on..."); } _log(ZONE__INIT, "Loading npc faction lists"); @@ -229,7 +229,7 @@ int main(int argc, char** argv) { _log(ZONE__INIT_ERR, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 0; - } + } _log(ZONE__INIT, "Loading skill caps"); if (!database.LoadSkillCaps()) { _log(ZONE__INIT_ERR, "Loading skill caps FAILED!"); @@ -237,8 +237,8 @@ int main(int argc, char** argv) { return 0; } - _log(ZONE__INIT, "Loading spells"); - EQEmu::MemoryMappedFile *mmf = nullptr; + _log(ZONE__INIT, "Loading spells"); + EQEmu::MemoryMappedFile *mmf = nullptr; LoadSpells(&mmf); _log(ZONE__INIT, "Loading guilds"); @@ -283,13 +283,13 @@ int main(int argc, char** argv) { taskmanager->LoadTasks(); } - parse = new QuestParserCollection(); + parse = new QuestParserCollection(); #ifdef EMBPERL PerlXSParser *pxs = new PerlXSParser(); parse->RegisterQuestInterface(pxs, "pl"); #endif Parser *ps = new Parser(); - //parse->RegisterQuestInterface(ps, "qst"); + //parse->RegisterQuestInterface(ps, "qst"); //now we have our parser, load the quests @@ -476,7 +476,7 @@ int main(int argc, char** argv) { safe_delete(parse); #ifdef EMBPERL - safe_delete(pxs); + safe_delete(pxs); #endif safe_delete(ps); safe_delete(mmf); @@ -514,8 +514,8 @@ void Shutdown() uint32 NetConnection::GetIP() { - char name[255+1]; - size_t len = 0; + char name[255+1]; + size_t len = 0; hostent* host = 0; if (gethostname(name, len) < 0 || len <= 0) @@ -584,25 +584,25 @@ NetConnection::~NetConnection() { } void LoadSpells(EQEmu::MemoryMappedFile **mmf) { - int records = database.GetMaxSpellID() + 1; + int records = database.GetMaxSpellID() + 1; - try { - EQEmu::IPCMutex mutex("spells"); - mutex.Lock(); - *mmf = new EQEmu::MemoryMappedFile("shared/spells"); - uint32 size = (*mmf)->Size(); - if(size != (records * sizeof(SPDat_Spell_Struct))) { - EQ_EXCEPT("Zone", "Unable to load spells: (*mmf)->Size() != records * sizeof(SPDat_Spell_Struct)"); - } + try { + EQEmu::IPCMutex mutex("spells"); + mutex.Lock(); + *mmf = new EQEmu::MemoryMappedFile("shared/spells"); + uint32 size = (*mmf)->Size(); + if(size != (records * sizeof(SPDat_Spell_Struct))) { + EQ_EXCEPT("Zone", "Unable to load spells: (*mmf)->Size() != records * sizeof(SPDat_Spell_Struct)"); + } - spells = reinterpret_cast((*mmf)->Get()); - mutex.Unlock(); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Error loading spells: %s", ex.what()); - return; - } + spells = reinterpret_cast((*mmf)->Get()); + mutex.Unlock(); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "Error loading spells: %s", ex.what()); + return; + } - SPDAT_RECORDS = records; + SPDAT_RECORDS = records; } diff --git a/zone/net.h b/zone/net.h index 25f5002c7..e81dd6d51 100644 --- a/zone/net.h +++ b/zone/net.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 */ #ifdef _WINDOWS #include diff --git a/zone/npc.cpp b/zone/npc.cpp index ad0525fee..bb5743956 100644 --- a/zone/npc.cpp +++ b/zone/npc.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 @@ -28,7 +28,7 @@ using namespace std; #ifdef _WINDOWS #define snprintf _snprintf #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #else #include #include @@ -56,55 +56,55 @@ extern EntityList entity_list; NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float heading, int iflymode, bool IsCorpse) : Mob(d->name, - d->lastname, - d->max_hp, - d->max_hp, - d->gender, - d->race, - d->class_, - (bodyType)d->bodytype, - d->deity, - d->level, - d->npc_id, - d->size, - d->runspeed, - heading, - x, - y, - z, - d->light, - d->texture, - d->helmtexture, - d->AC, - d->ATK, - d->STR, - d->STA, - d->DEX, - d->AGI, - d->INT, - d->WIS, - d->CHA, - d->haircolor, - d->beardcolor, - d->eyecolor1, - d->eyecolor2, - d->hairstyle, - d->luclinface, - d->beard, - d->drakkin_heritage, - d->drakkin_tattoo, - d->drakkin_details, - (uint32*)d->armor_tint, - 0, - d->see_invis, // pass see_invis/see_ivu flags to mob constructor - d->see_invis_undead, - d->see_hide, - d->see_improved_hide, - d->hp_regen, - d->mana_regen, - d->qglobal, - d->maxlevel, - d->scalerate ), + d->lastname, + d->max_hp, + d->max_hp, + d->gender, + d->race, + d->class_, + (bodyType)d->bodytype, + d->deity, + d->level, + d->npc_id, + d->size, + d->runspeed, + heading, + x, + y, + z, + d->light, + d->texture, + d->helmtexture, + d->AC, + d->ATK, + d->STR, + d->STA, + d->DEX, + d->AGI, + d->INT, + d->WIS, + d->CHA, + d->haircolor, + d->beardcolor, + d->eyecolor1, + d->eyecolor2, + d->hairstyle, + d->luclinface, + d->beard, + d->drakkin_heritage, + d->drakkin_tattoo, + d->drakkin_details, + (uint32*)d->armor_tint, + 0, + d->see_invis, // pass see_invis/see_ivu flags to mob constructor + d->see_invis_undead, + d->see_hide, + d->see_improved_hide, + d->hp_regen, + d->mana_regen, + d->qglobal, + d->maxlevel, + d->scalerate ), attacked_timer(CombatEventTimer_expire), swarm_timer(100), classattack_timer(1000), @@ -135,7 +135,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float platinum = 0; max_dmg = d->max_dmg; min_dmg = d->min_dmg; - attack_count = d->attack_count; + attack_count = d->attack_count; grid = 0; wp_m = 0; max_wp=0; @@ -152,11 +152,11 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float findable = d->findable; trackable = d->trackable; - MR = d->MR; - CR = d->CR; - DR = d->DR; - FR = d->FR; - PR = d->PR; + MR = d->MR; + CR = d->CR; + DR = d->DR; + FR = d->FR; + PR = d->PR; Corrup = d->Corrup; STR = d->STR; @@ -166,7 +166,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float INT = d->INT; WIS = d->WIS; CHA = d->CHA; - npc_mana = d->Mana; + npc_mana = d->Mana; //quick fix of ordering if they screwed it up in the DB if(max_dmg < min_dmg) { @@ -195,8 +195,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float accuracy_rating = d->accuracy_rating; ATK = d->ATK; - CalcMaxMana(); - SetMana(GetMaxMana()); + CalcMaxMana(); + SetMana(GetMaxMana()); MerchantType = d->merchanttype; adventure_template_id = d->adventure_template; @@ -208,7 +208,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float guard_y = -1; guard_z = -1; guard_heading = 0; - guard_anim = eaStanding; + guard_anim = eaStanding; roambox_distance = 0; roambox_max_x = -2; roambox_max_y = -2; @@ -244,7 +244,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float slow_mitigation = d->slow_mitigation; EntityList::RemoveNumbers(name); - entity_list.MakeNameUnique(name); + entity_list.MakeNameUnique(name); npc_aggro = d->npc_aggro; @@ -343,8 +343,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float ldon_locked_skill = 0; ldon_trap_detected = 0; } - reface_timer = new Timer(15000); - reface_timer->Disable(); + reface_timer = new Timer(15000); + reface_timer->Disable(); qGlobals = nullptr; guard_x_saved = 0; guard_y_saved = 0; @@ -393,7 +393,7 @@ NPC::~NPC() faction_list.clear(); } - safe_delete(reface_timer); + safe_delete(reface_timer); safe_delete(swarmInfoPtr); safe_delete(qGlobals); UninitializeBuffSlots(); @@ -444,7 +444,7 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot) { itemlist.erase(cur); return; } - else if (item->item_id == item_id && item->equipSlot == slot && quantity >= 1) { + else if (item->item_id == item_id && item->equipSlot == slot && quantity >= 1) { //cout<<"NPC::RemoveItem"<<" equipSlot:"<equipSlot<<" quantity:"<< quantity<charges <= quantity) itemlist.erase(cur); @@ -517,7 +517,7 @@ void NPC::QueryLoot(Client* to) { to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12); } else - LogFile->write(EQEMuLog::Error, "Database error, invalid item"); + LogFile->write(EQEMuLog::Error, "Database error, invalid item"); x++; } to->Message(0, "%i items on %s.", x, GetName()); @@ -525,24 +525,24 @@ void NPC::QueryLoot(Client* to) { void NPC::AddCash(uint16 in_copper, uint16 in_silver, uint16 in_gold, uint16 in_platinum) { if(in_copper >= 0) - copper = in_copper; - else - copper = 0; + copper = in_copper; + else + copper = 0; - if(in_silver >= 0) - silver = in_silver; - else - silver = 0; + if(in_silver >= 0) + silver = in_silver; + else + silver = 0; - if(in_gold >= 0) - gold = in_gold; - else - gold = 0; + if(in_gold >= 0) + gold = in_gold; + else + gold = 0; - if(in_platinum >= 0) - platinum = in_platinum; - else - platinum = 0; + if(in_platinum >= 0) + platinum = in_platinum; + else + platinum = 0; } void NPC::AddCash() { @@ -563,32 +563,32 @@ bool NPC::Process() { _ZP(NPC_Process); - adverrorinfo = 1; + adverrorinfo = 1; if (IsStunned() && stunned_timer.Check()) - { - this->stunned = false; - this->stunned_timer.Disable(); + { + this->stunned = false; + this->stunned_timer.Disable(); this->spun_timer.Disable(); - } + } - if (p_depop) - { - Mob* owner = entity_list.GetMob(this->ownerid); - if (owner != 0) - { - //if(GetBodyType() != BT_SwarmPet) - // owner->SetPetID(0); + if (p_depop) + { + Mob* owner = entity_list.GetMob(this->ownerid); + if (owner != 0) + { + //if(GetBodyType() != BT_SwarmPet) + // owner->SetPetID(0); this->ownerid = 0; - this->petid = 0; - } - return false; - } + this->petid = 0; + } + return false; + } - adverrorinfo = 2; + adverrorinfo = 2; - SpellProcess(); + SpellProcess(); - if(tic_timer.Check()) + if(tic_timer.Check()) { BuffProcess(); @@ -604,7 +604,7 @@ bool NPC::Process() if(oocregen > 0){ //should pull from Mob class OOCRegen += GetMaxHP() * oocregen / 100; } - //Lieka Edit: Fixing NPC regen. NPCs should regen to full during a set duration, not based on their HPs. Increase NPC's HPs by % of total HPs / tick. + //Lieka Edit:Fixing NPC regen.NPCs should regen to full during a set duration, not based on their HPs.Increase NPC's HPs by % of total HPs / tick. if((GetHP() < GetMaxHP()) && !IsPet()) { if(!IsEngaged()) {//NPC out of combat if(hp_regen > OOCRegen) @@ -648,7 +648,7 @@ bool NPC::Process() } } } - } + } if (sendhpupdate_timer.Check() && (IsTargeted() || (IsPet() && GetOwner() && GetOwner()->IsClient()))) { if(!IsFullHP || cur_hpCheck() && !IsEngaged() && (guard_x == GetX() && guard_y == GetY() && guard_z == GetZ())) { - SetHeading(guard_heading); - SendPosition(); - reface_timer->Disable(); - } + if(reface_timer->Check() && !IsEngaged() && (guard_x == GetX() && guard_y == GetY() && guard_z == GetZ())) { + SetHeading(guard_heading); + SendPosition(); + reface_timer->Disable(); + } - if (IsMezzed()) - return true; + if (IsMezzed()) + return true; if(IsStunned()) { if(spun_timer.Check()) @@ -710,7 +710,7 @@ bool NPC::Process() AI_Process(); - return true; + return true; } uint32 NPC::CountLoot() { @@ -755,7 +755,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) { else return false; break; - } + } case SE_CurrentHPOnce: case SE_CurrentHP: { if(this->GetHPRatio() < 100 && spells[spell_id].buffduration == 0) @@ -763,7 +763,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) { else return false; break; - } + } case SE_HealOverTime: { if(this->GetHPRatio() < 100) @@ -771,10 +771,10 @@ bool NPC::DatabaseCastAccepted(int spell_id) { else return false; break; - } + } case SE_DamageShield: { return true; - } + } case SE_NecPet: case SE_SummonPet: { if(GetPet()){ @@ -784,12 +784,12 @@ bool NPC::DatabaseCastAccepted(int spell_id) { return false; } break; - } + } case SE_LocateCorpse: case SE_SummonCorpse: { return false; //Pfft, npcs don't need to summon corpses/locate corpses! break; - } + } default: if(spells[spell_id].goodEffect == 1 && !(spells[spell_id].buffduration == 0 && this->GetHPRatio() == 100) && !IsEngaged()) return true; @@ -984,10 +984,10 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_ROW row; uint32 tmp = 0; uint32 tmp2 = 0; - uint32 last_insert_id = 0; + uint32 last_insert_id = 0; switch (command) { case 0: { // Create a new NPC and add all spawn related data uint32 npc_type_id = 0; @@ -1025,7 +1025,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver if (npc_type_id) { if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO npc_types (id, name, level, race, class, hp, gender, texture, helmtexture, size, loottable_id, merchant_id, face, runspeed, prim_melee_type, sec_melee_type) values(%i,\"%s\",%i,%i,%i,%i,%i,%i,%i,%f,%i,%i,%i,%f,%i,%i)", npc_type_id, tmpstr, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28), errbuf, 0, 0, &npc_type_id)) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); safe_delete(query); return false; } @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver else { if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO npc_types (name, level, race, class, hp, gender, texture, helmtexture, size, loottable_id, merchant_id, face, runspeed, prim_melee_type, sec_melee_type) values(\"%s\",%i,%i,%i,%i,%i,%i,%i,%f,%i,%i,%i,%f,%i,%i)", tmpstr, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28), errbuf, 0, 0, &npc_type_id)) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); safe_delete(query); return false; } @@ -1042,21 +1042,21 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver safe_delete_array(query); snprintf(tmpstr, sizeof(tmpstr), "%s-%s", zone, spawn->GetName()); if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawngroup (id, name) values(%i, '%s')", tmp, tmpstr), errbuf, 0, 0, &spawngroupid)) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); safe_delete(query); return false; } if(c) c->LogSQL(query); safe_delete_array(query); if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) values('%s', %u, %f, %f, %f, %i, %f, %i)", zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(), 1200, spawn->GetHeading(), spawngroupid), errbuf, 0, 0, &tmp)) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); safe_delete(query); return false; } if(c) c->LogSQL(query); safe_delete_array(query); if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawnentry (spawngroupID, npcID, chance) values(%i, %i, %i)", spawngroupid, npc_type_id, 100), errbuf, 0)) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); safe_delete(query); return false; } @@ -1070,7 +1070,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver char tmpstr[64]; snprintf(tmpstr, sizeof(tmpstr), "%s%s%i", zone, spawn->GetName(),Timer::GetCurrentTime()); if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawngroup (name) values('%s')", tmpstr), errbuf, 0, 0, &last_insert_id)) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); safe_delete(query); return false; } @@ -1086,7 +1086,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver else respawntime = 1200; if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) values('%s', %u, %f, %f, %f, %i, %f, %i)", zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(), respawntime, spawn->GetHeading(), last_insert_id), errbuf, 0, 0, &spawnid)) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); safe_delete(query); return false; } @@ -1094,7 +1094,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver safe_delete_array(query); if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawnentry (spawngroupID, npcID, chance) values(%i, %i, %i)", last_insert_id, tmp2, 100), errbuf, 0)) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf); safe_delete(query); return false; } @@ -1318,7 +1318,7 @@ void NPC::PickPocket(Client* thief) { bool is_arrow = (item->ItemType == ItemTypeArrow) ? true : false; int slot_id = thief->GetInv().FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow); if (/*!Equipped(item->ID) &&*/ - !item->Magic && item->NoDrop != 0 && !inst->IsType(ItemClassContainer) && slot_id != SLOT_INVALID + !item->Magic && item->NoDrop != 0 && !inst->IsType(ItemClassContainer) && slot_id != SLOT_INVALID /*&& steal_skill > item->StealSkill*/ ) { slot[x] = slot_id; @@ -1387,38 +1387,38 @@ void NPC::PickPocket(Client* thief) { { switch (steal_type) { - case 0:{ - if (amt > GetPlatinum()) - amt = GetPlatinum(); - SetPlatinum(GetPlatinum()-amt); - thief->AddMoneyToPP(0,0,0,amt,false); - thief->SendPickPocketResponse(this, amt, PickPocketPlatinum); - break; - } - case 1:{ - if (amt > GetGold()) - amt = GetGold(); - SetGold(GetGold()-amt); - thief->AddMoneyToPP(0,0,amt,0,false); - thief->SendPickPocketResponse(this, amt, PickPocketGold); - break; - } - case 2:{ - if (amt > GetSilver()) - amt = GetSilver(); - SetSilver(GetSilver()-amt); - thief->AddMoneyToPP(0,amt,0,0,false); - thief->SendPickPocketResponse(this, amt, PickPocketSilver); - break; - } - case 3:{ - if (amt > GetCopper()) - amt = GetCopper(); - SetCopper(GetCopper()-amt); - thief->AddMoneyToPP(amt,0,0,0,false); - thief->SendPickPocketResponse(this, amt, PickPocketCopper); - break; - } + case 0:{ + if (amt > GetPlatinum()) + amt = GetPlatinum(); + SetPlatinum(GetPlatinum()-amt); + thief->AddMoneyToPP(0,0,0,amt,false); + thief->SendPickPocketResponse(this, amt, PickPocketPlatinum); + break; + } + case 1:{ + if (amt > GetGold()) + amt = GetGold(); + SetGold(GetGold()-amt); + thief->AddMoneyToPP(0,0,amt,0,false); + thief->SendPickPocketResponse(this, amt, PickPocketGold); + break; + } + case 2:{ + if (amt > GetSilver()) + amt = GetSilver(); + SetSilver(GetSilver()-amt); + thief->AddMoneyToPP(0,amt,0,0,false); + thief->SendPickPocketResponse(this, amt, PickPocketSilver); + break; + } + case 3:{ + if (amt > GetCopper()) + amt = GetCopper(); + SetCopper(GetCopper()-amt); + thief->AddMoneyToPP(amt,0,0,0,false); + thief->SendPickPocketResponse(this, amt, PickPocketCopper); + break; + } } } else @@ -1430,18 +1430,18 @@ void NPC::PickPocket(Client* thief) { } void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool remove) { - if(reset) + if(reset) { for(int i = 0; i < SPECATK_MAXNUM; i++) { SpecAttacks[i] = false; safe_delete(SpecAttackTimers[i]); } - } + } const char* orig_parse = parse; - while (*parse) - { + while (*parse) + { switch(*parse) { case 'E': @@ -1569,7 +1569,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem break; } parse++; - } + } if(permtag == 1 && this->GetNPCTypeID() > 0) { @@ -1584,8 +1584,8 @@ bool Mob::HasNPCSpecialAtk(const char* parse) { bool HasAllAttacks = true; - while (*parse && HasAllAttacks == true) - { + while (*parse && HasAllAttacks == true) + { switch(*parse) { case 'E': @@ -1730,7 +1730,7 @@ bool Mob::HasNPCSpecialAtk(const char* parse) { break; } parse++; - } + } return HasAllAttacks; } @@ -1847,7 +1847,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue) return; } - if(id == "max_mana") + if(id == "max_mana") { npc_mana = atoi(val.c_str()); CalcMaxMana(); @@ -1937,7 +1937,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue) return; } - if(id == "attack_count") + if(id == "attack_count") { attack_count = atoi(val.c_str()); return; @@ -2070,26 +2070,26 @@ void NPC::LevelScale() { void NPC::CalcNPCResists() { - if (!MR) - MR = (GetLevel() * 11)/10; - if (!CR) - CR = (GetLevel() * 11)/10; - if (!DR) - DR = (GetLevel() * 11)/10; - if (!FR) - FR = (GetLevel() * 11)/10; - if (!PR) - PR = (GetLevel() * 11)/10; + if (!MR) + MR = (GetLevel() * 11)/10; + if (!CR) + CR = (GetLevel() * 11)/10; + if (!DR) + DR = (GetLevel() * 11)/10; + if (!FR) + FR = (GetLevel() * 11)/10; + if (!PR) + PR = (GetLevel() * 11)/10; if (!Corrup) - Corrup = 15; + Corrup = 15; return; } void NPC::CalcNPCRegen() { - // Fix for lazy db-updaters (regen values left at 0) - if (GetCasterClass() != 'N' && mana_regen == 0) - mana_regen = (GetLevel() / 10) + 4; + // Fix for lazy db-updaters (regen values left at 0) + if (GetCasterClass() != 'N' && mana_regen == 0) + mana_regen = (GetLevel() / 10) + 4; else if(mana_regen < 0) mana_regen = 0; else @@ -2100,25 +2100,25 @@ void NPC::CalcNPCRegen() { if(hp_regen == 0) { if(GetLevel() <= 6) - hp_regen = 1; - else if(GetLevel() > 6 && GetLevel() <= 10) - hp_regen = 2; - else if(GetLevel() > 10 && GetLevel() <= 15) - hp_regen = 3; - else if(GetLevel() > 15 && GetLevel() <= 20) - hp_regen = 5; - else if(GetLevel() > 20 && GetLevel() <= 30) - hp_regen = 7; - else if(GetLevel() > 30 && GetLevel() <= 35) - hp_regen = 9; - else if(GetLevel() > 35 && GetLevel() <= 40) - hp_regen = 12; - else if(GetLevel() > 40 && GetLevel() <= 45) - hp_regen = 18; - else if(GetLevel() > 45 && GetLevel() <= 50) - hp_regen = 21; - else - hp_regen = 30; + hp_regen = 1; + else if(GetLevel() > 6 && GetLevel() <= 10) + hp_regen = 2; + else if(GetLevel() > 10 && GetLevel() <= 15) + hp_regen = 3; + else if(GetLevel() > 15 && GetLevel() <= 20) + hp_regen = 5; + else if(GetLevel() > 20 && GetLevel() <= 30) + hp_regen = 7; + else if(GetLevel() > 30 && GetLevel() <= 35) + hp_regen = 9; + else if(GetLevel() > 35 && GetLevel() <= 40) + hp_regen = 12; + else if(GetLevel() > 40 && GetLevel() <= 45) + hp_regen = 18; + else if(GetLevel() > 45 && GetLevel() <= 50) + hp_regen = 21; + else + hp_regen = 30; } else if(hp_regen < 0) { hp_regen = 0; } else @@ -2138,16 +2138,16 @@ void NPC::CalcNPCDamage() { max_dmg = ((((99000)*(GetLevel()-64))/400)*AC_adjust/10); } else if (GetLevel() >= 60 && GetLevel() <= 65){ - if(min_dmg==0) + if(min_dmg==0) min_dmg = (GetLevel()+(GetLevel()/3)); - if(max_dmg==0) - max_dmg = (GetLevel()*3)*AC_adjust/10; + if(max_dmg==0) + max_dmg = (GetLevel()*3)*AC_adjust/10; } else if (GetLevel() >= 51 && GetLevel() <= 59){ - if(min_dmg==0) - min_dmg = (GetLevel()+(GetLevel()/3)); - if(max_dmg==0) - max_dmg = (GetLevel()*3)*AC_adjust/10; + if(min_dmg==0) + min_dmg = (GetLevel()+(GetLevel()/3)); + if(max_dmg==0) + max_dmg = (GetLevel()*3)*AC_adjust/10; } else if (GetLevel() >= 40 && GetLevel() <= 50) { if (min_dmg==0) @@ -2156,15 +2156,15 @@ void NPC::CalcNPCDamage() { max_dmg = (GetLevel()*3)*AC_adjust/10; } else if (GetLevel() >= 28 && GetLevel() <= 39) { - if (min_dmg==0) + if (min_dmg==0) min_dmg = GetLevel() / 2; - if (max_dmg==0) + if (max_dmg==0) max_dmg = ((GetLevel()*2)+2)*AC_adjust/10; } else if (GetLevel() <= 27) { - if (min_dmg==0) + if (min_dmg==0) min_dmg=1; - if (max_dmg==0) + if (max_dmg==0) max_dmg = (GetLevel()*2)*AC_adjust/10; } @@ -2228,42 +2228,42 @@ void NPC::SetSwarmTarget(int target_id) int32 NPC::CalcMaxMana() { if(npc_mana == 0) { - switch (GetCasterClass()) { - case 'I': - max_mana = (((GetINT()/2)+1) * GetLevel()) + spellbonuses.Mana + itembonuses.Mana; - break; - case 'W': - max_mana = (((GetWIS()/2)+1) * GetLevel()) + spellbonuses.Mana + itembonuses.Mana; - break; - case 'N': - default: - max_mana = 0; - break; - } - if (max_mana < 0) { - max_mana = 0; - } + switch (GetCasterClass()) { + case 'I': + max_mana = (((GetINT()/2)+1) * GetLevel()) + spellbonuses.Mana + itembonuses.Mana; + break; + case 'W': + max_mana = (((GetWIS()/2)+1) * GetLevel()) + spellbonuses.Mana + itembonuses.Mana; + break; + case 'N': + default: + max_mana = 0; + break; + } + if (max_mana < 0) { + max_mana = 0; + } - return max_mana; - } else { - switch (GetCasterClass()) { - case 'I': - max_mana = npc_mana + spellbonuses.Mana + itembonuses.Mana; - break; - case 'W': - max_mana = npc_mana + spellbonuses.Mana + itembonuses.Mana; - break; - case 'N': - default: - max_mana = 0; - break; - } - if (max_mana < 0) { - max_mana = 0; - } + return max_mana; + } else { + switch (GetCasterClass()) { + case 'I': + max_mana = npc_mana + spellbonuses.Mana + itembonuses.Mana; + break; + case 'W': + max_mana = npc_mana + spellbonuses.Mana + itembonuses.Mana; + break; + case 'N': + default: + max_mana = 0; + break; + } + if (max_mana < 0) { + max_mana = 0; + } - return max_mana; - } + return max_mana; + } } void NPC::SignalNPC(int _signal_id) diff --git a/zone/npc.h b/zone/npc.h index 5090c2bdb..cd9b2baaa 100644 --- a/zone/npc.h +++ b/zone/npc.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 NPC_H #define NPC_H @@ -34,7 +34,7 @@ using namespace std; #include "../common/rulesys.h" #ifdef _WINDOWS - #define M_PI 3.141592 + #define M_PI 3.141592 #endif #define LEAVECOMBAT 0 @@ -64,7 +64,7 @@ struct AISpells_Struct { uint32 time_cancast; // when we can cast this spell next int32 recast_delay; int16 priority; - int16 resist_adjust; + int16 resist_adjust; }; class AA_SwarmPetInfo; @@ -134,7 +134,7 @@ public: virtual void RangedAttack(Mob* other); virtual void ThrowingAttack(Mob* other) { } - int32 GetNumberOfAttacks() const { return attack_count; } + int32 GetNumberOfAttacks() const { return attack_count; } bool DatabaseCastAccepted(int spell_id); bool IsFactionListAlly(uint32 other_faction); @@ -156,7 +156,7 @@ public: void AddLootTable(); void AddLootTable(uint32 ldid); void DescribeAggro(Client *towho, Mob *mob, bool verbose); - void RemoveItem(uint32 item_id, uint16 quantity = 0, uint16 slot = 0); + void RemoveItem(uint32 item_id, uint16 quantity = 0, uint16 slot = 0); void CheckMinMaxLevel(Mob *them); void ClearItemList(); ServerLootItem_Struct* GetItem(int slot_id); @@ -179,7 +179,7 @@ public: inline void SetPlatinum(uint32 amt) { platinum = amt; } - virtual int32 CalcMaxMana(); + virtual int32 CalcMaxMana(); void SetGrid(int32 grid_){ grid=grid_; } void SetSp2(uint32 sg2){ spawn_group=sg2; } void SetWaypointMax(uint16 wp_){ wp_m=wp_; } @@ -197,9 +197,9 @@ public: float GetGuardPointX() const { return guard_x; } float GetGuardPointY() const { return guard_y; } float GetGuardPointZ() const { return guard_z; } - float GetGuardPointH() const { return guard_heading; } - EmuAppearance GetGuardPointAnim() const { return guard_anim; } - void SaveGuardPointAnim(EmuAppearance anim) { guard_anim = anim; } + float GetGuardPointH() const { return guard_heading; } + EmuAppearance GetGuardPointAnim() const { return guard_anim; } + void SaveGuardPointAnim(EmuAppearance anim) { guard_anim = anim; } void SetFlyMode(uint8 FlyMode){ flymode=FlyMode; } uint32 GetFlyMode() const { return flymode; } @@ -221,22 +221,22 @@ public: inline int32 GetNPCFactionID() const { return npc_faction_id; } inline int32 GetPrimaryFaction() const { return primary_faction; } - int32 GetNPCHate(Mob* in_ent) {return hate_list.GetEntHate(in_ent);} - bool IsOnHatelist(Mob*p) { return hate_list.IsOnHateList(p);} + int32 GetNPCHate(Mob* in_ent) {return hate_list.GetEntHate(in_ent);} + bool IsOnHatelist(Mob*p) { return hate_list.IsOnHateList(p);} void SetNPCFactionID(int32 in) { npc_faction_id = in; database.GetFactionIdsForNPC(npc_faction_id, &faction_list, &primary_faction); } - float org_x, org_y, org_z, org_heading; + float org_x, org_y, org_z, org_heading; uint32 GetMaxDMG() const {return max_dmg;} uint32 GetMinDMG() const {return min_dmg;} float GetSlowMitigation() const {return slow_mitigation;} float GetAttackSpeed() const {return attack_speed;} bool IsAnimal() const { return(bodytype == BT_Animal); } - uint16 GetPetSpellID() const {return pet_spell_id;} - void SetPetSpellID(uint16 amt) {pet_spell_id = amt;} + uint16 GetPetSpellID() const {return pet_spell_id;} + void SetPetSpellID(uint16 amt) {pet_spell_id = amt;} uint32 GetMaxDamage(uint8 tlevel); - void SetTaunting(bool tog) {taunting = tog;} + void SetTaunting(bool tog) {taunting = tog;} void PickPocket(Client* thief); void StartSwarmTimer(uint32 duration) { swarm_timer.Start(duration); } void AddLootDrop(const Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); @@ -244,7 +244,7 @@ public: void CheckSignal(); //waypoint crap - int GetMaxWp() const { return max_wp; } + int GetMaxWp() const { return max_wp; } void DisplayWaypointInfo(Client *to); void CalculateNewWaypoint(); void AssignWaypoints(int32 grid); @@ -256,7 +256,7 @@ public: void ResumeWandering(); void PauseWandering(int pausetime); void MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot); - void GetClosestWaypoint(list &wp_list, int count, float m_x, float m_y, float m_z); + void GetClosestWaypoint(list &wp_list, int count, float m_x, float m_y, float m_z); uint32 GetEquipment(uint8 material_slot) const; // returns item id int32 GetEquipmentMaterial(uint8 material_slot) const; @@ -286,7 +286,7 @@ public: inline void GiveNPCTypeData(NPCType *ours) { NPCTypedata_ours = ours; } inline const uint32 GetNPCSpellsID() const { return npc_spells_id; } - ItemList itemlist; //kathgar - why is this public? Doing other things or I would check the code + ItemList itemlist; //kathgar - why is this public? Doing other things or I would check the code NPCProximity* proximity; Spawn2* respawn2; @@ -326,7 +326,7 @@ public: //The corpse we make can only be looted by people who got credit for the kill const bool HasPrivateCorpse() const { return NPCTypedata->private_corpse; } - const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; } + const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; } const char* GetRawNPCTypeName() const { return NPCTypedata->name; } bool GetDepop() { return p_depop; } @@ -336,17 +336,17 @@ public: uint32 GetAdventureTemplate() const { return adventure_template_id; } void AddSpellToNPCList(int16 iPriority, int16 iSpellID, uint16 iType, int16 iManaCost, int32 iRecastDelay, int16 iResistAdjust); void RemoveSpellFromNPCList(int16 spell_id); - Timer *GetRefaceTimer() const { return reface_timer; } - const uint32 GetAltCurrencyType() const { return NPCTypedata->alt_currency_type; } + Timer *GetRefaceTimer() const { return reface_timer; } + const uint32 GetAltCurrencyType() const { return NPCTypedata->alt_currency_type; } NPC_Emote_Struct* GetNPCEmote(uint16 emoteid, uint8 event_); void DoNPCEmote(uint8 event_, uint16 emoteid); bool CanTalk(); - inline void SetSpellScale(float amt) { spellscale = amt; } + inline void SetSpellScale(float amt) { spellscale = amt; } inline float GetSpellScale() { return spellscale; } - inline void SetHealScale(float amt) { healscale = amt; } + inline void SetHealScale(float amt) { healscale = amt; } inline float GetHealScale() { return healscale; } void AddQuestItem(ItemInst* inst) { questItems.Insert(inst); } @@ -472,24 +472,24 @@ protected: uint32 silver; uint32 gold; uint32 platinum; - int32 grid; - uint32 spawn_group; + int32 grid; + uint32 spawn_group; uint16 wp_m; int32 npc_faction_id; int32 primary_faction; Timer attacked_timer; //running while we are being attacked (damaged) - Timer swarm_timer; - Timer classattack_timer; + Timer swarm_timer; + Timer classattack_timer; Timer knightattack_timer; - Timer assist_timer; //ask for help from nearby mobs + Timer assist_timer; //ask for help from nearby mobs Timer qglobal_purge_timer; bool combat_event; //true if we are in combat, false otherwise - Timer sendhpupdate_timer; + Timer sendhpupdate_timer; Timer enraged_timer; - Timer *reface_timer; + Timer *reface_timer; uint32 npc_spells_id; uint8 casting_spell_AIindex; @@ -504,15 +504,15 @@ protected: uint32 max_dmg; uint32 min_dmg; int32 accuracy_rating; - int16 attack_count; - uint32 npc_mana; - float spellscale; - float healscale; + int16 attack_count; + uint32 npc_mana; + float spellscale; + float healscale; //pet crap: uint16 pet_spell_id; bool taunting; - Timer taunt_timer; //for pet taunting + Timer taunt_timer; //for pet taunting bool npc_aggro; @@ -523,9 +523,9 @@ protected: void _ClearWaypints(); int max_wp; int save_wp; - float guard_x, guard_y, guard_z, guard_heading; + float guard_x, guard_y, guard_z, guard_heading; float guard_x_saved, guard_y_saved, guard_z_saved, guard_heading_saved; - EmuAppearance guard_anim; + EmuAppearance guard_anim; float roambox_max_x; float roambox_max_y; float roambox_min_x; @@ -535,8 +535,8 @@ protected: float roambox_movingto_y; uint32 roambox_delay; - uint16 skills[HIGHEST_SKILL+1]; - uint32 equipment[MAX_WORN_INVENTORY]; //this is an array of item IDs + uint16 skills[HIGHEST_SKILL+1]; + uint32 equipment[MAX_WORN_INVENTORY]; //this is an array of item IDs uint16 d_meele_texture1; //this is an item Material value uint16 d_meele_texture2; //this is an item Material value (offhand) uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation diff --git a/zone/object.h b/zone/object.h index 4328f3ff9..d122c29e2 100644 --- a/zone/object.h +++ b/zone/object.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 OBJECT_H #define OBJECT_H @@ -91,7 +91,7 @@ IT10725_ACTORDEF=Shuriken #define OT_TEIRDALFORGE 0x20 //dark elf #define OT_OGGOKFORGE 0x21 //ogre #define OT_STORMGUARDF 0x22 //dwarven -#define OT_VALEFORGE 0x31 //halfling +#define OT_VALEFORGE 0x31 //halfling // gnome forge 0x23 (ak'anon forge) // barbarian forge 0x24 (northman forge) // @@ -175,12 +175,12 @@ public: uint32 GetDBID(); uint32 GetType(); - void SetType(uint32 type); - void SetDBID(uint32 dbid); + void SetType(uint32 type); + void SetDBID(uint32 dbid); uint32 GetIcon(); - void SetIcon(uint32 icon); + void SetIcon(uint32 icon); uint32 GetItemID(); - void SetItemID(uint32 itemid); + void SetItemID(uint32 itemid); void GetObjectData(Object_Struct* Data); void SetObjectData(Object_Struct* Data); void GetLocation(float* x, float* y, float* z); diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index 504343993..031e2492f 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -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 */ #include "../common/debug.h" #include @@ -36,30 +36,30 @@ using namespace std; #define snprintf _snprintf #define vsnprintf _vsnprintf #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #endif bool spells_loaded = false; volatile bool RunLoops = true; extern volatile bool ZoneLoaded; #ifdef SHAREMEM - #include "../common/EMuShareMem.h" - extern LoadEMuShareMemDLL EMuShareMemDLL; - #ifndef WIN32 - #include - #include - #include - #include + #include "../common/EMuShareMem.h" + extern LoadEMuShareMemDLL EMuShareMemDLL; + #ifndef WIN32 + #include + #include + #include + #include #ifndef FREEBSD - union semun { - int val; - struct semid_ds *buf; - ushort *array; - struct seminfo *__buf; - void *__pad; - }; + union semun { + int val; + struct semid_ds *buf; + ushort *array; + struct seminfo *__buf; + void *__pad; + }; #endif - #endif + #endif #endif @@ -674,20 +674,20 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) { token[u]=(char)0; } //cout << "end class"; - /*for(y=0; y< 3;y++) - { - in.get(temp); - while(chrcmpI(&temp,&sep)) - { - strncat(token,&temp,1); - a++; - in.get(temp); - } - spells[tempid].unknown1[y]=atoi(token); - cout << spells[tempid].unknown1[y] << '^'; - a=0; - for(u=0;u<64;u++) - token[u]=(char)0; + /*for(y=0; y< 3;y++) + { + in.get(temp); + while(chrcmpI(&temp,&sep)) + { + strncat(token,&temp,1); + a++; + in.get(temp); + } + spells[tempid].unknown1[y]=atoi(token); + cout << spells[tempid].unknown1[y] << '^'; + a=0; + for(u=0;u<64;u++) + token[u]=(char)0; } in.get(temp); @@ -754,23 +754,23 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) { token[u]=(char)0; for(y=0; y< 23;y++) - { + { in.get(temp); while(chrcmpI(&temp,&sep)) { strncat(token,&temp,1); a++; in.get(temp); - } + } spells[tempid].Spacing2[y]=atoi(token); //cout << spells[tempid].base[y] << '^'; a=0; for(u=0;u<64;u++) - token[u]=(char)0; + token[u]=(char)0; } - in.get(temp); - while(chrcmpI(&temp,&sep)) + in.get(temp); + while(chrcmpI(&temp,&sep)) { strncat(token,&temp,1); a++; @@ -780,9 +780,9 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) { //cout << spells[tempid].ResistDiff << '^'; a=0; for(u=0;u<64;u++) - token[u]=(char)0; + token[u]=(char)0; - in.get(temp); + in.get(temp); for(y=0; y< 2;y++) { in.get(temp); @@ -799,8 +799,8 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) { token[u]=(char)0; } - in.get(temp); - while(chrcmpI(&temp,&sep)) + in.get(temp); + while(chrcmpI(&temp,&sep)) { strncat(token,&temp,1); a++; @@ -810,9 +810,9 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) { //cout << spells[tempid].RecourseLink << '^'; a=0; for(u=0;u<64;u++) - token[u]=(char)0; + token[u]=(char)0; - while(temp!='\n') + while(temp!='\n') in.get(temp); //cout << endl; @@ -840,7 +840,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) { void ZoneDatabase::UpdateAndDeleteAATimers(uint32 charid){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; char *query2 = 0; if (!RunQuery(query, MakeAnyLenString(&query, "delete from aa_timers where charid=%i and UNIX_TIMESTAMP(now())>=end",charid), errbuf)) { @@ -855,7 +855,7 @@ void ZoneDatabase::UpdateAndDeleteAATimers(uint32 charid){ void ZoneDatabase::UpdateTimersClientConnected(uint32 charid){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "update aa_timers set end=(UNIX_TIMESTAMP(now())+(end-begin)),begin=UNIX_TIMESTAMP(now()) where charid=%i",charid), errbuf)) { LogFile->write(EQEMuLog::Error, "UpdateAATimers query '%s' %s", query, errbuf); } @@ -864,8 +864,8 @@ void ZoneDatabase::UpdateTimersClientConnected(uint32 charid){ void ZoneDatabase::GetAATimers(uint32 charid){ 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 ability,begin,end from aa_timers WHERE charid=%i", charid), errbuf, &result)) { @@ -887,8 +887,8 @@ void ZoneDatabase::GetAATimers(uint32 charid){ uint32 ZoneDatabase::GetTimerRemaining(uint32 charid,uint32 ability){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; MYSQL_ROW row; uint32 remain=0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT end-begin from aa_timers WHERE charid=%i and ability=%i", charid,ability), errbuf, &result)) { @@ -906,7 +906,7 @@ uint32 ZoneDatabase::GetTimerRemaining(uint32 charid,uint32 ability){ void ZoneDatabase::UpdateAATimers(uint32 charid,uint32 endtime,uint32 begintime,uint32 ability){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if(begintime==0){ if (!RunQuery(query, MakeAnyLenString(&query, "replace into aa_timers (charid,end,begin,ability) values(%i,UNIX_TIMESTAMP(now())+%i,UNIX_TIMESTAMP(now()),%i)",charid,endtime,ability), errbuf)) { LogFile->write(EQEMuLog::Error, "UpdateAATimers query '%s' %s", query, errbuf); @@ -1148,7 +1148,7 @@ int32 Client::GenericFocus(uint16 spell_id, uint16 modspellid) return 100; break; default: - LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown limit effect %d", spells[modspellid].base[i]); + LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown limit effect %d", spells[modspellid].base[i]); } break; case SE_LimitCastTime: @@ -1167,7 +1167,7 @@ int32 Client::GenericFocus(uint16 spell_id, uint16 modspellid) return 100; break; default: - LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown limit spelltype %d", spells[modspellid].base[i]); + LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown limit spelltype %d", spells[modspellid].base[i]); } break; case SE_LimitMinDur: @@ -1182,7 +1182,7 @@ int32 Client::GenericFocus(uint16 spell_id, uint16 modspellid) modifier -= modspell.base[i]; break; default: - LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown effectid %d", modspell.effectid[i]); + LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown effectid %d", modspell.effectid[i]); } } @@ -1212,7 +1212,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] uint32 duration = 0; uint32 reuse = 0; - switch(disc_in->disc_id){ + switch(disc_in->disc_id){ // Shared? case discResistant: { // Resistant // 1 minute duration @@ -1223,7 +1223,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] duration = 60; reuse = 60*60; entity_list.MessageClose(this, false, 100, 0, "%s has become more resistant!", GetName()); - break; + break; } case discFearless: { // Fearless // 11 second duration @@ -1235,20 +1235,20 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] reuse = 60*60; entity_list.MessageClose_StringID(this, false, 100, 0, DISCIPLINE_FEARLESS, GetName()); //entity_list.MessageClose(this, false, 100, 0, "%s becomes fearless!", GetName()); - break; + break; } case discWhirlwind: { // Counterattack/Whirlwind/Furious // warrior level 56 // rogue/monk level 53 // 9 second duration // 1 hour reuse - if ( (GetClass() == WARRIOR && GetLevel() <= 56) + if ((GetClass() == WARRIOR && GetLevel() <= 56) ||(GetLevel() <= 53) ) return; duration = 9; reuse = 60*60; entity_list.MessageClose(this, false, 100, 0, "%s\'s face becomes twisted with fury!", GetName()); - break; + break; } case discFellstrike: { // Duelist/Innerflame/Fellstrike // monk level 56 @@ -1257,21 +1257,21 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // 12 second duration // 30 minute reuse // min 4*base hand/weapon damage - if ( (GetClass() == MONK && GetLevel() <= 55) + if ((GetClass() == MONK && GetLevel() <= 55) ||(GetClass() == WARRIOR && GetLevel() <= 58) ||(GetClass() == ROGUE && GetLevel() <= 59) ) return; duration = 12; reuse = 60*30; entity_list.MessageClose(this, false, 100, 0, "%s\'s muscles bulge with force of will!", GetName()); - break; + break; } case discBlindingSpeed: { // Blindingspeed/Hundredfist // rogue level 58 // monk level 57 // 15 second duration // 30 minute reuse - if ( (GetClass() == MONK && GetLevel() <= 58) + if ((GetClass() == MONK && GetLevel() <= 58) ||(GetClass() == ROGUE && GetLevel() <= 57) ) return; //disc_timer.Start(1000*60*30); @@ -1279,20 +1279,20 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] duration = 15; reuse = 60*30; Message(0, "This discipline not implemented.."); - break; + break; } case discDeadeye: { // Deadeye/Charge // warrior level 53 // rogue level 54 // 14 second duration // 30 minute reuse - if ( (GetClass() == WARRIOR && GetLevel() <= 53) + if ((GetClass() == WARRIOR && GetLevel() <= 53) ||(GetClass() == ROGUE && GetLevel() <= 54) ) return; duration = 14; reuse = 60*30; entity_list.MessageClose(this, false, 100, 0, "%s feels unstopable!", GetName()); - break; + break; } // Warrior case discEvasive: { // Evasive @@ -1303,7 +1303,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // -15% out duration = 3*60; reuse = 15*60; - break; + break; } case discMightystrike: { // Mightystrike // level 54 @@ -1312,7 +1312,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // Auto crit duration = 10; reuse = 60*60; - break; + break; } case discDefensive: { // Defensive // level 55 @@ -1325,7 +1325,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] reuse = 10*60; else reuse = 15*60; - break; + break; } case discPrecise: { // Precise // level 57 @@ -1335,7 +1335,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // +35% out duration = 3*60; reuse = 30*60; - break; + break; } case discAggressive: { // Aggressive // level 60 @@ -1345,7 +1345,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // +35% out duration = 3*60; reuse = 27*60; - break; + break; } // Monk case discStonestance: { // Stonestance @@ -1355,7 +1355,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] reuse = 3*60; else reuse = 12*60; - break; + break; } case discThunderkick: { // Thunderkick // level 52 @@ -1364,7 +1364,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 7*60; duration = 5*60; //hack for now, checked in combat and expired once used. - break; + break; } case discVoidance: { // Voidance // level 54 @@ -1373,7 +1373,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 60*60; duration = 8; - break; + break; } case discSilentfist: { // Silentfist // level 59 @@ -1385,7 +1385,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 7*60; duration = 5*60; //hack for now, checked in combat and expired once used. - break; + break; } case discAshenhand: { // Ashenhand // level 60 @@ -1394,7 +1394,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // Chance to slay reuse = 72*60; duration = 5*60; //hack for now, checked in combat and expired once used. - break; + break; } // Rogue case discNimble: { // Nimble @@ -1407,7 +1407,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 30*60; duration = 12; - break; + break; } case discKinesthetics: { // Kinesthetics // level 57 @@ -1420,7 +1420,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 30*60; duration = 18; - break; + break; } // Paladin case discHolyforge: { // Holyforge @@ -1434,7 +1434,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 72*60; duration = 5*60; - break; + break; } case discSanctification: { // Sanctification // level 60 @@ -1443,7 +1443,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // Spell immunity reuse = 72*60; duration = 15; - break; + break; } // Ranger case discTrueshot: { // Trueshot @@ -1457,7 +1457,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 72*60; duration = 2*60; - break; + break; } case discWeaponshield: { // Weaponshield // level 60 @@ -1466,7 +1466,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // auto parry reuse = 72*60; duration = 20; - break; + break; } // Bard case discDeftdance: { // Deftdance @@ -1480,7 +1480,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 72*60; duration = 10; - break; + break; } case discPuretone: { // Puretone // level 60 @@ -1489,7 +1489,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // Auto instrument reuse = 72*60; duration = 4*60; - break; + break; } // Shadow knight case discUnholyAura: { // Unholy @@ -1502,7 +1502,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else reuse = 72*60; duration = 5*60; //hack for now, checked in combat and expired once used. - break; + break; } case discLeechCurse: { // Leech curse // level 60 @@ -1511,18 +1511,18 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // Heal self for each point of melee damage done reuse = 72*60; duration = 15; - break; + break; } // Default case 0:{ // Timer request break; } default: - LogFile->write(EQEMuLog::Error, "Unknown Discipline requested by client: %s class: %i Disciline:%i", GetName(), class_,disc_in->disc_id); - return; - } + LogFile->write(EQEMuLog::Error, "Unknown Discipline requested by client: %s class: %i Disciline:%i", GetName(), class_,disc_in->disc_id); + return; + } - if(reuse != 0) { + if(reuse != 0) { p_timers.Start(pTimerDisciplineReuse, reuse); //nonpersistent timer for the 'discipline ready' message disc_timer.Start(1000*reuse); @@ -1541,37 +1541,37 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] while(iterator.MoreElements()) { Mob* mob = iterator.GetData(); if (group){ - // Client casting group spell with out target group buffs enabled - // Skip non group members - if ( caster->IsClient() - && !caster->CastToClient()->TGB() - && GetGroupByMob(mob) != 0 - && !GetGroupByMob(mob)->IsGroupMember(caster) - ) { - LogFile->write(EQEMuLog::Debug, "Group spell skipping %s", mob->GetName()); - iterator.Advance(); - continue; - } - // Client casting group spell with target group buffs enabled - else if ( caster->IsClient() - && caster->CastToClient()->TGB() - && GetGroupByMob(mob) != 0 - && GetGroupByMob(mob)->IsGroupMember(caster) - ){ - LogFile->write(EQEMuLog::Debug, "Group spell TGB on %s's Group", mob->GetName()); - GetGroupByMob(mob)->CastGroupSpell(caster, spell_id); - iterator.Advance(); - continue; - } - else if ( caster->IsClient() - && caster->CastToClient()->TGB() - && GetGroupByMob(mob) == 0 - && mob == center - ){ - LogFile->write(EQEMuLog::Debug, "Group spell TGB on %s", mob->GetName()); - caster->SpellOnTarget(spell_id, mob); - return; - } + // Client casting group spell with out target group buffs enabled + // Skip non group members + if (caster->IsClient() + && !caster->CastToClient()->TGB() + && GetGroupByMob(mob) != 0 + && !GetGroupByMob(mob)->IsGroupMember(caster) + ) { + LogFile->write(EQEMuLog::Debug, "Group spell skipping %s", mob->GetName()); + iterator.Advance(); + continue; + } + // Client casting group spell with target group buffs enabled + else if (caster->IsClient() + && caster->CastToClient()->TGB() + && GetGroupByMob(mob) != 0 + && GetGroupByMob(mob)->IsGroupMember(caster) + ){ + LogFile->write(EQEMuLog::Debug, "Group spell TGB on %s's Group", mob->GetName()); + GetGroupByMob(mob)->CastGroupSpell(caster, spell_id); + iterator.Advance(); + continue; + } + else if (caster->IsClient() + && caster->CastToClient()->TGB() + && GetGroupByMob(mob) == 0 + && mob == center + ){ + LogFile->write(EQEMuLog::Debug, "Group spell TGB on %s", mob->GetName()); + caster->SpellOnTarget(spell_id, mob); + return; + } } if ( mob->DistNoZ(*center) <= dist @@ -1586,66 +1586,66 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else if(caster->IsNPC() && !caster->CastToNPC()->IsInteractive()) { #else else if(caster->IsNPC()) { - #endif - // Npc + #endif + // Npc if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard) { - // printf("NPC Spell casted on %s\n", mob->GetName()); + //printf("NPC Spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else if (mob->IsAIControlled() && spells[spell_id].targettype == ST_AEBard) { - // printf("NPC mgb/aebard spell casted on %s\n", mob->GetName()); + //printf("NPC mgb/aebard spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else { - // printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype); + //printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype); } } #ifdef IPC - else if(caster->IsNPC() && caster->CastToNPC()->IsInteractive()) { - // Interactive npc + else if(caster->IsNPC() && caster->CastToNPC()->IsInteractive()) { + // Interactive npc if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard && spells[spell_id].targettype != ST_GroupTeleport) { - // printf("IPC Spell casted on %s\n", mob->GetName()); + //printf("IPC Spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else if (!mob->IsAIControlled() && (spells[spell_id].targettype == ST_AEBard||group) && mob->CastToClient()->GetPVP() == caster->CastToClient()->GetPVP()) { - if (group && GetGroupByMob(mob) != GetGroupByMob(caster)) { - iterator.Advance(); - continue; - } - // printf("IPC mgb/aebard spell casted on %s\n", mob->GetName()); + if (group && GetGroupByMob(mob) != GetGroupByMob(caster)) { + iterator.Advance(); + continue; + } + //printf("IPC mgb/aebard spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else { - // printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype); + //printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype); } } #endif - else if (caster->IsClient() && !(caster->CastToClient()->IsBecomeNPC())) { + else if (caster->IsClient() && !(caster->CastToClient()->IsBecomeNPC())) { // Client if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard){ - // printf("Client Spell casted on %s\n", mob->GetName()); + //printf("Client Spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else if(spells[spell_id].targettype == ST_GroupTeleport && mob->IsClient() && mob->isgrouped && caster->isgrouped && entity_list.GetGroupByMob(caster)) { Group* caster_group = entity_list.GetGroupByMob(caster); - if(caster_group != 0 && caster_group->IsGroupMember(mob)) - caster->SpellOnTarget(spell_id,mob); + if(caster_group != 0 && caster_group->IsGroupMember(mob)) + caster->SpellOnTarget(spell_id,mob); } else if (mob->IsClient() && (spells[spell_id].targettype == ST_AEBard||group) && mob->CastToClient()->GetPVP() == caster->CastToClient()->GetPVP()) { if (group && GetGroupByMob(mob) != GetGroupByMob(caster)) { - iterator.Advance(); - continue; - } + iterator.Advance(); + continue; + } else if (mob->IsClient() && spells[spell_id].targettype == ST_AEBard && mob->CastToClient()->GetPVP() == caster->CastToClient()->GetPVP()) caster->SpellOnTarget(spell_id, mob); #ifdef IPC - else if (mob->IsNPC() && mob->CastToNPC()->IsInteractive()) { - if (group && GetGroupByMob(mob) != GetGroupByMob(caster)) - continue; - caster->SpellOnTarget(spell_id, mob); + else if (mob->IsNPC() && mob->CastToNPC()->IsInteractive()) { + if (group && GetGroupByMob(mob) != GetGroupByMob(caster)) + continue; + caster->SpellOnTarget(spell_id, mob); } - #endif + #endif } } else if (caster->IsClient()) { @@ -1662,9 +1662,9 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] // Queries the loottable: adds item & coin to the npc void ZoneDatabase::AddLootTableToNPC(uint32 loottable_id, ItemList* itemlist, uint32* copper, uint32* silver, uint32* gold, uint32* plat) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; *copper = 0; *silver = 0; *gold = 0; @@ -1747,12 +1747,12 @@ void ZoneDatabase::AddLootTableToNPC(uint32 loottable_id, ItemList* itemlist, ui // maxdrops = size of the array npcd void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; -// This is Wiz's updated Pool Looting functionality. Eventually, the database format should be moved over to use this -// or implemented to support both methods. (A unique identifier in lootable_entries indicates to roll for a pool item +// This is Wiz's updated Pool Looting functionality. Eventually, the database format should be moved over to use this +// or implemented to support both methods. (A unique identifier in lootable_entries indicates to roll for a pool item // in another table. #ifdef POOLLOOTING uint32 chancepool = 0; @@ -1782,14 +1782,14 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) { uint32 res; i = 0; - if (chancepool!=0) //avoid divide by zero if some mobs have 0 for chancepool - { - res = rand()%chancepool; - } - else - { - res = 0; - } + if (chancepool!=0) //avoid divide by zero if some mobs have 0 for chancepool + { + res = rand()%chancepool; + } + else + { + res = 0; + } while (items[i] != 0) { @@ -1821,7 +1821,7 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) { safe_delete_array(query); while ((row = mysql_fetch_row(result))) { - uint8 LootDropMod=1; // place holder till I put it in a database variable to make it configurable. + uint8 LootDropMod=1; // place holder till I put it in a database variable to make it configurable. if( (rand()%100) < ((atoi(row[4]) * LootDropMod)) ) { uint32 itemid = atoi(row[1]); diff --git a/zone/oldcode.h b/zone/oldcode.h index 3ec6f1ec4..6decf7f76 100644 --- a/zone/oldcode.h +++ b/zone/oldcode.h @@ -1,25 +1,22 @@ -/* 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 OLDCODE_H #define OLDCODE_H - - - #endif diff --git a/zone/parser.h b/zone/parser.h index 1a3497a93..7d068ff86 100644 --- a/zone/parser.h +++ b/zone/parser.h @@ -84,37 +84,37 @@ public: int ParseCommands(std::string text, int line, int justcheck, uint32 npcid, Mob* other, Mob* mob, std::string filename=string("none")); int ParseIf(std::string text); int pcalc(const char * string); - void ParseVars(std::string& text, uint32 npcid, Mob* mob); + void ParseVars(std::string& text, uint32 npcid, Mob* mob); void Replace(std::string& string1, std::string repstr, std::string rep, int all=0); void scanformat(char *string, const char *format, char arg[10][1024]); bool SetNPCqstID(uint32 iNPCID, int32 iValue); - char * strrstr(char* string, const char * sub); + char * strrstr(char* string, const char * sub); virtual void SendCommands(const char * event, uint32 npcid, NPC* npcmob, Mob* mob); int HasQuestFile(uint32 npcid); - //interface stuff - virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {} - virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {} - virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {} - virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {} - virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {} - virtual bool HasQuestSub(uint32 npcid, const char *subname) { return HasQuestFile(npcid) != 0; } - virtual bool PlayerHasQuestSub(const char *subname) { return true; } - virtual bool GlobalPlayerHasQuestSub(const char *subname) { return true; } - virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname) { return true; } - virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return true; } - virtual void AddVar(std::string varname, std::string varval); + //interface stuff + virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {} + virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {} + virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {} + virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {} + virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {} + virtual bool HasQuestSub(uint32 npcid, const char *subname) { return HasQuestFile(npcid) != 0; } + virtual bool PlayerHasQuestSub(const char *subname) { return true; } + virtual bool GlobalPlayerHasQuestSub(const char *subname) { return true; } + virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname) { return true; } + virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return true; } + virtual void AddVar(std::string varname, std::string varval); virtual void ReloadQuests(bool with_timers = false); - virtual uint32 GetIdentifier() { return 0x04629fff; } + virtual uint32 GetIdentifier() { return 0x04629fff; } private: - //void Event(int event, uint32 npcid, const char * data, Mob* npcmob, Mob* mob); - //changed - Eglin. more reasonable (IMHO) than changing every single referance to the global pointer. + //void Event(int event, uint32 npcid, const char * data, Mob* npcmob, Mob* mob); + //changed - Eglin. more reasonable (IMHO) than changing every single referance to the global pointer. //that's what you get for using globals! :) - virtual void Event(QuestEventID event, uint32 npcid, const char * data, NPC* npcmob, Mob* mob, uint32 extradata = 0); + virtual void Event(QuestEventID event, uint32 npcid, const char * data, NPC* npcmob, Mob* mob, uint32 extradata = 0); uint32 pMaxNPCID; int32* pNPCqstID; diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 93b3f9bea..c269029ec 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -13,7 +13,7 @@ #include "zone.h" #ifdef _WINDOWS -#define snprintf _snprintf +#define snprintf _snprintf #endif //#define PATHDEBUG @@ -114,7 +114,7 @@ bool PathManager::loadPaths(FILE *PathFile) fread(&Head, sizeof(Head), 1, PathFile); LogFile->write(EQEMuLog::Status, "Path File Header: Version %ld, PathNodes %ld", - (long)Head.version, (long)Head.PathNodeCount); + (long)Head.version, (long)Head.PathNodeCount); if(Head.version != 2) { @@ -163,7 +163,7 @@ void PathManager::PrintPathing() for(uint32 i = 0; i < Head.PathNodeCount; ++i) { printf("PathNode: %2d id %2d. (%8.3f, %8.3f, %8.3f), BestZ: %8.3f\n", - i, PathNodes[i].id, PathNodes[i].v.x, PathNodes[i].v.y, PathNodes[i].v.z, PathNodes[i].bestz); + i, PathNodes[i].id, PathNodes[i].v.x, PathNodes[i].v.y, PathNodes[i].v.z, PathNodes[i].bestz); if(PathNodes[i].Neighbours[0].id == -1) @@ -178,7 +178,7 @@ void PathManager::PrintPathing() break; printf(" Neighbour: %2d, Distance %8.3f", PathNodes[i].Neighbours[j].id, - PathNodes[i].Neighbours[j].distance); + PathNodes[i].Neighbours[j].distance); if(PathNodes[i].Neighbours[j].Teleport) printf(" ***** TELEPORT *****"); @@ -294,7 +294,7 @@ list PathManager::FindRoute(int startID, int endID) AStarEntry.GCost = CurrentNode.GCost + PathNodes[CurrentNode.PathNodeID].Neighbours[i].distance; - float FCost = AStarEntry.HCost + AStarEntry.GCost; + float FCost = AStarEntry.HCost + AStarEntry.GCost; #ifdef PATHDEBUG printf("Node: %i, Open Neighbour %i has HCost %8.3f, GCost %8.3f (Total Cost: %8.3f)\n", CurrentNode.PathNodeID, @@ -314,7 +314,7 @@ list PathManager::FindRoute(int startID, int endID) { AlreadyInOpenList = true; - float GCostToNode = CurrentNode.GCost + PathNodes[CurrentNode.PathNodeID].Neighbours[i].distance; + float GCostToNode = CurrentNode.GCost + PathNodes[CurrentNode.PathNodeID].Neighbours[i].distance; if(GCostToNode < (*OpenListIterator).GCost) { @@ -361,7 +361,7 @@ list PathManager::FindRoute(VERTEX Start, VERTEX End) _ZP(Pathing_FindRoute_FromVertices); - _log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); + _log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); list noderoute; @@ -381,10 +381,10 @@ list PathManager::FindRoute(VERTEX Start, VERTEX End) for(uint32 i = 0 ; i < Head.PathNodeCount; ++i) { if((ABS(Start.x - PathNodes[i].v.x) <= CandidateNodeRangeXY) && - (ABS(Start.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) && - (ABS(Start.z - PathNodes[i].v.z) <= CandidateNodeRangeZ)) + (ABS(Start.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) && + (ABS(Start.z - PathNodes[i].v.z) <= CandidateNodeRangeZ)) { - TempNode.id = i; + TempNode.id = i; TempNode.Distance = VertexDistanceNoRoot(Start, PathNodes[i].v); SortedByDistance.push_back(TempNode); @@ -420,10 +420,10 @@ list PathManager::FindRoute(VERTEX Start, VERTEX End) for(uint32 i = 0 ; i < Head.PathNodeCount; ++i) { if((ABS(End.x - PathNodes[i].v.x) <= CandidateNodeRangeXY) && - (ABS(End.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) && - (ABS(End.z - PathNodes[i].v.z) <= CandidateNodeRangeZ)) + (ABS(End.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) && + (ABS(End.z - PathNodes[i].v.z) <= CandidateNodeRangeZ)) { - TempNode.id = i; + TempNode.id = i; TempNode.Distance = VertexDistanceNoRoot(End, PathNodes[i].v); SortedByDistance.push_back(TempNode); } @@ -479,7 +479,7 @@ list PathManager::FindRoute(VERTEX Start, VERTEX End) break; if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Second)].v, 1.0f, nullptr, nullptr) - && zone->pathing->NoHazards(Start, PathNodes[(*Second)].v)) + && zone->pathing->NoHazards(Start, PathNodes[(*Second)].v)) { noderoute.erase(First); @@ -512,7 +512,7 @@ list PathManager::FindRoute(VERTEX Start, VERTEX End) break; if(!zone->zonemap->LineIntersectsZone(End, PathNodes[(*Second)].v, 1.0f, nullptr, nullptr) - && zone->pathing->NoHazards(End, PathNodes[(*Second)].v)) + && zone->pathing->NoHazards(End, PathNodes[(*Second)].v)) { noderoute.erase(First); @@ -673,7 +673,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo VERTEX From(GetX(), GetY(), GetZ()); - VERTEX HeadPosition(From.x, From.y, From.z + (GetSize() < 6.0 ? 6 : GetSize()) * HEAD_POSITION); + VERTEX HeadPosition(From.x, From.y, From.z + (GetSize() < 6.0 ? 6 : GetSize()) * HEAD_POSITION); VERTEX To(ToX, ToY, ToZ); @@ -761,8 +761,8 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo if((RouteSize == 2) || ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) - && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) - && PathingLOSCheckTimer->Check())) + && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) + && PathingLOSCheckTimer->Check())) { mlog(PATHING__DEBUG, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); @@ -770,7 +770,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo mlog(PATHING__DEBUG, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) - && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) + && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr, nullptr)) PathingLOSState = HaveLOS; @@ -836,7 +836,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo mlog(PATHING__DEBUG, " Now moving to node %i", NextNode); - return zone->pathing->GetPathNodeCoordinates(NextNode); + return zone->pathing->GetPathNodeCoordinates(NextNode); } else { @@ -853,8 +853,8 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo int RouteSize = Route.size(); if((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) - && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) - && PathingLOSCheckTimer->Check()) + && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) + && PathingLOSCheckTimer->Check()) { mlog(PATHING__DEBUG, " Checking distance to target."); @@ -863,7 +863,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo mlog(PATHING__DEBUG, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) - && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) + && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr, nullptr)) PathingLOSState = HaveLOS; @@ -901,7 +901,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo float Distance = VertexDistanceNoRoot(From, To); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) - && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) + && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { mlog(PATHING__DEBUG, " Checking for short LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr, nullptr)) @@ -1053,7 +1053,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo float Distance = VertexDistanceNoRoot(From, To); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) - && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) + && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { mlog(PATHING__DEBUG, " Checking for long LOS at distance %8.3f.", Distance); @@ -1121,10 +1121,10 @@ int PathManager::FindNearestPathNode(VERTEX Position) for(uint32 i = 0 ; i < Head.PathNodeCount; ++i) { if((ABS(Position.x - PathNodes[i].v.x) <= CandidateNodeRangeXY) && - (ABS(Position.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) && - (ABS(Position.z - PathNodes[i].v.z) <= CandidateNodeRangeZ)) + (ABS(Position.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) && + (ABS(Position.z - PathNodes[i].v.z) <= CandidateNodeRangeZ)) { - TempNode.id = i; + TempNode.id = i; TempNode.Distance = VertexDistanceNoRoot(Position, PathNodes[i].v); SortedByDistance.push_back(TempNode); @@ -1193,7 +1193,7 @@ bool PathManager::NoHazardsAccurate(VERTEX From, VERTEX To) stepx = (float)To.x - curx; stepy = (float)To.y - cury; stepz = (float)To.z - curz; - float factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz); + float factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz); stepx = (stepx/factor)*step_size; stepy = (stepy/factor)*step_size; stepz = (stepz/factor)*step_size; @@ -1955,7 +1955,7 @@ void PathManager::DisconnectNodeToNode(int32 Node1, int32 Node2) bool disconnect_a_from_b = false; if(NodesConnected(a, b)) - disconnect_a_from_b = true; + disconnect_a_from_b = true; bool disconnect_b_from_a = false; if(NodesConnected(b, a)) @@ -2295,3 +2295,4 @@ void PathManager::SortNodes() safe_delete_array(PathNodes); PathNodes = t_PathNodes; } + diff --git a/zone/perl_PlayerCorpse.cpp b/zone/perl_PlayerCorpse.cpp index 288d901a6..7fedb85c2 100644 --- a/zone/perl_PlayerCorpse.cpp +++ b/zone/perl_PlayerCorpse.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 */ #include "../common/features.h" @@ -36,7 +36,7 @@ #include "PlayerCorpse.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -804,8 +804,6 @@ XS(boot_Corpse) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "GetCharID"), XS_Corpse_GetCharID, file, "$"); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index efbf1ba15..d1c6f19f8 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.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 @@ -16,13 +16,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/features.h" @@ -1696,7 +1696,7 @@ XS(XS_Client_TakeMoneyFromPP) { dXSARGS; if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::TakeMoneyFromPP(THIS, copper, updateclient=false)"); + Perl_croak(aTHX_ "Usage: Client::TakeMoneyFromPP(THIS, copper, updateclient=false)"); { Client * THIS; bool RETVAL; @@ -3897,8 +3897,8 @@ XS(XS_Client_GetClientVersionBit) if (items != 1) Perl_croak(aTHX_ "Usage: Client::GetClientVersionBit(THIS)"); { - Client * THIS; - uint32 RETVAL; + Client * THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Client")) { @@ -5453,8 +5453,8 @@ XS(XS_Client_GetItemInInventory) Perl_croak(aTHX_ "Usage: Client::GetItemInInventory(THIS, slot_id)"); { Client * THIS; - int16 slot_id = (int16)SvIV(ST(1)); - ItemInst *RETVAL = nullptr; + int16 slot_id = (int16)SvIV(ST(1)); + ItemInst *RETVAL = nullptr; if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -5465,8 +5465,8 @@ XS(XS_Client_GetItemInInventory) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetInv().GetItem(slot_id); - ST(0) = sv_newmortal(); + RETVAL = THIS->GetInv().GetItem(slot_id); + ST(0) = sv_newmortal(); sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL); } XSRETURN(1); @@ -5480,9 +5480,9 @@ XS(XS_Client_SetCustomItemData) Perl_croak(aTHX_ "Usage: Client::SetCustomItemData(THIS, slot_id, identifier, value)"); { Client * THIS; - int16 slot_id = (int16)SvIV(ST(1)); - Const_char* identifier = SvPV_nolen(ST(2)); - Const_char* value = SvPV_nolen(ST(3)); + int16 slot_id = (int16)SvIV(ST(1)); + Const_char* identifier = SvPV_nolen(ST(2)); + Const_char* value = SvPV_nolen(ST(3)); if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -5493,7 +5493,7 @@ XS(XS_Client_SetCustomItemData) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->GetInv().SetCustomItemData(THIS->CharacterID(), slot_id, std::string(identifier), std::string(value)); + THIS->GetInv().SetCustomItemData(THIS->CharacterID(), slot_id, std::string(identifier), std::string(value)); } XSRETURN_EMPTY; } @@ -5506,9 +5506,9 @@ XS(XS_Client_GetCustomItemData) Perl_croak(aTHX_ "Usage: Client::GetCustomItemData(THIS, slot_id, identifier)"); { Client * THIS; - int16 slot_id = (int16)SvIV(ST(1)); - Const_char* identifier = SvPV_nolen(ST(2)); - Const_char * RETVAL; + int16 slot_id = (int16)SvIV(ST(1)); + Const_char* identifier = SvPV_nolen(ST(2)); + Const_char * RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Client")) { @@ -5520,9 +5520,9 @@ XS(XS_Client_GetCustomItemData) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - std::string ret_val = THIS->GetInv().GetCustomItemData(slot_id, std::string(identifier)); - RETVAL = ret_val.c_str(); - sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; + std::string ret_val = THIS->GetInv().GetCustomItemData(slot_id, std::string(identifier)); + RETVAL = ret_val.c_str(); + sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; } XSRETURN(1); } diff --git a/zone/perl_doors.cpp b/zone/perl_doors.cpp index 5d0f7a15f..77ad1902b 100644 --- a/zone/perl_doors.cpp +++ b/zone/perl_doors.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 @@ -16,13 +16,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/features.h" @@ -36,7 +36,7 @@ #include "doors.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -737,8 +737,6 @@ XS(boot_Doors) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "GetID"),XS_Doors_GetID, file, "$"); newXSproto(strcpy(buf, "SetModelName"),XS_Doors_SetModelName, file, "$$"); diff --git a/zone/perl_entity.cpp b/zone/perl_entity.cpp index 5703e7c96..255e9278f 100644 --- a/zone/perl_entity.cpp +++ b/zone/perl_entity.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 @@ -16,13 +16,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/features.h" @@ -37,7 +37,7 @@ #include "entity.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif diff --git a/zone/perl_groups.cpp b/zone/perl_groups.cpp index 1ace3eddb..9db01353b 100644 --- a/zone/perl_groups.cpp +++ b/zone/perl_groups.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 @@ -16,13 +16,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/features.h" @@ -36,7 +36,7 @@ #include "groups.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -632,8 +632,6 @@ XS(boot_Group) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "DisbandGroup"), XS_Group_DisbandGroup, file, "$"); diff --git a/zone/perl_hateentry.cpp b/zone/perl_hateentry.cpp index 456d59413..fa65e8b39 100644 --- a/zone/perl_hateentry.cpp +++ b/zone/perl_hateentry.cpp @@ -1,5 +1,5 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2009 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2009 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 "../common/features.h" @@ -139,3 +139,4 @@ XS(boot_HateEntry) } #endif //EMBPERL_XS_CLASSES + diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index fa57c0423..013975326 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.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 */ #include "../common/features.h" @@ -40,7 +40,7 @@ typedef const char Const_char; #include "client.h" #include "../common/spdat.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -5872,9 +5872,9 @@ XS(XS_Mob_NPCSpecialAttacks) { Mob * THIS; char* parse = (char *)SvPV_nolen(ST(1)); - int permtag = (int)SvIV(ST(2)); - bool reset = items == 4 ? (bool)SvTRUE(ST(3)) : true; - bool remove = items == 5 ? (bool)SvTRUE(ST(4)) : false; + int permtag = (int)SvIV(ST(2)); + bool reset = items == 4 ? (bool)SvTRUE(ST(3)) : true; + bool remove = items == 5 ? (bool)SvTRUE(ST(4)) : false; if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -6792,7 +6792,7 @@ XS(XS_Mob_ProjectileAnim) { dXSARGS; if (items < 3 || items > 8) - Perl_croak(aTHX_ "Usage: Mob::ProjectileAnim(THIS, mob, item_id, IsArrow?, speed, angle, tilt, arc)"); + Perl_croak(aTHX_ "Usage: Mob::ProjectileAnim(THIS, mob, item_id, IsArrow?, speed, angle, tilt, arc)"); { Mob * THIS; @@ -7407,7 +7407,7 @@ XS(XS_Mob_DoKnockback) Perl_croak(aTHX_ "Usage: Mob::DoKnockback(THIS, caster, pushback, pushup)"); { Mob * THIS; - Mob * caster; + Mob * caster; uint32 pushback = (uint16)SvUV(ST(2)); uint32 pushup = (uint16)SvUV(ST(2)); @@ -7477,7 +7477,7 @@ XS(XS_Mob_SetRunning) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->SetRunning(value); + THIS->SetRunning(value); } XSRETURN_EMPTY; } @@ -7502,7 +7502,7 @@ XS(XS_Mob_IsRunning) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->IsRunning(); + RETVAL = THIS->IsRunning(); ST(0) = boolSV(RETVAL); sv_2mortal(ST(0)); } @@ -7518,7 +7518,7 @@ XS(XS_Mob_SetBodyType) { Mob * THIS; int32 type = (int32)SvIV(ST(1)); - bool overwrite_orig = false; + bool overwrite_orig = false; if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -7529,11 +7529,11 @@ XS(XS_Mob_SetBodyType) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - if(items == 3) { - overwrite_orig = (bool)SvTRUE(ST(2)); - } + if(items == 3) { + overwrite_orig = (bool)SvTRUE(ST(2)); + } - THIS->SetBodyType((bodyType)type, overwrite_orig); + THIS->SetBodyType((bodyType)type, overwrite_orig); } XSRETURN_EMPTY; } @@ -7584,7 +7584,7 @@ XS(XS_Mob_SetLD) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->SendAppearancePacket(AT_Linkdead, value); + THIS->SendAppearancePacket(AT_Linkdead, value); } XSRETURN_EMPTY; } @@ -7735,7 +7735,7 @@ XS(XS_Mob_SetAllowBeneficial) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->SetAllowBeneficial(value); + THIS->SetAllowBeneficial(value); } XSRETURN_EMPTY; } @@ -7811,7 +7811,7 @@ XS(XS_Mob_ModVulnerability) Perl_croak(aTHX_ "Usage: Mob::ModVulnerability(THIS, resist, value)"); { Mob * THIS; - uint8 resist = (uint8)SvIV(ST(1)); + uint8 resist = (uint8)SvIV(ST(1)); int16 value = (int16)SvIV(ST(2)); if (sv_derived_from(ST(0), "Mob")) { @@ -7902,8 +7902,8 @@ XS(XS_Mob_DoArcheryAttackDmg) { Mob * THIS; Mob* target; - ItemInst* RangeWeapon = nullptr; - ItemInst* Ammo = nullptr; + ItemInst* RangeWeapon = nullptr; + ItemInst* Ammo = nullptr; uint16 weapon_damage = (uint16)SvIV(ST(4)); int16 chance_mod = (int16)SvIV(ST(5)); int16 focus = (int16)SvIV(ST(6)); @@ -7940,7 +7940,7 @@ XS(XS_Mob_DoThrowingAttackDmg) { Mob * THIS; Mob* target; - ItemInst* RangeWeapon = nullptr; + ItemInst* RangeWeapon = nullptr; Item_Struct* item = nullptr; uint16 weapon_damage = (uint16)SvIV(ST(4)); int16 chance_mod = (int16)SvIV(ST(5)); @@ -7988,7 +7988,7 @@ XS(XS_Mob_SetDisableMelee) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->SetDisableMelee(value); + THIS->SetDisableMelee(value); } XSRETURN_EMPTY; } @@ -8086,8 +8086,6 @@ XS(boot_Mob) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "IsClient"), XS_Mob_IsClient, file, "$"); @@ -8351,7 +8349,7 @@ XS(boot_Mob) newXSproto(strcpy(buf, "SetDeltas"), XS_Mob_SetDeltas, file, "$$$$$"); newXSproto(strcpy(buf, "SetLD"), XS_Mob_SetLD, file, "$$"); newXSproto(strcpy(buf, "SetTargetDestSteps"), XS_Mob_SetTargetDestSteps, file, "$$"); - newXSproto(strcpy(buf, "SetTargetable"), XS_Mob_SetTargetable, file, "$$"); + newXSproto(strcpy(buf, "SetTargetable"), XS_Mob_SetTargetable, file, "$$"); newXSproto(strcpy(buf, "MakeTempPet"), XS_Mob_MakeTempPet, file, "$$;$$$$"); newXSproto(strcpy(buf, "ModSkillDmgTaken"), XS_Mob_ModSkillDmgTaken, file, "$$$"); newXSproto(strcpy(buf, "GetModSkillDmgTaken"), XS_Mob_GetModSkillDmgTaken, file, "$$"); diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index 381a5c6b7..c89445bd2 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.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 @@ -16,13 +16,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/features.h" @@ -38,7 +38,7 @@ typedef const char Const_char; #include "npc.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -852,8 +852,8 @@ XS(XS_NPC_GetMinDMG) if (items != 1) Perl_croak(aTHX_ "Usage: NPC::GetMinDMG(THIS)"); { - NPC * THIS; - uint32 RETVAL; + NPC * THIS; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "NPC")) { @@ -2154,8 +2154,6 @@ XS(boot_NPC) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "SignalNPC"), XS_NPC_SignalNPC, file, "$$"); diff --git a/zone/perl_object.cpp b/zone/perl_object.cpp index 3c9390c70..9c71ec6ed 100644 --- a/zone/perl_object.cpp +++ b/zone/perl_object.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 */ #include "../common/features.h" @@ -36,7 +36,7 @@ #include "object.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -927,8 +927,6 @@ XS(boot_Object) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "Depop"),XS_Object_Depop, file, "$"); newXSproto(strcpy(buf, "Repop"),XS_Object_Repop, file, "$"); diff --git a/zone/perl_perlpacket.cpp b/zone/perl_perlpacket.cpp index 6faf46a7b..05bbf01f6 100644 --- a/zone/perl_perlpacket.cpp +++ b/zone/perl_perlpacket.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 @@ -16,13 +16,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/features.h" @@ -36,7 +36,7 @@ #include "perlpacket.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -47,9 +47,9 @@ XS(XS_PerlPacket_new) if (items < 1 || items > 3) Perl_croak(aTHX_ "Usage: PerlPacket::new(CLASS, opcode= \"OP_Unknown\", len= 0)"); { - char *CLASS = (char *)SvPV_nolen(ST(0)); - PerlPacket *RETVAL; - const char *opcode; + char *CLASS = (char *)SvPV_nolen(ST(0)); + PerlPacket *RETVAL; + const char *opcode; uint32 len; if (items < 2) diff --git a/zone/perl_questitem.cpp b/zone/perl_questitem.cpp index 2b5491ee3..0396ec666 100644 --- a/zone/perl_questitem.cpp +++ b/zone/perl_questitem.cpp @@ -1,5 +1,5 @@ -/* 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 @@ -7,13 +7,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/features.h" @@ -201,7 +201,7 @@ XS(XS_QuestItem_GetAugment) Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, augment_id)"); { ItemInst* THIS; - int16 slot_id = (int16)SvIV(ST(1)); + int16 slot_id = (int16)SvIV(ST(1)); ItemInst* RETVAL; if (sv_derived_from(ST(0), "QuestItem")) { @@ -213,8 +213,8 @@ XS(XS_QuestItem_GetAugment) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetAugment(slot_id); - ST(0) = sv_newmortal(); + RETVAL = THIS->GetAugment(slot_id); + ST(0) = sv_newmortal(); sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL); } XSRETURN(1); @@ -240,7 +240,7 @@ XS(XS_QuestItem_GetID) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetItem()->ID; + RETVAL = THIS->GetItem()->ID; XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); @@ -272,8 +272,8 @@ XS(boot_QuestItem) newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$"); newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$"); newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$"); - newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$"); - newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$"); + newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$"); + newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$"); XSRETURN_YES; } diff --git a/zone/perl_raids.cpp b/zone/perl_raids.cpp index 6a9ea9b89..be3aea356 100644 --- a/zone/perl_raids.cpp +++ b/zone/perl_raids.cpp @@ -1,14 +1,14 @@ /* - * This file was generated automatically by ExtUtils::ParseXS version 2.18 from the - * contents of raids.h.xs. Do not edit this file, edit raids.h.xs instead. - * - * ANY CHANGES MADE HERE WILL BE LOST! - * - */ +* This file was generated automatically by ExtUtils::ParseXS version 2.18 from the +* contents of raids.h.xs. Do not edit this file, edit raids.h.xs 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 @@ -16,13 +16,13 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/features.h" @@ -37,7 +37,7 @@ #include "raids.h" #include "client.h" -#ifdef THIS /* this macro seems to leak out on some systems */ +#ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS #endif @@ -593,8 +593,6 @@ XS(boot_Raid) //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; newXSproto(strcpy(buf, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$"); diff --git a/zone/perlpacket.cpp b/zone/perlpacket.cpp index 80f3814ed..262c2a278 100644 --- a/zone/perlpacket.cpp +++ b/zone/perlpacket.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" #include @@ -137,12 +137,10 @@ void PerlPacket::SetString(uint32 pos, char *str) { #pragma pack(1) struct EQ1319 { - int32 part13:13, - part19:19; + int32 part13:13, part19:19; }; struct EQ1913 { - int32 part19:19, - part13:13; + int32 part19:19, part13:13; }; #pragma pack() @@ -191,5 +189,3 @@ float PerlPacket::GetFloat(uint32 pos) { return(*p); } - - diff --git a/zone/perlpacket.h b/zone/perlpacket.h index 039344574..cb50dcd93 100644 --- a/zone/perlpacket.h +++ b/zone/perlpacket.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 PERLPACKET_H #define PERLPACKET_H @@ -62,7 +62,4 @@ protected: unsigned char *packet; }; - - - #endif diff --git a/zone/perlparser.cpp b/zone/perlparser.cpp index d69d69c7d..88f97cc40 100644 --- a/zone/perlparser.cpp +++ b/zone/perlparser.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 "../common/features.h" @@ -159,7 +159,7 @@ void PerlXSParser::SendCommands(const char * pkgprefix, const char *event, uint3 perl->dosub(std::string(pkgprefix).append("::").append(event).c_str()); #ifdef EMBPERL_XS_CLASSES - std::string eval_str = (std::string)"$" + (std::string)pkgprefix + (std::string)"::client = undef;"; + std::string eval_str = (std::string)"$" + (std::string)pkgprefix + (std::string)"::client = undef;"; eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::npc = undef;"; eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::questitem = undef;"; eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::entity_list = undef;"; @@ -277,8 +277,8 @@ XS(XS__echo); // prototype to pass -Wmissing-prototypes XS(XS__echo) { dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: echo(id#, str)"); + if (items != 2) + Perl_croak(aTHX_ "Usage: echo(id#, str)"); quest_manager.echo(SvUV(ST(0)), SvPV_nolen(ST(1))); @@ -471,7 +471,7 @@ XS(XS__setstat) XSRETURN_EMPTY; } -XS(XS__incstat); //old setstat command aza +XS(XS__incstat); //old setstat command aza XS(XS__incstat) { dXSARGS; @@ -1878,79 +1878,79 @@ XS(XS__clear_zone_flag) XS(XS__summonburriedplayercorpse); XS(XS__summonburriedplayercorpse) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: summonburriedplayercorpse(char_id,dest_x,dest_y,dest_z,dest_heading)"); + dXSARGS; + if (items != 5) + Perl_croak(aTHX_ "Usage: summonburriedplayercorpse(char_id,dest_x,dest_y,dest_z,dest_heading)"); - bool RETVAL; - uint32 char_id = (int)SvIV(ST(0)); - float dest_x = (float)SvIV(ST(1)); - float dest_y = (float)SvIV(ST(2)); - float dest_z = (float)SvIV(ST(3)); - float dest_heading = (float)SvIV(ST(4)); + bool RETVAL; + uint32 char_id = (int)SvIV(ST(0)); + float dest_x = (float)SvIV(ST(1)); + float dest_y = (float)SvIV(ST(2)); + float dest_z = (float)SvIV(ST(3)); + float dest_heading = (float)SvIV(ST(4)); - RETVAL = quest_manager.summonburriedplayercorpse(char_id, dest_x, dest_y, dest_z, dest_heading); + RETVAL = quest_manager.summonburriedplayercorpse(char_id, dest_x, dest_y, dest_z, dest_heading); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); + ST(0) = boolSV(RETVAL); + sv_2mortal(ST(0)); + XSRETURN(1); } XS(XS__summonallplayercorpses); XS(XS__summonallplayercorpses) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: summonallplayercorpses(char_id,dest_x,dest_y,dest_z,dest_heading)"); + dXSARGS; + if (items != 5) + Perl_croak(aTHX_ "Usage: summonallplayercorpses(char_id,dest_x,dest_y,dest_z,dest_heading)"); - bool RETVAL; - uint32 char_id = (int)SvIV(ST(0)); - float dest_x = (float)SvIV(ST(1)); - float dest_y = (float)SvIV(ST(2)); - float dest_z = (float)SvIV(ST(3)); - float dest_heading = (float)SvIV(ST(4)); + bool RETVAL; + uint32 char_id = (int)SvIV(ST(0)); + float dest_x = (float)SvIV(ST(1)); + float dest_y = (float)SvIV(ST(2)); + float dest_z = (float)SvIV(ST(3)); + float dest_heading = (float)SvIV(ST(4)); - RETVAL = quest_manager.summonallplayercorpses(char_id, dest_x, dest_y, dest_z, dest_heading); + RETVAL = quest_manager.summonallplayercorpses(char_id, dest_x, dest_y, dest_z, dest_heading); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); + ST(0) = boolSV(RETVAL); + sv_2mortal(ST(0)); + XSRETURN(1); } XS(XS__getplayerburriedcorpsecount); XS(XS__getplayerburriedcorpsecount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: getplayerburriedcorpsecount(char_id)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: getplayerburriedcorpsecount(char_id)"); - uint32 RETVAL; - dXSTARG; + uint32 RETVAL; + dXSTARG; - uint32 char_id = (int)SvIV(ST(0)); + uint32 char_id = (int)SvIV(ST(0)); - RETVAL = quest_manager.getplayerburriedcorpsecount(char_id); - XSprePUSH; PUSHu((IV)RETVAL); + RETVAL = quest_manager.getplayerburriedcorpsecount(char_id); + XSprePUSH; PUSHu((IV)RETVAL); - XSRETURN(1); + XSRETURN(1); } XS(XS__buryplayercorpse); XS(XS__buryplayercorpse) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: buryplayercorpse(char_id)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: buryplayercorpse(char_id)"); - uint32 RETVAL; - dXSTARG; + uint32 RETVAL; + dXSTARG; - uint32 char_id = (int)SvIV(ST(0)); + uint32 char_id = (int)SvIV(ST(0)); - RETVAL = quest_manager.buryplayercorpse(char_id); - XSprePUSH; PUSHu((IV)RETVAL); + RETVAL = quest_manager.buryplayercorpse(char_id); + XSprePUSH; PUSHu((IV)RETVAL); - XSRETURN(1); + XSRETURN(1); } XS(XS__forcedooropen); @@ -2022,14 +2022,14 @@ XS(XS__toggledoorstate) XS(XS__isdooropen); XS(XS__isdooropen) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: isdooropen(doorid)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: isdooropen(doorid)"); - bool RETVAL; - dXSTARG; + bool RETVAL; + dXSTARG; - uint32 doorid = (int)SvIV(ST(0)); + uint32 doorid = (int)SvIV(ST(0)); RETVAL = quest_manager.isdooropen(doorid); XSprePUSH; PUSHu((IV)RETVAL); @@ -2210,9 +2210,9 @@ XS(XS__npcfeature) XS(XS__createbotcount); XS(XS__createbotcount) { - dXSARGS; - int RETVAL; - dXSTARG; + dXSARGS; + int RETVAL; + dXSTARG; RETVAL = quest_manager.createbotcount(); XSprePUSH; PUSHi((IV)RETVAL); @@ -2223,9 +2223,9 @@ XS(XS__createbotcount) XS(XS__spawnbotcount); XS(XS__spawnbotcount) { - dXSARGS; - int RETVAL; - dXSTARG; + dXSARGS; + int RETVAL; + dXSTARG; RETVAL = quest_manager.spawnbotcount(); XSprePUSH; PUSHi((IV)RETVAL); @@ -2236,9 +2236,9 @@ XS(XS__spawnbotcount) XS(XS__botquest); XS(XS__botquest) { - dXSARGS; - bool RETVAL; - dXSTARG; + dXSARGS; + bool RETVAL; + dXSTARG; RETVAL = quest_manager.botquest(); XSprePUSH; PUSHu((IV)RETVAL); @@ -2338,7 +2338,7 @@ XS(XS__istaskenabled); XS(XS__istaskenabled) { dXSARGS; - bool RETVAL; + bool RETVAL; dXSTARG; if(items == 1) { @@ -2356,7 +2356,7 @@ XS(XS__istaskactive); XS(XS__istaskactive) { dXSARGS; - bool RETVAL; + bool RETVAL; dXSTARG; if(items == 1) { @@ -2374,7 +2374,7 @@ XS(XS__istaskactivityactive); XS(XS__istaskactivityactive) { dXSARGS; - bool RETVAL; + bool RETVAL; dXSTARG; if(items == 2) { @@ -2393,7 +2393,7 @@ XS(XS__gettaskactivitydonecount); XS(XS__gettaskactivitydonecount) { dXSARGS; - uint32 RETVAL; + uint32 RETVAL; dXSTARG; if(items == 2) { @@ -2495,7 +2495,7 @@ XS(XS__tasktimeleft); XS(XS__tasktimeleft) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 1) { @@ -2514,7 +2514,7 @@ XS(XS__istaskcompleted); XS(XS__istaskcompleted) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 1) { @@ -2533,7 +2533,7 @@ XS(XS__enabledtaskcount); XS(XS__enabledtaskcount) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 1) { @@ -2552,7 +2552,7 @@ XS(XS__firsttaskinset); XS(XS__firsttaskinset) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 1) { @@ -2571,7 +2571,7 @@ XS(XS__lasttaskinset); XS(XS__lasttaskinset) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 1) { @@ -2590,7 +2590,7 @@ XS(XS__nexttaskinset); XS(XS__nexttaskinset) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 2) { @@ -2609,7 +2609,7 @@ XS(XS__activespeaktask); XS(XS__activespeaktask) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 0) { @@ -2627,7 +2627,7 @@ XS(XS__activespeakactivity); XS(XS__activespeakactivity) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 1) { @@ -2646,7 +2646,7 @@ XS(XS__activetasksinset); XS(XS__activetasksinset) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 1) { @@ -2665,7 +2665,7 @@ XS(XS__completedtasksinset); XS(XS__completedtasksinset) { dXSARGS; - int RETVAL; + int RETVAL; dXSTARG; if(items == 1) { @@ -2685,7 +2685,7 @@ XS(XS__istaskappropriate); XS(XS__istaskappropriate) { dXSARGS; - bool RETVAL; + bool RETVAL; dXSTARG; if(items == 1) { @@ -2702,13 +2702,13 @@ XS(XS__istaskappropriate) XS(XS__popup); // prototype to pass -Wmissing-prototypes XS(XS__popup) { - dXSARGS; + dXSARGS; int popupid = 0; int buttons = 0; int duration = 0; if((items < 2) || (items > 5)) - Perl_croak(aTHX_ "Usage: popup(windowtitle, text, popupid, buttons, duration)"); + Perl_croak(aTHX_ "Usage: popup(windowtitle, text, popupid, buttons, duration)"); if(items >= 3) popupid = (int)SvIV(ST(2)); @@ -2719,9 +2719,9 @@ XS(XS__istaskappropriate) if(items == 5) duration = (int)SvIV(ST(4)); - quest_manager.popup(SvPV_nolen(ST(0)), SvPV_nolen(ST(1)), popupid, buttons, duration); + quest_manager.popup(SvPV_nolen(ST(0)), SvPV_nolen(ST(1)), popupid, buttons, duration); - XSRETURN_EMPTY; + XSRETURN_EMPTY; } XS(XS__clearspawntimers); XS(XS__clearspawntimers) @@ -3089,11 +3089,11 @@ XS(XS__saylink) { Const_char * RETVAL; char text[250]; char text2[250]; - bool silent = false; + bool silent = false; strcpy(text,(char *)SvPV_nolen(ST(0))); - if(items >= 2) { - silent = ((int)SvIV(ST(1))) == 0 ? false : true; - } + if(items >= 2) { + silent = ((int)SvIV(ST(1))) == 0 ? false : true; + } if (items == 3) strcpy(text2,(char *)SvPV_nolen(ST(2))); else @@ -3137,12 +3137,12 @@ XS(XS__SetRunning) XS(XS__IsRunning); XS(XS__IsRunning) { - dXSARGS; - if (items >= 1) - Perl_croak(aTHX_ "Usage: IsRunning()"); + dXSARGS; + if (items >= 1) + Perl_croak(aTHX_ "Usage: IsRunning()"); - bool RETVAL; - dXSTARG; + bool RETVAL; + dXSTARG; RETVAL = quest_manager.IsRunning(); @@ -3154,14 +3154,14 @@ XS(XS__IsRunning) XS(XS__IsEffectInSpell); XS(XS__IsEffectInSpell) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: IsEffectInSpell(spell_id, effect_id)"); + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: IsEffectInSpell(spell_id, effect_id)"); uint32 spell_id = (uint32)SvUV(ST(0)); uint32 effect_id = (uint32)SvUV(ST(1)); - bool RETVAL; - dXSTARG; + bool RETVAL; + dXSTARG; RETVAL = IsEffectInSpell(spell_id, effect_id); @@ -3173,13 +3173,13 @@ XS(XS__IsEffectInSpell) XS(XS__IsBeneficialSpell); XS(XS__IsBeneficialSpell) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: IsBeneficialSpell(spell_id)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: IsBeneficialSpell(spell_id)"); uint32 spell_id = (uint32)SvUV(ST(0)); - bool RETVAL; - dXSTARG; + bool RETVAL; + dXSTARG; RETVAL = BeneficialSpell(spell_id); @@ -3191,13 +3191,13 @@ XS(XS__IsBeneficialSpell) XS(XS__GetSpellResistType); XS(XS__GetSpellResistType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: GetSpellResistType(spell_id)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: GetSpellResistType(spell_id)"); uint32 spell_id = (uint32)SvUV(ST(0)); int32 spell_val = 0; - dXSTARG; + dXSTARG; spell_val = GetSpellResistType(spell_id); XSRETURN_UV(spell_val); @@ -3206,13 +3206,13 @@ XS(XS__GetSpellResistType) XS(XS__GetSpellTargetType); XS(XS__GetSpellTargetType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: GetSpellTargetType(spell_id)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: GetSpellTargetType(spell_id)"); uint32 spell_id = (uint32)SvUV(ST(0)); int32 spell_val = 0; - dXSTARG; + dXSTARG; spell_val = GetSpellTargetType(spell_id); XSRETURN_UV(spell_val); @@ -3243,54 +3243,54 @@ XS(XS_FactionValue) { XS(XS__enabletitle); XS(XS__enabletitle) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: enabletitle(titleset)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: enabletitle(titleset)"); - int titleset = (int)SvIV(ST(0)); + int titleset = (int)SvIV(ST(0)); - quest_manager.enabletitle(titleset); + quest_manager.enabletitle(titleset); - XSRETURN_EMPTY; + XSRETURN_EMPTY; } XS(XS__checktitle); XS(XS__checktitle) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: checktitle(titleset)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: checktitle(titleset)"); - bool RETVAL; - int titleset = (int)SvIV(ST(0)); + bool RETVAL; + int titleset = (int)SvIV(ST(0)); - RETVAL = quest_manager.checktitle(titleset); + RETVAL = quest_manager.checktitle(titleset); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); + ST(0) = boolSV(RETVAL); + sv_2mortal(ST(0)); + XSRETURN(1); } XS(XS__removetitle); XS(XS__removetitle) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: removetitle(titleset)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: removetitle(titleset)"); - int titleset = (int)SvIV(ST(0)); + int titleset = (int)SvIV(ST(0)); - quest_manager.removetitle(titleset); + quest_manager.removetitle(titleset); - XSRETURN_EMPTY; + XSRETURN_EMPTY; } XS(XS__wearchange); XS(XS__wearchange) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: wearchange(slot, texture)"); + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: wearchange(slot, texture)"); uint8 slot = (int)SvUV(ST(0)); uint16 texture = (int)SvUV(ST(1)); @@ -3320,72 +3320,72 @@ XS(XS__voicetell) XS(XS__LearnRecipe); XS(XS__LearnRecipe) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: LearnRecipe(recipe_id)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: LearnRecipe(recipe_id)"); - uint32 recipe_id = (uint32)SvIV(ST(0)); + uint32 recipe_id = (uint32)SvIV(ST(0)); - quest_manager.LearnRecipe(recipe_id); + quest_manager.LearnRecipe(recipe_id); - XSRETURN_EMPTY; + XSRETURN_EMPTY; } XS(XS__SendMail); XS(XS__SendMail) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: SendMail(to, from, subject, message)"); + dXSARGS; + if (items != 4) + Perl_croak(aTHX_ "Usage: SendMail(to, from, subject, message)"); - char *to = (char *)SvPV_nolen(ST(0)); - char *from = (char *)SvPV_nolen(ST(1)); - char *subject = (char *)SvPV_nolen(ST(2)); - char *message = (char *)SvPV_nolen(ST(3)); + char *to = (char *)SvPV_nolen(ST(0)); + char *from = (char *)SvPV_nolen(ST(1)); + char *subject = (char *)SvPV_nolen(ST(2)); + char *message = (char *)SvPV_nolen(ST(3)); - quest_manager.SendMail(to, from, subject, message); + quest_manager.SendMail(to, from, subject, message); - XSRETURN_EMPTY; + XSRETURN_EMPTY; } XS(XS__GetZoneID); XS(XS__GetZoneID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: GetZoneID(zone)"); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: GetZoneID(zone)"); - char *zone = (char *)SvPV_nolen(ST(0)); - int32 id = quest_manager.GetZoneID(zone); + char *zone = (char *)SvPV_nolen(ST(0)); + int32 id = quest_manager.GetZoneID(zone); - XSRETURN_IV(id); + XSRETURN_IV(id); } XS(XS__GetZoneLongName); XS(XS__GetZoneLongName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: GetZoneLongName(zone)"); - dXSTARG; - char *zone = (char *)SvPV_nolen(ST(0)); - Const_char* RETVAL = quest_manager.GetZoneLongName(zone); + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: GetZoneLongName(zone)"); + dXSTARG; + char *zone = (char *)SvPV_nolen(ST(0)); + Const_char* RETVAL = quest_manager.GetZoneLongName(zone); - sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; + sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; XSRETURN(1); } XS(XS__GetTimeSeconds); XS(XS__GetTimeSeconds) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: GetTimeSeconds()"); + dXSARGS; + if (items != 0) + Perl_croak(aTHX_ "Usage: GetTimeSeconds()"); uint32 seconds = 0; - dXSTARG; + dXSTARG; - seconds = Timer::GetTimeSeconds(); + seconds = Timer::GetTimeSeconds(); XSRETURN_UV(seconds); } @@ -3570,7 +3570,7 @@ EXTERN_C XS(boot_quest) newXS(strcpy(buf, "addloot"), XS__addloot, file); newXS(strcpy(buf, "zone"), XS__zone, file); newXS(strcpy(buf, "settimer"), XS__settimer, file); - newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file); + newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file); newXS(strcpy(buf, "stoptimer"), XS__stoptimer, file); newXS(strcpy(buf, "stopalltimers"), XS__stopalltimers, file); newXS(strcpy(buf, "emote"), XS__emote, file); @@ -3742,14 +3742,14 @@ EXTERN_C XS(boot_quest) newXS(strcpy(buf, "removetitle"), XS__removetitle, file); newXS(strcpy(buf, "wearchange"), XS__wearchange, file); newXS(strcpy(buf, "voicetell"), XS__voicetell, file); - newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file); - newXS(strcpy(buf, "SendMail"), XS__SendMail, file); - newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file); - newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file); - newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file); + newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file); + newXS(strcpy(buf, "SendMail"), XS__SendMail, file); + newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file); + newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file); + newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file); newXS(strcpy(buf, "handleturnin"), XS__handleturnin, file); - newXS(strcpy(buf, "completehandin"), XS__completehandin, file); - newXS(strcpy(buf, "resethandin"), XS__resethandin, file); + newXS(strcpy(buf, "completehandin"), XS__completehandin, file); + newXS(strcpy(buf, "resethandin"), XS__resethandin, file); newXS(strcpy(buf, "clearhandin"), XS__clearhandin, file); newXS(strcpy(buf, "crosszonesignalclientbycharid"), XS__crosszonesignalclientbycharid, file); newXS(strcpy(buf, "crosszonesignalclientbyname"), XS__crosszonesignalclientbyname, file); diff --git a/zone/perlparser.h b/zone/perlparser.h index c0260b82a..60020306f 100644 --- a/zone/perlparser.h +++ b/zone/perlparser.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2004 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 */ //extends the perl parser to use C methods diff --git a/zone/petitions.cpp b/zone/petitions.cpp index e4d8a60e5..2591298cc 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.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 @@ -219,7 +219,7 @@ void PetitionList::UpdatePetition(Petition* pet) { void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; uint8 checkedout = 0; if (wpet->CheckedOut()) checkedout = 0; @@ -234,7 +234,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; uint8 checkedout = 0; if (wpet->CheckedOut()) checkedout = 1; @@ -251,7 +251,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { void ZoneDatabase::InsertPetitionToDB(Petition* wpet) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; uint8 checkedout = 0; if (wpet->CheckedOut()) @@ -278,9 +278,9 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) void ZoneDatabase::RefreshPetitionsFromDB() { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; Petition* newpet; if (RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, accountname, lastgm, petitiontext, zone, urgency, charclass, charrace, charlevel, checkouts, unavailables, ischeckedout, senttime, gmtext from petitions order by petid"), errbuf, &result)) { diff --git a/zone/petitions.h b/zone/petitions.h index ed8def1f8..76db9b006 100644 --- a/zone/petitions.h +++ b/zone/petitions.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 PETITIONS_H #define PETITIONS_H @@ -40,14 +40,14 @@ public: uint32 GetCharRace() { return charrace; } uint32 GetCharClass() { return charclass; } uint32 GetUrgency() { return urgency; } - //char* GetZone() { return this->zone; } + //char* GetZone() { return this->zone; } uint32 GetZone() { return this->zone; } - char* GetCharName() { return charname; } - char* GetAccountName() { return accountname; } - char* GetLastGM() { return lastgm; } + char* GetCharName() { return charname; } + char* GetAccountName() { return accountname; } + char* GetLastGM() { return lastgm; } time_t GetSentTime() { return senttime; } - char* GetPetitionText() { return petitiontext; } - char* GetGMText() { return gmtext; } + char* GetPetitionText() { return petitiontext; } + char* GetGMText() { return gmtext; } bool CheckedOut() { return ischeckedout; } @@ -75,12 +75,12 @@ public: protected: uint32 petid; - char charname[64]; - char accountname[32]; - char lastgm[64]; - char petitiontext[1024]; - char gmtext[1024]; - //char zone[32]; + char charname[64]; + char accountname[32]; + char lastgm[64]; + char petitiontext[1024]; + char gmtext[1024]; + //char zone[32]; uint32 zone; uint32 urgency; // 0 = green, 1 = yellow, 2 = red uint32 charclass; @@ -112,7 +112,7 @@ public: private: LinkedList list; uint32 last_insert_id; - Mutex PList_Mutex; + Mutex PList_Mutex; }; #endif diff --git a/zone/pets.cpp b/zone/pets.cpp index ce5aab779..c508d46c9 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -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 */ #include "../common/debug.h" #include "../common/spdat.h" @@ -445,10 +445,10 @@ bool ZoneDatabase::GetPetEntry(const char *pet_type, PetRecord *into) { bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetRecord *into) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 querylen = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; if (petpower <= 0) { querylen = MakeAnyLenString(&query, @@ -480,7 +480,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR mysql_free_result(result); } else { - LogFile->write(EQEMuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query, errbuf); safe_delete_array(query); } return(false); @@ -579,7 +579,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) { buffs[i].ticsremaining = pet_buffs[i].duration; buffs[i].casterlevel = pet_buffs[i].level; buffs[i].casterid = 0; - buffs[i].counters = pet_buffs[i].counters; + buffs[i].counters = pet_buffs[i].counters; buffs[i].numhits = spells[pet_buffs[i].spellid].numhits; } else { @@ -649,14 +649,14 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { // are loaded after that, up to a max depth of 5. (Arbitrary limit // so we don't go into an endless loop if the DB data is cyclic for // some reason.) - // A slot will only get an item put in it if it is empty. That way + // A slot will only get an item put in it if it is empty. That way // an equipmentset can overload a slot for the set(s) it includes. char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 querylen = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; int depth = 0; int32 curset = equipmentset; int32 nextset = -1; @@ -697,7 +697,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { mysql_free_result(result); } else { - LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query, errbuf); safe_delete_array(query); } curset = nextset; @@ -713,7 +713,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { } else { - LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query, errbuf); + LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query, errbuf); safe_delete_array(query); return false; } diff --git a/zone/pets.h b/zone/pets.h index a343b0380..92ae8bde2 100644 --- a/zone/pets.h +++ b/zone/pets.h @@ -44,21 +44,8 @@ protected: eStandingPetOrder pStandingPetOrder; bool taunting; - Timer taunt_timer; //for pet taunting + Timer taunt_timer; //for pet taunting };*/ #endif - - - - - - - - - - - - - diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 25ceac1b4..5f6fee48a 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.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 */ /* @@ -109,12 +109,12 @@ void QuestManager::Process() { //make sure the mob is still in zone. if(entity_list.IsMobInZone(cur->mob)){ if(cur->mob->IsNPC()) { - parse->EventNPC(EVENT_TIMER, cur->mob->CastToNPC(), nullptr, cur->name, 0); + parse->EventNPC(EVENT_TIMER, cur->mob->CastToNPC(), nullptr, cur->name, 0); } else { - //this is inheriently unsafe if we ever make it so more than npc/client start timers - parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0); - } + //this is inheriently unsafe if we ever make it so more than npc/client start timers + parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0); + } //we MUST reset our iterator since the quest could have removed/added any //number of timers... worst case we have to check a bunch of timers twice @@ -204,7 +204,7 @@ void QuestManager::ClearAllTimers() { //quest perl functions void QuestManager::echo(int colour, const char *str) { - entity_list.MessageClose(initiator, false, 200, colour, str); + entity_list.MessageClose(initiator, false, 200, colour, str); } void QuestManager::say(const char *str) { @@ -213,12 +213,12 @@ void QuestManager::say(const char *str) { return; } else { - if(RuleB(NPC, EnableNPCQuestJournal) && initiator) { - owner->QuestJournalledSay(initiator, str); - } - else { - owner->Say(str); - } + if(RuleB(NPC, EnableNPCQuestJournal) && initiator) { + owner->QuestJournalledSay(initiator, str); + } + else { + owner->Say(str); + } } } @@ -558,7 +558,7 @@ void QuestManager::shout2(const char *str) { void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint32 to_guilddbid, uint32 to_minstatus) { if(send_to_world) - worldserver.SendEmoteMessage(0, to_guilddbid, to_minstatus, color, "%s", str); + worldserver.SendEmoteMessage(0, to_guilddbid, to_minstatus, color, "%s", str); else entity_list.MessageStatus(to_guilddbid, to_minstatus, color, "%s", str); } @@ -797,21 +797,21 @@ void QuestManager::surname(const char *name) { } void QuestManager::permaclass(int class_id) { - //Makes the client the class specified + //Makes the client the class specified initiator->SetBaseClass(class_id); initiator->Save(2); initiator->Kick(); } void QuestManager::permarace(int race_id) { - //Makes the client the race specified + //Makes the client the race specified initiator->SetBaseRace(race_id); initiator->Save(2); initiator->Kick(); } void QuestManager::permagender(int gender_id) { - //Makes the client the gender specified + //Makes the client the gender specified initiator->SetBaseGender(gender_id); initiator->Save(2); initiator->Kick(); @@ -837,9 +837,9 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) { ( RuleB(Spells, UseCHAScribeHack) && spells[curspell].effectid[EFFECT_COUNT - 1] != 10 ) ) { - if (book_slot == -1) //no more book slots + if (book_slot == -1) //no more book slots break; - if(!IsDiscipline(curspell) && !initiator->HasSpellScribed(curspell)) { //isn't a discipline & we don't already have it scribed + if(!IsDiscipline(curspell) && !initiator->HasSpellScribed(curspell)) { //isn't a discipline & we don't already have it scribed if (SpellGlobalRule) { // Bool to see if the character has the required QGlobal to scribe it if one exists in the Spell_Globals table SpellGlobalCheckResult = initiator->SpellGlobalCheck(curspell, Char_ID); @@ -855,7 +855,7 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) { } } } - return count; //how many spells were scribed successfully + return count; //how many spells were scribed successfully } uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) { @@ -906,7 +906,7 @@ uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) { } //if we get to this point, there's already a discipline in this slot, so we skip it } } - } + } } return count; //how many disciplines were learned successfully } @@ -980,7 +980,7 @@ void QuestManager::pvp(const char *mode) { void QuestManager::movepc(int zone_id, float x, float y, float z, float heading) { if (initiator && initiator->IsClient()) - initiator->MovePC(zone_id, x, y, z, heading); + initiator->MovePC(zone_id, x, y, z, heading); } void QuestManager::gmmove(float x, float y, float z) { @@ -989,23 +989,26 @@ void QuestManager::gmmove(float x, float y, float z) { } void QuestManager::movegrp(int zoneid, float x, float y, float z) { - if (initiator && initiator->IsClient()) + if (initiator && initiator->IsClient()) { Group *g = entity_list.GetGroupByClient(initiator); - if (g != nullptr){ + if (g != nullptr) { g->TeleportGroup(owner, zoneid, 0, x, y, z, 0.0f); - } else { + } + else { Raid *r = entity_list.GetRaidByClient(initiator); - if (r != nullptr){ + if (r != nullptr) { uint32 gid = r->GetGroup(initiator); if (gid >= 0 && gid < 12) { r->TeleportGroup(owner, zoneid, 0, x, y, z, 0.0f, gid); - } else { + } + else { initiator->MovePC(zoneid, x, y, z, 0.0f); } - } else { + } + else { initiator->MovePC(zoneid, x, y, z, 0.0f); - } + } } } } @@ -1195,7 +1198,7 @@ void QuestManager::setglobal(const char *varname, const char *newvalue, int opti /* options value determines the availability of global variables to NPCs when a quest begins ------------------------------------------------------------------ - value npcid player zone + value npcid player zone ------------------------------------------------------------------ 0 this this this 1 all this this @@ -1206,7 +1209,7 @@ void QuestManager::setglobal(const char *varname, const char *newvalue, int opti 6 this all all 7 all all all */ - if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved + if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved { qgCharid=initiator->CharacterID(); } @@ -1332,7 +1335,7 @@ void QuestManager::delglobal(const char *varname) { int qgZoneid=zone->GetZoneID(); int qgCharid=0; int qgNpcid=owner->GetNPCTypeID(); - if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved + if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved { qgCharid=initiator->CharacterID(); } @@ -1342,10 +1345,10 @@ void QuestManager::delglobal(const char *varname) { qgCharid=-qgNpcid; // make char id negative npc id as a fudge } if (!database.RunQuery(query, - MakeAnyLenString(&query, - "DELETE FROM quest_globals WHERE name='%s'" - " && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)", - varname,qgNpcid,qgCharid,qgZoneid),errbuf)) + MakeAnyLenString(&query, + "DELETE FROM quest_globals WHERE name='%s'" + " && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)", + varname,qgNpcid,qgCharid,qgZoneid),errbuf)) { cerr << "delglobal error deleting " << varname << " : " << errbuf << endl; } @@ -1887,7 +1890,8 @@ void QuestManager::npcfeature(char *feature, int setting) void QuestManager::popup(char *title, char *text, uint32 popupid, uint32 buttons, uint32 Duration) { - if(initiator) initiator->SendPopupToClient(title, text, popupid, buttons, Duration); + if(initiator) + initiator->SendPopupToClient(title, text, popupid, buttons, Duration); } #ifdef BOTS @@ -2127,7 +2131,7 @@ bool QuestManager::istaskappropriate(int task) { return false; } void QuestManager::clearspawntimers() { - if(zone) { + if(zone) { //TODO: Dec 19, 2008, replace with code updated for current spawn timers. LinkedListIterator iterator(zone->spawn2_list); iterator.Reset(); @@ -2159,7 +2163,7 @@ int QuestManager::getlevel(uint8 type) else if(type == 1) { Group *g = entity_list.GetGroupByClient(initiator); - if (g != nullptr) + if (g != nullptr) return (g->GetAvgLevel()); else return 0; @@ -2167,7 +2171,7 @@ int QuestManager::getlevel(uint8 type) else if(type == 2) { Raid *r = entity_list.GetRaidByClient(initiator); - if (r != nullptr) + if (r != nullptr) return (r->GetAvgLevel()); else return 0; @@ -2304,7 +2308,7 @@ void QuestManager::UpdateSpawnTimer(uint32 id, uint32 newTime) } } -// used to set the number of an item in the selected merchant's temp item list. Defaults to zero if no quantity is specified. +// used to set the number of an item in the selected merchant's temp item list. Defaults to zero if no quantity is specified. void QuestManager::MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity) { Mob* merchant = entity_list.GetMobByNpcTypeID(NPCid); @@ -2475,9 +2479,9 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) { MYSQL_ROW row; int sayid = 0; - int sz = strlen(Phrase); - char *escaped_string = new char[sz * 2]; - database.DoEscapeString(escaped_string, Phrase, sz); + int sz = strlen(Phrase); + char *escaped_string = new char[sz * 2]; + database.DoEscapeString(escaped_string, Phrase, sz); // Query for an existing phrase and id in the saylink table if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT `id` FROM `saylink` WHERE `phrase` = '%s'", escaped_string),errbuf,&result)) @@ -2490,7 +2494,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) { } mysql_free_result(result); } - else // Add a new saylink entry to the database and query it again for the new sayid number + else // Add a new saylink entry to the database and query it again for the new sayid number { safe_delete_array(query); @@ -2516,7 +2520,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) { } } safe_delete_array(query); - safe_delete_array(escaped_string); + safe_delete_array(escaped_string); if(silent) sayid = sayid + 750000; @@ -2631,17 +2635,17 @@ uint8 QuestManager::FactionValue() } void QuestManager::enabletitle(int titleset) { - initiator->EnableTitle(titleset); + initiator->EnableTitle(titleset); } bool QuestManager::checktitle(int titleset) { - return initiator->CheckTitle(titleset); + return initiator->CheckTitle(titleset); } void QuestManager::removetitle(int titleset) { - initiator->RemoveTitle(titleset); + initiator->RemoveTitle(titleset); } void QuestManager::wearchange(uint8 slot, uint16 texture) @@ -2684,24 +2688,24 @@ void QuestManager::voicetell(char *str, int macronum, int racenum, int gendernum } void QuestManager::LearnRecipe(uint32 recipe_id) { - if(!initiator) - return; - initiator->LearnRecipe(recipe_id); + if(!initiator) + return; + initiator->LearnRecipe(recipe_id); } void QuestManager::SendMail(const char *to, const char *from, const char *subject, const char *message) { - if(to == nullptr || from == nullptr || subject == nullptr || message == nullptr) { - return; - } + if(to == nullptr || from == nullptr || subject == nullptr || message == nullptr) { + return; + } - uint32 message_len = strlen(message) + 1; - ServerPacket* pack = new ServerPacket(ServerOP_UCSMailMessage, sizeof(ServerMailMessageHeader_Struct) + message_len); + uint32 message_len = strlen(message) + 1; + ServerPacket* pack = new ServerPacket(ServerOP_UCSMailMessage, sizeof(ServerMailMessageHeader_Struct) + message_len); ServerMailMessageHeader_Struct* mail = (ServerMailMessageHeader_Struct*) pack->pBuffer; - strn0cpy(mail->to, to, 64); - strn0cpy(mail->from, from, 64); - strn0cpy(mail->subject, subject, 128); - strcpy(mail->message, message); + strn0cpy(mail->to, to, 64); + strn0cpy(mail->from, from, 64); + strn0cpy(mail->subject, subject, 128); + strcpy(mail->message, message); worldserver.SendPacket(pack); safe_delete(pack); @@ -2715,16 +2719,16 @@ uint16 QuestManager::CreateDoor(const char* model, float x, float y, float z, fl } int32 QuestManager::GetZoneID(const char *zone) { - return static_cast(database.GetZoneID(zone)); + return static_cast(database.GetZoneID(zone)); } const char* QuestManager::GetZoneLongName(const char *zone) { - char *long_name; - database.GetZoneLongName(zone, &long_name); - std::string ln = long_name; - safe_delete_array(long_name); + char *long_name; + database.GetZoneLongName(zone, &long_name); + std::string ln = long_name; + safe_delete_array(long_name); - return ln.c_str(); + return ln.c_str(); } bool QuestManager::TurnInItem(uint32 itm, int charges) @@ -2793,3 +2797,4 @@ void QuestManager::CrossZoneMessagePlayerByName(uint32 Type, const char *CharNam worldserver.SendPacket(pack); safe_delete(pack); } + diff --git a/zone/questmgr.h b/zone/questmgr.h index ce01334b5..b78e01991 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.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 __QUEST_MANAGER_H__ #define __QUEST_MANAGER_H__ @@ -62,7 +62,7 @@ public: void addloot(int item_id, int charges = 0, bool equipitem = true); void Zone(const char *zone_name); void settimer(const char *timer_name, int seconds); - void settimerMS(const char *timer_name, int milliseconds); + void settimerMS(const char *timer_name, int milliseconds); void stoptimer(const char *timer_name); void stopalltimers(); void emote(const char *str); @@ -80,7 +80,7 @@ public: // void cumflag(); // void flagnpc(uint32 flag_num, uint8 flag_value); // void flagcheck(uint32 flag_to_check, uint32 flag_to_set); -// bool isflagset(int flag_num); +// bool isflagset(int flag_num); void changedeity(int diety_id); void exp(int amt); void level(int newlevel); @@ -190,15 +190,15 @@ public: int activetasksinset(int taskset); int completedtasksinset(int taskset); bool istaskappropriate(int task); - void clearspawntimers(); + void clearspawntimers(); void ze(int type, const char *str); void we(int type, const char *str); - int getlevel(uint8 type); - int collectitems(uint32 item_id, bool remove); - int collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove); - void enabletitle(int titleset); - bool checktitle(int titlecheck); - void removetitle(int titlecheck); + int getlevel(uint8 type); + int collectitems(uint32 item_id, bool remove); + int collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove); + void enabletitle(int titleset); + bool checktitle(int titlecheck); + void removetitle(int titlecheck); uint16 CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time = 300000); uint16 CreateGroundObjectFromModel(const char* model, float x, float y, float z, float heading, uint8 type = 0x00, uint32 decay_time = 0); @@ -227,11 +227,11 @@ public: uint8 FactionValue(); void wearchange(uint8 slot, uint16 texture); void voicetell(char *str, int macronum, int racenum, int gendernum); - void LearnRecipe(uint32 recipe_id); - void SendMail(const char *to, const char *from, const char *subject, const char *message); + void LearnRecipe(uint32 recipe_id); + void SendMail(const char *to, const char *from, const char *subject, const char *message); uint16 CreateDoor( const char* model, float x, float y, float z, float heading, uint8 opentype, uint16 size); - int32 GetZoneID(const char *zone); - const char *GetZoneLongName(const char *zone); + int32 GetZoneID(const char *zone); + const char *GetZoneLongName(const char *zone); //not in here because it retains perl types //thing ChooseRandom(array_of_things) @@ -275,7 +275,7 @@ protected: class QuestTimer { public: inline QuestTimer(int duration, Mob *_mob, string _name) : mob(_mob), name(_name), Timer_(duration) { Timer_.Start(duration, false); } - Mob* mob; + Mob* mob; string name; Timer Timer_; }; diff --git a/zone/queues.h b/zone/queues.h index c6779385a..474d7d898 100644 --- a/zone/queues.h +++ b/zone/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 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. + 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 */ + 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/zone/raid.h b/zone/raid.h index 8cbd0f1a4..fad4b9fa2 100644 --- a/zone/raid.h +++ b/zone/raid.h @@ -1,23 +1,23 @@ /* 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 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. + 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 */ + 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 */ -/* Parser needs these defines always, even if USE_RAID is not defined */ -#define RAID_TYPE_0 1 /* Striping */ -#define RAID_TYPE_x 2 /* Some new modes */ +/* Parser needs these defines always, even if USE_RAID is not defined */ +#define RAID_TYPE_0 1 /* Striping */ +#define RAID_TYPE_x 2 /* Some new modes */ #define RAID_TYPE_y 3 #define RAID_DEFAULT_CHUNKS 4 @@ -43,119 +43,119 @@ const char *my_raid_type(int raid_type); /* Trap all occurences of my_...() in source and use our wrapper around this function */ #ifdef MAP_TO_USE_RAID -#define my_read(A,B,C,D) my_raid_read(A,B,C,D) -#define my_write(A,B,C,D) my_raid_write(A,B,C,D) -#define my_pwrite(A,B,C,D,E) my_raid_pwrite(A,B,C,D,E) -#define my_pread(A,B,C,D,E) my_raid_pread(A,B,C,D,E) -#define my_chsize(A,B,C) my_raid_chsize(A,B,C) -#define my_close(A,B) my_raid_close(A,B) -#define my_tell(A,B) my_raid_tell(A,B) -#define my_seek(A,B,C,D) my_raid_seek(A,B,C,D) -#define my_lock(A,B,C,D,E) my_raid_lock(A,B,C,D,E) -#define my_fstat(A,B,C) my_raid_fstat(A,B,C) +#define my_read(A,B,C,D) my_raid_read(A,B,C,D) +#define my_write(A,B,C,D) my_raid_write(A,B,C,D) +#define my_pwrite(A,B,C,D,E) my_raid_pwrite(A,B,C,D,E) +#define my_pread(A,B,C,D,E) my_raid_pread(A,B,C,D,E) +#define my_chsize(A,B,C) my_raid_chsize(A,B,C) +#define my_close(A,B) my_raid_close(A,B) +#define my_tell(A,B) my_raid_tell(A,B) +#define my_seek(A,B,C,D) my_raid_seek(A,B,C,D) +#define my_lock(A,B,C,D,E) my_raid_lock(A,B,C,D,E) +#define my_fstat(A,B,C) my_raid_fstat(A,B,C) #endif /* MAP_TO_USE_RAID */ #ifdef __cplusplus extern "C" { #endif - void init_raid(void); - void end_raid(void); +void init_raid(void); +void end_raid(void); - bool is_raid(File fd); - File my_raid_create(const char *FileName, int CreateFlags, int access_flags, - uint raid_type, uint raid_chunks, ulong raid_chunksize, - myf MyFlags); - File my_raid_open(const char *FileName, int Flags, - uint raid_type, uint raid_chunks, ulong raid_chunksize, - myf MyFlags); - int my_raid_rename(const char *from, const char *to, uint raid_chunks, - myf MyFlags); - int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags); - int my_raid_redel(const char *old_name, const char *new_name, - uint raid_chunks, myf MyFlags); +bool is_raid(File fd); +File my_raid_create(const char *FileName, int CreateFlags, int access_flags, + uint raid_type, uint raid_chunks, ulong raid_chunksize, + myf MyFlags); +File my_raid_open(const char *FileName, int Flags, + uint raid_type, uint raid_chunks, ulong raid_chunksize, + myf MyFlags); +int my_raid_rename(const char *from, const char *to, uint raid_chunks, + myf MyFlags); +int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags); +int my_raid_redel(const char *old_name, const char *new_name, + uint raid_chunks, myf MyFlags); - my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags); - my_off_t my_raid_tell(File fd, myf MyFlags); +my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags); +my_off_t my_raid_tell(File fd, myf MyFlags); - uint my_raid_write(File,const byte *Buffer, uint Count, myf MyFlags); - uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags); +uint my_raid_write(File,const byte *Buffer, uint Count, myf MyFlags); +uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags); - uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset, - myf MyFlags); - uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count, - my_off_t offset, myf MyFlags); +uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset, + myf MyFlags); +uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count, + my_off_t offset, myf MyFlags); - int my_raid_lock(File,int locktype, my_off_t start, my_off_t length, - myf MyFlags); - int my_raid_chsize(File fd, my_off_t newlength, myf MyFlags); - int my_raid_close(File, myf MyFlags); - int my_raid_fstat(int Filedes, struct stat *buf, myf MyFlags); +int my_raid_lock(File,int locktype, my_off_t start, my_off_t length, + myf MyFlags); +int my_raid_chsize(File fd, my_off_t newlength, myf MyFlags); +int my_raid_close(File, myf MyFlags); +int my_raid_fstat(int Filedes, struct stat *buf, myf MyFlags); #ifdef __cplusplus } class RaidName { - public: - RaidName(const char *FileName); - ~RaidName(); - bool IsRaid(); - int Rename(const char * from, const char * to, myf MyFlags); - private: - uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */ - uint _raid_chunks; /* 1..n */ - ulong _raid_chunksize; /* 1..n in bytes */ + public: + RaidName(const char *FileName); + ~RaidName(); + bool IsRaid(); + int Rename(const char * from, const char * to, myf MyFlags); + private: + uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */ + uint _raid_chunks; /* 1..n */ + ulong _raid_chunksize; /* 1..n in bytes */ }; class RaidFd { - public: - RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize); - ~RaidFd(); - File Create(const char *FileName, int CreateFlags, int access_flags, + public: + RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize); + ~RaidFd(); + File Create(const char *FileName, int CreateFlags, int access_flags, myf MyFlags); - File Open(const char *FileName, int Flags, myf MyFlags); - my_off_t Seek(my_off_t pos,int whence,myf MyFlags); - my_off_t Tell(myf MyFlags); - int Write(const byte *Buffer, uint Count, myf MyFlags); - int Read(const byte *Buffer, uint Count, myf MyFlags); - int Lock(int locktype, my_off_t start, my_off_t length, myf MyFlags); - int Chsize(File fd, my_off_t newlength, myf MyFlags); - int Fstat(int fd, MY_STAT *stat_area, myf MyFlags ); - int Close(myf MyFlags); - static bool IsRaid(File fd); - static DYNAMIC_ARRAY _raid_map; /* Map of RaidFD* */ - private: + File Open(const char *FileName, int Flags, myf MyFlags); + my_off_t Seek(my_off_t pos,int whence,myf MyFlags); + my_off_t Tell(myf MyFlags); + int Write(const byte *Buffer, uint Count, myf MyFlags); + int Read(const byte *Buffer, uint Count, myf MyFlags); + int Lock(int locktype, my_off_t start, my_off_t length, myf MyFlags); + int Chsize(File fd, my_off_t newlength, myf MyFlags); + int Fstat(int fd, MY_STAT *stat_area, myf MyFlags ); + int Close(myf MyFlags); + static bool IsRaid(File fd); + static DYNAMIC_ARRAY _raid_map; /* Map of RaidFD* */ + private: - uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */ - uint _raid_chunks; /* 1..n */ - ulong _raid_chunksize; /* 1..n in bytes */ + uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */ + uint _raid_chunks; /* 1..n */ + ulong _raid_chunksize; /* 1..n in bytes */ - ulong _total_block; /* We are operating with block no x (can be 0..many). */ - uint _this_block; /* can be 0.._raid_chunks */ - uint _remaining_bytes; /* Maximum bytes that can be written in this block */ + ulong _total_block; /* We are operating with block no x (can be 0..many). */ + uint _this_block; /* can be 0.._raid_chunks */ + uint _remaining_bytes; /* Maximum bytes that can be written in this block */ - my_off_t _position; - my_off_t _size; /* Cached file size for faster seek(SEEK_END) */ - File _fd; - File *_fd_vector; /* Array of File */ - off_t *_seek_vector; /* Array of cached seek positions */ + my_off_t _position; + my_off_t _size; /* Cached file size for faster seek(SEEK_END) */ + File _fd; + File *_fd_vector; /* Array of File */ + off_t *_seek_vector; /* Array of cached seek positions */ - inline void Calculate() - { - DBUG_ENTER("RaidFd::_Calculate"); - DBUG_PRINT("info",("_position: %lu _raid_chunksize: %d, _size: %lu", - (ulong) _position, _raid_chunksize, (ulong) _size)); + inline void Calculate() + { + DBUG_ENTER("RaidFd::_Calculate"); + DBUG_PRINT("info",("_position: %lu _raid_chunksize: %d, _size: %lu", + (ulong) _position, _raid_chunksize, (ulong) _size)); - _total_block = (ulong) (_position / _raid_chunksize); - _this_block = _total_block % _raid_chunks; /* can be 0.._raid_chunks */ - _remaining_bytes = (uint) (_raid_chunksize - - (_position - _total_block * _raid_chunksize)); - DBUG_PRINT("info", - ("_total_block: %d this_block: %d _remaining_bytes:%d", - _total_block, _this_block, _remaining_bytes)); - DBUG_VOID_RETURN; - } + _total_block = (ulong) (_position / _raid_chunksize); + _this_block = _total_block % _raid_chunks; /* can be 0.._raid_chunks */ + _remaining_bytes = (uint) (_raid_chunksize - (_position - _total_block * _raid_chunksize)); + DBUG_PRINT("info", + ("_total_block: %d this_block: %d _remaining_bytes:%d", + _total_block, _this_block, _remaining_bytes)); + DBUG_VOID_RETURN; + } }; #endif /* __cplusplus */ #endif /* USE_RAID */ + diff --git a/zone/raids.cpp b/zone/raids.cpp index 8bd5519e3..6de7cf912 100644 --- a/zone/raids.cpp +++ b/zone/raids.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" #include "masterentity.h" @@ -75,7 +75,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo return; char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO raid_members SET raidid=%lu, charid=%lu, groupid=%lu, _class=%d, level=%d, name='%s', isgroupleader=%d, israidleader=%d, islooter=%d", (unsigned long)GetID(), (unsigned long)c->CharacterID(), (unsigned long)group, c->GetClass(), c->GetLevel(), c->GetName(), groupleader, rleader, looter ),errbuf,&result)){ mysql_free_result(result); @@ -103,7 +103,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo void Raid::RemoveMember(const char *c) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "DELETE FROM raid_members where name='%s'", c ),errbuf,&result)){ mysql_free_result(result); @@ -134,7 +134,7 @@ void Raid::RemoveMember(const char *c) void Raid::DisbandRaid() { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "DELETE FROM raid_members WHERE raidid=%lu", (unsigned long)GetID()),errbuf,&result)){ mysql_free_result(result); @@ -160,7 +160,7 @@ void Raid::DisbandRaid() void Raid::MoveMember(const char *name, uint32 newGroup) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET groupid=%lu WHERE name='%s'", (unsigned long)newGroup, name),errbuf,&result)){ mysql_free_result(result); @@ -184,7 +184,7 @@ void Raid::MoveMember(const char *name, uint32 newGroup) void Raid::SetGroupLeader(const char *who, bool glFlag) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET isgroupleader=%lu WHERE name='%s'", (unsigned long)glFlag, who),errbuf,&result)){ mysql_free_result(result); @@ -211,7 +211,7 @@ void Raid::SetGroupLeader(const char *who, bool glFlag) void Raid::SetRaidLeader(const char *wasLead, const char *name) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (!database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET israidleader=0 WHERE name='%s'", wasLead),errbuf,&result)){ printf("Set Raid Leader error: %s\n", errbuf); @@ -265,7 +265,7 @@ bool Raid::IsGroupLeader(const char *who) void Raid::UpdateLevel(const char *name, int newLevel) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET level=%lu WHERE name='%s'", (unsigned long)newLevel, name),errbuf,&result)){ mysql_free_result(result); @@ -514,8 +514,8 @@ void Raid::BalanceHP(int32 penalty, uint32 gid) if(members[gi].member){ if(members[gi].GroupNumber == gid) { - if((members[gi].member->GetMaxHP() - dmgtaken) < 1){ //this way the ability will never kill someone - members[gi].member->SetHP(1); //but it will come darn close + if((members[gi].member->GetMaxHP() - dmgtaken) < 1){//this way the ability will never kill someone + members[gi].member->SetHP(1); //but it will come darn close members[gi].member->SendHPUpdate(); } else{ @@ -570,90 +570,89 @@ void Raid::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum if(copper == 0 && silver == 0 && gold == 0 && platinum == 0) return; - uint32 i; - uint8 membercount = 0; - for (i = 0; i < MAX_RAID_MEMBERS; i++) { - if (members[i].member != nullptr) { + uint32 i; + uint8 membercount = 0; + for (i = 0; i < MAX_RAID_MEMBERS; i++) { + if (members[i].member != nullptr) { + membercount++; + } + } - membercount++; - } - } + if (membercount == 0) + return; - if (membercount == 0) - return; + uint32 mod; + //try to handle round off error a little better + if(membercount > 1) { + mod = platinum % membercount; + if((mod) > 0) { + platinum -= mod; + gold += 10 * mod; + } + mod = gold % membercount; + if((mod) > 0) { + gold -= mod; + silver += 10 * mod; + } + mod = silver % membercount; + if((mod) > 0) { + silver -= mod; + copper += 10 * mod; + } + } - uint32 mod; - //try to handle round off error a little better - if(membercount > 1) { - mod = platinum % membercount; - if((mod) > 0) { - platinum -= mod; - gold += 10 * mod; - } - mod = gold % membercount; - if((mod) > 0) { - gold -= mod; - silver += 10 * mod; - } - mod = silver % membercount; - if((mod) > 0) { - silver -= mod; - copper += 10 * mod; - } - } + //calculate the splits + //We can still round off copper pieces, but I dont care + uint32 sc; + uint32 cpsplit = copper / membercount; + sc = copper % membercount; + uint32 spsplit = silver / membercount; + uint32 gpsplit = gold / membercount; + uint32 ppsplit = platinum / membercount; - //calculate the splits - //We can still round off copper pieces, but I dont care - uint32 sc; - uint32 cpsplit = copper / membercount; - sc = copper % membercount; - uint32 spsplit = silver / membercount; - uint32 gpsplit = gold / membercount; - uint32 ppsplit = platinum / membercount; + char buf[128]; + buf[63] = '\0'; + string msg = "You receive"; + bool one = false; - char buf[128]; - buf[63] = '\0'; - string msg = "You receive"; - bool one = false; + if(ppsplit > 0) { + snprintf(buf, 63, " %u platinum", ppsplit); + msg += buf; + one = true; + } + if(gpsplit > 0) { + if(one) + msg += ","; + snprintf(buf, 63, " %u gold", gpsplit); + msg += buf; + one = true; + } + if(spsplit > 0) { + if(one) + msg += ","; + snprintf(buf, 63, " %u silver", spsplit); + msg += buf; + one = true; + } + if(cpsplit > 0) { + if(one) + msg += ","; + //this message is not 100% accurate for the splitter + //if they are receiving any roundoff + snprintf(buf, 63, " %u copper", cpsplit); + msg += buf; + one = true; + } + msg += " as your split"; - if(ppsplit > 0) { - snprintf(buf, 63, " %u platinum", ppsplit); - msg += buf; - one = true; - } - if(gpsplit > 0) { - if(one) - msg += ","; - snprintf(buf, 63, " %u gold", gpsplit); - msg += buf; - one = true; - } - if(spsplit > 0) { - if(one) - msg += ","; - snprintf(buf, 63, " %u silver", spsplit); - msg += buf; - one = true; - } - if(cpsplit > 0) { - if(one) - msg += ","; - //this message is not 100% accurate for the splitter - //if they are receiving any roundoff - snprintf(buf, 63, " %u copper", cpsplit); - msg += buf; - one = true; - } - msg += " as your split"; - - for (i = 0; i < MAX_RAID_MEMBERS; i++) { - if (members[i].member != nullptr) { // If Group Member is Client + for (i = 0; i < MAX_RAID_MEMBERS; i++) { + if (members[i].member != nullptr) { // If Group Member is Client //I could not get MoneyOnCorpse to work, so we use this members[i].member->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true); members[i].member->Message(2, msg.c_str()); - } - } + } + } } void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ @@ -721,7 +720,7 @@ void Raid::TeleportRaid(Mob* sender, uint32 zoneID, uint16 instance_id, float x, void Raid::ChangeLootType(uint32 type) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_details SET loottype=%lu WHERE raidid=%lu", (unsigned long)type, (unsigned long)GetID()),errbuf,&result)){ mysql_free_result(result); @@ -734,7 +733,7 @@ void Raid::ChangeLootType(uint32 type) void Raid::AddRaidLooter(const char* looter) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET islooter=1 WHERE name='%s'", looter),errbuf,&result)){ mysql_free_result(result); @@ -771,7 +770,7 @@ void Raid::AddRaidLooter(const char* looter) void Raid::RemoveRaidLooter(const char* looter) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET islooter=0 WHERE name='%s'", looter),errbuf,&result)){ mysql_free_result(result); @@ -1227,7 +1226,7 @@ void Raid::SendRaidGroupRemove(const char *who, uint32 gid) void Raid::LockRaid(bool lockFlag) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_details SET locked=%d WHERE raidid=%lu", lockFlag, (unsigned long)GetID()),errbuf,&result)){ mysql_free_result(result); @@ -1253,7 +1252,7 @@ void Raid::LockRaid(bool lockFlag) void Raid::SetRaidDetails() { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO raid_details SET raidid=%lu, loottype=4, locked=0", (unsigned long)GetID()),errbuf,&result)){ mysql_free_result(result); @@ -1265,7 +1264,7 @@ void Raid::SetRaidDetails() void Raid::GetRaidDetails() { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; MYSQL_ROW row; if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT locked, loottype FROM raid_details WHERE raidid=%lu", (unsigned long)GetID()),errbuf,&result)){ @@ -1288,7 +1287,7 @@ bool Raid::LearnMembers() { memset(members, 0, (sizeof(RaidMember)*MAX_RAID_MEMBERS)); char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; MYSQL_ROW row; if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT name, groupid, _class, level, isgroupleader, israidleader, islooter FROM raid_members WHERE raidid=%lu", (unsigned long)GetID()),errbuf,&result)){ @@ -1368,7 +1367,7 @@ void Raid::SendHPPacketsTo(Client *c) uint32 gid = this->GetGroup(c); EQApplicationPacket hpapp; - EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); + EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); for(int x = 0; x < MAX_RAID_MEMBERS; x++) { if(members[x].member) @@ -1377,18 +1376,18 @@ void Raid::SendHPPacketsTo(Client *c) { members[x].member->CreateHPPacket(&hpapp); c->QueuePacket(&hpapp, false); - if(c->GetClientVersion() >= EQClientSoD) - { - outapp.SetOpcode(OP_MobManaUpdate); - MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer; - mmus->spawn_id = members[x].member->GetID(); - mmus->mana = members[x].member->GetManaPercent(); - c->QueuePacket(&outapp, false); - outapp.SetOpcode(OP_MobEnduranceUpdate); - MobEnduranceUpdate_Struct *meus = (MobEnduranceUpdate_Struct *)outapp.pBuffer; - meus->endurance = members[x].member->GetEndurancePercent(); - c->QueuePacket(&outapp, false); - } + if(c->GetClientVersion() >= EQClientSoD) + { + outapp.SetOpcode(OP_MobManaUpdate); + MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer; + mmus->spawn_id = members[x].member->GetID(); + mmus->mana = members[x].member->GetManaPercent(); + c->QueuePacket(&outapp, false); + outapp.SetOpcode(OP_MobEnduranceUpdate); + MobEnduranceUpdate_Struct *meus = (MobEnduranceUpdate_Struct *)outapp.pBuffer; + meus->endurance = members[x].member->GetEndurancePercent(); + c->QueuePacket(&outapp, false); + } } } } @@ -1403,7 +1402,7 @@ void Raid::SendHPPacketsFrom(Mob *m) if(m->IsClient()) gid = this->GetGroup(m->CastToClient()); EQApplicationPacket hpapp; - EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); + EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); m->CreateHPPacket(&hpapp); for(int x = 0; x < MAX_RAID_MEMBERS; x++) @@ -1413,18 +1412,18 @@ void Raid::SendHPPacketsFrom(Mob *m) if(!m->IsClient() || ((members[x].member != m->CastToClient()) && (members[x].GroupNumber == gid))) { members[x].member->QueuePacket(&hpapp, false); - if(members[x].member->GetClientVersion() >= EQClientSoD) - { - outapp.SetOpcode(OP_MobManaUpdate); - MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer; - mmus->spawn_id = m->GetID(); - mmus->mana = m->GetManaPercent(); - members[x].member->QueuePacket(&outapp, false); - outapp.SetOpcode(OP_MobEnduranceUpdate); - MobEnduranceUpdate_Struct *meus = (MobEnduranceUpdate_Struct *)outapp.pBuffer; - meus->endurance = m->GetEndurancePercent(); - members[x].member->QueuePacket(&outapp, false); - } + if(members[x].member->GetClientVersion() >= EQClientSoD) + { + outapp.SetOpcode(OP_MobManaUpdate); + MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer; + mmus->spawn_id = m->GetID(); + mmus->mana = m->GetManaPercent(); + members[x].member->QueuePacket(&outapp, false); + outapp.SetOpcode(OP_MobEnduranceUpdate); + MobEnduranceUpdate_Struct *meus = (MobEnduranceUpdate_Struct *)outapp.pBuffer; + meus->endurance = m->GetEndurancePercent(); + members[x].member->QueuePacket(&outapp, false); + } } } } diff --git a/zone/raids.h b/zone/raids.h index ab0089cea..89f034df0 100644 --- a/zone/raids.h +++ b/zone/raids.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 RAIDS_H #define RAIDS_H @@ -47,7 +47,7 @@ enum { //raid packet types: raidChangeGroupLeader = 13, //136 raid leader, new group leader, group_id? raidBecomeGroupLeader = 14, //472 raidUnknown2 = 15, - raidChangeGroup = 16, //?? len 136 old leader, new leader, 0 (preceeded with a remove2) + raidChangeGroup = 16, //?? len 136 old leader, new leader, 0 (preceeded with a remove2) raidLock = 17, //len 136 leader?, leader, 0 raidUnlock = 18, //len 136 leader?, leader, 0 raidRedStringID = 19, @@ -125,7 +125,7 @@ public: uint32 GetLowestLevel(); uint32 GetGroup(const char *name); uint32 GetGroup(Client *c); - uint16 GetAvgLevel(); + uint16 GetAvgLevel(); uint32 GetLootType() { return LootType; } void ChangeLootType(uint32 type); @@ -143,9 +143,7 @@ public: void LockRaid(bool lockFlag); bool IsLocked() { return locked; } - /* - * Actual Implementation Stuff - */ + //Actual Implementation Stuff void RaidMessage_StringID(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0); void CastGroupSpell(Mob* caster,uint16 spellid, uint32 gid); diff --git a/zone/skills.h b/zone/skills.h index 2ea5a7b9f..581b66647 100644 --- a/zone/skills.h +++ b/zone/skills.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 SKILLS_H #define SKILLS_H diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index faf402959..6d2b22e8a 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.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 @@ -76,7 +76,7 @@ Spawn2::Spawn2(uint32 in_spawn2_id, uint32 spawngroup_id, y = in_y; z = in_z; heading = in_heading; - respawn_ = respawn; + respawn_ = respawn; variance_ = variance; grid_ = grid; condition_id = in_cond_id; @@ -225,12 +225,12 @@ bool Spawn2::Process() { npcthis = npc; npc->AddLootTable(); npc->SetSp2(spawngroup_id_); - npc->SaveGuardPointAnim(anim); - npc->SetAppearance((EmuAppearance)anim); + npc->SaveGuardPointAnim(anim); + npc->SetAppearance((EmuAppearance)anim); entity_list.AddNPC(npc); //this limit add must be done after the AddNPC since we need the entity ID. entity_list.LimitAddNPC(npc); - if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay) + if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay) npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay); if(zone->InstantGrids()) { _log(SPAWNS__MAIN, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); @@ -415,7 +415,7 @@ bool ZoneDatabase::CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; // if(GetInverseXY()==1) { @@ -683,12 +683,12 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { SpawnCondition cond; len = MakeAnyLenString(&query, - "UPDATE spawn_events SET " - "next_minute=%d, next_hour=%d, next_day=%d, next_month=%d, " - "next_year=%d, enabled=%d " - "WHERE id=%d", - event.next.minute, event.next.hour, event.next.day, event.next.month, - event.next.year, event.enabled?1:0, event.id + "UPDATE spawn_events SET " + "next_minute=%d, next_hour=%d, next_day=%d, next_month=%d, " + "next_year=%d, enabled=%d " + "WHERE id=%d", + event.next.minute, event.next.hour, event.next.day, event.next.month, + event.next.year, event.enabled?1:0, event.id ); if(!database.RunQuery(query, len, errbuf)) { LogFile->write(EQEMuLog::Error, "Unable to update spawn event '%s': %s\n", query, errbuf); @@ -722,8 +722,8 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, stri bool ret = false; len = MakeAnyLenString(&query, - "SELECT id,cond_id,period,next_minute,next_hour,next_day,next_month,next_year,enabled,action,argument,zone " - "FROM spawn_events WHERE id=%d", event_id); + "SELECT id,cond_id,period,next_minute,next_hour,next_day,next_month,next_year,enabled,action,argument,zone " + "FROM spawn_events WHERE id=%d", event_id); if (database.RunQuery(query, len, errbuf, &result)) { safe_delete_array(query); if((row = mysql_fetch_row(result))) { @@ -813,8 +813,8 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //load spawn events SpawnEvent event; len = MakeAnyLenString(&query, - "SELECT id,cond_id,period,next_minute,next_hour,next_day,next_month,next_year,enabled,action,argument " - "FROM spawn_events WHERE zone='%s'", zone_name); + "SELECT id,cond_id,period,next_minute,next_hour,next_day,next_month,next_year,enabled,action,argument " + "FROM spawn_events WHERE zone='%s'", zone_name); if (database.RunQuery(query, len, errbuf, &result)) { safe_delete_array(query); while((row = mysql_fetch_row(result))) { @@ -847,7 +847,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in return false; } - //now we need to catch up on events that happened while we were away + //now we need to catch up on events that happened while we were away //and use them to alter just the condition variables. //each spawn2 will then use its correct condition value when @@ -1121,7 +1121,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese //advance the next time by our period EQTime::AddMinutes(e.period, &e.next); } else { - _log(SPAWNS__CONDITIONS, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); + _log(SPAWNS__CONDITIONS, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); } //save the event in the DB UpdateDBEvent(e); @@ -1195,12 +1195,3 @@ bool SpawnConditionManager::Check(uint16 condition, int16 min_value) { return(cond.value >= min_value); } - - - - - - - - - diff --git a/zone/spawn2.h b/zone/spawn2.h index 6a12f50cf..375f624ce 100644 --- a/zone/spawn2.h +++ b/zone/spawn2.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 SPAWN2_H #define SPAWN2_H @@ -91,7 +91,7 @@ private: uint16 condition_id; int16 condition_min_value; bool enabled; - EmuAppearance anim; + EmuAppearance anim; bool IsDespawned; uint32 killcount; }; @@ -112,7 +112,7 @@ public: uint16 condition_id; int16 value; - OnChange on_change; + OnChange on_change; }; class SpawnEvent { diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index 20eca6eb9..d31d53bae 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.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 "spawngroup.h" @@ -92,7 +92,7 @@ uint32 SpawnGroup::GetNPCType() { roll -= se->chance; } } - //CODER implement random table + //CODER implement random table return npcType; } diff --git a/zone/spawngroup.h b/zone/spawngroup.h index 6c36c0b11..bc80b7877 100644 --- a/zone/spawngroup.h +++ b/zone/spawngroup.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 SPAWNGROUP_H #define SPAWNGROUP_H @@ -45,14 +45,14 @@ public: uint32 GetNPCType(); void AddSpawnEntry( SpawnEntry* newEntry ); uint32 id; - float roamdist; - float roambox[4]; + float roamdist; + float roambox[4]; int delay; int despawn; uint32 despawn_timer; private: char name_[120]; - list list_; + list list_; uint8 group_spawn_limit; //max # of this entry which can be spawned by this group }; @@ -66,7 +66,7 @@ public: SpawnGroup* GetSpawnGroup(uint32 id); bool RemoveSpawnGroup(uint32 in_id); private: -// LinkedList list_; + //LinkedList list_; map groups; }; diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 9c2e83ef6..4950e3b35 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator -Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.net) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2002 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" @@ -33,14 +33,8 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.net) int Mob::GetKickDamage() { int multiple=(GetLevel()*100/5); multiple += 100; - int32 dmg=( - ( - (GetSkill(KICK) + GetSTR() + GetLevel())*100 / 9000 - ) * multiple - ) - + 600; //Set a base of 6 damage, 1 seemed too low at the sub level 30 level. - if(GetClass() == WARRIOR || GetClass() == WARRIORGM - ||GetClass() == BERSERKER || GetClass() == BERSERKERGM) { + int32 dmg=(((GetSkill(KICK) + GetSTR() + GetLevel())*100 / 9000) * multiple) + 600; //Set a base of 6 damage, 1 seemed too low at the sub level 30 level. + if(GetClass() == WARRIOR || GetClass() == WARRIORGM ||GetClass() == BERSERKER || GetClass() == BERSERKERGM) { dmg*=12/10;//small increase for warriors } dmg /= 100; @@ -58,12 +52,7 @@ int Mob::GetBashDamage() { multiple += 100; //this is complete shite - int32 dmg=( - ( - ((GetSkill(BASH) + GetSTR())*100 + GetLevel()*100/2) / 10000 - ) * multiple - ) - + 600; //Set a base of 6 damage, 1 seemed too low at the sub level 30 level. + int32 dmg=((((GetSkill(BASH) + GetSTR())*100 + GetLevel()*100/2) / 10000) * multiple) + 600; //Set a base of 6 damage, 1 seemed too low at the sub level 30 level. dmg /= 100; int32 mindmg = 1; @@ -239,8 +228,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { int32 skill_reduction = this->GetSkillReuseTime(ca_atk->m_skill); - if ((ca_atk->m_atk == 100) - && (ca_atk->m_skill == BASH)) { // SLAM - Bash without a shield equipped + if ((ca_atk->m_atk == 100) && (ca_atk->m_skill == BASH)) { // SLAM - Bash without a shield equipped if (GetTarget() != this) { CheckIncreaseSkill(BASH, GetTarget(), 10); @@ -281,7 +269,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { CheckIncreaseSkill(FRENZY, GetTarget(), 10); int AtkRounds = 3; int skillmod = 100*GetSkill(FRENZY)/MaxSkill(FRENZY); - int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100); + int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100); int32 min_dmg = 0; DoAnim(anim2HSlashing); @@ -412,64 +400,64 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) switch(unchecked_type) { - case FLYING_KICK:{ - skill_type = FLYING_KICK; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, FlyingKickBonus) / 100) + 35; - min_dmg = ((level*8)/10); - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animFlyingKick); - reuse = FlyingKickReuseTime; - break; + case FLYING_KICK:{ + skill_type = FLYING_KICK; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, FlyingKickBonus) / 100) + 35; + min_dmg = ((level*8)/10); + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animFlyingKick); + reuse = FlyingKickReuseTime; + break; } - case DRAGON_PUNCH:{ - skill_type = DRAGON_PUNCH; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, DragonPunchBonus) / 100) + 26; - itemslot = SLOT_HANDS; - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animTailRake); - reuse = TailRakeReuseTime; - break; + case DRAGON_PUNCH:{ + skill_type = DRAGON_PUNCH; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, DragonPunchBonus) / 100) + 26; + itemslot = SLOT_HANDS; + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animTailRake); + reuse = TailRakeReuseTime; + break; } - case EAGLE_STRIKE:{ - skill_type = EAGLE_STRIKE; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, EagleStrikeBonus) / 100) + 19; - itemslot = SLOT_HANDS; - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animEagleStrike); - reuse = EagleStrikeReuseTime; - break; + case EAGLE_STRIKE:{ + skill_type = EAGLE_STRIKE; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, EagleStrikeBonus) / 100) + 19; + itemslot = SLOT_HANDS; + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animEagleStrike); + reuse = EagleStrikeReuseTime; + break; } - case TIGER_CLAW:{ - skill_type = TIGER_CLAW; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, TigerClawBonus) / 100) + 12; - itemslot = SLOT_HANDS; - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animTigerClaw); - reuse = TigerClawReuseTime; - break; + case TIGER_CLAW:{ + skill_type = TIGER_CLAW; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, TigerClawBonus) / 100) + 12; + itemslot = SLOT_HANDS; + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animTigerClaw); + reuse = TigerClawReuseTime; + break; } - case ROUND_KICK:{ - skill_type = ROUND_KICK; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, RoundKickBonus) / 100) + 10; - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animRoundKick); - reuse = RoundKickReuseTime; - break; + case ROUND_KICK:{ + skill_type = ROUND_KICK; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, RoundKickBonus) / 100) + 10; + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animRoundKick); + reuse = RoundKickReuseTime; + break; } - case KICK:{ - skill_type = KICK; - max_dmg = GetKickDamage(); - DoAnim(animKick); - reuse = KickReuseTime; - break; - } - default: - mlog(CLIENT__ERROR, "Invalid special attack type %d attempted", unchecked_type); - return(1000); /* nice long delay for them, the caller depends on this! */ + case KICK:{ + skill_type = KICK; + max_dmg = GetKickDamage(); + DoAnim(animKick); + reuse = KickReuseTime; + break; + } + default: + mlog(CLIENT__ERROR, "Invalid special attack type %d attempted", unchecked_type); + return(1000); /* nice long delay for them, the caller depends on this! */ } if(IsClient()){ @@ -629,7 +617,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) if(primaryweapondamage > 0){ if(level > 25){ - max_hit = (((2*backstab_dmg) * GetDamageTable(BACKSTAB) / 100) * 10 * GetSkill(BACKSTAB) / 355) + ((level-25)/3) + 1; + max_hit = (((2*backstab_dmg) * GetDamageTable(BACKSTAB) / 100) * 10 * GetSkill(BACKSTAB) / 355) + ((level-25)/3) + 1; hate = 20 * backstab_dmg * GetSkill(BACKSTAB) / 355; } else{ @@ -644,7 +632,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) } else { - // Trumpcard: Replaced switch statement with formula calc. This will give minhit increases all the way to 65. + // Trumpcard: Replaced switch statement with formula calc. This will give minhit increases all the way to 65. min_hit = (level * ( level*5 - 105)) / 100; } @@ -1340,10 +1328,10 @@ void Mob::ProjectileAnimation(Mob* to, uint16 item_id, bool IsArrow, float speed uint8 item_type = 0; if(!item_id) { - item = database.GetItem(8005); // Arrow will be default + item = database.GetItem(8005); // Arrow will be default } else { - item = database.GetItem(item_id); // Use the item input into the command + item = database.GetItem(item_id); // Use the item input into the command } if(!item) { @@ -1431,7 +1419,7 @@ void NPC::DoClassAttacks(Mob *target) { //general stuff, for all classes.... //only gets used when their primary ability get used too if (taunting && HasOwner() && target->IsNPC() && target->GetBodyType() != BT_Undead && taunt_time) { - this->GetOwner()->Message_StringID(MT_PetResponse, PET_TAUNTING); + this->GetOwner()->Message_StringID(MT_PetResponse, PET_TAUNTING); Taunt(target->CastToNPC(), false); } @@ -1528,7 +1516,7 @@ void NPC::DoClassAttacks(Mob *target) { case BERSERKER: case BERSERKERGM: { int AtkRounds = 3; - int32 max_dmg = 26 + ((GetLevel()-6) * 2); + int32 max_dmg = 26 + ((GetLevel()-6) * 2); int32 min_dmg = 0; DoAnim(anim2HSlashing); @@ -1740,7 +1728,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) CheckIncreaseSkill(FRENZY, GetTarget(), 10); int AtkRounds = 3; int skillmod = 100*GetSkill(FRENZY)/MaxSkill(FRENZY); - int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100); + int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100); int32 min_dmg = 0; DoAnim(anim2HSlashing); @@ -2150,7 +2138,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillType skil } } - if (damage == -3) { + if (damage == -3) { DoRiposte(other); if (HasDied()) return; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 831193f86..58954ffe7 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -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 */ #include "../common/debug.h" #include "../common/spdat.h" @@ -143,7 +143,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) { if(parse->SpellHasQuestSub(spell_id, "EVENT_SPELL_EFFECT_NPC")) { - parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0); + parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0); CalcBonuses(); return true; } @@ -152,7 +152,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) { if(parse->SpellHasQuestSub(spell_id, "EVENT_SPELL_EFFECT_CLIENT")) { - parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0); + parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0); CalcBonuses(); return true; } @@ -644,7 +644,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (max_level == 0) max_level = RuleI(Spells, BaseImmunityLevel); // NPCs get to ignore max_level for their spells. - if(SpecAttacks[UNSTUNABLE] || + if(SpecAttacks[UNSTUNABLE] || ((GetLevel() > max_level) && caster && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity))))) { @@ -998,7 +998,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) spells[buffs[slot].spellid].buffdurationformula != DF_Permanent && spells[buffs[slot].spellid].dispel_flag < 1 && !IsDiscipline(buffs[slot].spellid)) - { + { BuffFadeBySlot(slot); slot = buff_count; } @@ -1020,9 +1020,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) for(int slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && spells[buffs[slot].spellid].buffdurationformula != DF_Permanent && - IsDetrimentalSpell(buffs[slot].spellid) && + IsDetrimentalSpell(buffs[slot].spellid) && spells[buffs[slot].spellid].dispel_flag < 1) - { + { BuffFadeBySlot(slot); slot = buff_count; } @@ -1044,9 +1044,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) for(int slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && spells[buffs[slot].spellid].buffdurationformula != DF_Permanent && - IsBeneficialSpell(buffs[slot].spellid) && + IsBeneficialSpell(buffs[slot].spellid) && spells[buffs[slot].spellid].dispel_flag < 1) - { + { BuffFadeBySlot(slot); slot = buff_count; } @@ -1072,11 +1072,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #endif if(!item) { - Message(13, "Unable to summon item %d. Item not found.", spell.base[i]); + Message(13, "Unable to summon item %d. Item not found.", spell.base[i]); } else if(IsClient()){ Client *c=CastToClient(); - if (c->CheckLoreConflict(item)) { + if (c->CheckLoreConflict(item)) { c->DuplicateLoreMessage(spell.base[i]); } else { int charges; @@ -1114,7 +1114,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else if ((slot=SummonedItem->FirstOpenSlot())==0xff) { if(caster) caster->Message(13,"SE_SummonItemIntoBag but no room in summoned bag!"); } else if (IsClient()) { - if (CastToClient()->CheckLoreConflict(item)) { + if (CastToClient()->CheckLoreConflict(item)) { CastToClient()->DuplicateLoreMessage(spell.base[i]); } else { int charges; @@ -1375,7 +1375,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) max_level = RuleI(Spells, BaseImmunityLevel); // Default max is 55 level limit // NPCs ignore level limits in their spells - if(SpecAttacks[UNSTUNABLE] || + if(SpecAttacks[UNSTUNABLE] || ((GetLevel() > max_level) && caster && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity))))) { @@ -1454,7 +1454,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) snprintf(effect_desc, _EDLEN, "Feign Death"); #endif //todo, look up spell ID in DB - if(spell_id == 2488) //Dook- Lifeburn fix + if(spell_id == 2488) //Dook- Lifeburn fix break; if(IsClient()) @@ -1505,7 +1505,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(caster) mlog(SPELLS__REZ, " corpse being rezzed using spell %i by %s", - spell_id, caster->GetName()); + spell_id, caster->GetName()); CastToCorpse()->CastRezz(spell_id, caster); } @@ -1532,8 +1532,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (caster){ rooted_mod = caster->aabonuses.RootBreakChance + - caster->itembonuses.RootBreakChance + - caster->spellbonuses.RootBreakChance; + caster->itembonuses.RootBreakChance + + caster->spellbonuses.RootBreakChance; } break; @@ -1679,7 +1679,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - case SE_DisarmLDoNTrap: + case SE_DisarmLDoNTrap: { if(IsNPC()) { @@ -2020,7 +2020,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } - case SE_TemporaryPets: //Dook- swarms and wards: + case SE_TemporaryPets: //Dook- swarms and wards: { // EverHood - this makes necro epic 1.5/2.0 proc work properly if((spell_id != 6882) && (spell_id != 6884)) // Chaotic Jester/Steadfast Servant @@ -2039,13 +2039,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #ifdef SPELL_EFFECT_SPAM snprintf(effect_desc, _EDLEN, "Fading Memories"); #endif - if(caster && caster->IsClient()) - caster->CastToClient()->Escape(); - else - { - entity_list.RemoveFromTargets(caster); - SetInvisible(1); - } + if(caster && caster->IsClient()) + caster->CastToClient()->Escape(); + else + { + entity_list.RemoveFromTargets(caster); + SetInvisible(1); + } break; } @@ -2103,7 +2103,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) /* Weapon Damage = spells[spell_id].base[i] Chance to Hit Bonus = spells[spell_id].base2[i] - ???? = spells[spell_id].max[i] - MOST of the effects have this value. + ???? = spells[spell_id].max[i] - MOST of the effects have this value. *Max is lower value then Weapon base, possibly min hit vs Weapon Damage range ie. MakeRandInt(max,base) */ int16 focus = 0; @@ -2294,9 +2294,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) uint8 BonusChance = 0; if(caster) { - BonusChance = caster->aabonuses.UnfailingDivinity + - caster->itembonuses.UnfailingDivinity + - caster->spellbonuses.UnfailingDivinity; + BonusChance = caster->aabonuses.UnfailingDivinity + + caster->itembonuses.UnfailingDivinity + + caster->spellbonuses.UnfailingDivinity; } #ifdef SPELL_EFFECT_SPAM @@ -2513,7 +2513,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_Taunt: { if (IsNPC()) - caster->Taunt(this->CastToNPC(), false, spell.base[i]); + caster->Taunt(this->CastToNPC(), false, spell.base[i]); } case SE_Purify: @@ -2715,8 +2715,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_SecondaryDmgInc: case SE_ArcheryDamageModifier: case SE_ConsumeProjectile: - case SE_ForageAdditionalItems: - case SE_Salvage: + case SE_ForageAdditionalItems: + case SE_Salvage: case SE_FrontalBackstabChance: case SE_FrontalBackstabMinDmg: case SE_TripleBackstab: @@ -2841,7 +2841,7 @@ neotokyo: i need those formulas checked!!!! 205 = stacking issues ? 105 - 0x77 = min + level / 8 +0x77 = min + level / 8 */ int result = 0, updownsign = 1, ubase = base; @@ -2853,7 +2853,7 @@ neotokyo: i need those formulas checked!!!! // the max is actually less than the base, hence they grow downward /* This seems to mainly catch spells where both base and max are negative. -Strangely, damage spells have a negative base and positive max, but +Strangely, damage spells have a negative base and positive max, but snare has both of them negative, yet their range should work the same: (meaning they both start at a negative value and the value gets lower) */ @@ -2876,7 +2876,7 @@ snare has both of them negative, yet their range should work the same: case 60: //used in stun spells..? case 70: result = ubase/100; break; - case 0: + case 0: case 100: // confirmed 2/6/04 result = ubase; break; case 101: // confirmed 2/6/04 @@ -2911,7 +2911,7 @@ snare has both of them negative, yet their range should work the same: case 114: result = updownsign * (ubase + 15 * (caster_level - GetMinLevel(spell_id))); break; - //these formula were updated according to lucy 10/16/04 + //these formula were updated according to lucy 10/16/04 case 115: // this is only in symbol of transal result = ubase + 6 * (caster_level - GetMinLevel(spell_id)); break; case 116: // this is only in symbol of ryltan @@ -3070,7 +3070,7 @@ void Mob::DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, M { if(parse->SpellHasQuestSub(spell_id, "EVENT_SPELL_EFFECT_BUFF_TIC_NPC")) { - parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0); + parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0); return; } } @@ -3078,7 +3078,7 @@ void Mob::DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, M { if(parse->SpellHasQuestSub(spell_id, "EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT")) { - parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0); + parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0); return; } } @@ -3678,14 +3678,14 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) SendPetBuffsToClient(); } if((IsClient() && !CastToClient()->GetPVP()) || (IsPet() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()) || - (IsMerc() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP())) + (IsMerc() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP())) { EQApplicationPacket *outapp = MakeBuffsPacket(); entity_list.QueueClientsByTarget(this, outapp, false, nullptr, true, false, BIT_SoDAndLater); - if(GetTarget() == this) { - CastToClient()->QueuePacket(outapp); - } + if(GetTarget() == this) { + CastToClient()->QueuePacket(outapp); + } safe_delete(outapp); } @@ -4289,7 +4289,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; default: - LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -4622,7 +4622,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } } @@ -4698,7 +4698,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { //Spell Focus if (spellbonuses.FocusEffects[type]){ int buff_slot = 0; - uint16 focusspellid = 0; + uint16 focusspellid = 0; uint32 buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { @@ -4884,8 +4884,8 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { int buff_tracker = -1; int buff_slot = 0; - uint16 focusspellid = 0; - uint16 focusspell_tracker = 0; + uint16 focusspellid = 0; + uint16 focusspell_tracker = 0; uint32 buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { focusspellid = buffs[buff_slot].spellid; @@ -5052,7 +5052,7 @@ bool Mob::CheckHitsRemaining(uint32 buff_slot, bool when_spell_done, bool negate // For lowering numhits when we already know the effects buff_slot // Effects: SE_SpellVulnerability,SE_MitigateMeleeDamage,SE_NegateAttacks,SE_MitigateSpellDamage,SE_ManaAbsorbPercentDamage - if(spells[buffs[buff_slot].spellid].numhits > 0 || negate) { + if(spells[buffs[buff_slot].spellid].numhits > 0 || negate) { if(buffs[buff_slot].numhits > 1) { buffs[buff_slot].numhits--; return true; @@ -5349,8 +5349,8 @@ bool Mob::PassLimitClass(uint32 Classes_, uint16 Class_) for (int CurrentClass = 1; CurrentClass <= PLAYER_CLASS_COUNT; ++CurrentClass){ if (Classes_ % 2 == 1){ - if (CurrentClass == Class_) - return true; + if (CurrentClass == Class_) + return true; } Classes_ >>= 1; } diff --git a/zone/spells.cpp b/zone/spells.cpp index 2c1908414..cf37971dd 100644 --- a/zone/spells.cpp +++ b/zone/spells.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 */ @@ -22,11 +22,11 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) 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. @@ -141,7 +141,7 @@ void NPC::SpellProcess() Mob *targMob = entity_list.GetMob(GetSwarmInfo()->target); if(GetSwarmInfo()->target != 0) - { + { if(!targMob || (targMob && targMob->IsCorpse())) Depop(); } @@ -154,9 +154,9 @@ void NPC::SpellProcess() // // only CastSpell and DoCastSpell should be setting casting_spell_id. // basically casting_spell_id is only set when casting a triggered spell from -// the spell bar gems, an ability, or an item. note that it's actually set +// the spell bar gems, an ability, or an item. note that it's actually set // even if it's a 0 cast time, but then the spell is finished right after and -// it's unset. this is ok, since the 0 cast time spell is still a triggered +// it's unset. this is ok, since the 0 cast time spell is still a triggered // one. // the rule is you can cast one triggered (usually timed) spell at a time // but things like SpellFinished() can run concurrent with a triggered cast @@ -244,11 +244,11 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, return(false); } - if (HasActiveSong() && IsBardSong(spell_id)) { - mlog(SPELLS__BARDS, "Casting a new song while singing a song. Killing old song %d.", bardsong); - //Note: this does NOT tell the client - _StopSong(); - } + if (HasActiveSong() && IsBardSong(spell_id)) { + mlog(SPELLS__BARDS, "Casting a new song while singing a song. Killing old song %d.", bardsong); + //Note: this does NOT tell the client + _StopSong(); + } //Added to prevent MQ2 exploitation of equipping normally-unequippable/clickable items with effects and clicking them for benefits. if(item_slot && IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT))) @@ -306,7 +306,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } // -// the order of things here is intentional and important. make sure you +// the order of things here is intentional and important. make sure you // understand the whole spell casting process and the flags that are passed // around if you're gonna modify this // @@ -314,7 +314,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, // to repeat a spell for bard songs // bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, - int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, + int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 timer, uint32 timer_duration, uint32 type, int16 resist_adjust) { @@ -622,8 +622,8 @@ bool Client::CheckFizzle(uint16 spell_id) } // == 0 --> on par - // > 0 --> skill is lower, higher chance of fizzle - // < 0 --> skill is better, lower chance of fizzle + // > 0 --> skill is lower, higher chance of fizzle + // < 0 --> skill is better, lower chance of fizzle // the max that diff can be is +- 235 float diff = par_skill + spells[spell_id].basediff - act_skill; @@ -695,25 +695,25 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) { EQApplicationPacket *outapp; uint16 message_other; - bool bard_song_mode = false; //has the bard song gone to auto repeat mode + bool bard_song_mode = false; //has the bard song gone to auto repeat mode if (spellid == SPELL_UNKNOWN) { if(bardsong) { - spellid = bardsong; - bard_song_mode = true; - } else { - spellid = casting_spell_id; - } - } + spellid = bardsong; + bard_song_mode = true; + } else { + spellid = casting_spell_id; + } + } if(casting_spell_id && IsNPC()) { CastToNPC()->AI_Event_SpellCastFinished(false, casting_spell_slot); } - if(casting_spell_type == 1 && IsClient()) { //Rest AA Timer on failed cast - CastToClient()->SendAATimer(casting_spell_timer - pTimerAAStart, 0, 0xFFFFFF); - CastToClient()->Message_StringID(15,ABILITY_FAILED); - CastToClient()->GetPTimers().Clear(&database, casting_spell_timer); - } + if(casting_spell_type == 1 && IsClient()) { //Rest AA Timer on failed cast + CastToClient()->SendAATimer(casting_spell_timer - pTimerAAStart, 0, 0xFFFFFF); + CastToClient()->Message_StringID(15,ABILITY_FAILED); + CastToClient()->GetPTimers().Clear(&database, casting_spell_timer); + } ZeroCastingVars(); // resets all the state keeping stuff @@ -725,9 +725,9 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) if (bardsong || IsBardSong(casting_spell_id)) _StopSong(); - if(bard_song_mode) { - return; - } + if(bard_song_mode) { + return; + } if(!message) message = IsBardSong(spellid) ? SONG_ENDS_ABRUPTLY : INTERRUPT_SPELL; @@ -780,13 +780,13 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) } // this is called after the timer is up and the spell is finished -// casting. everything goes through here, including items with zero cast time +// casting. everything goes through here, including items with zero cast time // only to be used from SpellProcess -// NOTE: do not put range checking, etc into this function. this should +// NOTE: do not put range checking, etc into this function. this should // just check timed spell specific things before passing off to SpellFinished // which figures out proper targets etc void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, - uint16 mana_used, uint32 inventory_slot, int16 resist_adjust) + uint16 mana_used, uint32 inventory_slot, int16 resist_adjust) { _ZP(Mob_CastedSpellFinished); @@ -794,7 +794,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(IsClient() && slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && spells[spell_id].recast_time > 1000) { // 10 is item if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) { - //should we issue a message or send them a spell gem packet? + //should we issue a message or send them a spell gem packet? Message_StringID(13, SPELL_RECAST); mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: spell reuse timer not expired", spell_id); InterruptSpell(); @@ -900,7 +900,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // max 93% chance at 252 skill channelchance = 30 + GetSkill(CHANNELING) / 400.0f * 100; channelchance -= attacked_count * 2; - channelchance += channelchance * channelbonuses / 100.0f; + channelchance += channelchance * channelbonuses / 100.0f; } #ifdef BOTS else if(IsBot()) { @@ -914,7 +914,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // max 93% chance at 252 skill channelchance = 30 + GetSkill(CHANNELING) / 400.0f * 100; channelchance -= attacked_count * 2; - channelchance += channelchance * channelbonuses / 100.0f; + channelchance += channelchance * channelbonuses / 100.0f; } #endif //BOTS else { @@ -1018,7 +1018,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } break; - default: // some non-instrument component. Let it go, but record it in the log + default: // some non-instrument component. Let it go, but record it in the log mlog(SPELLS__CASTING_ERR, "Something odd happened: Song %d required component %s", spell_id, component); } @@ -1199,8 +1199,8 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(this->IsClient()) { if(parse->PlayerHasQuestSub("EVENT_CAST") ) { char temp[64]; - sprintf(temp, "%d", spell_id); - parse->EventPlayer(EVENT_CAST, CastToClient(), temp, 0); + sprintf(temp, "%d", spell_id); + parse->EventPlayer(EVENT_CAST, CastToClient(), temp, 0); } } @@ -1241,7 +1241,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, c->CheckSpecializeIncrease(spell_id); } } - } + } // there should be no casting going on now ZeroCastingVars(); @@ -1270,14 +1270,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce AE on location - this is a tricky one that is cast on a mob target but has a special AE duration that keeps it recasting every 2.5 sec on the - same location. These work the same as AE around target spells, except + same location. These work the same as AE around target spells, except the target is a special beacon that's created when the spell is cast Group - the caster is always affected, but there's more targetgroupbuffs on - these affect the target and the target's group. targetgroupbuffs off - no target, affects the caster's group. - Group Teleport - the caster plus his group are affected. these cannot + Group Teleport - the caster plus his group are affected. these cannot be targeted. I think the string ID SPELL_NEED_TAR is wrong, it dosent seem to show up. @@ -1354,10 +1354,10 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { uint8 body_type = spell_target ? spell_target->GetBodyType() : 0; if(!spell_target || (spell_target != GetPet()) || - (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3 && body_type != BT_Animal)) + (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3 && body_type != BT_Animal)) { mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target of body type %d (summoned pet)", - spell_id, body_type); + spell_id, body_type); Message_StringID(13, SPELL_NEED_TAR); @@ -1712,7 +1712,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if ( this->IsClient() && - (zone->GetZoneID() == 183 || zone->GetZoneID() == 184) && // load + (zone->GetZoneID() == 183 || zone->GetZoneID() == 184) && // load CastToClient()->Admin() < 80 ) { @@ -1737,12 +1737,12 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 mlog(SPELLS__CASTING, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); // if a spell has the AEDuration flag, it becomes an AE on target - // spell that's recast every 2500 msec for AEDuration msec. There are + // spell that's recast every 2500 msec for AEDuration msec. There are // spells of all kinds of target types that do this, strangely enough // TODO: finish this if(IsAEDurationSpell(spell_id)) { // the spells are AE target, but we aim them on a beacon - Mob *beacon_loc = spell_target ? spell_target : this; + Mob *beacon_loc = spell_target ? spell_target : this; Beacon *beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); entity_list.AddBeacon(beacon); mlog(SPELLS__CASTING, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); @@ -2004,7 +2004,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // if this was a spell slot or an ability use up the mana for it // CastSpell already reduced the cost for it if we're a client with focus - if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && mana_used > 0) + if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && mana_used > 0) { mlog(SPELLS__CASTING, "Spell %d: consuming %d mana", spell_id, mana_used); if (!DoHPToManaCovert(mana_used)) @@ -2056,9 +2056,9 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 * handle bard song pulses... * * we make several assumptions that SpellFinished does not: - * - there are no AEDuration (beacon) bard songs - * - there are no recourse spells on bard songs - * - there is no long recast delay on bard songs + * - there are no AEDuration (beacon) bard songs + * - there are no recourse spells on bard songs + * - there is no long recast delay on bard songs * * return false to stop the song */ @@ -2611,21 +2611,21 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, if(effect1 != effect2) continue; - /* - Skip check if effect is SE_Limit* - skip checking effect2 since we know they are equal - */ - if(effect1 == SE_LimitMaxLevel || - effect1 == SE_LimitResist || - effect1 == SE_LimitTarget || - effect1 == SE_LimitEffect || - effect1 == SE_LimitSpellType || - effect1 == SE_LimitSpell || - effect1 == SE_LimitMinDur || - effect1 == SE_LimitInstant || - effect1 == SE_LimitMinLevel || - effect1 == SE_LimitCastTime) - continue; + /* + Skip check if effect is SE_Limit* + skip checking effect2 since we know they are equal + */ + if(effect1 == SE_LimitMaxLevel || + effect1 == SE_LimitResist || + effect1 == SE_LimitTarget || + effect1 == SE_LimitEffect || + effect1 == SE_LimitSpellType || + effect1 == SE_LimitSpell || + effect1 == SE_LimitMinDur || + effect1 == SE_LimitInstant || + effect1 == SE_LimitMinLevel || + effect1 == SE_LimitCastTime) + continue; /* If target is a npc and caster1 and caster2 exist @@ -2667,7 +2667,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, sp1_value = CalcSpellEffectValue(spellid1, i, caster_level1); sp2_value = CalcSpellEffectValue(spellid2, i, caster_level2); - // some spells are hard to compare just on value. attack speed spells + // some spells are hard to compare just on value. attack speed spells // have a value that's a percentage for instance if ( @@ -2743,9 +2743,9 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration); // first we loop through everything checking that the spell - // can stack with everything. this is to avoid stripping the spells + // can stack with everything. this is to avoid stripping the spells // it would overwrite, and then hitting a buff we can't stack with. - // we also check if overwriting will occur. this is so after this loop + // we also check if overwriting will occur. this is so after this loop // we can determine if there will be room for this buff uint32 buff_count = GetMaxTotalSlots(); uint32 start_slot = 0; @@ -2798,32 +2798,32 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid // we didn't find an empty slot to put it in, and it's not overwriting // anything so there must not be any room left. - if(emptyslot == -1 && !will_overwrite) - // return -1; - { - if(IsDetrimentalSpell(spell_id)) //Sucks to be you, bye bye one of your buffs - { - for(buffslot = 0; buffslot < buff_count; buffslot++) - { - const Buffs_Struct &curbuf = buffs[buffslot]; - if(IsBeneficialSpell(curbuf.spellid)) - { - mlog(SPELLS__BUFFS, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", spell_id, curbuf.spellid, buffslot); - BuffFadeBySlot(buffslot,false); - emptyslot = buffslot; + if(emptyslot == -1 && !will_overwrite) + // return -1; + { + if(IsDetrimentalSpell(spell_id)) //Sucks to be you, bye bye one of your buffs + { + for(buffslot = 0; buffslot < buff_count; buffslot++) + { + const Buffs_Struct &curbuf = buffs[buffslot]; + if(IsBeneficialSpell(curbuf.spellid)) + { + mlog(SPELLS__BUFFS, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", spell_id, curbuf.spellid, buffslot); + BuffFadeBySlot(buffslot,false); + emptyslot = buffslot; break; - } - } - if(emptyslot == -1) { - mlog(SPELLS__BUFFS, "Unable to find a buff slot for detrimental buff %d", spell_id); + } + } + if(emptyslot == -1) { + mlog(SPELLS__BUFFS, "Unable to find a buff slot for detrimental buff %d", spell_id); return(-1); - } - } - else { - mlog(SPELLS__BUFFS, "Unable to find a buff slot for beneficial buff %d", spell_id); - return -1; - } - } + } + } + else { + mlog(SPELLS__BUFFS, "Unable to find a buff slot for beneficial buff %d", spell_id); + return -1; + } + } // at this point we know that this buff will stick, but we have // to remove some other buffs already worn if will_overwrite is true @@ -2848,19 +2848,19 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid buffs[emptyslot].spellid = spell_id; buffs[emptyslot].casterlevel = caster_level; - if(caster && caster->IsClient()) { - strcpy(buffs[emptyslot].caster_name, caster->GetName()); - } else { - memset(buffs[emptyslot].caster_name, 0, 64); - } + if(caster && caster->IsClient()) { + strcpy(buffs[emptyslot].caster_name, caster->GetName()); + } else { + memset(buffs[emptyslot].caster_name, 0, 64); + } buffs[emptyslot].casterid = caster ? caster->GetID() : 0; buffs[emptyslot].ticsremaining = duration; - buffs[emptyslot].counters = CalculateCounters(spell_id); + buffs[emptyslot].counters = CalculateCounters(spell_id); buffs[emptyslot].numhits = spells[spell_id].numhits; buffs[emptyslot].client = caster ? caster->IsClient() : 0; - buffs[emptyslot].persistant_buff = 0; - buffs[emptyslot].deathsaveCasterAARank = 0; - buffs[emptyslot].deathSaveSuccessChance = 0; + buffs[emptyslot].persistant_buff = 0; + buffs[emptyslot].deathsaveCasterAARank = 0; + buffs[emptyslot].deathSaveSuccessChance = 0; if(level_override > 0) { @@ -2878,15 +2878,15 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid if((IsClient() && !CastToClient()->GetPVP()) || (IsPet() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()) || - (IsMerc() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP())) + (IsMerc() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP())) { EQApplicationPacket *outapp = MakeBuffsPacket(); entity_list.QueueClientsByTarget(this, outapp, false, nullptr, true, false, BIT_SoDAndLater); - if(GetTarget() == this) { - CastToClient()->QueuePacket(outapp); - } + if(GetTarget() == this) { + CastToClient()->QueuePacket(outapp); + } safe_delete(outapp); } @@ -2960,7 +2960,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) // Group::CastGroupSpell (called by Mob::SpellFinished) // // also note you can't interrupt the spell here. at this point it's going -// and if you don't want effects just return false. interrupting here will +// and if you don't want effects just return false. interrupting here will // break stuff // bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_resist_adjust, int16 resist_adjust, bool isproc) @@ -2977,12 +2977,12 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(spelltar->IsClient() && spelltar->CastToClient()->IsHoveringForRespawn()) return false; - if(IsDetrimentalSpell(spell_id) && !IsAttackAllowed(spelltar) && !IsResurrectionEffects(spell_id)) { - if(!IsClient() || !CastToClient()->GetGM()) { - Message_StringID(MT_Shout, SPELL_NO_HOLD); - return false; - } - } + if(IsDetrimentalSpell(spell_id) && !IsAttackAllowed(spelltar) && !IsResurrectionEffects(spell_id)) { + if(!IsClient() || !CastToClient()->GetGM()) { + Message_StringID(MT_Shout, SPELL_NO_HOLD); + return false; + } + } if(RuleB(Spells, EnableBlockedBuffs)) { @@ -2995,7 +2995,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(spelltar->IsPet() && spelltar->GetOwner() && spelltar->GetOwner()->IsBlockedPetBuff(spell_id)) { mlog(SPELLS__BUFFS, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", spell_id, spelltar->GetName(), - spelltar->GetOwner()->GetName()); + spelltar->GetOwner()->GetName()); return false; } } @@ -3043,8 +3043,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // select target if // Bind Sight line of spells ( - spell_id == 500 || // bind sight - spell_id == 407 // cast sight + spell_id == 500 || // bind sight + spell_id == 407 // cast sight ) { action->target = GetID(); @@ -3069,12 +3069,13 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r entity_list.QueueCloseClients(spelltar, action_packet, true, 200, this, true, spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells); - /* Send the EVENT_CAST_ON event */ - if(spelltar->IsNPC()) - { char temp1[100]; - sprintf(temp1, "%d", spell_id); - parse->EventNPC(EVENT_CAST_ON, spelltar->CastToNPC(), this, temp1, 0); - } + /* Send the EVENT_CAST_ON event */ + if(spelltar->IsNPC()) + { + char temp1[100]; + sprintf(temp1, "%d", spell_id); + parse->EventNPC(EVENT_CAST_ON, spelltar->CastToNPC(), this, temp1, 0); + } // now check if the spell is allowed to land @@ -3489,7 +3490,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(!spelltar->SpellEffect(this, spell_id, spell_effectiveness)) { // if SpellEffect returned false there's a problem applying the - // spell. It's most likely a buff that can't stack. + // spell. It's most likely a buff that can't stack. mlog(SPELLS__CASTING_ERR, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); Message_StringID(MT_Shout, SPELL_NO_HOLD); safe_delete(action_packet); @@ -3592,11 +3593,11 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster) _log(SPELLS__REZ, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,Rezzed(),rezzexp); if(Rezzed()){ - if(Caster && Caster->IsClient()) + if(Caster && Caster->IsClient()) Caster->Message(13,"This character has already been resurrected."); - return; - } + return; + } /* if(!can_rez) { if(Caster && Caster->IsClient()) @@ -3753,7 +3754,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(!IsValidSpell(spell_id)) return true; - if(IsBeneficialSpell(spell_id) && (caster->GetNPCTypeID())) //then skip the rest, stop NPCs aggroing each other with buff spells. 2013-03-05 + if(IsBeneficialSpell(spell_id) && (caster->GetNPCTypeID())) //then skip the rest, stop NPCs aggroing each other with buff spells. 2013-03-05 return false; if(IsMezSpell(spell_id)) @@ -3916,7 +3917,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) // // Spell resists: -// returns an effectiveness index from 0 to 100. for most spells, 100 means +// returns an effectiveness index from 0 to 100. for most spells, 100 means // it landed, and anything else means it was resisted; however there are some // spells that can be partially effective, and this value can be used there. // TODO: we need to figure out how the following pvp values work and implement them @@ -4406,7 +4407,7 @@ void Mob::Mesmerize() stunon->duration = 0xFFFF; this->CastToClient()->QueuePacket(outapp); safe_delete(outapp); - } else { + } else { SetRunAnimSpeed(0); } */ @@ -4617,7 +4618,7 @@ bool Client::SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID) { mysql_free_result(result); - if (Spell_Global_Name.empty()) { // If the entry in the spell_globals table has nothing set for the qglobal name + if (Spell_Global_Name.empty()) { // If the entry in the spell_globals table has nothing set for the qglobal name return true; } else if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT value FROM quest_globals WHERE charid=%i AND name='%s'", Char_ID, Spell_Global_Name.c_str()), errbuf, &result)) { @@ -4628,13 +4629,13 @@ bool Client::SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID) { Global_Value = atoi(row[0]); mysql_free_result(result); - if (Global_Value == Spell_Global_Value) { // If the values match from both tables, allow the spell to be scribed + if (Global_Value == Spell_Global_Value) { // If the values match from both tables, allow the spell to be scribed return true; } - else if (Global_Value > Spell_Global_Value) { // Check if the qglobal value is greater than the require spellglobal value + else if (Global_Value > Spell_Global_Value) { // Check if the qglobal value is greater than the require spellglobal value return true; } - else // If no matching result found in qglobals, don't scribe this spell + else // If no matching result found in qglobals, don't scribe this spell { LogFile->write(EQEMuLog::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", Char_ID, Spell_Global_Name.c_str(), Spell_Global_Value, Global_Value, Spell_ID); return false; @@ -4648,16 +4649,16 @@ bool Client::SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID) { LogFile->write(EQEMuLog::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", Spell_ID, Spell_Global_Name.c_str(), Spell_Global_Value); } else { - return true; // Spell ID isn't listed in the spells_global table, so it is not restricted from scribing + return true; // Spell ID isn't listed in the spells_global table, so it is not restricted from scribing } mysql_free_result(result); } else { - LogFile->write(EQEMuLog::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", Spell_ID, query, errbuf); + LogFile->write(EQEMuLog::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", Spell_ID, query, errbuf); safe_delete_array(query); - return false; // Query failed, so prevent spell from scribing just in case + return false; // Query failed, so prevent spell from scribing just in case } - return false; // Default is false + return false; // Default is false } //this is one nasty function... FindType and FindSpell are rather complex operations... @@ -4668,14 +4669,14 @@ bool Client::SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID) { CheckPet(); uint8 newtype[15] = { SE_ArmorClass, SE_STR, SE_DEX, SE_AGI, SE_WIS, - SE_INT, SE_CHA, SE_AttackSpeed, SE_MovementSpeed, - SE_DamageShield, SE_ResistFire, SE_ResistCold, - SE_ResistMagic, SE_ResistPoison, SE_ResistDisease }; + SE_INT, SE_CHA, SE_AttackSpeed, SE_MovementSpeed, + SE_DamageShield, SE_ResistFire, SE_ResistCold, + SE_ResistMagic, SE_ResistPoison, SE_ResistDisease }; for (int h=0; h<15; h++) { if (!this->FindType(newtype[h])) { uint16 buffid = FindSpell(this->class_, this->level, - newtype[h], SPELLTYPE_SELF, 0, - GetMana()); + newtype[h], SPELLTYPE_SELF, 0, + GetMana()); if (buffid != 0) { this->CastSpell(buffid, this->GetID()); } @@ -4691,12 +4692,12 @@ void Mob::CheckPet() { if ((GetClass() == NECROMANCER || GetClass() == MAGICIAN)) { if (this->GetClass() == MAGICIAN) { buffid = FindSpell(class_, level, - SE_SummonPet, SPELLTYPE_OTHER, 0, - GetMana()); - } else if (GetClass() == NECROMANCER) { + SE_SummonPet, SPELLTYPE_OTHER, 0, + GetMana()); + } else if (GetClass() == NECROMANCER) { buffid = FindSpell(class_, level, - SE_NecPet, SPELLTYPE_OTHER, 0, - GetMana()); + SE_NecPet, SPELLTYPE_OTHER, 0, + GetMana()); } if (buffid != 0) { CastSpell(buffid, GetID()); @@ -4705,154 +4706,154 @@ void Mob::CheckPet() { } uint16 Mob::FindSpell(uint16 classp, uint16 level, int type, - FindSpellType spelltype, float distance, - int32 mana_avail) { - int i,j; + FindSpellType spelltype, float distance, + int32 mana_avail) { + int i,j; - int bestvalue = -1; - int bestid = 0; + int bestvalue = -1; + int bestid = 0; - if (classp < 1) - return 0; - if (level < 1) - return 0; + if (classp < 1) + return 0; + if (level < 1) + return 0; classp = GetEQArrayEQClass(classp); - // purpose: find a suited spell for a class and level and type - // the if's are here to filter out anything which isnt normal. - // its possible that we miss some valid spells, but who cares. + // purpose: find a suited spell for a class and level and type + // the if's are here to filter out anything which isnt normal. + // its possible that we miss some valid spells, but who cares. for (i = 0; i < SPDAT_RECORDS; i++) { if(!IsValidSpell(i)) continue; - // Filter all spells that should never be used - if (spells[i].effectid[0] == SE_NegateIfCombat) - continue; - if (spells[i].targettype == ST_Group) - continue; - if (i == 2632) // fix for obsolete BST pet summon spell - continue; - if (i == 1576) // fix for torpor - continue; - if (spells[i].cast_time < 11) - continue; - if (spells[i].mana == 0) - continue; + // Filter all spells that should never be used + if (spells[i].effectid[0] == SE_NegateIfCombat) + continue; + if (spells[i].targettype == ST_Group) + continue; + if (i == 2632) // fix for obsolete BST pet summon spell + continue; + if (i == 1576) // fix for torpor + continue; + if (spells[i].cast_time < 11) + continue; + if (spells[i].mana == 0) + continue; - // now for closer checks - if (spelltype == SPELLTYPE_SELF) { - if ( i == 357) // fix for dark empathy - continue; - // check buffs 12 would be max, but 90% of all effects are in the first 4 slots - for (j = 0; j < 5; j++) { - // fix for pets - if ( spells[i].effectid[j] == SE_Illusion && - type != SE_Illusion) // only let illusions thru if explicitly requested - continue; - if ( spells[i].effectid[j] == type && - spells[i].goodEffect != 0 && - spells[i].classes[classp] <= level && - spells[i].classes[classp] <= 65 && - (spells[i].recast_time < 10000 || - type == SE_SummonPet || - type == SE_SummonBSTPet) && // fix for druid pets - (type == SE_AbsorbMagicAtt || type == SE_Rune || - type == SE_NecPet || type == SE_SummonPet || - spells[i].components[0] == -1 ) && - spells[i].targettype != ST_Undead && // for necro mend series - spells[i].targettype != ST_Group && // fix for group spells - spells[i].targettype != ST_Pet && // fix for beastlords casting pet heals on self - spells[i].targettype != ST_Summoned && // fix for vs. summoned spells on normal npcs - spells[i].targettype != ST_AETarget && // dont let em cast AEtarget spells - spells[i].mana <= mana_avail && - spells[i].range >= distance) { - int32 spellvalue; + // now for closer checks + if (spelltype == SPELLTYPE_SELF) { + if ( i == 357) // fix for dark empathy + continue; + // check buffs 12 would be max, but 90% of all effects are in the first 4 slots + for (j = 0; j < 5; j++) { + // fix for pets + if ( spells[i].effectid[j] == SE_Illusion && + type != SE_Illusion) // only let illusions thru if explicitly requested + continue; + if (spells[i].effectid[j] == type && + spells[i].goodEffect != 0 && + spells[i].classes[classp] <= level && + spells[i].classes[classp] <= 65 && + (spells[i].recast_time < 10000 || + type == SE_SummonPet || + type == SE_SummonBSTPet) && // fix for druid pets + (type == SE_AbsorbMagicAtt || type == SE_Rune || + type == SE_NecPet || type == SE_SummonPet || + spells[i].components[0] == -1 ) && + spells[i].targettype != ST_Undead && // for necro mend series + spells[i].targettype != ST_Group && // fix for group spells + spells[i].targettype != ST_Pet && // fix for beastlords casting pet heals on self + spells[i].targettype != ST_Summoned && // fix for vs. summoned spells on normal npcs + spells[i].targettype != ST_AETarget && // dont let em cast AEtarget spells + spells[i].mana <= mana_avail && + spells[i].range >= distance) { + int32 spellvalue; - // lets assume pet is always better if higher, so no formula needed - if (type == SE_NecPet || - type == SE_SummonPet || - type == SE_SummonBSTPet) { - spellvalue = spells[i].classes[classp]; - } else { + // lets assume pet is always better if higher, so no formula needed + if (type == SE_NecPet || + type == SE_SummonPet || + type == SE_SummonBSTPet) { + spellvalue = spells[i].classes[classp]; + } else { spellvalue = CalcSpellEffectValue_formula(spells[i].formula[j], - spells[i].base[j], - spells[i].max[j], - level, i); - } + spells[i].base[j], + spells[i].max[j], + level, i); + } - if (abs(spellvalue) > bestvalue) { - bestvalue = abs(spellvalue); - bestid = i; - } - } - } - } else if (spelltype == SPELLTYPE_OFFENSIVE) { - // check offensive spells - for (j = 0; j < 5; j++) { - if (spells[i].effectid[j] == SE_Illusion && - type != SE_Illusion) // only let illusions thru if explicitly requested - continue; - if (spells[i].effectid[j] == type && - spells[i].goodEffect == 0 && - spells[i].classes[classp] <= level && - spells[i].classes[classp] <= 65 && - spells[i].recast_time < 10000 && - spells[i].components[0] == -1 && - spells[i].mana <= mana_avail && - spells[i].targettype != ST_Undead && // thats for the necro mend series - spells[i].targettype != ST_Group && // fix for group spells - spells[i].targettype != ST_Pet && // fix for beastlords casting pet heals on self - spells[i].targettype != ST_Summoned && // fix for vs. summoned spells on normal npcs - spells[i].targettype != ST_AETarget && // dont let em cast AEtarget spells - spells[i].range >= distance) { - int32 spellvalue = CalcSpellEffectValue_formula(spells[i].formula[j], - spells[i].base[j], - spells[i].max[j], - level, i); - if ( abs(spellvalue) > bestvalue ) { - bestvalue = abs(spellvalue); - bestid = i; - } - } - } - } else if (spelltype == SPELLTYPE_OTHER) { - if ( i == 357) // fix for dark empathy - continue; - // healing and such - for (j = 0; j < 5; j++) { - if (spells[i].effectid[j] == SE_Illusion && - type != SE_Illusion) // only let illusions thru if explicitly requested - continue; - if (spells[i].effectid[j] == type && - spells[i].targettype != ST_Self && - spells[i].goodEffect != 0 && - spells[i].classes[classp] <= level && - spells[i].classes[classp] <= 65 && - spells[i].recast_time < 10000 && - spells[i].components[0] == -1 && - spells[i].targettype != ST_Undead && // thats for the necro mend series - spells[i].targettype != ST_Group && // fix for group spells - spells[i].targettype != ST_Pet && // fix for beastlords casting pet heals on self - spells[i].targettype != ST_Summoned && // fix for vs. summoned spells on normal npcs - spells[i].targettype != ST_AETarget && // dont let em cast AEtarget spells - spells[i].mana <= mana_avail && - spells[i].range >= distance) { - int32 spellvalue = CalcSpellEffectValue_formula(spells[i].formula[j], - spells[i].base[j], - spells[i].max[j], - level, i); - if ( abs(spellvalue) > bestvalue ) { - bestvalue = abs(spellvalue); - bestid = i; - } - } - } - } - } // for i + if (abs(spellvalue) > bestvalue) { + bestvalue = abs(spellvalue); + bestid = i; + } + } + } + } else if (spelltype == SPELLTYPE_OFFENSIVE) { + // check offensive spells + for (j = 0; j < 5; j++) { + if (spells[i].effectid[j] == SE_Illusion && + type != SE_Illusion) // only let illusions thru if explicitly requested + continue; + if (spells[i].effectid[j] == type && + spells[i].goodEffect == 0 && + spells[i].classes[classp] <= level && + spells[i].classes[classp] <= 65 && + spells[i].recast_time < 10000 && + spells[i].components[0] == -1 && + spells[i].mana <= mana_avail && + spells[i].targettype != ST_Undead && // thats for the necro mend series + spells[i].targettype != ST_Group && // fix for group spells + spells[i].targettype != ST_Pet && // fix for beastlords casting pet heals on self + spells[i].targettype != ST_Summoned && // fix for vs. summoned spells on normal npcs + spells[i].targettype != ST_AETarget && // dont let em cast AEtarget spells + spells[i].range >= distance) { + int32 spellvalue = CalcSpellEffectValue_formula(spells[i].formula[j], + spells[i].base[j], + spells[i].max[j], + level, i); + if ( abs(spellvalue) > bestvalue ) { + bestvalue = abs(spellvalue); + bestid = i; + } + } + } + } else if (spelltype == SPELLTYPE_OTHER) { + if ( i == 357) // fix for dark empathy + continue; + // healing and such + for (j = 0; j < 5; j++) { + if (spells[i].effectid[j] == SE_Illusion && + type != SE_Illusion) // only let illusions thru if explicitly requested + continue; + if (spells[i].effectid[j] == type && + spells[i].targettype != ST_Self && + spells[i].goodEffect != 0 && + spells[i].classes[classp] <= level && + spells[i].classes[classp] <= 65 && + spells[i].recast_time < 10000 && + spells[i].components[0] == -1 && + spells[i].targettype != ST_Undead && // thats for the necro mend series + spells[i].targettype != ST_Group && // fix for group spells + spells[i].targettype != ST_Pet && // fix for beastlords casting pet heals on self + spells[i].targettype != ST_Summoned && // fix for vs. summoned spells on normal npcs + spells[i].targettype != ST_AETarget && // dont let em cast AEtarget spells + spells[i].mana <= mana_avail && + spells[i].range >= distance) { + int32 spellvalue = CalcSpellEffectValue_formula(spells[i].formula[j], + spells[i].base[j], + spells[i].max[j], + level, i); + if ( abs(spellvalue) > bestvalue ) { + bestvalue = abs(spellvalue); + bestid = i; + } + } + } + } + } // for i -// g_LogFile.write("for combination [class %02d][level %02d][SE_type %02d][type %02d] i selected the spell: %s", -// classp, level, (uint16)type, uint16(spelltype), spells[bestid].name); - return bestid; +// g_LogFile.write("for combination [class %02d][level %02d][SE_type %02d][type %02d] i selected the spell: %s", +// classp, level, (uint16)type, uint16(spelltype), spells[bestid].name); + return bestid; } #if 0 @@ -5027,14 +5028,14 @@ int16 Mob::GetBuffSlotFromType(uint16 type) { } } } - return -1; + return -1; } uint16 Mob::GetSpellIDFromSlot(uint8 slot) { if (buffs[slot].spellid != SPELL_UNKNOWN) return buffs[slot].spellid; - return 0; + return 0; } @@ -5044,24 +5045,24 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { if (buffs[i].spellid != SPELL_UNKNOWN) { for (int j = 0; j < EFFECT_COUNT; j++) { - // adjustments necessary for offensive npc casting behavior - if (bOffensive) { - if (spells[buffs[i].spellid].effectid[j] == type) { - int16 value = - CalcSpellEffectValue_formula(spells[buffs[i].spellid].buffdurationformula, - spells[buffs[i].spellid].base[j], - spells[buffs[i].spellid].max[j], - buffs[i].casterlevel, buffs[i].spellid); - LogFile->write(EQEMuLog::Normal, - "FindType: type = %d; value = %d; threshold = %d", - type, value, threshold); - if (value < threshold) - return true; - } - } else { - if (spells[buffs[i].spellid].effectid[j] == type ) - return true; - } + // adjustments necessary for offensive npc casting behavior + if (bOffensive) { + if (spells[buffs[i].spellid].effectid[j] == type) { + int16 value = + CalcSpellEffectValue_formula(spells[buffs[i].spellid].buffdurationformula, + spells[buffs[i].spellid].base[j], + spells[buffs[i].spellid].max[j], + buffs[i].casterlevel, buffs[i].spellid); + LogFile->write(EQEMuLog::Normal, + "FindType: type = %d; value = %d; threshold = %d", + type, value, threshold); + if (value < threshold) + return true; + } + } else { + if (spells[buffs[i].spellid].effectid[j] == type ) + return true; + } } } } @@ -5074,7 +5075,7 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance) { int i; if (bPerma) { - for (i = 0; i < MAX_PROCS; i++) { + for (i = 0; i < MAX_PROCS; i++) { if (PermaProcs[i].spellID == SPELL_UNKNOWN) { PermaProcs[i].spellID = spell_id; PermaProcs[i].chance = iChance; @@ -5085,7 +5086,7 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance) { } } mlog(SPELLS__PROCS, "Too many perma procs for %s", GetName()); - } else { + } else { for (i = 0; i < MAX_PROCS; i++) { if (SpellProcs[i].spellID == SPELL_UNKNOWN) { SpellProcs[i].spellID = spell_id; @@ -5097,7 +5098,7 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance) { } mlog(SPELLS__PROCS, "Too many procs for %s", GetName()); } - return false; + return false; } bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { @@ -5109,7 +5110,7 @@ bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { mlog(SPELLS__PROCS, "Removed proc %d from slot %d", spell_id, i); } } - return true; + return true; } bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) @@ -5128,7 +5129,7 @@ bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id } } - return false; + return false; } bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll) @@ -5141,7 +5142,7 @@ bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll) mlog(SPELLS__PROCS, "Removed defensive proc %d from slot %d", spell_id, i); } } - return true; + return true; } bool Mob::AddSkillProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) @@ -5159,7 +5160,7 @@ bool Mob::AddSkillProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) return true; } } - return false; + return false; } bool Mob::RemoveSkillProc(uint16 spell_id, bool bAll) @@ -5172,7 +5173,7 @@ bool Mob::RemoveSkillProc(uint16 spell_id, bool bAll) mlog(SPELLS__PROCS, "Removed Skill proc %d from slot %d", spell_id, i); } } - return true; + return true; } bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) @@ -5191,7 +5192,7 @@ bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) } } - return false; + return false; } bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll) @@ -5204,7 +5205,7 @@ bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll) mlog(SPELLS__PROCS, "Removed ranged proc %d from slot %d", spell_id, i); } } - return true; + return true; } // this is checked in a few places to decide wether special bard @@ -5467,3 +5468,4 @@ void NPC::UninitializeBuffSlots() { safe_delete_array(buffs); } + diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 73a2a8004..172f3d18c 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -1,20 +1,20 @@ -/* 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 - it 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" @@ -63,7 +63,7 @@ bool TaskManager::LoadTaskSets() { const char *TaskSetQuery = "SELECT `id`, `taskid` from `tasksets` WHERE `id` > 0 AND `id` < %i " - "AND `taskid` >= 0 AND `taskid` < %i ORDER BY `id`, `taskid` ASC"; + "AND `taskid` >= 0 AND `taskid` < %i ORDER BY `id`, `taskid` ASC"; const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::LoadTaskSets: %s"; @@ -134,27 +134,27 @@ bool TaskManager::LoadTasks(int SingleTask) { // If TaskID !=0, then just load the task specified. const char *AllTaskQuery = "SELECT `id`, `duration`, `title`, `description`, `reward`, `rewardid`," - "`cashreward`, `xpreward`, `rewardmethod`, `startzone`, `minlevel`, `maxlevel`, `repeatable` " - "from `tasks` WHERE `id` < %i"; + "`cashreward`, `xpreward`, `rewardmethod`, `startzone`, `minlevel`, `maxlevel`, `repeatable` " + "from `tasks` WHERE `id` < %i"; const char *SingleTaskQuery = "SELECT `id`, `duration`, `title`, `description`, `reward`, `rewardid`," - "`cashreward`, `xpreward`, `rewardmethod`, `startzone`, `minlevel`, `maxlevel`, `repeatable` " - "from `tasks` WHERE `id` = %i"; + "`cashreward`, `xpreward`, `rewardmethod`, `startzone`, `minlevel`, `maxlevel`, `repeatable` " + "from `tasks` WHERE `id` = %i"; const char *AllActivityQuery = "SELECT `taskid`, `step`, `activityid`, `activitytype`, `text1`, `text2`," - "`text3`, `goalid`, `goalmethod`, `goalcount`, `delivertonpc`, " - "`zoneid`, `optional` from `activities` WHERE " - "`taskid` < %i AND `activityid` < %i ORDER BY taskid, activityid ASC"; + "`text3`, `goalid`, `goalmethod`, `goalcount`, `delivertonpc`, " + "`zoneid`, `optional` from `activities` WHERE " + "`taskid` < %i AND `activityid` < %i ORDER BY taskid, activityid ASC"; const char *SingleTaskActivityQuery = "SELECT `taskid`, `step`, `activityid`, `activitytype`, `text1`, `text2`," - "`text3`, `goalid`, `goalmethod`, `goalcount`, `delivertonpc`, " - "`zoneid`, `optional` from `activities` WHERE " - "`taskid` = %i AND `activityid` < %i ORDER BY taskid, activityid ASC"; + "`text3`, `goalid`, `goalmethod`, `goalcount`, `delivertonpc`, " + "`zoneid`, `optional` from `activities` WHERE " + "`taskid` = %i AND `activityid` < %i ORDER BY taskid, activityid ASC"; const char *ERR_TASK_OOR = "[TASKS]Task ID %i out of range while loading tasks from database"; const char *ERR_TASK_OR_ACTIVITY_OOR = "[TASKS]Task or Activity ID (%i, %i) out of range while loading" - "activities from database"; + "activities from database"; const char *ERR_NOTASK = "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database"; @@ -212,9 +212,9 @@ bool TaskManager::LoadTasks(int SingleTask) { Tasks[TaskID]->LastStep = 0; _log(TASKS__GLOBALLOAD,"TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", - TaskID, Tasks[TaskID]->Duration, Tasks[TaskID]->StartZone, Tasks[TaskID]->Reward, - Tasks[TaskID]->MinLevel, Tasks[TaskID]->MaxLevel, - Tasks[TaskID]->Repeatable ? "Yes" : "No"); + TaskID, Tasks[TaskID]->Duration, Tasks[TaskID]->StartZone, Tasks[TaskID]->Reward, + Tasks[TaskID]->MinLevel, Tasks[TaskID]->MaxLevel, + Tasks[TaskID]->Repeatable ? "Yes" : "No"); _log(TASKS__GLOBALLOAD,"Title: %s ", Tasks[TaskID]->Title); //_log(TASKS__GLOBALLOAD,"Description: %s ", Tasks[TaskID]->Description); @@ -299,20 +299,20 @@ bool TaskManager::LoadTasks(int SingleTask) { Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Optional = atoi(row[12]); _log(TASKS__GLOBALLOAD, "Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " - "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", - Tasks[TaskID]->ActivityCount, ActivityID, TaskID, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Type, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalID, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalMethod, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalCount, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].ZoneID); + "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", + Tasks[TaskID]->ActivityCount, ActivityID, TaskID, + Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Type, + Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalID, + Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalMethod, + Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalCount, + Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].ZoneID); _log(TASKS__GLOBALLOAD, " Text1: %s", - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text1); + Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text1); _log(TASKS__GLOBALLOAD, " Text2: %s", - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text2); + Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text2); _log(TASKS__GLOBALLOAD, " Text3: %s", - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text3); + Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text3); Tasks[TaskID]->ActivityCount++; @@ -337,13 +337,13 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { // duration of a session will overcome this. // const char *TaskQuery="REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " - "VALUES (%i, %i, %i, %i)"; + "VALUES (%i, %i, %i, %i)"; const char *ActivityQuery="REPLACE INTO character_activities (charid, taskid, activityid, donecount, completed) " - "VALUES "; + "VALUES "; const char *CompletedTaskQuery="REPLACE INTO completed_tasks (charid, completedtime, taskid, activityid) " - "VALUES (%i, %i, %i, %i)"; + "VALUES (%i, %i, %i, %i)"; const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::SaveClientState %s"; @@ -364,13 +364,13 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[Task].Updated) { _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", - CharacterID, Task, TaskID); + CharacterID, Task, TaskID); if(!database.RunQuery(query,MakeAnyLenString(&query, TaskQuery, - CharacterID, - TaskID, - Task, - state->ActiveTasks[Task].AcceptedTime), errbuf)) { + CharacterID, + TaskID, + Task, + state->ActiveTasks[Task].AcceptedTime), errbuf)) { LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); } @@ -389,22 +389,22 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[Task].Activity[Activity].Updated) { _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientSate for character ID %d, " - "Updating Activity %i, %i", - CharacterID, Task, Activity); + "Updating Activity %i, %i", + CharacterID, Task, Activity); if(UpdatedActivityCount==0) { MakeAnyLenString(&buf, "(%i, %i, %i, %i, %i)", CharacterID, TaskID, - Activity, - state->ActiveTasks[Task].Activity[Activity].DoneCount, - state->ActiveTasks[Task].Activity[Activity].State == - ActivityCompleted); + Activity, + state->ActiveTasks[Task].Activity[Activity].DoneCount, + state->ActiveTasks[Task].Activity[Activity].State == + ActivityCompleted); } else { MakeAnyLenString(&buf, ", (%i, %i, %i, %i, %i)", CharacterID, TaskID, - Activity, - state->ActiveTasks[Task].Activity[Activity].DoneCount, - state->ActiveTasks[Task].Activity[Activity].State == - ActivityCompleted); + Activity, + state->ActiveTasks[Task].Activity[Activity].DoneCount, + state->ActiveTasks[Task].Activity[Activity].State == + ActivityCompleted); } UpdateActivityQuery = UpdateActivityQuery + buf; safe_delete_array(buf); @@ -415,7 +415,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(UpdatedActivityCount > 0) { _log(TASKS__CLIENTSAVE, "Executing query %s", UpdateActivityQuery.c_str()); if(!database.RunQuery(query,MakeAnyLenString(&query, UpdateActivityQuery.c_str()), - errbuf)) { + errbuf)) { LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); } @@ -432,7 +432,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { } if(RuleB(TaskSystem, RecordCompletedTasks) && - (state->CompletedTasks.size() > (unsigned int)state->LastCompletedTaskLoaded)) { + (state->CompletedTasks.size() > (unsigned int)state->LastCompletedTaskLoaded)) { for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { @@ -440,14 +440,14 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { int TaskID = state->CompletedTasks[i].TaskID; if((TaskID<=0) || (TaskID>=MAXTASKS) || (Tasks[TaskID]==nullptr)) continue; - // First we save a record with an ActivityID of -1. + // First we save a record with an ActivityID of -1. // This indicates this task was completed at the given time. We infer that all // none optional activities were completed. // if(!database.RunQuery(query,MakeAnyLenString(&query, CompletedTaskQuery, - CharacterID, - state->CompletedTasks[i].CompletedTime, - TaskID, -1), errbuf)) { + CharacterID, + state->CompletedTasks[i].CompletedTime, + TaskID, -1), errbuf)) { LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); continue; @@ -463,9 +463,9 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(Tasks[TaskID]->Activity[j].Optional && state->CompletedTasks[i].ActivityDone[j]) { if(!database.RunQuery(query,MakeAnyLenString(&query, CompletedTaskQuery, - CharacterID, - state->CompletedTasks[i].CompletedTime, - TaskID, j), errbuf)) { + CharacterID, + state->CompletedTasks[i].CompletedTime, + TaskID, j), errbuf)) { LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); } @@ -509,7 +509,7 @@ void Client::RemoveClientTaskState() { bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { const char *TaskQuery = "SELECT `taskid`, `slot`, `acceptedtime` from `character_tasks` " - "WHERE `charid` = %i ORDER BY acceptedtime"; + "WHERE `charid` = %i ORDER BY acceptedtime"; const char *ERR_TASK_OOR1 = "[TASKS]Task ID %i out of range while loading character tasks from database"; @@ -521,8 +521,8 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; if(!c || !state) return false; @@ -575,8 +575,8 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTaskCount++; _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState. Char: %i Task ID %i, " - "Accepted Time: %8X", - CharacterID, TaskID,acceptedtime); + "Accepted Time: %8X", + CharacterID, TaskID,acceptedtime); } mysql_free_result(result); safe_delete_array(query); @@ -591,8 +591,8 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // Load Activities const char *ActivityQuery = "SELECT `taskid`, `activityid`, `donecount`, `completed` " - " from `character_activities` WHERE `charid` = %i " - "ORDER BY `taskid` ASC, `activityid` ASC"; + " from `character_activities` WHERE `charid` = %i " + "ORDER BY `taskid` ASC, `activityid` ASC"; const char *ERR_TASK_OOR2 = "[TASKS]Task ID %i out of range while loading character activities from database"; @@ -607,7 +607,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(database.RunQuery(query,MakeAnyLenString(&query, ActivityQuery, - CharacterID), errbuf, &result)) { + CharacterID), errbuf, &result)) { while((row = mysql_fetch_row(result))) { @@ -633,7 +633,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(ActiveTaskIndex == -1) { - LogFile->write(EQEMuLog::Error, ERR_NOTASK, ActivityID, TaskID); + LogFile->write(EQEMuLog::Error, ERR_NOTASK, ActivityID, TaskID); continue; } @@ -648,8 +648,8 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].Updated = false; _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, " - "DoneCount: %i, Completed: %i", - CharacterID, TaskID, ActivityID, DoneCount, Completed); + "DoneCount: %i, Completed: %i", + CharacterID, TaskID, ActivityID, DoneCount, Completed); } mysql_free_result(result); @@ -663,7 +663,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } const char *CompletedTaskQuery = "SELECT `taskid`, `activityid`, `completedtime` from `completed_tasks` " - "WHERE `charid` = %i ORDER BY completedtime, taskid, activityid"; + "WHERE `charid` = %i ORDER BY completedtime, taskid, activityid"; const char *ERR_TASK_OOR3 = "[TASKS]Task ID %i out of range while loading completed tasks from database"; @@ -675,7 +675,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(RuleB(TaskSystem, RecordCompletedTasks)) { if(database.RunQuery(query,MakeAnyLenString(&query, CompletedTaskQuery, - CharacterID), errbuf, &result)) { + CharacterID), errbuf, &result)) { CompletedTaskInformation cti; @@ -704,7 +704,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int CompletedTime = atoi(row[2]); if((PreviousTaskID != -1) && ((TaskID != PreviousTaskID) || - (CompletedTime != PreviousCompletedTime))) { + (CompletedTime != PreviousCompletedTime))) { state->CompletedTasks.push_back(cti); for(int i=0; i0 AND `taskid` < %i ORDER BY `taskid` ASC"; + "AND `taskid` >0 AND `taskid` < %i ORDER BY `taskid` ASC"; const char *ERR_MYSQLERROR4 = "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s"; if(database.RunQuery(query,MakeAnyLenString(&query, EnabledTaskQuery, - CharacterID, MAXTASKS), errbuf, &result)) { + CharacterID, MAXTASKS), errbuf, &result)) { while((row = mysql_fetch_row(result))) { int TaskID = atoi(row[0]); @@ -771,14 +771,14 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { const char *ERR_NOTASK2 = "[TASKS]Character %i has task %i which does not exist."; const char *ERR_INCONSISTENT = "[TASKS]Fatal error in character %i task state. Activity %i for " - "Task %i either missing from client state or from task."; + "Task %i either missing from client state or from task."; for(int i=0; iActiveTasks[i].TaskID; if(TaskID==TASKSLOTEMPTY) continue; if(!Tasks[TaskID]) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " - "Removing from memory. Contact a GM to resolve this.",i, TaskID); + "Removing from memory. Contact a GM to resolve this.",i, TaskID); LogFile->write(EQEMuLog::Error, ERR_NOTASK2, CharacterID, TaskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; @@ -789,8 +789,8 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[i].Activity[j].ActivityID != j) { c->Message(13, "Active Task %i, %s. Activity count does not match expected value." - "Removing from memory. Contact a GM to resolve this.", - TaskID, Tasks[TaskID]->Title); + "Removing from memory. Contact a GM to resolve this.", + TaskID, Tasks[TaskID]->Title); LogFile->write(EQEMuLog::Error, ERR_INCONSISTENT, CharacterID, j, TaskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; @@ -1069,7 +1069,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i int PlayerLevel = c->GetLevel(); _log(TASKS__UPDATE, "TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, - state->EnabledTasks.size()); + state->EnabledTasks.size()); if((TaskSetID<=0) || (TaskSetID>=MAXTASKSETS)) return; if(TaskSets[TaskSetID].size() > 0) { @@ -1083,7 +1083,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) { if(AppropriateLevel((*Iterator), PlayerLevel) && !state->IsTaskActive((*Iterator)) && - (IsTaskRepeatable((*Iterator)) || !state->IsTaskCompleted((*Iterator)))) + (IsTaskRepeatable((*Iterator)) || !state->IsTaskCompleted((*Iterator)))) TaskList[TaskListIndex++] = (*Iterator); Iterator++; @@ -1099,19 +1099,19 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i while((EnabledTaskIndex < state->EnabledTasks.size()) && (TaskSetIndex < TaskSets[TaskSetID].size()) && - (TaskListIndex < MAXCHOOSERENTRIES)) { + (TaskListIndex < MAXCHOOSERENTRIES)) { _log(TASKS__UPDATE, "Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", - EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex, - TaskSets[TaskSetID][TaskSetIndex]); + EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex, + TaskSets[TaskSetID][TaskSetIndex]); if((TaskSets[TaskSetID][TaskSetIndex] > 0) && - (state->EnabledTasks[EnabledTaskIndex] == TaskSets[TaskSetID][TaskSetIndex])) { + (state->EnabledTasks[EnabledTaskIndex] == TaskSets[TaskSetID][TaskSetIndex])) { if(AppropriateLevel(TaskSets[TaskSetID][TaskSetIndex], PlayerLevel) && - !state->IsTaskActive(TaskSets[TaskSetID][TaskSetIndex]) && - (IsTaskRepeatable(TaskSets[TaskSetID][TaskSetIndex]) || - !state->IsTaskCompleted(TaskSets[TaskSetID][TaskSetIndex]))) { + !state->IsTaskActive(TaskSets[TaskSetID][TaskSetIndex]) && + (IsTaskRepeatable(TaskSets[TaskSetID][TaskSetIndex]) || + !state->IsTaskCompleted(TaskSets[TaskSetID][TaskSetIndex]))) { TaskList[TaskListIndex++] = TaskSets[TaskSetID][TaskSetIndex]; @@ -1146,11 +1146,11 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task int PlayerLevel = c->GetLevel(); AvailableTaskHeader_Struct* AvailableTaskHeader; - AvailableTaskData1_Struct* AvailableTaskData1; - AvailableTaskData2_Struct* AvailableTaskData2; - AvailableTaskTrailer_Struct* AvailableTaskTrailer; + AvailableTaskData1_Struct* AvailableTaskData1; + AvailableTaskData2_Struct* AvailableTaskData2; + AvailableTaskTrailer_Struct* AvailableTaskTrailer; - // Check if any of the tasks exist + // Check if any of the tasks exist for(int i=0; iTitle) + 1 + - strlen(Tasks[TaskList[i]]->Description) + 1 + sizeof(AvailableTaskData2_Struct) + 10 + - sizeof(AvailableTaskTrailer_Struct) + 5; + strlen(Tasks[TaskList[i]]->Description) + 1 + sizeof(AvailableTaskData2_Struct) + 10 + + sizeof(AvailableTaskTrailer_Struct) + 5; } if(ValidTasks == 0) return; @@ -1270,7 +1270,7 @@ void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *T int PlayerLevel = c->GetLevel(); - // Check if any of the tasks exist + // Check if any of the tasks exist for(int i=0; iSequenceMode); + CharID, ActiveTasks[TaskIndex].TaskID, Task->SequenceMode); if(Task->SequenceMode == ActivitiesSequential) { if(ActiveTasks[TaskIndex].Activity[0].State != ActivityCompleted) @@ -1474,7 +1474,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // Enable the next Hidden task. for(int i=0; iActivityCount; i++) { if((ActiveTasks[TaskIndex].Activity[i].State == ActivityActive) && - (!Task->Activity[i].Optional)) { + (!Task->Activity[i].Optional)) { AllActivitiesComplete = false; break; } @@ -1531,7 +1531,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { for(int i=0; iActivityCount; i++) { if((Task->Activity[i].StepNumber == 0) && - (ActiveTasks[TaskIndex].Activity[i].State == ActivityHidden)) { + (ActiveTasks[TaskIndex].Activity[i].State == ActivityHidden)) { ActiveTasks[TaskIndex].Activity[i].State = ActivityActive; //ActiveTasks[TaskIndex].Activity[i].Updated=true; } @@ -1543,7 +1543,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { for(int Activity=0; ActivityActivityCount; Activity++) { if(Task->Activity[Activity].StepNumber == (int)ActiveTasks[TaskIndex].CurrentStep) { if((ActiveTasks[TaskIndex].Activity[Activity].State != ActivityCompleted) && - (!Task->Activity[Activity].Optional)) { + (!Task->Activity[Activity].Optional)) { CurrentStepComplete = false; AllActivitiesComplete = false; break; @@ -1594,8 +1594,8 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // for(int Activity=0; ActivityActivityCount; Activity++) { if((Task->Activity[Activity].StepNumber == (int)ActiveTasks[TaskIndex].CurrentStep) && - (ActiveTasks[TaskIndex].Activity[Activity].State == ActivityHidden)) { - ActiveTasks[TaskIndex].Activity[Activity].State = ActivityActive; + (ActiveTasks[TaskIndex].Activity[Activity].State == ActivityHidden)) { + ActiveTasks[TaskIndex].Activity[Activity].State = ActivityActive; ActiveTasks[TaskIndex].Activity[Activity].Updated=true; } } @@ -1644,7 +1644,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { _log(TASKS__UPDATE, "Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", - c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID); + c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID); continue; } // Is the activity to kill this type of NPC ? @@ -1697,7 +1697,7 @@ int ClientTaskState::ActiveSpeakTask(int NPCTypeID) { } // Is the activity to speak with this type of NPC ? if((Task->Activity[j].GoalMethod == METHODQUEST) && - (Task->Activity[j].GoalID == NPCTypeID)) return ActiveTasks[i].TaskID; + (Task->Activity[j].GoalID == NPCTypeID)) return ActiveTasks[i].TaskID; } } return 0; @@ -1728,7 +1728,7 @@ int ClientTaskState::ActiveSpeakActivity(int NPCTypeID, int TaskID) { } // Is the activity to speak with this type of NPC ? if((Task->Activity[j].GoalMethod == METHODQUEST) && - (Task->Activity[j].GoalID == NPCTypeID)) return j; + (Task->Activity[j].GoalID == NPCTypeID)) return j; } return 0; } @@ -1764,7 +1764,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { _log(TASKS__UPDATE, "Char: %s Activity type %i for Item %i failed zone check", - c->GetName(), Type, ItemID); + c->GetName(), Type, ItemID); continue; } // Is the activity related to this item ? @@ -1815,7 +1815,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { if(Task->Activity[j].Type != ActivityExplore) continue; if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { _log(TASKS__UPDATE, "Char: %s Explore exploreid %i failed zone check", - c->GetName(), ExploreID); + c->GetName(), ExploreID); continue; } // Is the activity to explore this area id ? @@ -1838,7 +1838,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { // (Only a goal count of 1 makes sense for explore activities?) _log(TASKS__UPDATE, "Increment on explore"); IncrementDoneCount(c, Task, i, j, - Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); + Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); } } @@ -1868,11 +1868,11 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i if(ActiveTasks[i].Activity[j].State != ActivityActive) continue; // We are only interested in Deliver activities if((Task->Activity[j].Type != ActivityDeliver) && - (Task->Activity[j].Type != ActivityGiveCash)) continue; + (Task->Activity[j].Type != ActivityGiveCash)) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { _log(TASKS__UPDATE, "Char: %s Deliver activity failed zone check (current zone %i, need zone %i", - c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID); + c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID); continue; } // Is the activity to deliver to this NPCTypeID ? @@ -1895,7 +1895,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i case METHODLIST: if(!taskmanager->GoalListManager.IsInList(Task->Activity[j].GoalID, - Items[k])) + Items[k])) continue; break; @@ -1939,14 +1939,14 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { if(Task->Activity[j].GoalMethod != METHODSINGLEID) continue; if(Task->Activity[j].ZoneID != ZoneID) { _log(TASKS__UPDATE, "Char: %s Touch activity failed zone check", - c->GetName()); + c->GetName()); continue; } // We found an active task to zone into this zone, so set done count to goal count // (Only a goal count of 1 makes sense for touch activities?) _log(TASKS__UPDATE, "Increment on Touch"); IncrementDoneCount(c, Task, i, j, - Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); + Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); } } @@ -1970,16 +1970,16 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T // Have we reached the goal count for this activity ? if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount >= Task->Activity[ActivityID].GoalCount) { _log(TASKS__UPDATE, "Done (%i) = Goal (%i) for Activity %i", - ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, - Task->Activity[ActivityID].GoalCount, - ActivityID); + ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, + Task->Activity[ActivityID].GoalCount, + ActivityID); if(Task->Activity[ActivityID].GoalMethod != METHODQUEST) { char buf[24]; snprintf(buf, 23, "%d %d", ActiveTasks[TaskIndex].TaskID, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID); buf[23] = '\0'; - parse->EventPlayer(EVENT_TASK_STAGE_COMPLETE, c, buf, 0); + parse->EventPlayer(EVENT_TASK_STAGE_COMPLETE, c, buf, 0); } // Flag the activity as complete @@ -2185,7 +2185,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) { if(ActivityID >= Task->ActivityCount) return false; _log(TASKS__UPDATE, "ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, - ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State); + ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State); return (ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State == ActivityActive); @@ -2267,7 +2267,7 @@ void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { ActiveTaskIndex, Task->Activity[ActivityID].Optional); } -void ClientTaskState::ShowClientTasks(Client *c) { +void ClientTaskState::ShowClientTasks(Client *c) { c->Message(0, "Task Information:"); //for(int i=0; iMessage(0, " Description: [%s]\n", taskmanager->Tasks[ActiveTasks[i].TaskID]->Description); for(int j=0; jGetActivityCount(ActiveTasks[i].TaskID); j++) { c->Message(0, " Activity: %2d, DoneCount: %2d, Status: %d (0=Hidden, 1=Active, 2=Complete)", - ActiveTasks[i].Activity[j].ActivityID, - ActiveTasks[i].Activity[j].DoneCount, - ActiveTasks[i].Activity[j].State); + ActiveTasks[i].Activity[j].ActivityID, + ActiveTasks[i].Activity[j].DoneCount, + ActiveTasks[i].Activity[j].State); } } @@ -2316,8 +2316,8 @@ int ClientTaskState::TaskTimeLeft(int TaskID) { int ClientTaskState::IsTaskCompleted(int TaskID) { // Returns: -1 if RecordCompletedTasks is not true - // +1 if the task has been completed - // 0 if the task has not been completed + // +1 if the task has been completed + // 0 if the task has not been completed if(!(RuleB(TaskSystem, RecordCompletedTasks))) return -1; @@ -2329,7 +2329,7 @@ int ClientTaskState::IsTaskCompleted(int TaskID) { return 0; } -bool TaskManager::IsTaskRepeatable(int TaskID) { +bool TaskManager::IsTaskRepeatable(int TaskID) { if((TaskID <= 0) || (TaskID >= MAXTASKS)) return false; @@ -2457,10 +2457,10 @@ void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) { if(CompletedTasks[AdjustedTaskIndex].ActivityDone[i]) { CompletedActivityCount++; PacketLength = PacketLength + sizeof(TaskHistoryReplyData1_Struct) + - strlen(Task->Activity[i].Text1) + 1 + - strlen(Task->Activity[i].Text2) + 1 + - sizeof(TaskHistoryReplyData2_Struct) + - strlen(Task->Activity[i].Text3) + 1; + strlen(Task->Activity[i].Text1) + 1 + + strlen(Task->Activity[i].Text2) + 1 + + sizeof(TaskHistoryReplyData2_Struct) + + strlen(Task->Activity[i].Text3) + 1; } } @@ -2581,7 +2581,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) FirstTaskToSend = State->CompletedTasks.size() - 50; _log(TASKS__UPDATE, "Completed Task Count: %i, First Task to send is %i, Last is %i", - State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend); + State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend); /* for(iterator=State->CompletedTasks.begin(); iterator!=State->CompletedTasks.end(); iterator++) { int TaskID = (*iterator).TaskID; @@ -2682,8 +2682,8 @@ void TaskManager::SendTaskActivityLong(Client *c, int TaskID, int ActivityID, in long PacketLength = sizeof(TaskActivityHeader_Struct) + +sizeof(TaskActivityData1_Struct) + sizeof(TaskActivityTrailer_Struct); PacketLength = PacketLength + strlen(Tasks[TaskID]->Activity[ActivityID].Text1) + 1 + - strlen(Tasks[TaskID]->Activity[ActivityID].Text2) + 1 + - strlen(Tasks[TaskID]->Activity[ActivityID].Text3) + 1; + strlen(Tasks[TaskID]->Activity[ActivityID].Text2) + 1 + + strlen(Tasks[TaskID]->Activity[ActivityID].Text3) + 1; EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskActivity, PacketLength); @@ -2697,7 +2697,7 @@ void TaskManager::SendTaskActivityLong(Client *c, int TaskID, int ActivityID, in // We send our 'internal' types as ActivityUse1. text3 should be set to the activity description, so it makes // no difference to the client. All activity updates will be done based on our interal activity types. - if((Tasks[TaskID]->Activity[ActivityID].Type > 0) && Tasks[TaskID]->Activity[ActivityID].Type < 100) + if((Tasks[TaskID]->Activity[ActivityID].Type > 0) && Tasks[TaskID]->Activity[ActivityID].Type < 100) tah->ActivityType = Tasks[TaskID]->Activity[ActivityID].Type; else tah->ActivityType = ActivityUse1; @@ -2762,10 +2762,10 @@ void TaskManager::SendTaskActivityNew(Client *c, int TaskID, int ActivityID, int long PacketLength = 29 + 4 + 8 + 4 + 4 + 5; PacketLength = PacketLength + strlen(Tasks[TaskID]->Activity[ActivityID].Text1) + 1 + - strlen(Tasks[TaskID]->Activity[ActivityID].Text2) + 1 + - strlen(Tasks[TaskID]->Activity[ActivityID].Text3) + 1 + - ((strlen(itoa(Tasks[TaskID]->Activity[ActivityID].ZoneID)) + 1) * 2) + - 3 + String2Len; + strlen(Tasks[TaskID]->Activity[ActivityID].Text2) + 1 + + strlen(Tasks[TaskID]->Activity[ActivityID].Text3) + 1 + + ((strlen(itoa(Tasks[TaskID]->Activity[ActivityID].ZoneID)) + 1) * 2) + + 3 + String2Len; EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskActivity, PacketLength); @@ -2777,7 +2777,7 @@ void TaskManager::SendTaskActivityNew(Client *c, int TaskID, int ActivityID, int // We send our 'internal' types as ActivityUse1. text3 should be set to the activity description, so it makes // no difference to the client. All activity updates will be done based on our interal activity types. - if((Tasks[TaskID]->Activity[ActivityID].Type > 0) && Tasks[TaskID]->Activity[ActivityID].Type < 100) + if((Tasks[TaskID]->Activity[ActivityID].Type > 0) && Tasks[TaskID]->Activity[ActivityID].Type < 100) outapp->WriteUInt32(Tasks[TaskID]->Activity[ActivityID].Type); else outapp->WriteUInt32(ActivityUse1); @@ -2837,7 +2837,7 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { //for(int TaskIndex=0; TaskIndexGetActiveTaskCount(); TaskIndex++) { for(int TaskIndex=0; TaskIndexGetActiveTaskID(TaskIndex); - if((TaskID==0) || (Tasks[TaskID] ==0)) continue; + if((TaskID==0) || (Tasks[TaskID] ==0)) continue; int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, false); @@ -2849,11 +2849,11 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { _log(TASKS__UPDATE, " Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, - Tasks[TaskID]->Activity[Activity].Optional, - TaskComplete); + Tasks[TaskID]->Activity[Activity].Optional, + TaskComplete); else SendTaskActivityLong(c, TaskID, Activity, TaskIndex, - Tasks[TaskID]->Activity[Activity].Optional, 0); + Tasks[TaskID]->Activity[Activity].Optional, 0); } else { _log(TASKS__UPDATE, " Short: %i, %i, %i", TaskID, Activity, TaskIndex); @@ -2873,7 +2873,7 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta int TaskID = c->GetActiveTaskID(TaskIndex); - if((TaskID==0) || (Tasks[TaskID] ==0)) return; + if((TaskID==0) || (Tasks[TaskID] ==0)) return; int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, BringUpTaskJournal); @@ -2886,10 +2886,10 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta _log(TASKS__UPDATE, " Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, - Tasks[TaskID]->Activity[Activity].Optional, TaskComplete); + Tasks[TaskID]->Activity[Activity].Optional, TaskComplete); else SendTaskActivityLong(c, TaskID, Activity, TaskIndex, - Tasks[TaskID]->Activity[Activity].Optional, 0); + Tasks[TaskID]->Activity[Activity].Optional, 0); } else { _log(TASKS__UPDATE, " Short: %i, %i, %i", TaskID, Activity, TaskIndex); @@ -2905,8 +2905,8 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN if((TaskID<1) || (TaskID>=MAXTASKS) || !Tasks[TaskID]) return; int PacketLength = sizeof(TaskDescriptionHeader_Struct) + strlen(Tasks[TaskID]->Title) + 1 - + sizeof(TaskDescriptionData1_Struct) + strlen(Tasks[TaskID]->Description) + 1 - + sizeof(TaskDescriptionData2_Struct) + 1 + sizeof(TaskDescriptionTrailer_Struct); + + sizeof(TaskDescriptionData1_Struct) + strlen(Tasks[TaskID]->Description) + 1 + + sizeof(TaskDescriptionData2_Struct) + 1 + sizeof(TaskDescriptionTrailer_Struct); string RewardText; int ItemID = 0; @@ -2933,26 +2933,26 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN case EQClient62: { MakeAnyLenString(&RewardTmp, "%c%07i-00001-00001-00001-00001-000013E0ABA6B%s%c", - 0x12, ItemID, Tasks[TaskID]->Reward,0x12); + 0x12, ItemID, Tasks[TaskID]->Reward,0x12); break; } case EQClientTitanium: { MakeAnyLenString(&RewardTmp, "%c%06X000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Tasks[TaskID]->Reward,0x12); + 0x12, ItemID, Tasks[TaskID]->Reward,0x12); break; } case EQClientRoF: { MakeAnyLenString(&RewardTmp, "%c%06X0000000000000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Tasks[TaskID]->Reward,0x12); + 0x12, ItemID, Tasks[TaskID]->Reward,0x12); break; } default: { // All clients after Titanium MakeAnyLenString(&RewardTmp, "%c%06X00000000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Tasks[TaskID]->Reward,0x12); + 0x12, ItemID, Tasks[TaskID]->Reward,0x12); } } @@ -2967,26 +2967,26 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN case EQClient62: { MakeAnyLenString(&RewardTmp, "%c%07i-00001-00001-00001-00001-000013E0ABA6B%s%c", - 0x12, ItemID, Item->Name,0x12); + 0x12, ItemID, Item->Name,0x12); break; } case EQClientTitanium: { MakeAnyLenString(&RewardTmp, "%c%06X000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Item->Name ,0x12); + 0x12, ItemID, Item->Name ,0x12); break; } case EQClientRoF: { MakeAnyLenString(&RewardTmp, "%c%06X0000000000000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Item->Name ,0x12); + 0x12, ItemID, Item->Name ,0x12); break; } default: { // All clients after Titanium MakeAnyLenString(&RewardTmp, "%c%06X00000000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Item->Name ,0x12); + 0x12, ItemID, Item->Name ,0x12); } } } @@ -3047,7 +3047,7 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN tdd2 = (TaskDescriptionData2_Struct*)Ptr; // This next field may not be a reward count. It is always 1 in the packets I have seen. Setting it to 2 and trying - // to include multiple item links has so far proven futile. Setting it to 0 ends the packet after the next byte. + // to include multiple item links has so far proven futile. Setting it to 0 ends the packet after the next byte. tdd2->RewardCount = 1; if(Tasks[TaskID]->XPReward) @@ -3152,8 +3152,8 @@ void ClientTaskState::RemoveTask(Client *c, int SequenceNumber) { _log(TASKS__UPDATE, "ClientTaskState Cancel Task %i ", SequenceNumber); if(!database.RunQuery(query,MakeAnyLenString(&query, ActivityQuery, - CharacterID, - ActiveTasks[SequenceNumber].TaskID), errbuf)) { + CharacterID, + ActiveTasks[SequenceNumber].TaskID), errbuf)) { LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", errbuf); safe_delete_array(query); @@ -3162,8 +3162,8 @@ void ClientTaskState::RemoveTask(Client *c, int SequenceNumber) { _log(TASKS__UPDATE, "CancelTask: %s", query); safe_delete_array(query); if(!database.RunQuery(query,MakeAnyLenString(&query, TaskQuery, - CharacterID, - ActiveTasks[SequenceNumber].TaskID), errbuf)) { + CharacterID, + ActiveTasks[SequenceNumber].TaskID), errbuf)) { LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", errbuf); } @@ -3211,7 +3211,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID) { int FreeSlot = -1; for(int i=0; iSaveClientState(c, this); - parse->EventNPC(EVENT_TASKACCEPTED, npc, c, buf, 0); + parse->EventNPC(EVENT_TASKACCEPTED, npc, c, buf, 0); safe_delete_array(buf); } @@ -3299,10 +3299,10 @@ bool TaskGoalListManager::LoadLists() { const char *CountQuery = "SELECT `listid`, COUNT(`entry`) FROM `goallists` GROUP by `listid` " - "ORDER BY `listid`"; + "ORDER BY `listid`"; const char *ListQuery = "SELECT `entry` from `goallists` WHERE `listid`=%i " - "ORDER BY `entry` ASC LIMIT %i"; + "ORDER BY `entry` ASC LIMIT %i"; const char *ERR_MYSQLERROR = "Error in TaskGoalListManager::LoadLists: %s %s"; @@ -3332,7 +3332,7 @@ bool TaskGoalListManager::LoadLists() { int ListIndex = 0; while((row = mysql_fetch_row(result))) { - int ListID = atoi(row[0]); + int ListID = atoi(row[0]); int ListSize = atoi(row[1]); TaskGoalLists[ListIndex].ListID = ListID; @@ -3452,9 +3452,8 @@ bool TaskGoalListManager::IsInList(int ListID, int Entry) { if((ListIndex<0) || (ListIndex >= NumberOfLists)) return false; - if((Entry < TaskGoalLists[ListIndex].Min) || - (Entry > TaskGoalLists[ListIndex].Max)) - return false; + if((Entry < TaskGoalLists[ListIndex].Min) || (Entry > TaskGoalLists[ListIndex].Max)) + return false; int FirstEntry = 0; int LastEntry = TaskGoalLists[ListIndex].Size - 1; @@ -3490,8 +3489,8 @@ TaskProximityManager::~TaskProximityManager() { bool TaskProximityManager::LoadProximities(int ZoneID) { const char *ProximityQuery = "SELECT `exploreid`, `minx`, `maxx`, `miny`, `maxy`, " - "`minz`, `maxz` from `proximities` WHERE `zoneid`=%i " - "ORDER BY `zoneid` ASC"; + "`minz`, `maxz` from `proximities` WHERE `zoneid`=%i " + "ORDER BY `zoneid` ASC"; const char *ERR_MYSQLERROR = "Error in TaskProximityManager::LoadProximities %s %s"; @@ -3540,10 +3539,10 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) { TaskProximity* P = &TaskProximities[i]; _log(TASKS__PROXIMITY, "Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", - X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ); + X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ); if(X < P->MinX || X > P->MaxX || Y < P->MinY || Y > P->MaxY || - Z < P->MinZ || Z > P->MaxZ) continue; + Z < P->MinZ || Z > P->MaxZ) continue; return P->ExploreID; @@ -3552,4 +3551,3 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) { return 0; } - diff --git a/zone/tasks.h b/zone/tasks.h index 77da598f5..25d3872fa 100644 --- a/zone/tasks.h +++ b/zone/tasks.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 */ @@ -97,26 +97,26 @@ private: typedef enum { METHODSINGLEID = 0, METHODLIST = 1, METHODQUEST = 2 } TaskMethodType; struct ActivityInformation { - int StepNumber; - int Type; - char *Text1; - char *Text2; - char *Text3; - int GoalID; + int StepNumber; + int Type; + char *Text1; + char *Text2; + char *Text3; + int GoalID; TaskMethodType GoalMethod; - int GoalCount; - int DeliverToNPC; - int ZoneID; - bool Optional; + int GoalCount; + int DeliverToNPC; + int ZoneID; + bool Optional; }; typedef enum { ActivitiesSequential = 0, ActivitiesStepped = 1 } SequenceType; struct TaskInformation { int Duration; - char *Title; - char *Description; - char *Reward; + char *Title; + char *Description; + char *Reward; int RewardID; int CashReward; // Expressed in copper int XPReward; @@ -126,7 +126,7 @@ struct TaskInformation { SequenceType SequenceMode; int LastStep; short MinLevel; - short MaxLevel; + short MaxLevel; bool Repeatable; ActivityInformation Activity[MAXACTIVITIESPERTASK]; }; @@ -134,8 +134,8 @@ struct TaskInformation { typedef enum { ActivityHidden = 0, ActivityActive = 1, ActivityCompleted = 2 } ActivityState; typedef enum { ActivityDeliver = 1, ActivityKill = 2, ActivityLoot = 3, ActivitySpeakWith = 4, ActivityExplore = 5, - ActivityTradeSkill = 6, ActivityFish = 7, ActivityForage = 8, ActivityUse1 = 9, ActivityUse2 = 10, - ActivityTouch = 11, ActivityGiveCash = 100 } ActivityType; + ActivityTradeSkill = 6, ActivityFish = 7, ActivityForage = 8, ActivityUse1 = 9, ActivityUse2 = 10, + ActivityTouch = 11, ActivityGiveCash = 100 } ActivityType; struct ClientActivityInformation { @@ -147,7 +147,7 @@ struct ClientActivityInformation { struct ClientTaskInformation { int TaskID; - int CurrentStep; + int CurrentStep; int AcceptedTime; bool Updated; ClientActivityInformation Activity[MAXACTIVITIESPERTASK]; @@ -222,7 +222,7 @@ class TaskManager { public: TaskManager(); ~TaskManager(); - int GetActivityCount(int TaskID); + int GetActivityCount(int TaskID); bool LoadSingleTask(int TaskID); bool LoadTasks(int SingleTask=0); void ReloadGoalLists(); @@ -238,9 +238,9 @@ public: void SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool TaskComplete, bool BringUpTaskJournal=false); void SendTaskActivityShort(Client *c, int TaskID, int ActivityID, int ClientTaskIndex); void SendTaskActivityLong(Client *c, int TaskID, int ActivityID, int ClientTaskIndex, - bool Optional, bool TaskComplete=false); + bool Optional, bool TaskComplete=false); void SendTaskActivityNew(Client *c, int TaskID, int ActivityID, int ClientTaskIndex, - bool Optional, bool TaskComplete=false); + bool Optional, bool TaskComplete=false); void SendCompletedTasksToClient(Client *c, ClientTaskState *state); void ExplainTask(Client *c, int TaskID); int FirstTaskInSet(int TaskSet); diff --git a/zone/titles.cpp b/zone/titles.cpp index e6a2e5f61..1e73da26a 100644 --- a/zone/titles.cpp +++ b/zone/titles.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" #include "../common/eq_packet_structs.h" @@ -193,12 +193,10 @@ bool TitleManager::IsClientEligibleForTitle(Client *c, vector::itera if(Title->SkillID >= 0) { - if((Title->MinSkillValue >= 0) - && (c->GetRawSkill(static_cast(Title->SkillID)) < static_cast(Title->MinSkillValue))) + if((Title->MinSkillValue >= 0) && (c->GetRawSkill(static_cast(Title->SkillID)) < static_cast(Title->MinSkillValue))) return false; - if((Title->MaxSkillValue >= 0) - && (c->GetRawSkill(static_cast(Title->SkillID)) > static_cast(Title->MaxSkillValue))) + if((Title->MaxSkillValue >= 0) && (c->GetRawSkill(static_cast(Title->SkillID)) > static_cast(Title->MaxSkillValue))) return false; } @@ -206,8 +204,8 @@ bool TitleManager::IsClientEligibleForTitle(Client *c, vector::itera if((Title->ItemID >= 1) && (c->GetInv().HasItem(Title->ItemID, 0, 0xFF) == SLOT_INVALID)) return false; - if((Title->TitleSet > 0) && (!c->CheckTitle(Title->TitleSet))) - return false; + if((Title->TitleSet > 0) && (!c->CheckTitle(Title->TitleSet))) + return false; return true; } @@ -277,7 +275,7 @@ void TitleManager::CreateNewPlayerTitle(Client *c, const char *Title) safe_delete_array(query); if(!database.RunQuery(query,MakeAnyLenString(&query, "INSERT into titles (`char_id`, `prefix`) VALUES(%i, '%s')", - c->CharacterID(), EscTitle), errbuf)) + c->CharacterID(), EscTitle), errbuf)) LogFile->write(EQEMuLog::Error, "Error adding title: %s %s", query, errbuf); else { @@ -321,7 +319,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *c, const char *Suffix) safe_delete_array(query); if(!database.RunQuery(query,MakeAnyLenString(&query, "INSERT into titles (`char_id`, `suffix`) VALUES(%i, '%s')", - c->CharacterID(), EscSuffix), errbuf)) + c->CharacterID(), EscSuffix), errbuf)) LogFile->write(EQEMuLog::Error, "Error adding title suffix: %s %s", query, errbuf); else { @@ -372,65 +370,65 @@ void Client::SetTitleSuffix(const char *Suffix) void Client::EnableTitle(int titleset) { - if (CheckTitle(titleset)) { - return; - } + if (CheckTitle(titleset)) { + return; + } - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; - if(!database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO player_titlesets (char_id, title_set) VALUES (%i, %i)", CharacterID(), titleset), errbuf)) { - LogFile->write(EQEMuLog::Error, "Error in EnableTitle query for titleset %i and charid %i", titleset, CharacterID()); - safe_delete_array(query); - return; - } - else { - safe_delete_array(query); - return; - } + if(!database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO player_titlesets (char_id, title_set) VALUES (%i, %i)", CharacterID(), titleset), errbuf)) { + LogFile->write(EQEMuLog::Error, "Error in EnableTitle query for titleset %i and charid %i", titleset, CharacterID()); + safe_delete_array(query); + return; + } + else { + safe_delete_array(query); + return; + } } bool Client::CheckTitle(int titleset) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; + MYSQL_RES *result; - if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT `id` FROM player_titlesets WHERE `title_set`=%i AND `char_id`=%i LIMIT 1", titleset, CharacterID()), errbuf, &result)) { - safe_delete_array(query); - if (mysql_num_rows(result) >= 1) { - mysql_free_result(result); - return(true); - } - mysql_free_result(result); - } + if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT `id` FROM player_titlesets WHERE `title_set`=%i AND `char_id`=%i LIMIT 1", titleset, CharacterID()), errbuf, &result)) { + safe_delete_array(query); + if (mysql_num_rows(result) >= 1) { + mysql_free_result(result); + return(true); + } + mysql_free_result(result); + } - else { - LogFile->write(EQEMuLog::Error, "Error in CheckTitle query '%s': %s", query, errbuf); - safe_delete_array(query); - } + else { + LogFile->write(EQEMuLog::Error, "Error in CheckTitle query '%s': %s", query, errbuf); + safe_delete_array(query); + } - return(false); + return(false); } void Client::RemoveTitle(int titleset) { - if (!CheckTitle(titleset)) { - return; - } + if (!CheckTitle(titleset)) { + return; + } - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; - if (database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM player_titlesets WHERE `title_set`=%i AND `char_id`=%i", titleset, CharacterID()), errbuf)) { - safe_delete_array(query); - } + if (database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM player_titlesets WHERE `title_set`=%i AND `char_id`=%i", titleset, CharacterID()), errbuf)) { + safe_delete_array(query); + } - else { - LogFile->write(EQEMuLog::Error, "Error in RemoveTitle query '%s': %s", query, errbuf); - safe_delete_array(query); - } + else { + LogFile->write(EQEMuLog::Error, "Error in RemoveTitle query '%s': %s", query, errbuf); + safe_delete_array(query); + } - return; + return; } diff --git a/zone/titles.h b/zone/titles.h index 190b2f445..923cb6390 100644 --- a/zone/titles.h +++ b/zone/titles.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 TITLES_H #define TITLES_H diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 1d4e7664d..cd7edc38b 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.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 "../common/debug.h" @@ -78,7 +78,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if (itemsFound != 2) { - user->Message(13, "Error: Too many/few items in augmentation container."); + user->Message(13, "Error: Too many/few items in augmentation container."); return; } } @@ -217,8 +217,8 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob PlayerProfile_Struct& user_pp = user->GetPP(); ItemInst* container = nullptr; ItemInst* inst = nullptr; - uint8 c_type = 0xE8; - uint32 some_id = 0; + uint8 c_type = 0xE8; + uint32 some_id = 0; bool worldcontainer=false; if (in_combine->container_slot == SLOT_TRADESKILL) { @@ -235,8 +235,8 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if (inst) { const Item_Struct* item = inst->GetItem(); if (item && inst->IsType(ItemClassContainer)) { - c_type = item->BagType; - some_id = item->ID; + c_type = item->BagType; + some_id = item->ID; } } } @@ -248,29 +248,29 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob container = inst; - DBTradeskillRecipe_Struct spec; - if (!database.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) { - user->Message_StringID(MT_Emote,TRADESKILL_NOCOMBINE); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); - user->QueuePacket(outapp); - safe_delete(outapp); - return; - } + DBTradeskillRecipe_Struct spec; + if (!database.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) { + user->Message_StringID(MT_Emote,TRADESKILL_NOCOMBINE); + EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); + return; + } - // Character hasn't learnt the recipe yet. - // must_learn: - // bit 1 (0x01): recipe can't be experimented - // bit 2 (0x02): can try to experiment but not useable for auto-combine until learnt - // bit 5 (0x10): no learn message, use unlisted flag to prevent it showing up on search - // bit 6 (0x20): unlisted recipe flag - if ((spec.must_learn&0xF) == 1 && !spec.has_learnt) { - // Made up message for the client. Just giving a DNC is the other option. - user->Message(4, "You need to learn how to combine these first."); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); - user->QueuePacket(outapp); - safe_delete(outapp); - return; - } + // Character hasn't learnt the recipe yet. + // must_learn: + // bit 1 (0x01): recipe can't be experimented + // bit 2 (0x02): can try to experiment but not useable for auto-combine until learnt + // bit 5 (0x10): no learn message, use unlisted flag to prevent it showing up on search + // bit 6 (0x20): unlisted recipe flag + if ((spec.must_learn&0xF) == 1 && !spec.has_learnt) { + // Made up message for the client. Just giving a DNC is the other option. + user->Message(4, "You need to learn how to combine these first."); + EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); + return; + } // Character does not have the required skill. if(spec.skill_needed > 0 && user->GetSkill(spec.tradeskill) < spec.skill_needed ) { // Notify client. @@ -283,7 +283,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob //changing from a switch to string of if's since we don't need to iterate through all of the skills in the SkillType enum if (spec.tradeskill == ALCHEMY) { - if (user_pp.class_ != SHAMAN) { + if (user_pp.class_ != SHAMAN) { user->Message(13, "This tradeskill can only be performed by a shaman."); return; } @@ -293,13 +293,13 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob } } else if (spec.tradeskill == TINKERING) { - if (user_pp.race != GNOME) { + if (user_pp.race != GNOME) { user->Message(13, "Only gnomes can tinker."); return; } } else if (spec.tradeskill == MAKE_POISON) { - if (user_pp.class_ != ROGUE) { + if (user_pp.class_ != ROGUE) { user->Message(13, "Only rogues can mix poisons."); return; } @@ -390,9 +390,9 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac 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; uint8 qcount = 0; @@ -559,7 +559,7 @@ SkillType Object::TypeToSkill(uint32 type) { case OT_OGGOKFORGE: case OT_FIERDALFFORGE: case OT_STORMGUARDF: - case OT_VALEFORGE: { + case OT_VALEFORGE: { tradeskill = BLACKSMITHING; break; } @@ -607,12 +607,11 @@ SkillType Object::TypeToSkill(uint32 type) { return(tradeskill); } -void Client::TradeskillSearchResults(const char *query, unsigned long qlen, - unsigned long objtype, unsigned long someid) { +void Client::TradeskillSearchResults(const char *query, unsigned long qlen, unsigned long objtype, unsigned long someid) { char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; if (!database.RunQuery(query, qlen, errbuf, &result)) { LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query, errbuf); @@ -671,9 +670,9 @@ void Client::TradeskillSearchResults(const char *query, unsigned long qlen, void Client::SendTradeskillDetails(uint32 recipe_id) { 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; uint8 qcount = 0; @@ -789,7 +788,7 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { //returns true on success bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { - if(spec == nullptr) + if(spec == nullptr) return(false); uint16 user_skill = GetSkill(spec->tradeskill); @@ -804,13 +803,13 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { // 09/10/2006 v0.1 (eq4me) // 09/11/2006 v0.2 (eq4me) // Todo: - // Implementing AAs - // Success modifiers based on recipes - // Skillup modifiers based on the rarity of the ingredients + // Implementing AAs + // Success modifiers based on recipes + // Skillup modifiers based on the rarity of the ingredients // Some tradeskills are more eqal then others. ;-) // If you want to customize the stage1 success rate do it here. - // Remember: skillup_modifier is (float). Lower is better + // Remember: skillup_modifier is (float). Lower is better switch(spec->tradeskill) { case FLETCHING: case ALCHEMY: @@ -833,7 +832,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { // Some tradeskills take the higher of one additional stat beside INT and WIS // to determine the skillup rate. Additionally these tradeskills do not have an // -15 modifier on their statbonus. - if (spec->tradeskill == FLETCHING || spec->tradeskill == MAKE_POISON) { + if (spec->tradeskill == FLETCHING || spec->tradeskill == MAKE_POISON) { thirdstat = GetDEX(); stat_modifier = 0; } else if (spec->tradeskill == BLACKSMITHING) { @@ -847,9 +846,9 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { vector< pair >::iterator itr; - //calculate the base success chance + //calculate the base success chance // For trivials over 68 the chance is (skill - 0.75*trivial) +51.5 - // For trivial up to 68 the chance is (skill - trivial) + 66 + // For trivial up to 68 the chance is (skill - trivial) + 66 if (spec->trivial >= 68) { chance = (user_skill - (0.75*spec->trivial)) + 51.5; } else { @@ -916,7 +915,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { break; } } - const Item_Struct* item = nullptr; + const Item_Struct* item = nullptr; if (spec->tradeskill == BLACKSMITHING) { switch(GetAA(aaBlacksmithingMastery)) { @@ -1032,7 +1031,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { while(itr != spec->onsuccess.end() && !spec->quest) { //should we check this crap? SummonItem(itr->first, itr->second); - item = database.GetItem(itr->first); + item = database.GetItem(itr->first); if (this->GetGroup()) { entity_list.MessageGroup(this,true,MT_Skills,"%s has successfully fashioned %s!",GetName(),item->Name); @@ -1051,7 +1050,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(MT_Emote,TRADESKILL_FAILED); _log(TRADESKILLS__TRACE, "Tradeskill failed"); - if (this->GetGroup()) + if (this->GetGroup()) { entity_list.MessageGroup(this,true,MT_Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); } @@ -1063,19 +1062,19 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { itr++; } - // Rolls on each item, is possible to return everything - int SalvageChance = aabonuses.SalvageChance + itembonuses.SalvageChance + spellbonuses.SalvageChance; - // Skip check if not a normal TS or if a quest recipe these should be nofail, but check amyways - if(SalvageChance && spec->tradeskill != 75 && !spec->quest) { - itr = spec->salvage.begin(); - uint8 sc = 0; - while(itr != spec->salvage.end()) { - for(sc = 0; sc < itr->second; sc++) - if(MakeRandomInt(0,99) < SalvageChance) - SummonItem(itr->first, 1); - itr++; - } - } + // Rolls on each item, is possible to return everything + int SalvageChance = aabonuses.SalvageChance + itembonuses.SalvageChance + spellbonuses.SalvageChance; + // Skip check if not a normal TS or if a quest recipe these should be nofail, but check amyways + if(SalvageChance && spec->tradeskill != 75 && !spec->quest) { + itr = spec->salvage.begin(); + uint8 sc = 0; + while(itr != spec->salvage.end()) { + for(sc = 0; sc < itr->second; sc++) + if(MakeRandomInt(0,99) < SalvageChance) + SummonItem(itr->first, 1); + itr++; + } + } } return(false); @@ -1121,17 +1120,17 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float } _log(TRADESKILLS__TRACE, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); - _log(TRADESKILLS__TRACE, "...Stage1 chance was: %f percent", chance_stage1); - _log(TRADESKILLS__TRACE, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); + _log(TRADESKILLS__TRACE, "...Stage1 chance was: %f percent", chance_stage1); + _log(TRADESKILLS__TRACE, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); } bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec) { char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + char *query = 0; char buf2[4096]; uint32 sum = 0; @@ -1139,14 +1138,14 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 uint32 qcount = 0; uint32 qlen = 0; - // make where clause segment for container(s) - char containers[30]; - if (some_id == 0) { - // world combiner so no item number - snprintf(containers,29, "= %u", c_type); - } else { - // container in inventory - snprintf(containers,29, "in (%u,%u)", c_type, some_id); + // make where clause segment for container(s) + char containers[30]; + if (some_id == 0) { + // world combiner so no item number + snprintf(containers,29, "= %u", c_type); + } else { + // container in inventory + snprintf(containers,29, "in (%u,%u)", c_type, some_id); } buf2[0] = '\0'; @@ -1181,9 +1180,9 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 qlen = MakeAnyLenString(&query, "SELECT tre.recipe_id " " FROM tradeskill_recipe_entries AS tre" " WHERE ( tre.item_id IN(%s) AND tre.componentcount>0 )" - " OR ( tre.item_id %s AND tre.iscontainer=1 )" - " GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u" - " AND sum(tre.item_id * tre.componentcount) = %u", buf2, containers, count, sum); + " OR ( tre.item_id %s AND tre.iscontainer=1 )" + " GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u" + " AND sum(tre.item_id * tre.componentcount) = %u", buf2, containers, count, sum); if (!RunQuery(query, qlen, errbuf, &result)) { LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, query: %s", query); @@ -1219,9 +1218,9 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 qlen = MakeAnyLenString(&query, "SELECT tre.recipe_id" " FROM tradeskill_recipe_entries AS tre" - " WHERE tre.recipe_id IN (%s)" - " GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u" - " AND sum(tre.item_id * tre.componentcount) = %u", buf2, count, sum); + " WHERE tre.recipe_id IN (%s)" + " GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u" + " AND sum(tre.item_id * tre.componentcount) = %u", buf2, count, sum); if (!RunQuery(query, qlen, errbuf, &result)) { LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query); @@ -1284,9 +1283,9 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //This is here because something's up with the query above.. it needs to be rethought out bool has_components = true; char TSerrbuf[MYSQL_ERRMSG_SIZE]; - char *TSquery = 0; - MYSQL_RES *TSresult; - MYSQL_ROW TSrow; + char *TSquery = 0; + MYSQL_RES *TSresult; + MYSQL_ROW TSrow; if (RunQuery(TSquery, MakeAnyLenString(&TSquery, "SELECT item_id, componentcount from tradeskill_recipe_entries where recipe_id=%i AND componentcount > 0", recipe_id), TSerrbuf, &TSresult)) { while((TSrow = mysql_fetch_row(TSresult))!=nullptr) { int ccnt = 0; @@ -1321,31 +1320,31 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id uint32 char_id, DBTradeskillRecipe_Struct *spec) { char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + char *query = 0; uint32 qcount = 0; uint32 qlen; - // make where clause segment for container(s) - char containers[30]; - if (some_id == 0) { - // world combiner so no item number - snprintf(containers,29, "= %u", c_type); - } else { - // container in inventory - snprintf(containers,29, "in (%u,%u)", c_type, some_id); - } + // make where clause segment for container(s) + char containers[30]; + if (some_id == 0) { + // world combiner so no item number + snprintf(containers,29, "= %u", c_type); + } else { + // container in inventory + snprintf(containers,29, "in (%u,%u)", c_type, some_id); + } - qlen = MakeAnyLenString(&query, "SELECT tr.id, tr.tradeskill, tr.skillneeded," - " tr.trivial, tr.nofail, tr.replace_container, tr.name, tr.must_learn, tr.quest, crl.madecount" - " FROM tradeskill_recipe AS tr inner join tradeskill_recipe_entries as tre" - " ON tr.id = tre.recipe_id" - " LEFT JOIN (SELECT recipe_id, madecount from char_recipe_list WHERE char_id = %u) AS crl " - " ON tr.id = crl.recipe_id " - " WHERE tr.id = %lu AND tre.item_id %s" - " GROUP BY tr.id", char_id, (unsigned long)recipe_id, containers); + qlen = MakeAnyLenString(&query, "SELECT tr.id, tr.tradeskill, tr.skillneeded," + " tr.trivial, tr.nofail, tr.replace_container, tr.name, tr.must_learn, tr.quest, crl.madecount" + " FROM tradeskill_recipe AS tr inner join tradeskill_recipe_entries as tre" + " ON tr.id = tre.recipe_id" + " LEFT JOIN (SELECT recipe_id, madecount from char_recipe_list WHERE char_id = %u) AS crl " + " ON tr.id = crl.recipe_id " + " WHERE tr.id = %lu AND tre.item_id %s" + " GROUP BY tr.id", char_id, (unsigned long)recipe_id, containers); if (!RunQuery(query, qlen, errbuf, &result)) { LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, query: %s", query); @@ -1362,11 +1361,11 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id } row = mysql_fetch_row(result); - spec->tradeskill = (SkillType)atoi(row[1]); - spec->skill_needed = (int16)atoi(row[2]); - spec->trivial = (uint16)atoi(row[3]); - spec->nofail = atoi(row[4]) ? true : false; - spec->replace_container = atoi(row[5]) ? true : false; + spec->tradeskill = (SkillType)atoi(row[1]); + spec->skill_needed = (int16)atoi(row[2]); + spec->trivial = (uint16)atoi(row[3]); + spec->nofail = atoi(row[4]) ? true : false; + spec->replace_container = atoi(row[5]) ? true : false; spec->name = row[6]; spec->must_learn = (uint8)atoi(row[7]); spec->quest = atoi(row[8]) ? true : false; @@ -1424,25 +1423,24 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id mysql_free_result(result); } - // Pull the salvage list - qlen = MakeAnyLenString(&query, "SELECT item_id,salvagecount FROM tradeskill_recipe_entries" - " WHERE salvagecount>0 AND recipe_id=%u", recipe_id); + // Pull the salvage list + qlen = MakeAnyLenString(&query, "SELECT item_id,salvagecount FROM tradeskill_recipe_entries WHERE salvagecount>0 AND recipe_id=%u", recipe_id); - spec->salvage.clear(); - // Don't bother with the query if TS is nofail - if (!spec->nofail && RunQuery(query, qlen, errbuf, &result)) { - qcount = mysql_num_rows(result); - uint8 r; - for(r = 0; r < qcount; r++) { - row = mysql_fetch_row(result); - uint32 item = (uint32)atoi(row[0]); - uint8 num = (uint8)atoi(row[1]); - spec->salvage.push_back(pair(item, num)); - } - mysql_free_result(result); - } + spec->salvage.clear(); + // Don't bother with the query if TS is nofail + if (!spec->nofail && RunQuery(query, qlen, errbuf, &result)) { + qcount = mysql_num_rows(result); + uint8 r; + for(r = 0; r < qcount; r++) { + row = mysql_fetch_row(result); + uint32 item = (uint32)atoi(row[0]); + uint8 num = (uint8)atoi(row[1]); + spec->salvage.push_back(pair(item, num)); + } + mysql_free_result(result); + } - safe_delete_array(query); + safe_delete_array(query); return(true); } @@ -1476,7 +1474,7 @@ void Client::LearnRecipe(uint32 recipeID) qlen = MakeAnyLenString(&query, "SELECT tr.name, crl.madecount " " FROM tradeskill_recipe as tr " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl " - " ON tr.id = crl.recipe_id " + " ON tr.id = crl.recipe_id " " WHERE tr.id = %u ;", CharacterID(), recipeID); if (!database.RunQuery(query, qlen, errbuf, &result)) { @@ -1524,15 +1522,15 @@ bool Client::CanIncreaseTradeskill(SkillType tradeskill) { if (rawskill >= maxskill) //Max skill sanity check return false; - uint8 Baking = (GetRawSkill(BAKING) > 200) ? 1 : 0; - uint8 Smithing = (GetRawSkill(BLACKSMITHING) > 200) ? 1 : 0; - uint8 Brewing = (GetRawSkill(BREWING) > 200) ? 1 : 0; - uint8 Fletching = (GetRawSkill(FLETCHING) > 200) ? 1 : 0; - uint8 Jewelry = (GetRawSkill(JEWELRY_MAKING) > 200) ? 1 : 0; - uint8 Pottery = (GetRawSkill(POTTERY) > 200) ? 1 : 0; - uint8 Tailoring = (GetRawSkill(TAILORING) > 200) ? 1 : 0; + uint8 Baking = (GetRawSkill(BAKING) > 200) ? 1 : 0; + uint8 Smithing = (GetRawSkill(BLACKSMITHING) > 200) ? 1 : 0; + uint8 Brewing = (GetRawSkill(BREWING) > 200) ? 1 : 0; + uint8 Fletching = (GetRawSkill(FLETCHING) > 200) ? 1 : 0; + uint8 Jewelry = (GetRawSkill(JEWELRY_MAKING) > 200) ? 1 : 0; + uint8 Pottery = (GetRawSkill(POTTERY) > 200) ? 1 : 0; + uint8 Tailoring = (GetRawSkill(TAILORING) > 200) ? 1 : 0; uint8 SkillTotal = Baking + Smithing + Brewing + Fletching + Jewelry + Pottery + Tailoring; //Tradeskills above 200 - uint32 aaLevel = GetAA(aaNewTanaanCraftingMastery); //New Tanaan AA: Each level allows an additional tradeskill above 200 (first one is free) + uint32 aaLevel = GetAA(aaNewTanaanCraftingMastery); //New Tanaan AA: Each level allows an additional tradeskill above 200 (first one is free) switch (tradeskill) { case BAKING: diff --git a/zone/trading.cpp b/zone/trading.cpp index 14b81173d..aae28d0e8 100644 --- a/zone/trading.cpp +++ b/zone/trading.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 "masterentity.h" @@ -341,9 +341,9 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) mlog(TRADING__CLIENT, "Finishing trade with client %s", other->GetName()); int16 slot_id; - const Item_Struct* item = nullptr; - QSPlayerLogTrade_Struct* qsaudit = nullptr; - bool QSPLT = false; + const Item_Struct* item = nullptr; + QSPlayerLogTrade_Struct* qsaudit = nullptr; + bool QSPLT = false; // QS code if(qspack && RuleB(QueryServ, PlayerLogTrades)) { @@ -351,12 +351,12 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) QSPLT = true; if(finalizer) { qsaudit->char2_id = this->character_id; } - else { qsaudit->char1_id = this->character_id; } + else { qsaudit->char1_id = this->character_id; } } // Move each trade slot into free inventory slot for(int16 i = 3000; i <= 3007; i++){ - const ItemInst* inst = m_inv[i]; + const ItemInst* inst = m_inv[i]; uint16 parent_offset = 0; if(inst == nullptr) { continue; } @@ -365,23 +365,23 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) /// Log Player Trades through QueryServ if Rule Enabled if(QSPLT) { - uint16 item_count = qsaudit->char1_count + qsaudit->char2_count; - parent_offset = item_count; + uint16 item_count = qsaudit->char1_count + qsaudit->char2_count; + parent_offset = item_count; - qsaudit->items[item_count].from_id = this->character_id; - qsaudit->items[item_count].from_slot = i; - qsaudit->items[item_count].to_id = other->CharacterID(); - qsaudit->items[item_count].to_slot = 0; - qsaudit->items[item_count].item_id = inst->GetID(); - qsaudit->items[item_count].charges = inst->GetCharges(); - qsaudit->items[item_count].aug_1 = inst->GetAugmentItemID(1); - qsaudit->items[item_count].aug_2 = inst->GetAugmentItemID(2); - qsaudit->items[item_count].aug_3 = inst->GetAugmentItemID(3); - qsaudit->items[item_count].aug_4 = inst->GetAugmentItemID(4); - qsaudit->items[item_count].aug_5 = inst->GetAugmentItemID(5); + qsaudit->items[item_count].from_id = this->character_id; + qsaudit->items[item_count].from_slot = i; + qsaudit->items[item_count].to_id = other->CharacterID(); + qsaudit->items[item_count].to_slot = 0; + qsaudit->items[item_count].item_id = inst->GetID(); + qsaudit->items[item_count].charges = inst->GetCharges(); + qsaudit->items[item_count].aug_1 = inst->GetAugmentItemID(1); + qsaudit->items[item_count].aug_2 = inst->GetAugmentItemID(2); + qsaudit->items[item_count].aug_3 = inst->GetAugmentItemID(3); + qsaudit->items[item_count].aug_4 = inst->GetAugmentItemID(4); + qsaudit->items[item_count].aug_5 = inst->GetAugmentItemID(5); if(finalizer) { qsaudit->char2_count++; } - else { qsaudit->char1_count++; } + else { qsaudit->char1_count++; } if(inst->IsType(ItemClassContainer)) { // Pseudo-Slot ID's are generated based on how the db saves bag items... @@ -393,20 +393,20 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) int16 k=Inventory::CalcSlotId(i, j); item_count = qsaudit->char1_count + qsaudit->char2_count; - qsaudit->items[item_count].from_id = this->character_id; - qsaudit->items[item_count].from_slot = k; - qsaudit->items[item_count].to_id = other->CharacterID(); - qsaudit->items[item_count].to_slot = 0; - qsaudit->items[item_count].item_id = baginst->GetID(); - qsaudit->items[item_count].charges = baginst->GetCharges(); - qsaudit->items[item_count].aug_1 = baginst->GetAugmentItemID(1); - qsaudit->items[item_count].aug_2 = baginst->GetAugmentItemID(2); - qsaudit->items[item_count].aug_3 = baginst->GetAugmentItemID(3); - qsaudit->items[item_count].aug_4 = baginst->GetAugmentItemID(4); - qsaudit->items[item_count].aug_5 = baginst->GetAugmentItemID(5); + qsaudit->items[item_count].from_id = this->character_id; + qsaudit->items[item_count].from_slot = k; + qsaudit->items[item_count].to_id = other->CharacterID(); + qsaudit->items[item_count].to_slot = 0; + qsaudit->items[item_count].item_id = baginst->GetID(); + qsaudit->items[item_count].charges = baginst->GetCharges(); + qsaudit->items[item_count].aug_1 = baginst->GetAugmentItemID(1); + qsaudit->items[item_count].aug_2 = baginst->GetAugmentItemID(2); + qsaudit->items[item_count].aug_3 = baginst->GetAugmentItemID(3); + qsaudit->items[item_count].aug_4 = baginst->GetAugmentItemID(4); + qsaudit->items[item_count].aug_5 = baginst->GetAugmentItemID(5); if(finalizer) { qsaudit->char2_count++; } - else { qsaudit->char1_count++; } + else { qsaudit->char1_count++; } } } } @@ -418,7 +418,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) mlog(TRADING__CLIENT, "Trying to put %s (%d) into slot %d", inst->GetItem()->Name, inst->GetItem()->ID, slot_id); if(other->PutItemInInventory(slot_id, *inst, true)) { - mlog(TRADING__CLIENT, "Item %s (%d) successfully transfered, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + mlog(TRADING__CLIENT, "Item %s (%d) successfully transfered, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if(QSPLT) { qsaudit->items[parent_offset].to_slot = slot_id; @@ -488,16 +488,16 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) // This is currently setup to show character offers, not receipts if(QSPLT) { if(finalizer) { - qsaudit->char2_money.platinum = this->trade->pp; - qsaudit->char2_money.gold = this->trade->gp; - qsaudit->char2_money.silver = this->trade->sp; - qsaudit->char2_money.copper = this->trade->cp; + qsaudit->char2_money.platinum = this->trade->pp; + qsaudit->char2_money.gold = this->trade->gp; + qsaudit->char2_money.silver = this->trade->sp; + qsaudit->char2_money.copper = this->trade->cp; } else { qsaudit->char1_money.platinum = this->trade->pp; - qsaudit->char1_money.gold = this->trade->gp; - qsaudit->char1_money.silver = this->trade->sp; - qsaudit->char1_money.copper = this->trade->cp; + qsaudit->char1_money.gold = this->trade->gp; + qsaudit->char1_money.silver = this->trade->sp; + qsaudit->char1_money.copper = this->trade->cp; } } @@ -506,7 +506,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) } else if(tradingWith && tradingWith->IsNPC()) { QSPlayerLogHandin_Struct* qsaudit = nullptr; - bool QSPLH = false; + bool QSPLH = false; // QS code if(qspack && RuleB(QueryServ, PlayerLogTrades)) { @@ -515,19 +515,19 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) qsaudit = (QSPlayerLogHandin_Struct*) qspack->pBuffer; QSPLH = true; - qsaudit->quest_id = 0; - qsaudit->char_id = character_id; - qsaudit->char_money.platinum = trade->pp; - qsaudit->char_money.gold = trade->gp; - qsaudit->char_money.silver = trade->sp; - qsaudit->char_money.copper = trade->cp; - qsaudit->char_count = 0; - qsaudit->npc_id = tradingWith->GetNPCTypeID(); - qsaudit->npc_money.platinum = 0; - qsaudit->npc_money.gold = 0; - qsaudit->npc_money.silver = 0; - qsaudit->npc_money.copper = 0; - qsaudit->npc_count = 0; + qsaudit->quest_id = 0; + qsaudit->char_id = character_id; + qsaudit->char_money.platinum = trade->pp; + qsaudit->char_money.gold = trade->gp; + qsaudit->char_money.silver = trade->sp; + qsaudit->char_money.copper = trade->cp; + qsaudit->char_count = 0; + qsaudit->npc_id = tradingWith->GetNPCTypeID(); + qsaudit->npc_money.platinum = 0; + qsaudit->npc_money.gold = 0; + qsaudit->npc_money.silver = 0; + qsaudit->npc_money.copper = 0; + qsaudit->npc_count = 0; } if(QSPLH) { // This can be incoporated below when revisions are made -U @@ -537,14 +537,14 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) if(trade_inst) { strcpy(qsaudit->items[qsaudit->char_count].action_type, "HANDIN"); - qsaudit->items[qsaudit->char_count].char_slot = slot_id; - qsaudit->items[qsaudit->char_count].item_id = trade_inst->GetID(); - qsaudit->items[qsaudit->char_count].charges = trade_inst->GetCharges(); - qsaudit->items[qsaudit->char_count].aug_1 = trade_inst->GetAugmentItemID(1); - qsaudit->items[qsaudit->char_count].aug_2 = trade_inst->GetAugmentItemID(2); - qsaudit->items[qsaudit->char_count].aug_3 = trade_inst->GetAugmentItemID(3); - qsaudit->items[qsaudit->char_count].aug_4 = trade_inst->GetAugmentItemID(4); - qsaudit->items[qsaudit->char_count++].aug_5 = trade_inst->GetAugmentItemID(5); + qsaudit->items[qsaudit->char_count].char_slot = slot_id; + qsaudit->items[qsaudit->char_count].item_id = trade_inst->GetID(); + qsaudit->items[qsaudit->char_count].charges = trade_inst->GetCharges(); + qsaudit->items[qsaudit->char_count].aug_1 = trade_inst->GetAugmentItemID(1); + qsaudit->items[qsaudit->char_count].aug_2 = trade_inst->GetAugmentItemID(2); + qsaudit->items[qsaudit->char_count].aug_3 = trade_inst->GetAugmentItemID(3); + qsaudit->items[qsaudit->char_count].aug_4 = trade_inst->GetAugmentItemID(4); + qsaudit->items[qsaudit->char_count++].aug_5 = trade_inst->GetAugmentItemID(5); if(trade_inst->IsType(ItemClassContainer)) { for(uint8 bag_idx = 0; bag_idx < trade_inst->GetItem()->BagSlots; bag_idx++) { @@ -553,14 +553,14 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) if(trade_baginst) { strcpy(qsaudit->items[qsaudit->char_count].action_type, "HANDIN"); - qsaudit->items[qsaudit->char_count].char_slot = Inventory::CalcSlotId(slot_id, bag_idx); - qsaudit->items[qsaudit->char_count].item_id = trade_baginst->GetID(); - qsaudit->items[qsaudit->char_count].charges = trade_baginst->GetCharges(); - qsaudit->items[qsaudit->char_count].aug_1 = trade_baginst->GetAugmentItemID(1); - qsaudit->items[qsaudit->char_count].aug_2 = trade_baginst->GetAugmentItemID(2); - qsaudit->items[qsaudit->char_count].aug_3 = trade_baginst->GetAugmentItemID(3); - qsaudit->items[qsaudit->char_count].aug_4 = trade_baginst->GetAugmentItemID(4); - qsaudit->items[qsaudit->char_count++].aug_5 = trade_baginst->GetAugmentItemID(5); + qsaudit->items[qsaudit->char_count].char_slot = Inventory::CalcSlotId(slot_id, bag_idx); + qsaudit->items[qsaudit->char_count].item_id = trade_baginst->GetID(); + qsaudit->items[qsaudit->char_count].charges = trade_baginst->GetCharges(); + qsaudit->items[qsaudit->char_count].aug_1 = trade_baginst->GetAugmentItemID(1); + qsaudit->items[qsaudit->char_count].aug_2 = trade_baginst->GetAugmentItemID(2); + qsaudit->items[qsaudit->char_count].aug_3 = trade_baginst->GetAugmentItemID(3); + qsaudit->items[qsaudit->char_count].aug_4 = trade_baginst->GetAugmentItemID(4); + qsaudit->items[qsaudit->char_count++].aug_5 = trade_baginst->GetAugmentItemID(5); } } } @@ -639,40 +639,40 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) snprintf(temp1, 100, "item%d.%d", z+1,tradingWith->GetNPCTypeID()); snprintf(temp2, 100, "%d",items[z]); parse->AddVar(temp1,temp2); - // memset(temp1,0x0,100); - // memset(temp2,0x0,100); + // memset(temp1,0x0,100); + // memset(temp2,0x0,100); snprintf(temp1, 100, "item%d.charges.%d", z+1,tradingWith->GetNPCTypeID()); snprintf(temp2, 100, "%d",charges[z]); parse->AddVar(temp1,temp2); - // memset(temp1,0x0,100); - // memset(temp2,0x0,100); + // memset(temp1,0x0,100); + // memset(temp2,0x0,100); snprintf(temp1, 100, "item%d.attuned.%d", z+1,tradingWith->GetNPCTypeID()); snprintf(temp2, 100, "%d",attuned[z]); parse->AddVar(temp1,temp2); - // memset(temp1,0x0,100); - // memset(temp2,0x0,100); + // memset(temp1,0x0,100); + // memset(temp2,0x0,100); } snprintf(temp1, 100, "copper.%d",tradingWith->GetNPCTypeID()); snprintf(temp2, 100, "%i",trade->cp); parse->AddVar(temp1,temp2); - // memset(temp1,0x0,100); - // memset(temp2,0x0,100); + // memset(temp1,0x0,100); + // memset(temp2,0x0,100); snprintf(temp1, 100, "silver.%d",tradingWith->GetNPCTypeID()); snprintf(temp2, 100, "%i",trade->sp); parse->AddVar(temp1,temp2); - // memset(temp1,0x0,100); - // memset(temp2,0x0,100); + // memset(temp1,0x0,100); + // memset(temp2,0x0,100); snprintf(temp1, 100, "gold.%d",tradingWith->GetNPCTypeID()); snprintf(temp2, 100, "%i",trade->gp); parse->AddVar(temp1,temp2); - // memset(temp1,0x0,100); - // memset(temp2,0x0,100); + // memset(temp1,0x0,100); + // memset(temp2,0x0,100); snprintf(temp1, 100, "platinum.%d",tradingWith->GetNPCTypeID()); snprintf(temp2, 100, "%i",trade->pp); parse->AddVar(temp1,temp2); - // memset(temp1,0x0,100); - // memset(temp2,0x0,100); - parse->EventNPC(EVENT_ITEM, tradingWith->CastToNPC(), this, "", 0); + // memset(temp1,0x0,100); + // memset(temp2,0x0,100); + parse->EventNPC(EVENT_ITEM, tradingWith->CastToNPC(), this, "", 0); } } } @@ -999,7 +999,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ item = this->GetInv().GetItem(SlotID); if(item && item->GetSerialNumber() == SerialNumber && - (item->GetCharges() >= Quantity || (item->GetCharges() <= 0 && Quantity == 1))){ + (item->GetCharges() >= Quantity || (item->GetCharges() <= 0 && Quantity == 1))){ return SlotID; } @@ -1007,7 +1007,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ } } _log(TRADING__CLIENT, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", - SerialNumber , Quantity, this->GetName()); + SerialNumber , Quantity, this->GetName()); return 0; } @@ -1136,7 +1136,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* } } _log(TRADING__CLIENT, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, - Quantity,this->GetName()); + Quantity,this->GetName()); } void Client::ReturnTraderReq(const EQApplicationPacket* app, int16 TraderItemCharges){ @@ -1145,7 +1145,7 @@ void Client::ReturnTraderReq(const EQApplicationPacket* app, int16 TraderItemCha EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderBuy, sizeof(TraderBuy_Struct)); - TraderBuy_Struct* outtbs = (TraderBuy_Struct*)outapp->pBuffer; + TraderBuy_Struct* outtbs = (TraderBuy_Struct*)outapp->pBuffer; memcpy(outtbs, tbs, app->size); @@ -1185,7 +1185,7 @@ void Client::TradeRequestFailed(const EQApplicationPacket* app) { static void BazaarAuditTrail(const char *Seller, const char *Buyer, const char *ItemName, int Quantity, int TotalCost, int TranType) { const char *AuditQuery="INSERT INTO `trader_audit` (`time`, `seller`, `buyer`, `itemname`, `quantity`, `totalcost`, `trantype`) " - "VALUES (NOW(), '%s', '%s', '%s', %i, %i, %i)"; + "VALUES (NOW(), '%s', '%s', '%s', %i, %i, %i)"; char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; @@ -1209,7 +1209,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat EQApplicationPacket* outapp = new EQApplicationPacket(OP_Trader,sizeof(TraderBuy_Struct)); - TraderBuy_Struct* outtbs = (TraderBuy_Struct*)outapp->pBuffer; + TraderBuy_Struct* outtbs = (TraderBuy_Struct*)outapp->pBuffer; outtbs->ItemID = tbs->ItemID; @@ -1223,10 +1223,10 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat } _log(TRADING__CLIENT, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", - BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges()); + BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges()); // If the item is not stackable, then we can only be buying one of them. if(!BuyItem->IsStackable()) - outtbs->Quantity = tbs->Quantity; + outtbs->Quantity = tbs->Quantity; else { // Stackable items, arrows, diamonds, etc int ItemCharges = BuyItem->GetCharges(); @@ -1371,8 +1371,8 @@ void Client::SendBazaarWelcome(){ row = mysql_fetch_row(result); - Message(10, "There are %i Buyers waiting to purchase your loot. Type /barter to search for them," - " or use /buyer to set up your own Buy Lines.", atoi(row[0])); + Message(10, "There are %i Buyers waiting to purchase your loot. Type /barter to search for them," + " or use /buyer to set up your own Buy Lines.", atoi(row[0])); } mysql_free_result(result); } @@ -1380,7 +1380,7 @@ void Client::SendBazaarWelcome(){ } void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint32 ItemStat, uint32 Slot, uint32 Type, - char Name[64], uint32 MinPrice, uint32 MaxPrice) { + char Name[64], uint32 MinPrice, uint32 MaxPrice) { char errbuf[MYSQL_ERRMSG_SIZE]; char* Query = 0; @@ -1419,16 +1419,16 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint Search.append(Tmp); } if(Class_ != 0xFFFFFFFF){ - sprintf(Tmp, " and mid(reverse(bin(items.classes)),%i,1)=1", Class_); - Search.append(Tmp); + sprintf(Tmp, " and mid(reverse(bin(items.classes)),%i,1)=1", Class_); + Search.append(Tmp); } if(Race!=0xFFFFFFFF){ - sprintf(Tmp, " and mid(reverse(bin(items.races)),%i,1)=1", Race); - Search.append(Tmp); + sprintf(Tmp, " and mid(reverse(bin(items.races)),%i,1)=1", Race); + Search.append(Tmp); } if(Slot!=0xFFFFFFFF){ - sprintf(Tmp, " and mid(reverse(bin(items.slots)),%i,1)=1", Slot + 1); - Search.append(Tmp); + sprintf(Tmp, " and mid(reverse(bin(items.slots)),%i,1)=1", Slot + 1); + Search.append(Tmp); } if(Type!=0xFFFFFFFF){ @@ -1574,7 +1574,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint Values.append(",sum(charges), items.stackable "); if (database.RunQuery(Query,MakeAnyLenString(&Query, "select %s from trader,items %s group by items.id,charges,char_id limit %i", - Values.c_str(),Search.c_str(), RuleI(Bazaar, MaxSearchResults)),errbuf,&Result)){ + Values.c_str(),Search.c_str(), RuleI(Bazaar, MaxSearchResults)),errbuf,&Result)){ _log(TRADING__CLIENT, "SRCH: %s", Query); safe_delete_array(Query); @@ -1584,7 +1584,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint if(mysql_num_rows(Result) == static_cast(RuleI(Bazaar, MaxSearchResults))) Message(15, "Your search reached the limit of %i results. Please narrow your search down by selecting more options.", - RuleI(Bazaar, MaxSearchResults)); + RuleI(Bazaar, MaxSearchResults)); if(mysql_num_rows(Result) == 0){ EQApplicationPacket* outapp2 = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarReturnDone_Struct)); @@ -1692,7 +1692,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint } } -static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Struct* gis, uint32 ItemID) { +static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Struct* gis, uint32 ItemID) { // Send Item packets to the customer to update the Merchant window with the // new items for sale, and give them a message in their chat window. @@ -1727,7 +1727,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Str inst->SetMerchantCount(gis->Charges[i]); _log(TRADING__CLIENT, "Sending price update for %s, Serial No. %i with %i charges", - item->Name, gis->SerialNumber[i], gis->Charges[i]); + item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); } @@ -1736,7 +1736,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Str safe_delete(inst); } -static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_Struct* gis, uint32 ItemID, int32 Charges, uint32 NewPrice) { +static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_Struct* gis, uint32 ItemID, int32 Charges, uint32 NewPrice) { // Send ItemPackets to update the customer's Merchant window with the new price (or remove the item if // the new price is 0) and inform them with a chat message. @@ -1762,10 +1762,9 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_S for(int i = 0; i < 80; i++) { if(gis->ItemID[i] == ItemID) { - tdis->ItemID = gis->SerialNumber[i]; _log(TRADING__CLIENT, "Telling customer to remove item %i with %i charges and S/N %i", - ItemID, Charges, gis->SerialNumber[i]); + ItemID, Charges, gis->SerialNumber[i]); _pkt(TRADING__PACKETS, outapp); @@ -1796,7 +1795,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_S for(int i = 0; i < 80; i++) { if((gis->ItemID[i] != ItemID) || - ((!item->Stackable) && (gis->Charges[i] != Charges))) + ((!item->Stackable) && (gis->Charges[i] != Charges))) continue; inst->SetSerialNumber(gis->SerialNumber[i]); @@ -1804,7 +1803,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_S inst->SetMerchantSlot(gis->SerialNumber[i]); _log(TRADING__CLIENT, "Sending price update for %s, Serial No. %i with %i charges", - item->Name, gis->SerialNumber[i], gis->Charges[i]); + item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); } @@ -1820,7 +1819,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer; _log(TRADING__CLIENT, "Received Price Update for %s, Item Serial No. %i, New Price %i", - GetName(), tpus->SerialNumber, tpus->NewPrice); + GetName(), tpus->SerialNumber, tpus->NewPrice); // Pull the items this Trader currently has for sale from the trader table. // @@ -1887,7 +1886,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) { _log(TRADING__CLIENT, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], - newgis->Charges[i]); + newgis->Charges[i]); IDOfItemToAdd = newgis->Items[i]; ChargesOnItemToAdd = newgis->Charges[i]; @@ -1932,7 +1931,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if(SameItemWithDifferingCharges) Message(13, "Warning: You have more than one %s with different charges. They have all been added for sale " - "at the same price.", item->Name); + "at the same price.", item->Name); } // Now put all Items with a matching ItemID up for trade. @@ -1950,15 +1949,15 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { gis->ItemCost[i] = tpus->NewPrice; _log(TRADING__CLIENT, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", - GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i], - tpus->NewPrice, i); + GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i], + tpus->NewPrice, i); } } // If we have a customer currently browsing, update them with the new items. // if(CustomerID) - UpdateTraderCustomerItemsAdded(CustomerID, gis, IDOfItemToAdd); + UpdateTraderCustomerItemsAdded(CustomerID, gis, IDOfItemToAdd); safe_delete(gis); safe_delete(newgis); @@ -2029,7 +2028,7 @@ void Client::SendBuyerResults(char* SearchString, uint32 SearchID) { database.DoEscapeString(EscSearchString, SearchString, strlen(SearchString)); if (database.RunQuery(Query,MakeAnyLenString(&Query, "select * from buyer where itemname like '%%%s%%' order by charid limit %i", - EscSearchString, RuleI(Bazaar, MaxBarterSearchResults)), errbuf, &Result)) { + EscSearchString, RuleI(Bazaar, MaxBarterSearchResults)), errbuf, &Result)) { int NumberOfRows = mysql_num_rows(Result); @@ -2040,7 +2039,7 @@ void Client::SendBuyerResults(char* SearchString, uint32 SearchID) { Message(10, "There are %i Buy Lines.", NumberOfRows); else Message(10, "There are %i Buy Lines that match the search string '%s'.", - NumberOfRows, SearchString); + NumberOfRows, SearchString); } if(NumberOfRows == 0) { @@ -2082,19 +2081,19 @@ void Client::SendBuyerResults(char* SearchString, uint32 SearchID) { if(!Buyer) continue; - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerSearchResults); // Command - VARSTRUCT_ENCODE_TYPE(uint32, Buf, SearchID); // Match up results with the request - VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); // Slot in this Buyer's list - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0x01); // Unknown - probably a flag field - VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); // ItemID - VARSTRUCT_ENCODE_STRING( Buf, ItemName); // Itemname - VARSTRUCT_ENCODE_TYPE(uint32, Buf, item->Icon); // Icon - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); // Quantity - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0x01); // Unknown - probably a flag field - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); // Price - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Buyer->GetID()); // Entity ID - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Flag for + Items , probably ItemCount - VARSTRUCT_ENCODE_STRING( Buf, Buyer->GetName()); // Seller Name + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerSearchResults); // Command + VARSTRUCT_ENCODE_TYPE(uint32, Buf, SearchID); // Match up results with the request + VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); // Slot in this Buyer's list + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0x01); // Unknown - probably a flag field + VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); // ItemID + VARSTRUCT_ENCODE_STRING(Buf, ItemName); // Itemname + VARSTRUCT_ENCODE_TYPE(uint32, Buf, item->Icon); // Icon + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); // Quantity + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0x01); // Unknown - probably a flag field + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); // Price + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Buyer->GetID()); // Entity ID + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Flag for + Items , probably ItemCount + VARSTRUCT_ENCODE_STRING(Buf, Buyer->GetName()); // Seller Name _pkt(TRADING__BARTER, outapp); @@ -2159,7 +2158,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) { MYSQL_ROW Row; if (database.RunQuery(Query,MakeAnyLenString(&Query, "select * from buyer where charid = %i", - Buyer->CharacterID()),errbuf,&Result)){ + Buyer->CharacterID()),errbuf,&Result)){ if(mysql_num_rows(Result) == 0) { @@ -2186,18 +2185,18 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) { if(!item) continue; - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerInspectWindow); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // Flag - VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); - VARSTRUCT_ENCODE_STRING( Buf, ItemName); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, item->Icon); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // Flag - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Buyer->GetID()); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); - VARSTRUCT_ENCODE_STRING( Buf, Buyer->GetName()); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerInspectWindow); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // Flag + VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); + VARSTRUCT_ENCODE_STRING(Buf, ItemName); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, item->Icon); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // Flag + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Buyer->GetID()); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); + VARSTRUCT_ENCODE_STRING(Buf, Buyer->GetName()); _pkt(TRADING__BARTER, outapp); QueuePacket(outapp); @@ -2219,7 +2218,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { uint32 BuySlot = VARSTRUCT_DECODE_TYPE(uint32, Buf); uint32 UnknownByte = VARSTRUCT_DECODE_TYPE(uint8, Buf); uint32 ItemID = VARSTRUCT_DECODE_TYPE(uint32, Buf); - /* ItemName */ VARSTRUCT_DECODE_STRING(ItemName, Buf); + /* ItemName */ VARSTRUCT_DECODE_STRING(ItemName, Buf); /*uint32 Unknown2 =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused uint32 QtyBuyerWants = VARSTRUCT_DECODE_TYPE(uint32, Buf); UnknownByte = VARSTRUCT_DECODE_TYPE(uint8, Buf); @@ -2232,9 +2231,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { if(!item || !Quantity || !Price || !QtyBuyerWants) return; if(m_inv.HasItem(ItemID, Quantity, invWhereWorn|invWherePersonal|invWhereCursor) == SLOT_INVALID) { - Message(13, "You do not have %i %s on you.", Quantity, item->Name); - return; } @@ -2249,9 +2246,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { // For Stackable items, HasSpaceForItem will try check if there is space to stack with existing stacks in // the buyer inventory. if(!(Buyer->GetInv().HasSpaceForItem(item, Quantity))) { - - Message(13, "The Buyer does not have space for %i %s", Quantity, item->Name); - + Message(13, "The Buyer does not have space for %i %s", Quantity, item->Name); return; } @@ -2269,7 +2264,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { if(Buyer->CheckLoreConflict(item)) { Message(13, "That item is LORE and the Buyer already has one."); Buyer->Message(13, "%s tried to sell you %s but this item is LORE and you already have one.", - GetName(), item->Name); + GetName(), item->Name); return; } @@ -2293,7 +2288,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { break; } _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); - Message(13, "Internal error while processing transaction."); + Message(13, "Internal error while processing transaction."); return; } @@ -2301,7 +2296,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) { _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); - Message(13, "Internal error while processing transaction."); + Message(13, "Internal error while processing transaction."); if(ItemToTransfer) safe_delete(ItemToTransfer); @@ -2339,7 +2334,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { if(SellerSlot == SLOT_INVALID) { _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); - Message(13, "Internal error while processing transaction."); + Message(13, "Internal error while processing transaction."); return; } @@ -2347,7 +2342,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { if(!ItemToTransfer) { _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); - Message(13, "Internal error while processing transaction."); + Message(13, "Internal error while processing transaction."); return; } @@ -2359,7 +2354,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); - Message(13, "Internal error while processing transaction."); + Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; } @@ -2394,7 +2389,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); - Message(13, "Internal error while processing transaction."); + Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; } @@ -2404,9 +2399,9 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { EQApplicationPacket* outapp2 = new EQApplicationPacket(OP_DeleteItem,sizeof(MoveItem_Struct)); MoveItem_Struct* mis = (MoveItem_Struct*)outapp2->pBuffer; - mis->from_slot = SellerSlot; - mis->to_slot = 0xFFFFFFFF; - mis->number_in_stack = 0xFFFFFFFF; + mis->from_slot = SellerSlot; + mis->to_slot = 0xFFFFFFFF; + mis->number_in_stack = 0xFFFFFFFF; for(int i = 0; i < QuantityToRemoveFromStack; i++) QueuePacket(outapp2); @@ -2439,20 +2434,20 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Buf = (char *)outapp->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_SellerTransactionComplete); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity * Price); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_SellerTransactionComplete); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity * Price); if(GetClientVersion() >= EQClientSoD) { - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Think this is the upper 32 bits of a 64 bit price + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Think this is the upper 32 bits of a 64 bit price } sprintf(Buf, "%s", Buyer->GetName()); Buf += 64; - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x00); - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0x01); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x00); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x00); + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0x01); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x00); sprintf(Buf, "%s", ItemName); Buf += 64; @@ -2465,19 +2460,19 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Buf = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerTransactionComplete); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity * Price); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity * Price); if(Buyer->GetClientVersion() >= EQClientSoD) { - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Think this is the upper 32 bits of a 64 bit price + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Think this is the upper 32 bits of a 64 bit price } sprintf(Buf, "%s", GetName()); Buf += 64; - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x00); - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0x01); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x00); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x00); + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0x01); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x00); sprintf(Buf, "%s", ItemName); Buf += 64; @@ -2495,29 +2490,29 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Buf = (char *)outapp3->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerInspectWindow); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // Unknown - VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); - VARSTRUCT_ENCODE_STRING( Buf, ItemName); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, item->Icon); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, QtyBuyerWants - Quantity); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerInspectWindow); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // Unknown + VARSTRUCT_ENCODE_TYPE(uint32, Buf,ItemID); + VARSTRUCT_ENCODE_STRING(Buf, ItemName); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, item->Icon); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, QtyBuyerWants - Quantity); // If the amount we have just sold completely satisfies the quantity the Buyer was looking for, // setting the next byte to 0 will remove the item from the Barter Window. // if(QtyBuyerWants - Quantity > 0) { - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // 0 = Toggle Off, 1 = Toggle On + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // 0 = Toggle Off, 1 = Toggle On } else { - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0); // 0 = Toggle Off, 1 = Toggle On + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0); // 0 = Toggle Off, 1 = Toggle On } - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Buyer->GetID()); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Buyer->GetID()); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); - VARSTRUCT_ENCODE_STRING( Buf, Buyer->GetName()); + VARSTRUCT_ENCODE_STRING(Buf, Buyer->GetName()); _pkt(TRADING__BARTER, outapp3); QueuePacket(outapp3); @@ -2530,26 +2525,26 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Buf = (char*)outapp4->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerItemUpdate); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); - VARSTRUCT_ENCODE_STRING( Buf, ItemName); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, item->Icon); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, QtyBuyerWants - Quantity); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerItemUpdate); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); + VARSTRUCT_ENCODE_STRING(Buf, ItemName); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, item->Icon); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, QtyBuyerWants - Quantity); if((QtyBuyerWants - Quantity) > 0) { - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // 0 = Toggle Off, 1 = Toggle On + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 1); // 0 = Toggle Off, 1 = Toggle On } else { - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0); // 0 = Toggle Off, 1 = Toggle On + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0); // 0 = Toggle Off, 1 = Toggle On } - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x08f4); // Unknown - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); - VARSTRUCT_ENCODE_STRING( Buf, Buyer->GetName()); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x08f4); // Unknown + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); + VARSTRUCT_ENCODE_STRING(Buf, Buyer->GetName()); _pkt(TRADING__BARTER, outapp4); Buyer->QueuePacket(outapp4); @@ -2616,12 +2611,12 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { /*uint32 Action =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused uint32 BuySlot = VARSTRUCT_DECODE_TYPE(uint32, Buf); - uint8 Unknown009 = VARSTRUCT_DECODE_TYPE(uint8, Buf); + uint8 Unknown009 = VARSTRUCT_DECODE_TYPE(uint8, Buf); uint32 ItemID = VARSTRUCT_DECODE_TYPE(uint32, Buf); - /* ItemName */ VARSTRUCT_DECODE_STRING(ItemName, Buf); + /* ItemName */ VARSTRUCT_DECODE_STRING(ItemName, Buf); uint32 Icon = VARSTRUCT_DECODE_TYPE(uint32, Buf); uint32 Quantity = VARSTRUCT_DECODE_TYPE(uint32, Buf); - uint8 ToggleOnOff = VARSTRUCT_DECODE_TYPE(uint8, Buf); + uint8 ToggleOnOff = VARSTRUCT_DECODE_TYPE(uint8, Buf); uint32 Price = VARSTRUCT_DECODE_TYPE(uint32, Buf); /*uint32 UnknownZ =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused uint32 ItemCount = VARSTRUCT_DECODE_TYPE(uint32, Buf); @@ -2633,7 +2628,7 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { bool LoreConflict = CheckLoreConflict(item); _log(TRADING__BARTER, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", - GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict); + GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict); if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) { _log(TRADING__BARTER, "Adding to database"); @@ -2663,18 +2658,18 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { Buf = (char*)outapp->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerItemUpdate); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); - VARSTRUCT_ENCODE_TYPE(uint8, Buf, Unknown009); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); - VARSTRUCT_ENCODE_STRING( Buf, ItemName); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Icon); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); - VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0); // Toggle the Buy Line off in the client - VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x08f4); // Unknown - VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); - VARSTRUCT_ENCODE_STRING( Buf, GetName()); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Barter_BuyerItemUpdate); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, BuySlot); + VARSTRUCT_ENCODE_TYPE(uint8, Buf, Unknown009); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, ItemID); + VARSTRUCT_ENCODE_STRING(Buf, ItemName); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Icon); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); + VARSTRUCT_ENCODE_TYPE(uint8, Buf, 0); // Toggle the Buy Line off in the client + VARSTRUCT_ENCODE_TYPE(uint32, Buf, Price); + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0x08f4); // Unknown + VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); + VARSTRUCT_ENCODE_STRING(Buf, GetName()); _pkt(TRADING__BARTER, outapp); QueuePacket(outapp); @@ -2726,7 +2721,7 @@ void Client::BuyerItemSearch(const EQApplicationPacket *app) { } if (Count == MAX_BUYER_ITEMSEARCH_RESULTS) Message(15, "Your search returned more than %i results. Only the first %i are displayed.", - MAX_BUYER_ITEMSEARCH_RESULTS, MAX_BUYER_ITEMSEARCH_RESULTS); + MAX_BUYER_ITEMSEARCH_RESULTS, MAX_BUYER_ITEMSEARCH_RESULTS); bisr->Action = Barter_BuyerSearch; bisr->ResultCount = Count; diff --git a/zone/trap.cpp b/zone/trap.cpp index db118dca0..45f67e94c 100644 --- a/zone/trap.cpp +++ b/zone/trap.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 "../common/debug.h" #include "../common/types.h" @@ -26,21 +26,21 @@ Schema: CREATE TABLE traps ( - id int(11) NOT nullptr auto_increment, - zone varchar(16) NOT nullptr default '', - x int(11) NOT nullptr default '0', - y int(11) NOT nullptr default '0', - z int(11) NOT nullptr default '0', - chance tinyint NOT nullptr default '0', - maxzdiff float NOT nullptr default '0', - radius float NOT nullptr default '0', - effect int(11) NOT nullptr default '0', - effectvalue int(11) NOT nullptr default '0', - effectvalue2 int(11) NOT nullptr default '0', - message varcahr(200) NOT nullptr; - skill int(11) NOT nullptr default '0', - spawnchance int(11) NOT nullptr default '0', - PRIMARY KEY (id) + id int(11) NOT nullptr auto_increment, + zone varchar(16) NOT nullptr default '', + x int(11) NOT nullptr default '0', + y int(11) NOT nullptr default '0', + z int(11) NOT nullptr default '0', + chance tinyint NOT nullptr default '0', + maxzdiff float NOT nullptr default '0', + radius float NOT nullptr default '0', + effect int(11) NOT nullptr default '0', + effectvalue int(11) NOT nullptr default '0', + effectvalue2 int(11) NOT nullptr default '0', + message varcahr(200) NOT nullptr; + skill int(11) NOT nullptr default '0', + spawnchance int(11) NOT nullptr default '0', + PRIMARY KEY (id) ) TYPE=MyISAM; @@ -143,7 +143,7 @@ void Trap::Trigger(Mob* trigger) { if ((tmp = database.GetNPCType(effectvalue))) { - NPC* new_npc = new NPC(tmp, 0, x-5+MakeRandomInt(0, 10), y-5+MakeRandomInt(0, 10), z-5+MakeRandomInt(0, 10), MakeRandomInt(0, 249), FlyMode3); + NPC* new_npc = new NPC(tmp, 0, x-5+MakeRandomInt(0, 10), y-5+MakeRandomInt(0, 10), z-5+MakeRandomInt(0, 10), MakeRandomInt(0, 249), FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -164,7 +164,7 @@ void Trap::Trigger(Mob* trigger) { if ((tmp = database.GetNPCType(effectvalue))) { - NPC* new_npc = new NPC(tmp, 0, x-2+MakeRandomInt(0, 5), y-2+MakeRandomInt(0, 5), z-2+MakeRandomInt(0, 5), MakeRandomInt(0, 249), FlyMode3); + NPC* new_npc = new NPC(tmp, 0, x-2+MakeRandomInt(0, 5), y-2+MakeRandomInt(0, 5), z-2+MakeRandomInt(0, 5), MakeRandomInt(0, 249), FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -266,9 +266,9 @@ Mob* EntityList::GetTrapTrigger(Trap* trap) { //todo: rewrite this to not need direct access to trap members. bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; // int char_num = 0; unsigned long* lengths; @@ -327,7 +327,7 @@ void Trap::CreateHiddenTrigger() make_npc->npc_spells_id = 0; make_npc->d_meele_texture1 = 0; make_npc->d_meele_texture2 = 0; - make_npc->trackable = 0; + make_npc->trackable = 0; make_npc->level = level; strcpy(make_npc->npc_attacks, "ABHG"); NPC* npca = new NPC(make_npc, 0, x, y, z, 0, FlyMode3); diff --git a/zone/trap.h b/zone/trap.h index b5de69748..ad2e2171a 100644 --- a/zone/trap.h +++ b/zone/trap.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 _TRAP_H #define _TRAP_H @@ -40,7 +40,7 @@ public: Trap(); virtual ~Trap(); virtual bool Process(); - virtual bool IsTrap() const { return true; } + virtual bool IsTrap() const { return true; } void Trigger(Mob* trigger); void SpellOnTarget(Mob* trigger, uint32 spell_id); diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 45f9bffac..9d864a72d 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.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/eq_packet_structs.h" @@ -36,7 +36,7 @@ using namespace std; #define vsnprintf _vsnprintf #endif #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #else #include #include @@ -384,8 +384,8 @@ void Client::SendGuildTributes() { bool ZoneDatabase::LoadTributes() { char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; TributeData t; memset(&t.tiers, 0, sizeof(t.tiers)); diff --git a/zone/updatemgr.cpp b/zone/updatemgr.cpp index 106a51978..bc155ed04 100644 --- a/zone/updatemgr.cpp +++ b/zone/updatemgr.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 "../common/debug.h" #include "../common/features.h" @@ -31,13 +31,12 @@ const float UpdateManager::level_distances2[UPDATE_LEVELS] //delay between sending packets in each level, in ms //its best if they are all multiples of UPDATE_RESOLUTION //these values are pulled out of my ass, should be tuned some day -const uint32 UpdateManager::level_timers[UPDATE_LEVELS+1] - = { UPDATE_RESOLUTION, //.3s - 2*UPDATE_RESOLUTION, //.6s +const uint32 UpdateManager::level_timers[UPDATE_LEVELS+1] = { UPDATE_RESOLUTION, //.3s + 2*UPDATE_RESOLUTION, //.6s 3*UPDATE_RESOLUTION, //.9s 9*UPDATE_RESOLUTION, //~2s 34*UPDATE_RESOLUTION //~10s - }; + }; /* @@ -186,9 +185,3 @@ if(level > 0) #endif //PACKET_UPDATE_MANAGER - - - - - - diff --git a/zone/updatemgr.h b/zone/updatemgr.h index df6a7c375..b024e5db6 100644 --- a/zone/updatemgr.h +++ b/zone/updatemgr.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 UPDATE_MANAGER_H #define UPDATE_MANAGER_H diff --git a/zone/watermap.cpp b/zone/watermap.cpp index d42bc21de..4eafe30fb 100644 --- a/zone/watermap.cpp +++ b/zone/watermap.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2008 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2008 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 - 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 */ #include "../common/debug.h" @@ -25,7 +25,7 @@ #include "watermap.h" #include "../common/MiscFunctions.h" #ifdef _WINDOWS -#define snprintf _snprintf +#define snprintf _snprintf #endif @@ -49,8 +49,8 @@ WaterRegionType WaterMap::BSPReturnRegionType(int32 node_number, float y, float // Are we at a leaf - if((current_node->left==0)&& - (current_node->right==0)) { + if ((current_node->left==0) && + (current_node->right==0)) { return (WaterRegionType) current_node->special; } @@ -59,30 +59,28 @@ WaterRegionType WaterMap::BSPReturnRegionType(int32 node_number, float y, float // distance = (x * current_node->normal[0]) + - (y * current_node->normal[1]) + - (z * current_node->normal[2]) + - current_node->splitdistance; + (y * current_node->normal[1]) + + (z * current_node->normal[2]) + + current_node->splitdistance; // If we are exactly on the split plane, I don't know what should happen. // if(distance == 0.0f) { - return(RegionTypeNormal); + return(RegionTypeNormal); } if(distance >0.0f) { - if(current_node->left==0) { - // This shouldn't happen - return(RegionTypeNormal); - } - return BSPReturnRegionType( current_node->left, - y, x, z); + if(current_node->left==0) { + // This shouldn't happen + return(RegionTypeNormal); + } + return BSPReturnRegionType(current_node->left, y, x, z); } if(current_node->right==0) { - // This should't happen - return(RegionTypeNormal); + // This should't happen + return(RegionTypeNormal); } - return BSPReturnRegionType(current_node->right, - y, x, z); + return BSPReturnRegionType(current_node->right, y, x, z); } bool WaterMap::InWater(float y, float x, float z) const { @@ -158,7 +156,7 @@ bool WaterMap::loadWaterMap(FILE *fp) { return(false); } if(strncmp(EQWMagic,"EQEMUWATER",10)) { - printf("Bad header in Water region map.\n"); + printf("Bad header in Water region map.\n"); return(false); } if(fread(&EQWVersion, sizeof(EQWVersion), 1, fp)!=1) { diff --git a/zone/watermap.h b/zone/watermap.h index dc8b56d8b..c3b36483b 100644 --- a/zone/watermap.h +++ b/zone/watermap.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2008 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2008 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 - 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 WATERMAP_H #define WATERMAP_H @@ -22,23 +22,23 @@ #pragma pack(1) typedef struct ZBSP_Node { - int32 node_number; - float normal[3], splitdistance; - int32 region; - int32 special; - int32 left, right; + int32 node_number; + float normal[3], splitdistance; + int32 region; + int32 special; + int32 left, right; } ZBSP_Node; #pragma pack() typedef enum { RegionTypeUnsupported = -2, RegionTypeUntagged = -1, - RegionTypeNormal = 0, - RegionTypeWater = 1, - RegionTypeLava = 2, + RegionTypeNormal = 0, + RegionTypeWater = 1, + RegionTypeLava = 2, RegionTypeZoneLine = 3, RegionTypePVP = 4, - RegionTypeSlime = 5, + RegionTypeSlime = 5, RegionTypeIce = 6, RegionTypeVWater =7 } WaterRegionType; @@ -46,11 +46,11 @@ typedef enum { class WaterMap { public: - static WaterMap* LoadWaterMapfile(const char* in_zonename, const char *directory = nullptr); - WaterRegionType BSPReturnRegionType(int32 node_number, float y, float x, float z) const; - bool InWater(float y, float x, float z) const; - bool InVWater(float y, float x, float z) const; - bool InLava(float y, float x, float z) const; + static WaterMap* LoadWaterMapfile(const char* in_zonename, const char *directory = nullptr); + WaterRegionType BSPReturnRegionType(int32 node_number, float y, float x, float z) const; + bool InWater(float y, float x, float z) const; + bool InVWater(float y, float x, float z) const; + bool InLava(float y, float x, float z) const; bool InLiquid(float y, float x, float z) const; WaterMap(); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 1d40bef8c..42dd23007 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -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 */ #include "../common/debug.h" #ifdef _EQDEBUG @@ -127,7 +127,7 @@ void NPC::ResumeWandering() char temp[100]; itoa(cur_wp,temp,10); //do this before updating to next waypoint CalculateNewWaypoint(); - SetAppearance(eaStanding, false); + SetAppearance(eaStanding, false); parse->EventNPC(EVENT_WAYPOINT_DEPART, this, nullptr, temp, 0); } // if not currently at a waypoint, we continue on to the one we were headed to before the stop } @@ -206,9 +206,9 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) cur_wp_z = mtz; cur_wp_pause = 0; cur_wp_heading = mth; - pLastFightingDelayMoving = 0; - if(AIwalking_timer->Enabled()) - AIwalking_timer->Start(100); + pLastFightingDelayMoving = 0; + if(AIwalking_timer->Enabled()) + AIwalking_timer->Start(100); } void NPC::UpdateWaypoint(int wp_index) @@ -233,7 +233,7 @@ void NPC::UpdateWaypoint(int wp_index) { if(!RuleB(Watermap, CheckForWaterAtWaypoints) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(cur_wp_x, cur_wp_y, cur_wp_z))) + (zone->HasWaterMap() && !zone->watermap->InWater(cur_wp_x, cur_wp_y, cur_wp_z))) { VERTEX dest(cur_wp_x, cur_wp_y, cur_wp_z); @@ -413,27 +413,27 @@ void NPC::GetClosestWaypoint(list &wp_list, int count, float m_x, float void NPC::SetWaypointPause() { - //Declare time to wait on current WP + //Declare time to wait on current WP - if (cur_wp_pause == 0) { - AIwalking_timer->Start(100); - } - else - { + if (cur_wp_pause == 0) { + AIwalking_timer->Start(100); + } + else + { - switch (pausetype) - { - case 0: //Random Half - AIwalking_timer->Start((cur_wp_pause - MakeRandomInt(0, cur_wp_pause-1)/2)*1000); - break; - case 1: //Full - AIwalking_timer->Start(cur_wp_pause*1000); - break; - case 2: //Random Full - AIwalking_timer->Start(MakeRandomInt(0, cur_wp_pause-1)*1000); - break; - } - } + switch (pausetype) + { + case 0: //Random Half + AIwalking_timer->Start((cur_wp_pause - MakeRandomInt(0, cur_wp_pause-1)/2)*1000); + break; + case 1: //Full + AIwalking_timer->Start(cur_wp_pause*1000); + break; + case 2: //Random Full + AIwalking_timer->Start(MakeRandomInt(0, cur_wp_pause-1)*1000); + break; + } + } } void NPC::SaveGuardSpot(bool iClearGuardSpot) { @@ -474,26 +474,26 @@ void NPC::NextGuardPosition() { /* // we need this for charmed NPCs void Mob::SaveSpawnSpot() { - spawn_x = x_pos; - spawn_y = y_pos; - spawn_z = z_pos; - spawn_heading = heading; + spawn_x = x_pos; + spawn_y = y_pos; + spawn_z = z_pos; + spawn_heading = heading; }*/ /*float Mob::CalculateDistanceToNextWaypoint() { - return CalculateDistance(cur_wp_x, cur_wp_y, cur_wp_z); + return CalculateDistance(cur_wp_x, cur_wp_y, cur_wp_z); }*/ float Mob::CalculateDistance(float x, float y, float z) { - return (float)sqrtf( ((x_pos-x)*(x_pos-x)) + ((y_pos-y)*(y_pos-y)) + ((z_pos-z)*(z_pos-z)) ); + return (float)sqrtf( ((x_pos-x)*(x_pos-x)) + ((y_pos-y)*(y_pos-y)) + ((z_pos-z)*(z_pos-z)) ); } /* uint8 NPC::CalculateHeadingToNextWaypoint() { - return CalculateHeadingToTarget(cur_wp_x, cur_wp_y); + return CalculateHeadingToTarget(cur_wp_x, cur_wp_y); } */ float Mob::CalculateHeadingToTarget(float in_x, float in_y) { @@ -541,7 +541,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b return true; } - int compare_steps = IsBoat() ? 1 : 20; + int compare_steps = IsBoat() ? 1 : 20; if(tar_ndx < compare_steps && tarx==x && tary==y){ x_pos = x_pos + tar_vx*tar_vector; y_pos = y_pos + tar_vy*tar_vector; @@ -560,7 +560,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) { VERTEX dest(x_pos, y_pos, z_pos); @@ -598,8 +598,8 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b tarz=z; float nx = this->x_pos; - float ny = this->y_pos; - float nz = this->z_pos; + float ny = this->y_pos; + float nz = this->z_pos; // float nh = this->heading; tar_vx = x - nx; @@ -638,7 +638,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b heading = CalculateHeadingToTarget(x, y); mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } - else + else { x_pos = x; y_pos = y; @@ -669,7 +669,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) { VERTEX dest(x_pos, y_pos, z_pos); @@ -688,7 +688,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b } else z_pos = newz+1; - } + } } } @@ -725,14 +725,14 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec _ZP(Mob_CalculateNewPosition); - float nx = x_pos; - float ny = y_pos; - float nz = z_pos; + float nx = x_pos; + float ny = y_pos; + float nz = z_pos; // float nh = heading; - // if NPC is rooted - if (speed == 0.0) { - SetHeading(CalculateHeadingToTarget(x, y)); + // if NPC is rooted + if (speed == 0.0) { + SetHeading(CalculateHeadingToTarget(x, y)); if(moved){ SendPosition(); SetMoving(false); @@ -740,8 +740,8 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec } SetRunAnimSpeed(0); mlog(AI__WAYPOINTS, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); - return true; - } + return true; + } float old_test_vector=test_vector; tar_vx = x - nx; @@ -786,7 +786,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) { VERTEX dest(x_pos, y_pos, z_pos); @@ -822,10 +822,10 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec } tar_ndx++; - // now get new heading + // now get new heading SetAppearance(eaStanding, false); // make sure they're standing - pLastChange = Timer::GetCurrentTime(); - return true; + pLastChange = Timer::GetCurrentTime(); + return true; } void NPC::AssignWaypoints(int32 grid) { @@ -841,7 +841,7 @@ void NPC::AssignWaypoints(int32 grid) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_ROW row; bool GridErr = false, WPErr = false; Waypoints.clear(); @@ -850,19 +850,19 @@ void NPC::AssignWaypoints(int32 grid) { if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT `type`,`type2` FROM `grid` WHERE `id`=%i AND `zoneid`=%i",grid,zone->GetZoneID()),errbuf, &result)) { if((row = mysql_fetch_row(result))) - { - if(row[0] != 0) - wandertype = atoi(row[0]); + { + if(row[0] != 0) + wandertype = atoi(row[0]); else wandertype = 0; if(row[1] != 0) pausetype = atoi(row[1]); else pausetype = 0; - } - else // No grid record found in this zone for the given ID + } + else // No grid record found in this zone for the given ID GridErr = true; - mysql_free_result(result); + mysql_free_result(result); } else // DB query error! { @@ -873,21 +873,21 @@ void NPC::AssignWaypoints(int32 grid) { if(!GridErr) { - this->CastToNPC()->SetGrid(grid); // Assign grid number - adverrorinfo = 7561; + this->CastToNPC()->SetGrid(grid); // Assign grid number + adverrorinfo = 7561; - // Retrieve all waypoints for this grid - if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT `x`,`y`,`z`,`pause`,`heading` FROM grid_entries WHERE `gridid`=%i AND `zoneid`=%i ORDER BY `number`",grid,zone->GetZoneID()),errbuf,&result)) - { - roamer = true; + // Retrieve all waypoints for this grid + if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT `x`,`y`,`z`,`pause`,`heading` FROM grid_entries WHERE `gridid`=%i AND `zoneid`=%i ORDER BY `number`",grid,zone->GetZoneID()),errbuf,&result)) + { + roamer = true; max_wp = -1; // Initialize it; will increment it for each waypoint successfully added to the list adverrorinfo = 7564; while((row = mysql_fetch_row(result))) { - if(row[0] != 0 && row[1] != 0 && row[2] != 0 && row[3] != 0) - { - wplist newwp; + if(row[0] != 0 && row[1] != 0 && row[2] != 0 && row[3] != 0) + { + wplist newwp; newwp.index = ++max_wp; newwp.x = atof(row[0]); newwp.y = atof(row[1]); @@ -910,23 +910,23 @@ void NPC::AssignWaypoints(int32 grid) { newwp.pause = atoi(row[3]); newwp.heading = atof(row[4]); Waypoints.push_back(newwp); - } + } } mysql_free_result(result); - } - else // DB query error! - { - WPErr = true; + } + else // DB query error! + { + WPErr = true; LogFile->write(EQEMuLog::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, errbuf); - } - safe_delete_array(query); + } + safe_delete_array(query); } // end if (!GridErr) if(Waypoints.size() < 2) { roamer = false; } else if(!GridErr && !WPErr) { - UpdateWaypoint(0); - SetWaypointPause(); - if (wandertype == 1 || wandertype == 2 || wandertype == 5) + UpdateWaypoint(0); + SetWaypointPause(); + if (wandertype == 1 || wandertype == 2 || wandertype == 5) CalculateNewWaypoint(); } else { roamer = false; @@ -947,7 +947,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo) ) { if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) { VERTEX dest(x_pos, y_pos, z_pos); @@ -974,7 +974,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo)) { if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) { VERTEX dest(x_pos, y_pos, z_pos); @@ -1225,7 +1225,7 @@ void ZoneDatabase::AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, flo /********** -* ModifyWP() has been obsoleted. The #wp command either uses AddWP() or DeleteWaypoint() +* ModifyWP() has been obsoleted. The #wp command either uses AddWP() or DeleteWaypoint() ***********/ /****************** @@ -1253,32 +1253,32 @@ void ZoneDatabase::DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num, uin * AddWPForSpawn - Used by the #wpadd command - for a given spawn, this will add a new waypoint to whatever grid that spawn is assigned to. * If there is currently no grid assigned to the spawn, a new grid will be created using the next available Grid ID number for the zone * the spawn is in. -* Returns 0 if the function didn't have to create a new grid. If the function had to create a new grid for the spawn, then the ID of +* Returns 0 if the function didn't have to create a new grid. If the function had to create a new grid for the spawn, then the ID of * the created grid is returned. */ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading) { char *query = 0; - uint32 grid_num, // The grid number the spawn is assigned to (if spawn has no grid, will be the grid number we end up creating) + uint32 grid_num, // The grid number the spawn is assigned to (if spawn has no grid, will be the grid number we end up creating) next_wp_num; // The waypoint number we should be assigning to the new waypoint - bool CreatedNewGrid; // Did we create a new grid in this function? - MYSQL_RES *result; - MYSQL_ROW row; + bool CreatedNewGrid; // Did we create a new grid in this function? + MYSQL_RES *result; + MYSQL_ROW row; char errbuf[MYSQL_ERRMSG_SIZE]; // See what grid number our spawn is assigned if(RunQuery(query, MakeAnyLenString(&query,"SELECT pathgrid FROM spawn2 WHERE id=%i",spawn2id),errbuf,&result)) { - safe_delete_array(query); - if(mysql_num_rows(result) > 0) - { + safe_delete_array(query); + if(mysql_num_rows(result) > 0) + { row = mysql_fetch_row(result); grid_num = atoi(row[0]); - } - else // This spawn ID was not found in the `spawn2` table + } + else // This spawn ID was not found in the `spawn2` table return 0; - mysql_free_result(result); + mysql_free_result(result); } else { // Query error LogFile->write(EQEMuLog::Error, "Error setting pathgrid '%s': '%s'", query, errbuf); @@ -1287,21 +1287,21 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float if (grid_num == 0) // Our spawn doesn't have a grid assigned to it -- we need to create a new grid and assign it to the spawn { - CreatedNewGrid = true; - if((grid_num = GetFreeGrid(zoneid)) == 0) // There are no grids for the current zone -- create Grid #1 + CreatedNewGrid = true; + if((grid_num = GetFreeGrid(zoneid)) == 0) // There are no grids for the current zone -- create Grid #1 grid_num = 1; - if(!RunQuery(query, MakeAnyLenString(&query,"insert into grid set id='%i',zoneid= %i, type='%i', type2='%i'",grid_num,zoneid,type1,type2), errbuf)) { + if(!RunQuery(query, MakeAnyLenString(&query,"insert into grid set id='%i',zoneid= %i, type='%i', type2='%i'",grid_num,zoneid,type1,type2), errbuf)) { LogFile->write(EQEMuLog::Error, "Error adding grid '%s': '%s'", query, errbuf); - } else { + } else { if(c) c->LogSQL(query); } - safe_delete_array(query); + safe_delete_array(query); - query = 0; - if(!RunQuery(query, MakeAnyLenString(&query,"update spawn2 set pathgrid='%i' where id='%i'",grid_num,spawn2id), errbuf)) { + query = 0; + if(!RunQuery(query, MakeAnyLenString(&query,"update spawn2 set pathgrid='%i' where id='%i'",grid_num,spawn2id), errbuf)) { LogFile->write(EQEMuLog::Error, "Error updating spawn2 pathing '%s': '%s'", query, errbuf); - } else { + } else { if(c) c->LogSQL(query); } safe_delete_array(query); @@ -1314,14 +1314,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float query = 0; if(RunQuery(query, MakeAnyLenString(&query,"SELECT max(`number`) FROM grid_entries WHERE zoneid='%i' AND gridid='%i'",zoneid,grid_num),errbuf,&result)) { - safe_delete_array(query); - row = mysql_fetch_row(result); - if(row[0] != 0) + safe_delete_array(query); + row = mysql_fetch_row(result); + if(row[0] != 0) next_wp_num = atoi(row[0]) + 1; - else // No waypoints in this grid yet + else // No waypoints in this grid yet next_wp_num = 1; - mysql_free_result(result); + mysql_free_result(result); } else { // Query error LogFile->write(EQEMuLog::Error, "Error getting next waypoint id '%s': '%s'", query, errbuf); @@ -1344,10 +1344,10 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { - char *query = 0; + char *query = 0; char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query,"SELECT max(id) from grid where zoneid = %i",zoneid),errbuf,&result)) { safe_delete_array(query); if (mysql_num_rows(result) == 1) { diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index abafb6ae4..3e77a093a 100644 --- a/zone/worldserver.cpp +++ b/zone/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 free software; you can redistribute it and/or modify + it 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 @@ -57,7 +57,7 @@ using namespace std; #include "QGlobals.h" -extern EntityList entity_list; +extern EntityList entity_list; extern Zone* zone; extern volatile bool ZoneLoaded; extern void CatchSignal(int); @@ -126,7 +126,7 @@ void WorldServer::OnConnected() { this->SetZone(zone->GetZoneID(), zone->GetInstanceID()); entity_list.UpdateWho(true); this->SendEmoteMessage(0, 0, 15, "Zone connect: %s", zone->GetLongName()); - zone->GetTimeSync(); + zone->GetTimeSync(); } else { this->SetZone(0); } @@ -389,8 +389,8 @@ void WorldServer::Process() { } else { #ifdef _EQDEBUG - _log(ZONE__WORLD, "Error: WhoAllReturnStruct did not point to a valid client! " - "id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", + _log(ZONE__WORLD, "Error: WhoAllReturnStruct did not point to a valid client! " + "id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", wars->id, wars->playerineqstring, wars->playersinzonestring); #endif } @@ -683,10 +683,10 @@ void WorldServer::Process() { //pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0 //also serves to inform Client::OPRezzAnswer to expect a packet. client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); - _log(SPELLS__REZ, "OP_RezzRequest in zone %s for %s, spellid:%i", - zone->GetShortName(), client->GetName(), srs->rez.spellid); + _log(SPELLS__REZ, "OP_RezzRequest in zone %s for %s, spellid:%i", + zone->GetShortName(), client->GetName(), srs->rez.spellid); EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, - sizeof(Resurrect_Struct)); + sizeof(Resurrect_Struct)); memcpy(outapp->pBuffer, &srs->rez, sizeof(Resurrect_Struct)); client->QueuePacket(outapp); _pkt(SPELLS__REZ, outapp); @@ -700,7 +700,7 @@ void WorldServer::Process() { Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name); if (corpse && corpse->IsCorpse()) { _log(SPELLS__REZ, "OP_RezzComplete received in zone %s for corpse %s", - zone->GetShortName(), srs->rez.corpse_name); + zone->GetShortName(), srs->rez.corpse_name); _log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). @@ -829,7 +829,7 @@ void WorldServer::Process() { } break; } - case ServerOP_GroupInvite: { + case ServerOP_GroupInvite: { // A player in another zone invited a player in this zone to join their group. // GroupInvite_Struct* gis = (GroupInvite_Struct*)pack->pBuffer; @@ -877,25 +877,25 @@ void WorldServer::Process() { group->UpdateGroupAAs(); - if(Inviter->CastToClient()->GetClientVersion() < EQClientSoD) - { - EQApplicationPacket* outapp=new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); - GroupJoin_Struct* outgj=(GroupJoin_Struct*)outapp->pBuffer; - strcpy(outgj->membername, Inviter->GetName()); - strcpy(outgj->yourname, Inviter->GetName()); - outgj->action = groupActInviteInitial; // 'You have formed the group'. - group->GetGroupAAs(&outgj->leader_aas); - Inviter->CastToClient()->QueuePacket(outapp); - safe_delete(outapp); - } - else - { - // SoD and later - // - Inviter->CastToClient()->SendGroupCreatePacket(); - Inviter->CastToClient()->SendGroupLeaderChangePacket(Inviter->GetName()); - Inviter->CastToClient()->SendGroupJoinAcknowledge(); - } + if(Inviter->CastToClient()->GetClientVersion() < EQClientSoD) + { + EQApplicationPacket* outapp=new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + GroupJoin_Struct* outgj=(GroupJoin_Struct*)outapp->pBuffer; + strcpy(outgj->membername, Inviter->GetName()); + strcpy(outgj->yourname, Inviter->GetName()); + outgj->action = groupActInviteInitial; // 'You have formed the group'. + group->GetGroupAAs(&outgj->leader_aas); + Inviter->CastToClient()->QueuePacket(outapp); + safe_delete(outapp); + } + else + { + // SoD and later + // + Inviter->CastToClient()->SendGroupCreatePacket(); + Inviter->CastToClient()->SendGroupLeaderChangePacket(Inviter->GetName()); + Inviter->CastToClient()->SendGroupJoinAcknowledge(); + } } if(!group) break; @@ -1040,7 +1040,7 @@ void WorldServer::Process() { if(gj->zoneid == zone->GetZoneID() && gj->instance_id == zone->GetInstanceID()) break; - Group* g = entity_list.GetGroupByID(gj->gid); + Group* g = entity_list.GetGroupByID(gj->gid); if(g) g->AddMember(gj->member_name); @@ -1382,7 +1382,7 @@ void WorldServer::Process() { break; } - case ServerOP_Consent: { + case ServerOP_Consent: { ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer; Client* client = entity_list.GetClientByName(s->grantname); if(client) { @@ -2053,7 +2053,7 @@ uint32 WorldServer::NextGroupID() { } void WorldServer::UpdateLFP(uint32 LeaderID, uint8 Action, uint8 MatchFilter, uint32 FromLevel, uint32 ToLevel, uint32 Classes, - const char *Comments, GroupLFPMemberEntry *LFPMembers) { + const char *Comments, GroupLFPMemberEntry *LFPMembers) { ServerPacket* pack = new ServerPacket(ServerOP_LFPUpdate, sizeof(ServerLFPUpdate_Struct)); ServerLFPUpdate_Struct* sus = (ServerLFPUpdate_Struct*) pack->pBuffer; diff --git a/zone/worldserver.h b/zone/worldserver.h index 4d14459fe..3c2e03fa6 100644 --- a/zone/worldserver.h +++ b/zone/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 @@ -30,7 +30,7 @@ class Database; class WorldServer : public WorldConnection { public: WorldServer(); - virtual ~WorldServer(); + virtual ~WorldServer(); virtual void Process(); @@ -51,7 +51,7 @@ public: void SendReloadTasks(int Command, int TaskID=0); void HandleReloadTasks(ServerPacket *pack); void UpdateLFP(uint32 LeaderID, uint8 Action, uint8 MatchFilter, uint32 FromLevel, uint32 ToLevel, uint32 Classes, const char *Comments, - GroupLFPMemberEntry *LFPMembers); + GroupLFPMemberEntry *LFPMembers); void UpdateLFP(uint32 LeaderID, GroupLFPMemberEntry *LFPMembers); void StopLFP(uint32 LeaderID); void HandleLFGMatches(ServerPacket *pack); diff --git a/zone/zone.cpp b/zone/zone.cpp index c49f66751..707317012 100644 --- a/zone/zone.cpp +++ b/zone/zone.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 @@ -27,8 +27,8 @@ using namespace std; #ifdef _WINDOWS #include -#define snprintf _snprintf -#define vsnprintf _vsnprintf +#define snprintf _snprintf +#define vsnprintf _vsnprintf #else #include #include "../common/unix.h" @@ -64,7 +64,7 @@ using namespace std; #ifdef _WINDOWS #define snprintf _snprintf #define strncasecmp _strnicmp -#define strcasecmp _stricmp +#define strcasecmp _stricmp #endif @@ -136,7 +136,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { LogFile->write(EQEMuLog::Status, "Loot logging level: %i", zone->lootvar); } else { - zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) + zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) zone->merchantvar = 0; zone->tradevar = 0; zone->lootvar = 0; @@ -424,7 +424,7 @@ int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charg uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { - std::list TmpMerchantList = tmpmerchanttable[NPCID]; + std::list TmpMerchantList = tmpmerchanttable[NPCID]; std::list::const_iterator Iterator; for(Iterator = TmpMerchantList.begin(); Iterator != TmpMerchantList.end(); Iterator++) @@ -459,9 +459,9 @@ void Zone::LoadTempMerchantData(){ return; } /* char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; std::list merlist; if (database.RunQuery(query, MakeAnyLenString(&query, "select ml.npcid,ml.slot,ml.itemid,ml.charges from merchantlist_temp ml, npc_types nt, spawnentry se, spawn2 s2 where nt.id=ml.npcid and nt.id=se.npcid and se.spawngroupid=s2.spawngroupid and s2.zone='%s' group by ml.npcid,slot order by npcid,slot asc", GetShortName()), errbuf, &result)) { uint32 npcid = 0; @@ -491,7 +491,7 @@ void Zone::LoadTempMerchantData(){ } void Zone::LoadTempMerchantData_result(MYSQL_RES* result) { - MYSQL_ROW row; + MYSQL_ROW row; std::map >::iterator cur; uint32 npcid = 0; while((row = mysql_fetch_row(result))) { @@ -519,9 +519,9 @@ void Zone::LoadTempMerchantData_result(MYSQL_RES* result) { //there should prolly be a temp counterpart of this... void Zone::LoadNewMerchantData(uint32 merchantid){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; std::list merlist; if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT item, slot, faction_required, level_required, alt_currency_cost FROM merchantlist WHERE merchantid=%d", merchantid), errbuf, &result)) { while((row = mysql_fetch_row(result))) { @@ -529,9 +529,9 @@ void Zone::LoadNewMerchantData(uint32 merchantid){ ml.id = merchantid; ml.item = atoul(row[0]); ml.slot = atoul(row[1]); - ml.faction_required = atoul(row[2]); - ml.level_required = atoul(row[3]); - ml.alt_currency_cost = atoul(row[3]); + ml.faction_required = atoul(row[2]); + ml.level_required = atoul(row[3]); + ml.alt_currency_cost = atoul(row[3]); merlist.push_back(ml); } merchanttable[merchantid] = merlist; @@ -543,7 +543,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid){ } void Zone::LoadMerchantData_result(MYSQL_RES* result) { - MYSQL_ROW row; + MYSQL_ROW row; std::map >::iterator cur; uint32 npcid = 0; while((row = mysql_fetch_row(result))) { @@ -559,25 +559,25 @@ void Zone::LoadMerchantData_result(MYSQL_RES* result) { npcid = ml.id; } - std::list::iterator iter = cur->second.begin(); - bool found = false; - while(iter != cur->second.end()) { - if((*iter).item == ml.id) { - found = true; - break; - } - iter++; - } + std::list::iterator iter = cur->second.begin(); + bool found = false; + while(iter != cur->second.end()) { + if((*iter).item == ml.id) { + found = true; + break; + } + iter++; + } - if(found) { - continue; - } + if(found) { + continue; + } ml.slot = atoul(row[1]); ml.item = atoul(row[2]); - ml.faction_required = atoul(row[3]); - ml.level_required = atoul(row[4]); - ml.alt_currency_cost = atoul(row[5]); + ml.faction_required = atoul(row[3]); + ml.level_required = atoul(row[4]); + ml.alt_currency_cost = atoul(row[5]); cur->second.push_back(ml); } } @@ -603,9 +603,9 @@ void Zone::GetMerchantDataForZoneLoad(){ return; } /* char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; std::list merlist; if (database.RunQuery(query, MakeAnyLenString(&query, "select ml.merchantid,ml.slot,ml.item from merchantlist ml, npc_types nt, spawnentry se, spawn2 s2 where nt.merchant_id=ml.merchantid and nt.id=se.npcid and se.spawngroupid=s2.spawngroupid and s2.zone='%s' group by ml.merchantid,slot order by merchantid,slot asc", GetShortName()), errbuf, &result)) { uint32 npcid = 0; @@ -880,7 +880,7 @@ void Zone::Shutdown(bool quite) zone->ResetAuth(); safe_delete(zone); dbasync->CommitWrites(); - if(parse) { parse->ReloadQuests(true); } + if(parse) { parse->ReloadQuests(true); } UpdateWindowTitle(); } @@ -976,7 +976,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) totalBS = 0; aas = nullptr; totalAAs = 0; - gottime = false; + gottime = false; Instance_Shutdown_Timer = nullptr; bool is_perma = false; @@ -1120,7 +1120,7 @@ bool Zone::Init(bool iStaticZone) { zone->LoadLDoNTraps(); zone->LoadLDoNTrapEntries(); zone->LoadVeteranRewards(); - zone->LoadAlternateCurrencies(); + zone->LoadAlternateCurrencies(); zone->LoadNPCEmotes(&NPCEmoteList); //Load AA information @@ -1208,7 +1208,7 @@ void Zone::ReloadStaticData() { entity_list.RespawnAllDoors(); zone->LoadVeteranRewards(); - zone->LoadAlternateCurrencies(); + zone->LoadAlternateCurrencies(); NPCEmoteList.Clear(); zone->LoadNPCEmotes(&NPCEmoteList); @@ -1490,7 +1490,7 @@ bool Zone::Process() { } } - if(hotzone_timer.Check()) { UpdateHotzone(); } + if(hotzone_timer.Check()) { UpdateHotzone(); } return true; } @@ -1511,12 +1511,12 @@ bool Zone::Depop(bool StartSpawnTimer) { std::map::iterator itr; entity_list.Depop(StartSpawnTimer); - // Refresh npctable, getting current info from database. - while(npctable.size()) { + // Refresh npctable, getting current info from database. + while(npctable.size()) { itr=npctable.begin(); delete itr->second; npctable.erase(itr); - } + } return true; } @@ -1626,7 +1626,7 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien if(client) client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone LogFile->write(EQEMuLog::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - LogFile->write(EQEMuLog::Status, ". %f x %f y %f z ", x, y, z); + LogFile->write(EQEMuLog::Status, ". %f x %f y %f z ", x, y, z); } if(closest_dist > max_distance2) @@ -1728,7 +1728,7 @@ return true; bool ZoneDatabase::DumpZoneState() { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "DELETE FROM zone_state_dump WHERE zonename='%s'", zone->GetShortName()), errbuf)) { cerr << "Error in DumpZoneState query '" << query << "' " << errbuf << endl; @@ -1775,46 +1775,46 @@ bool ZoneDatabase::DumpZoneState() { } entity_list.DoZoneDump(spawn2_dump, npc_dump, npcloot_dump, gmspawntype_dump); - query = new char[512 + ((sizeof(ZSDump_Spawn2) * spawn2_count + sizeof(ZSDump_NPC) * npc_count + sizeof(ZSDump_NPC_Loot) * npcloot_count + sizeof(NPCType) * gmspawntype_count) * 2)]; + query = new char[512 + ((sizeof(ZSDump_Spawn2) * spawn2_count + sizeof(ZSDump_NPC) * npc_count + sizeof(ZSDump_NPC_Loot) * npcloot_count + sizeof(NPCType) * gmspawntype_count) * 2)]; char* end = query; - end += sprintf(end, "Insert Into zone_state_dump (zonename, spawn2_count, npc_count, npcloot_count, gmspawntype_count, spawn2, npcs, npc_loot, gmspawntype) values ('%s', %i, %i, %i, %i, ", zone->GetShortName(), spawn2_count, npc_count, npcloot_count, gmspawntype_count); - *end++ = '\''; + end += sprintf(end, "Insert Into zone_state_dump (zonename, spawn2_count, npc_count, npcloot_count, gmspawntype_count, spawn2, npcs, npc_loot, gmspawntype) values ('%s', %i, %i, %i, %i, ", zone->GetShortName(), spawn2_count, npc_count, npcloot_count, gmspawntype_count); + *end++ = '\''; if (spawn2_dump != 0) { end += DoEscapeString(end, (char*)spawn2_dump, sizeof(ZSDump_Spawn2) * spawn2_count); safe_delete_array(spawn2_dump); } - *end++ = '\''; - end += sprintf(end, ", "); - *end++ = '\''; + *end++ = '\''; + end += sprintf(end, ", "); + *end++ = '\''; if (npc_dump != 0) { end += DoEscapeString(end, (char*)npc_dump, sizeof(ZSDump_NPC) * npc_count); safe_delete_array(npc_dump); } - *end++ = '\''; - end += sprintf(end, ", "); - *end++ = '\''; + *end++ = '\''; + end += sprintf(end, ", "); + *end++ = '\''; if (npcloot_dump != 0) { end += DoEscapeString(end, (char*)npcloot_dump, sizeof(ZSDump_NPC_Loot) * npcloot_count); safe_delete_array(npcloot_dump); } - *end++ = '\''; - end += sprintf(end, ", "); - *end++ = '\''; + *end++ = '\''; + end += sprintf(end, ", "); + *end++ = '\''; if (gmspawntype_dump != 0) { end += DoEscapeString(end, (char*)gmspawntype_dump, sizeof(NPCType) * gmspawntype_count); safe_delete_array(gmspawntype_dump); } - *end++ = '\''; - end += sprintf(end, ")"); + *end++ = '\''; + end += sprintf(end, ")"); uint32 affected_rows = 0; if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { - // if (DoEscapeString(query, (unsigned int) (end - query))) { + // if (DoEscapeString(query, (unsigned int) (end - query))) { safe_delete_array(query); - cerr << "Error in ZoneDump query " << errbuf << endl; + cerr << "Error in ZoneDump query " << errbuf << endl; return false; - } + } safe_delete_array(query); if (affected_rows == 0) { @@ -1826,9 +1826,9 @@ bool ZoneDatabase::DumpZoneState() { int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList& spawn2_list) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; uint32 i; unsigned long* lengths; @@ -2026,9 +2026,9 @@ void Zone::SpawnStatus(Mob* client) { while(iterator.MoreElements()) { if (iterator.GetData()->timer.GetRemainingTime() == 0xFFFFFFFF) - client->Message(0, " %d: %1.1f, %1.1f, %1.1f: disabled", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ()); + client->Message(0, " %d: %1.1f, %1.1f, %1.1f: disabled", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ()); else - client->Message(0, " %d: %1.1f, %1.1f, %1.1f: %1.2f", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ(), (float)iterator.GetData()->timer.GetRemainingTime() / 1000); + client->Message(0, " %d: %1.1f, %1.1f, %1.1f: %1.2f", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ(), (float)iterator.GetData()->timer.GetRemainingTime() / 1000); x++; iterator.Advance(); @@ -2048,7 +2048,7 @@ void Zone::ShowEnabledSpawnStatus(Mob* client) { if (iterator.GetData()->timer.GetRemainingTime() != 0xFFFFFFFF) { - client->Message(0, " %d: %1.1f, %1.1f, %1.1f: %1.2f", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ(), (float)iterator.GetData()->timer.GetRemainingTime() / 1000); + client->Message(0, " %d: %1.1f, %1.1f, %1.1f: %1.2f", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ(), (float)iterator.GetData()->timer.GetRemainingTime() / 1000); iEnabledCount++; } @@ -2071,7 +2071,7 @@ void Zone::ShowDisabledSpawnStatus(Mob* client) { if (iterator.GetData()->timer.GetRemainingTime() == 0xFFFFFFFF) { - client->Message(0, " %d: %1.1f, %1.1f, %1.1f: disabled", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ()); + client->Message(0, " %d: %1.1f, %1.1f, %1.1f: disabled", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ()); iDisabledCount++; } @@ -2095,9 +2095,9 @@ void Zone::ShowSpawnStatusByID(Mob* client, uint32 spawnid) if (iterator.GetData()->GetID() == spawnid) { if (iterator.GetData()->timer.GetRemainingTime() == 0xFFFFFFFF) - client->Message(0, " %d: %1.1f, %1.1f, %1.1f: disabled", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ()); + client->Message(0, " %d: %1.1f, %1.1f, %1.1f: disabled", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ()); else - client->Message(0, " %d: %1.1f, %1.1f, %1.1f: %1.2f", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ(), (float)iterator.GetData()->timer.GetRemainingTime() / 1000); + client->Message(0, " %d: %1.1f, %1.1f, %1.1f: %1.2f", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ(), (float)iterator.GetData()->timer.GetRemainingTime() / 1000); iSpawnIDCount++; @@ -2506,9 +2506,9 @@ void Zone::LoadAlternateCurrencies() { while((row = mysql_fetch_row(result))) { - current_currency.id = atoi(row[0]); - current_currency.item_id = atoi(row[1]); - AlternateCurrencies.push_back(current_currency); + current_currency.id = atoi(row[0]); + current_currency.item_id = atoi(row[1]); + AlternateCurrencies.push_back(current_currency); } mysql_free_result(result); @@ -2672,17 +2672,17 @@ void Zone::ReloadWorld(uint32 Option){ void Zone::LoadTickItems() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - tick_items.clear(); + char errbuf[MYSQL_ERRMSG_SIZE]; + char* query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + tick_items.clear(); - if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"), errbuf, &result)) - { - while((row = mysql_fetch_row(result))) - { - if(atoi(row[0]) >= 1) + if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"), errbuf, &result)) + { + while((row = mysql_fetch_row(result))) + { + if(atoi(row[0]) >= 1) { item_tick_struct ti_tmp; ti_tmp.itemid = atoi(row[0]); @@ -2692,52 +2692,52 @@ void Zone::LoadTickItems() ti_tmp.qglobal = std::string(row[3]); tick_items[atoi(row[0])] = ti_tmp; } - } - mysql_free_result(result); - safe_delete_array(query); - } - else - { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query, errbuf); - safe_delete_array(query); - } + } + mysql_free_result(result); + safe_delete_array(query); + } + else + { + LogFile->write(EQEMuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query, errbuf); + safe_delete_array(query); + } } uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) { - LinkedListIterator iterator(spawn2_list); + LinkedListIterator iterator(spawn2_list); - iterator.Reset(); - while(iterator.MoreElements()) - { - if(iterator.GetData()->GetID() == in_spawnid) - { - return(iterator.GetData()->killcount); - } - iterator.Advance(); - } + iterator.Reset(); + while(iterator.MoreElements()) + { + if(iterator.GetData()->GetID() == in_spawnid) + { + return(iterator.GetData()->killcount); + } + iterator.Advance(); + } return 0; } void Zone::UpdateHotzone() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - bool updh; + char errbuf[MYSQL_ERRMSG_SIZE]; + char* query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + bool updh; - if(database.RunQuery(query, MakeAnyLenString(&query,"SELECT hotzone FROM zone WHERE short_name = '%s'", GetShortName()), errbuf, &result) ) - { - if( (row = mysql_fetch_row(result)) ) - { - updh = atoi(row[0]) == 0 ? false:true; - //Hotzone status has changed - if(is_hotzone != updh) - { - is_hotzone = updh; - } - } - mysql_free_result(result); - } - safe_delete_array(query); + if(database.RunQuery(query, MakeAnyLenString(&query,"SELECT hotzone FROM zone WHERE short_name = '%s'", GetShortName()), errbuf, &result) ) + { + if( (row = mysql_fetch_row(result)) ) + { + updh = atoi(row[0]) == 0 ? false:true; + //Hotzone status has changed + if(is_hotzone != updh) + { + is_hotzone = updh; + } + } + mysql_free_result(result); + } + safe_delete_array(query); } diff --git a/zone/zone.h b/zone/zone.h index 58f969780..5db6a78b5 100644 --- a/zone/zone.h +++ b/zone/zone.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 ZONE_H #define ZONE_H @@ -147,8 +147,8 @@ public: void Repop(uint32 delay = 0); void SpawnStatus(Mob* client); void ShowEnabledSpawnStatus(Mob* client); - void ShowDisabledSpawnStatus(Mob* client); - void ShowSpawnStatusByID(Mob* client, uint32 spawnid); + void ShowDisabledSpawnStatus(Mob* client); + void ShowSpawnStatusByID(Mob* client, uint32 spawnid); void StartShutdownTimer(uint32 set_time = (RuleI(Zone, AutoShutdownDelay))); void AddAuth(ServerZoneIncommingClient_Struct* szic); void RemoveAuth(const char* iCharName); @@ -197,7 +197,7 @@ public: map > merc_spells_list; map level_exp_mod; list VeteranRewards; - list AlternateCurrencies; + list AlternateCurrencies; char *adv_data; bool did_adventure_actions; @@ -205,7 +205,7 @@ public: void DoAdventureAssassinationCountIncrease(); void DoAdventureActions(); void LoadVeteranRewards(); - void LoadAlternateCurrencies(); + void LoadAlternateCurrencies(); void LoadNPCEmotes(LinkedList* NPCEmoteList); void ReloadWorld(uint32 Option); @@ -227,7 +227,7 @@ public: bool IsCity() const { return(is_city); } bool CanDoCombat() const { return(can_combat); } bool CanLevitate() const {return(can_levitate); } // Magoth78 - bool CanCastOutdoor() const {return(can_castoutdoor);} //qadar + bool CanCastOutdoor() const {return(can_castoutdoor);} //qadar bool AllowMercs() const {return(allow_mercs);} bool IsHotzone() const { return(is_hotzone); } inline bool BuffTimersSuspended() const { return newzone_data.SuspendBuffs != 0; }; @@ -285,13 +285,13 @@ private: bool can_bind; bool is_city; bool can_combat; - bool can_castoutdoor; + bool can_castoutdoor; bool can_levitate; bool is_hotzone; bool allow_mercs; uint32 pgraveyard_id, pgraveyard_zoneid; float pgraveyard_x, pgraveyard_y, pgraveyard_z, pgraveyard_heading; - int default_ruleset; + int default_ruleset; int totalBS; ZoneSpellsBlocked *blocked_spells; @@ -316,10 +316,10 @@ private: Timer clientauth_timer; Timer spawn2_timer; Timer qglobal_purge_timer; - Timer* Weather_Timer; + Timer* Weather_Timer; Timer* Instance_Timer; Timer* Instance_Shutdown_Timer; - Timer* Instance_Warning_timer; + Timer* Instance_Warning_timer; LinkedList client_auth_list; QGlobalCache *qGlobals; diff --git a/zone/zone_logsys.cpp b/zone/zone_logsys.cpp index da901d288..3ecf9ec6b 100644 --- a/zone/zone_logsys.cpp +++ b/zone/zone_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 free software; you can redistribute it and/or modify + it 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" @@ -65,14 +65,3 @@ void log_packet_mob(LogType type, Mob *who, const BasePacket *p) { log_hex(type,(const char *)p->pBuffer,p->size); } - - - - - - - - - - - diff --git a/zone/zone_profile.cpp b/zone/zone_profile.cpp index 3347f4b57..9646587a1 100644 --- a/zone/zone_profile.cpp +++ b/zone/zone_profile.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 "../common/debug.h" #include "../common/features.h" @@ -32,7 +32,7 @@ #define snprintf _snprintf #define vsnprintf _vsnprintf #define strncasecmp _strnicmp - #define strcasecmp _stricmp + #define strcasecmp _stricmp #else #include #include @@ -239,16 +239,16 @@ const char *__zp_names[ZoneProfiler::MaxZoneProfilerId] = { void DumpZoneProfile() { __DZP_timer.stop(); - time_t aclock; - struct tm *newtime; + time_t aclock; + struct tm *newtime; - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ - LogFile->write(EQEMuLog::Debug, "Profiling dump at: [%02d/%02d - %02d:%02d:%02d] (%.2f ms of data)", - newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, - __DZP_timer.getTotalDuration()); + time( &aclock ); /* Get time in seconds */ + newtime = localtime( &aclock ); /* Convert time to struct */ + LogFile->write(EQEMuLog::Debug, "Profiling dump at: [%02d/%02d - %02d:%02d:%02d] (%.2f ms of data)", + newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, + __DZP_timer.getTotalDuration()); - vector<_DZP_Data> data; + vector<_DZP_Data> data; int r; @@ -279,9 +279,9 @@ void DumpZoneProfile() { LogFile->write(EQEMuLog::Debug, "..%s: %llu calls, %.4fms", cur->str, (unsigned long long)cur->count, cur->dur); } - LogFile->write(EQEMuLog::Debug, "End Profiling dump at: [%02d/%02d - %02d:%02d:%02d] (%.2f ms of data)", - newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, - __DZP_timer.getTotalDuration()); + LogFile->write(EQEMuLog::Debug, "End Profiling dump at: [%02d/%02d - %02d:%02d:%02d] (%.2f ms of data)", + newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, + __DZP_timer.getTotalDuration()); __DZP_timer.start(); } @@ -299,5 +299,3 @@ void ResetZoneProfile() { #endif //EQPROFILE - - diff --git a/zone/zone_profile.h b/zone/zone_profile.h index 2ec1d6f78..071612d65 100644 --- a/zone/zone_profile.h +++ b/zone/zone_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 ZONE_PROFILE_H #define ZONE_PROFILE_H diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 0fe590a15..b93104924 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -62,7 +62,7 @@ ZoneDatabase::~ZoneDatabase() { bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct* zd){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "update zone set underworld=%f,minclip=%f," "maxclip=%f,fog_minclip=%f,fog_maxclip=%f,fog_blue=%i,fog_red=%i,fog_green=%i,sky=%i," "ztype=%i,zone_exp_multiplier=%f,safe_x=%f,safe_y=%f,safe_z=%f " @@ -171,7 +171,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti uint32 cur = tv.tv_sec; char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; //if we pass timeleft as 0 that means we clear from respawn time //otherwise we update with a REPLACE INTO @@ -250,7 +250,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if(!RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET enabled=%i WHERE id=%lu", new_status, (unsigned long)id),errbuf)) { @@ -262,7 +262,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) bool ZoneDatabase::logevents(const char* accountname,uint32 accountid,uint8 status,const char* charname, const char* target,const char* descriptiontype, const char* description,int event_nid){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 len = strlen(description); uint32 len2 = strlen(target); char* descriptiontext = new char[2*len+1]; @@ -330,7 +330,7 @@ void ZoneDatabase::UpdateBug(BugStruct* bug){ void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 len = strlen(bug->text); char* bugtext = new char[2*len+1]; memset(bugtext, 0, 2*len+1); @@ -344,7 +344,7 @@ void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){ bool ZoneDatabase::GetAccountInfoForLogin_result(MYSQL_RES* result, int16* admin, char* account_name, uint32* lsaccountid, uint8* gmspeed, bool* revoked,bool* gmhideme, uint32* account_creation) { - MYSQL_ROW row; + MYSQL_ROW row; if (mysql_num_rows(result) == 1) { row = mysql_fetch_row(result); if (admin) @@ -379,7 +379,7 @@ bool ZoneDatabase::GetAccountInfoForLogin_result(MYSQL_RES* result, int16* admin bool ZoneDatabase::SetSpecialAttkFlag(uint8 id, const char* flag) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE npc_types SET npcspecialattks='%s' WHERE id=%i;",flag,id), errbuf, 0, &affected_rows)) { @@ -415,9 +415,9 @@ void ZoneDatabase::SetDoorPlace(uint8 value,uint8 door_id,const char* zone_name) void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id,uint8 eventid,char* detail,char* timestamp, CharacterEventLog_Struct* cel) { 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]; uint32 count = 0; char modifications[200]; @@ -478,13 +478,13 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) } char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; MYSQL_RES *result; MYSQL_ROW row; //const Item_Struct* item = nullptr; //ItemInst* inst = nullptr; - uint32 len_query = MakeAnyLenString(&query, "select " + uint32 len_query = MakeAnyLenString(&query, "select " "bagidx,itemid,charges,augslot1,augslot2,augslot3,augslot4,augslot5 from object_contents where parentid=%i", parentid); if (RunQuery(query, len_query, errbuf, &result)) { @@ -526,7 +526,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const ItemInst* container) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; // Since state is not saved for each world container action, we'll just delete // all and save from scratch .. we may come back later to optimize @@ -567,7 +567,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It void ZoneDatabase::DeleteWorldContainer(uint32 parent_id,uint32 zone_id) { char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; uint32 len_query = MakeAnyLenString(&query, "delete from object_contents where parentid=%i and zoneid=%i", parent_id,zone_id); @@ -641,7 +641,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { MYSQL_ROW row; if (RunQuery(query,MakeAnyLenString(&query, "select * from trader where char_id=%i and serialnumber=%i order by slot_id limit 80", - CharID, SerialNumber),errbuf,&result)){ + CharID, SerialNumber),errbuf,&result)){ safe_delete_array(query); if (mysql_num_rows(result) != 1) { @@ -688,7 +688,7 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; if (!(RunQuery(query,MakeAnyLenString(&query, "replace INTO trader VALUES(%i,%i,%i,%i,%i,%i)", - CharID, ItemID, SerialNumber, Charges, ItemCost, Slot),errbuf))) + CharID, ItemID, SerialNumber, Charges, ItemCost, Slot),errbuf))) _log(TRADING__CLIENT, "Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, errbuf); safe_delete_array(query); @@ -700,9 +700,9 @@ void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int3 char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; if (!(RunQuery(query,MakeAnyLenString(&query, "update trader set charges=%i where char_id=%i and serialnumber=%i", - Charges, CharID, SerialNumber),errbuf))) - _log(TRADING__CLIENT, "Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", - SerialNumber, CharID, errbuf); + Charges, CharID, SerialNumber),errbuf))) + _log(TRADING__CLIENT, "Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", + SerialNumber, CharID, errbuf); safe_delete_array(query); @@ -725,10 +725,10 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg _log(TRADING__CLIENT, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); if (!(RunQuery(Query,MakeAnyLenString(&Query, "delete from trader where char_id=%i and item_id=%i", - CharID, ItemID),errbuf))) + CharID, ItemID),errbuf))) _log(TRADING__CLIENT, "Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", - ItemID, CharID, errbuf); + ItemID, CharID, errbuf); safe_delete_array(Query); @@ -737,17 +737,17 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg else { if(!item->Stackable) { if (!(RunQuery(Query,MakeAnyLenString(&Query, "update trader set item_cost=%i where char_id=%i and item_id=%i" - " and charges=%i", NewPrice, CharID, ItemID, Charges),errbuf))) + " and charges=%i", NewPrice, CharID, ItemID, Charges),errbuf))) - _log(TRADING__CLIENT, "Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", - ItemID, CharID, errbuf); + _log(TRADING__CLIENT, "Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", + ItemID, CharID, errbuf); } else { if (!(RunQuery(Query,MakeAnyLenString(&Query, "update trader set item_cost=%i where char_id=%i and item_id=%i", - NewPrice, CharID, ItemID),errbuf))) + NewPrice, CharID, ItemID),errbuf))) - _log(TRADING__CLIENT, "Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", - ItemID, CharID, errbuf); + _log(TRADING__CLIENT, "Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", + ItemID, CharID, errbuf); } safe_delete_array(Query); @@ -757,7 +757,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg void ZoneDatabase::DeleteTraderItem(uint32 char_id){ char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + char* query = 0; if(char_id==0){ if (!(RunQuery(query,MakeAnyLenString(&query, "delete from trader"),errbuf))) _log(TRADING__CLIENT, "Failed to delete all trader items data, the error was: %s\n",errbuf); @@ -796,7 +796,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; if (!(RunQuery(query,MakeAnyLenString(&query, "replace INTO buyer VALUES(%i,%i, %i,\"%s\",%i,%i)", - CharID, BuySlot, ItemID, ItemName, Quantity, Price),errbuf))) + CharID, BuySlot, ItemID, ItemName, Quantity, Price),errbuf))) _log(TRADING__CLIENT, "Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, errbuf); safe_delete_array(query); @@ -824,7 +824,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) char* query = 0; if (!(RunQuery(query,MakeAnyLenString(&query, "update buyer set quantity=%i where charid=%i and buyslot=%i", - Quantity, CharID, BuySlot), errbuf))) + Quantity, CharID, BuySlot), errbuf))) _log(TRADING__CLIENT, "Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, errbuf); safe_delete_array(query); @@ -837,9 +837,9 @@ uint32* pplen, uint32* guilddbid, uint8* guildrank, uint8 *class_, uint8 *level, bool *LFP, bool *LFG, uint8 *NumXTargets, uint8 *firstlogon) { _CP(Database_GetCharacterInfoForLogin); char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 querylen; - MYSQL_RES *result; + MYSQL_RES *result; bool ret = false; @@ -875,7 +875,7 @@ bool ZoneDatabase::GetCharacterInfoForLogin_result(MYSQL_RES* result, uint8 *class_, uint8 *level, bool *LFP, bool *LFG, uint8 *NumXTargets, uint8* firstlogon) { _CP(Database_GetCharacterInfoForLogin_result); - MYSQL_ROW row; + MYSQL_ROW row; unsigned long* lengths; if (mysql_num_rows(result) == 1) { @@ -967,7 +967,7 @@ bool ZoneDatabase::GetCharacterInfoForLogin_result(MYSQL_RES* result, bool ZoneDatabase::NoRentExpired(const char* name){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; MYSQL_RES *result; MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "Select (UNIX_TIMESTAMP(NOW())-timelaston) from character_ where name='%s'", name), errbuf, &result)) { @@ -990,73 +990,73 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { const NPCType *npc=nullptr; map::iterator itr; - // If NPC is already in tree, return it. + // If NPC is already in tree, return it. if((itr = zone->npctable.find(id)) != zone->npctable.end()) return itr->second; - // Otherwise, get NPCs from database. + // Otherwise, get NPCs from database. char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - // If id is 0, load all npc_types for the current zone, - // according to spawn2. - const char *basic_query = "SELECT " + // If id is 0, load all npc_types for the current zone, + // according to spawn2. + const char *basic_query = "SELECT " "npc_types.id," "npc_types.name," "npc_types.level," - "npc_types.race," + "npc_types.race," "npc_types.class," "npc_types.hp," - "npc_types.mana," - "npc_types.gender," + "npc_types.mana," + "npc_types.gender," "npc_types.texture," "npc_types.helmtexture," - "npc_types.size," + "npc_types.size," "npc_types.loottable_id," - "npc_types.merchant_id," - "npc_types.alt_currency_id," + "npc_types.merchant_id," + "npc_types.alt_currency_id," "npc_types.adventure_template_id," "npc_types.trap_template," "npc_types.attack_speed," - "npc_types.STR," + "npc_types.STR," "npc_types.STA," "npc_types.DEX," "npc_types.AGI," - "npc_types._INT," + "npc_types._INT," "npc_types.WIS," "npc_types.CHA," - "npc_types.MR," + "npc_types.MR," "npc_types.CR," "npc_types.DR," "npc_types.FR," "npc_types.PR," "npc_types.Corrup," - "npc_types.mindmg," - "npc_types.maxdmg," - "npc_types.attack_count," + "npc_types.mindmg," + "npc_types.maxdmg," + "npc_types.attack_count," "npc_types.npcspecialattks," - "npc_types.npc_spells_id," + "npc_types.npc_spells_id," "npc_types.d_meele_texture1," - "npc_types.d_meele_texture2," + "npc_types.d_meele_texture2," "npc_types.prim_melee_type," "npc_types.sec_melee_type," - "npc_types.runspeed," + "npc_types.runspeed," "npc_types.findable," "npc_types.trackable," - "npc_types.hp_regen_rate," + "npc_types.hp_regen_rate," "npc_types.mana_regen_rate," - "npc_types.aggroradius," + "npc_types.aggroradius," "npc_types.bodytype," - "npc_types.npc_faction_id," + "npc_types.npc_faction_id," "npc_types.face," - "npc_types.luclin_hairstyle," + "npc_types.luclin_hairstyle," "npc_types.luclin_haircolor," - "npc_types.luclin_eyecolor," + "npc_types.luclin_eyecolor," "npc_types.luclin_eyecolor2," - "npc_types.luclin_beardcolor," + "npc_types.luclin_beardcolor," "npc_types.luclin_beard," "npc_types.drakkin_heritage," "npc_types.drakkin_tattoo," @@ -1065,12 +1065,12 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { "npc_types.armortint_red," "npc_types.armortint_green," "npc_types.armortint_blue," - "npc_types.see_invis," + "npc_types.see_invis," "npc_types.see_invis_undead," - "npc_types.lastname," + "npc_types.lastname," "npc_types.qglobal," "npc_types.AC," - "npc_types.npc_aggro," + "npc_types.npc_aggro," "npc_types.spawn_limit," "npc_types.see_hide," "npc_types.see_improved_hide," @@ -1080,8 +1080,8 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { "npc_types.maxlevel," "npc_types.scalerate," "npc_types.private_corpse," - "npc_types.unique_spawn_by_name," - "npc_types.underwater," + "npc_types.unique_spawn_by_name," + "npc_types.underwater," "npc_types.emoteid," "npc_types.spellscale," "npc_types.healscale"; @@ -1089,7 +1089,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id); if (RunQuery(query, strlen(query), errbuf, &result)) { - // Process each row returned. + // Process each row returned. while((row = mysql_fetch_row(result))) { NPCType *tmpNPCType; tmpNPCType = new NPCType; @@ -1105,14 +1105,14 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->class_ = atoi(row[r++]); tmpNPCType->max_hp = atoi(row[r++]); tmpNPCType->cur_hp = tmpNPCType->max_hp; - tmpNPCType->Mana = atoi(row[r++]); + tmpNPCType->Mana = atoi(row[r++]); tmpNPCType->gender = atoi(row[r++]); tmpNPCType->texture = atoi(row[r++]); tmpNPCType->helmtexture = atoi(row[r++]); tmpNPCType->size = atof(row[r++]); tmpNPCType->loottable_id = atoi(row[r++]); tmpNPCType->merchanttype = atoi(row[r++]); - tmpNPCType->alt_currency_type = atoi(row[r++]); + tmpNPCType->alt_currency_type = atoi(row[r++]); tmpNPCType->adventure_template = atoi(row[r++]); tmpNPCType->trap_template = atoi(row[r++]); tmpNPCType->attack_speed = atof(row[r++]); @@ -1131,7 +1131,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->Corrup = atoi(row[r++]); tmpNPCType->min_dmg = atoi(row[r++]); tmpNPCType->max_dmg = atoi(row[r++]); - tmpNPCType->attack_count = atoi(row[r++]); + tmpNPCType->attack_count = atoi(row[r++]); strcpy(tmpNPCType->npc_attacks,row[r++]); tmpNPCType->npc_spells_id = atoi(row[r++]); tmpNPCType->d_meele_texture1 = atoi(row[r++]); @@ -1258,7 +1258,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->scalerate = atoi(row[r++]); tmpNPCType->private_corpse = atoi(row[r++]) == 1 ? true : false; tmpNPCType->unique_spawn_by_name = atoi(row[r++]) == 1 ? true : false; - tmpNPCType->underwater = atoi(row[r++]) == 1 ? true : false; + tmpNPCType->underwater = atoi(row[r++]) == 1 ? true : false; tmpNPCType->emoteid = atoi(row[r++]); tmpNPCType->spellscale = atoi(row[r++]); tmpNPCType->healscale = atoi(row[r++]); @@ -1283,9 +1283,9 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { } } else cerr << "Error loading NPCs from database. Bad query: " << errbuf << endl; - safe_delete_array(query); + safe_delete_array(query); - return npc; + return npc; } @@ -1296,77 +1296,77 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client //need to save based on merc_npc_type & client level uint32 merc_type_id = id * 100 + clientlevel; - // If NPC is already in tree, return it. + // If NPC is already in tree, return it. if((itr = zone->merctable.find(merc_type_id)) != zone->merctable.end()) return itr->second; //If the NPC type is 0, return nullptr. (sanity check) if(id == 0) return nullptr; - // Otherwise, get NPCs from database. + // Otherwise, get NPCs from database. char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - // If id is 0, load all npc_types for the current zone, - // according to spawn2. - const char *basic_query = "SELECT " + // If id is 0, load all npc_types for the current zone, + // according to spawn2. + const char *basic_query = "SELECT " "vwMercNpcTypes.merc_npc_type_id," "vwMercNpcTypes.name," //"vwMercNpcTypes.clientlevel," "vwMercNpcTypes.level," - "vwMercNpcTypes.race_id," + "vwMercNpcTypes.race_id," "vwMercNpcTypes.class_id," "vwMercNpcTypes.hp," - "vwMercNpcTypes.mana," - "vwMercNpcTypes.gender," + "vwMercNpcTypes.mana," + "vwMercNpcTypes.gender," "vwMercNpcTypes.texture," "vwMercNpcTypes.helmtexture," - //"vwMercNpcTypes.size," + //"vwMercNpcTypes.size," // "vwMercNpcTypes.loottable_id," - // "vwMercNpcTypes.merchant_id," - // "vwMercNpcTypes.alt_currency_id," + // "vwMercNpcTypes.merchant_id," + // "vwMercNpcTypes.alt_currency_id," // "vwMercNpcTypes.adventure_template_id," // "vwMercNpcTypes.trap_template," "vwMercNpcTypes.attack_speed," - "vwMercNpcTypes.STR," + "vwMercNpcTypes.STR," "vwMercNpcTypes.STA," "vwMercNpcTypes.DEX," "vwMercNpcTypes.AGI," - "vwMercNpcTypes._INT," + "vwMercNpcTypes._INT," "vwMercNpcTypes.WIS," "vwMercNpcTypes.CHA," - "vwMercNpcTypes.MR," + "vwMercNpcTypes.MR," "vwMercNpcTypes.CR," "vwMercNpcTypes.DR," "vwMercNpcTypes.FR," "vwMercNpcTypes.PR," "vwMercNpcTypes.Corrup," - "vwMercNpcTypes.mindmg," - "vwMercNpcTypes.maxdmg," - "vwMercNpcTypes.attack_count," + "vwMercNpcTypes.mindmg," + "vwMercNpcTypes.maxdmg," + "vwMercNpcTypes.attack_count," "vwMercNpcTypes.npcspecialattks," - // "vwMercNpcTypes.npc_spells_id," + // "vwMercNpcTypes.npc_spells_id," "vwMercNpcTypes.d_meele_texture1," - "vwMercNpcTypes.d_meele_texture2," + "vwMercNpcTypes.d_meele_texture2," "vwMercNpcTypes.prim_melee_type," "vwMercNpcTypes.sec_melee_type," - "vwMercNpcTypes.runspeed," + "vwMercNpcTypes.runspeed," // "vwMercNpcTypes.findable," // "vwMercNpcTypes.trackable," - "vwMercNpcTypes.hp_regen_rate," + "vwMercNpcTypes.hp_regen_rate," "vwMercNpcTypes.mana_regen_rate," - // "vwMercNpcTypes.aggroradius," + // "vwMercNpcTypes.aggroradius," "vwMercNpcTypes.bodytype," - // "vwMercNpcTypes.npc_faction_id," + // "vwMercNpcTypes.npc_faction_id," //"vwMercNpcTypes.face," - //"vwMercNpcTypes.luclin_hairstyle," + //"vwMercNpcTypes.luclin_hairstyle," //"vwMercNpcTypes.luclin_haircolor," - //"vwMercNpcTypes.luclin_eyecolor," + //"vwMercNpcTypes.luclin_eyecolor," //"vwMercNpcTypes.luclin_eyecolor2," - //"vwMercNpcTypes.luclin_beardcolor," + //"vwMercNpcTypes.luclin_beardcolor," //"vwMercNpcTypes.luclin_beard," //"vwMercNpcTypes.drakkin_heritage," //"vwMercNpcTypes.drakkin_tattoo," @@ -1375,12 +1375,12 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client "vwMercNpcTypes.armortint_red," "vwMercNpcTypes.armortint_green," "vwMercNpcTypes.armortint_blue," - // "vwMercNpcTypes.see_invis," + // "vwMercNpcTypes.see_invis," // "vwMercNpcTypes.see_invis_undead," - // "vwMercNpcTypes.lastname," + // "vwMercNpcTypes.lastname," // "vwMercNpcTypes.qglobal," "vwMercNpcTypes.AC," - // "vwMercNpcTypes.npc_aggro," + // "vwMercNpcTypes.npc_aggro," // "vwMercNpcTypes.spawn_limit," // "vwMercNpcTypes.see_hide," // "vwMercNpcTypes.see_improved_hide," @@ -1392,14 +1392,14 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client // "vwMercNpcTypes.maxlevel," // "vwMercNpcTypes.scalerate," // "vwMercNpcTypes.private_corpse," - // "vwMercNpcTypes.unique_spawn_by_name," - // "vwMercNpcTypes.underwater," + // "vwMercNpcTypes.unique_spawn_by_name," + // "vwMercNpcTypes.underwater," // "vwMercNpcTypes.emoteid"; MakeAnyLenString(&query, "%s FROM vwMercNpcTypes WHERE merc_npc_type_id=%d AND clientlevel=%d AND race_id = %d", basic_query, id, clientlevel, raceid); //dual primary keys. one is ID, one is level. if (RunQuery(query, strlen(query), errbuf, &result)) { - // Process each row returned. + // Process each row returned. while((row = mysql_fetch_row(result))) { NPCType *tmpNPCType; tmpNPCType = new NPCType; @@ -1415,14 +1415,14 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client tmpNPCType->class_ = atoi(row[r++]); tmpNPCType->max_hp = atoi(row[r++]); tmpNPCType->cur_hp = tmpNPCType->max_hp; - tmpNPCType->Mana = atoi(row[r++]); + tmpNPCType->Mana = atoi(row[r++]); tmpNPCType->gender = atoi(row[r++]); tmpNPCType->texture = atoi(row[r++]); tmpNPCType->helmtexture = atoi(row[r++]); //tmpNPCType->size = atof(row[r++]); //tmpNPCType->loottable_id = atoi(row[r++]); //tmpNPCType->merchanttype = atoi(row[r++]); - //tmpNPCType->alt_currency_type = atoi(row[r++]); + //tmpNPCType->alt_currency_type = atoi(row[r++]); //tmpNPCType->adventure_template = atoi(row[r++]); //tmpNPCType->trap_template = atoi(row[r++]); tmpNPCType->attack_speed = atof(row[r++]); @@ -1441,7 +1441,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client tmpNPCType->Corrup = atoi(row[r++]); tmpNPCType->min_dmg = atoi(row[r++]); tmpNPCType->max_dmg = atoi(row[r++]); - tmpNPCType->attack_count = atoi(row[r++]); + tmpNPCType->attack_count = atoi(row[r++]); strcpy(tmpNPCType->npc_attacks,row[r++]); //tmpNPCType->npc_spells_id = atoi(row[r++]); tmpNPCType->d_meele_texture1 = atoi(row[r++]); @@ -1569,7 +1569,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client tmpNPCType->scalerate = RuleI(Mercs, ScaleRate); //tmpNPCType->private_corpse = atoi(row[r++]) == 1 ? true : false; //tmpNPCType->unique_spawn_by_name = atoi(row[r++]) == 1 ? true : false; - //tmpNPCType->underwater = atoi(row[r++]) == 1 ? true : false; + //tmpNPCType->underwater = atoi(row[r++]) == 1 ? true : false; //tmpNPCType->emoteid = atoi(row[r++]); tmpNPCType->spellscale = atoi(row[r++]); tmpNPCType->healscale = atoi(row[r++]); @@ -1593,9 +1593,9 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client } } else cerr << "Error loading NPCs from database. Bad query: " << errbuf << endl; - safe_delete_array(query); + safe_delete_array(query); - return npc; + return npc; } bool ZoneDatabase::LoadMercInfo(Client *c) { @@ -1619,7 +1619,7 @@ bool ZoneDatabase::LoadMercInfo(Client *c) { uint8 slot = atoi(DataRow[1]); if(slot >= MAXMERCS) { - continue; + continue; } c->GetMercInfo(slot).mercid = atoi(DataRow[0]); @@ -1739,7 +1739,7 @@ bool ZoneDatabase::SaveMerc(Merc *merc) { } else { // Update existing merc record - if(!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE mercs SET OwnerCharacterID = '%u', Slot = '%u', Name = '%s', TemplateID = '%u', SuspendedTime = '%u', IsSuspended = '%u', TimerRemaining = '%u', Gender = '%u', StanceID = '%u', HP = '%u', Mana = '%u', Endurance = '%u', Face = '%i', LuclinHairStyle = '%i', LuclinHairColor = '%i', LuclinEyeColor = '%i', LuclinEyeColor2 = '%i', LuclinBeardColor = '%i', LuclinBeard = '%i', DrakkinHeritage = '%i', DrakkinTattoo = '%i', DrakkinDetails = '%i' WHERE MercID = '%u'", merc->GetMercCharacterID(), owner->GetMercSlot(), merc->GetCleanName(), merc->GetMercTemplateID(), owner->GetMercInfo().SuspendedTime, merc->IsSuspended(), owner->GetMercInfo().MercTimerRemaining, merc->GetGender(), merc->GetStance(), merc->GetHP(), merc->GetMana(), merc->GetEndurance(), merc->GetLuclinFace(), merc->GetHairStyle(), merc->GetHairColor(), merc->GetEyeColor1(), merc->GetEyeColor2(), merc->GetBeardColor(), merc->GetBeard(), merc->GetDrakkinHeritage(), merc->GetDrakkinTattoo(), merc->GetDrakkinDetails(), merc->GetMercID()), TempErrorMessageBuffer, 0, &affectedRows)) { + if(!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE mercs SET OwnerCharacterID = '%u', Slot = '%u', Name = '%s', TemplateID = '%u', SuspendedTime = '%u', IsSuspended = '%u', TimerRemaining = '%u', Gender = '%u', StanceID = '%u', HP = '%u', Mana = '%u', Endurance = '%u', Face = '%i', LuclinHairStyle = '%i', LuclinHairColor = '%i', LuclinEyeColor = '%i', LuclinEyeColor2 = '%i', LuclinBeardColor = '%i', LuclinBeard = '%i', DrakkinHeritage = '%i', DrakkinTattoo = '%i', DrakkinDetails = '%i' WHERE MercID = '%u'", merc->GetMercCharacterID(), owner->GetMercSlot(), merc->GetCleanName(), merc->GetMercTemplateID(), owner->GetMercInfo().SuspendedTime, merc->IsSuspended(), owner->GetMercInfo().MercTimerRemaining, merc->GetGender(), merc->GetStance(), merc->GetHP(), merc->GetMana(), merc->GetEndurance(), merc->GetLuclinFace(), merc->GetHairStyle(), merc->GetHairColor(), merc->GetEyeColor1(), merc->GetEyeColor2(), merc->GetBeardColor(), merc->GetBeard(), merc->GetDrakkinHeritage(), merc->GetDrakkinTattoo(), merc->GetDrakkinDetails(), merc->GetMercID()), TempErrorMessageBuffer, 0, &affectedRows)) { errorMessage = std::string(TempErrorMessageBuffer); } else { @@ -1797,17 +1797,17 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { IsPersistent = 0; if(!database.RunQuery(Query, MakeAnyLenString(&Query, "INSERT INTO merc_buffs (MercId, SpellId, CasterLevel, DurationFormula, " - "TicsRemaining, PoisonCounters, DiseaseCounters, CurseCounters, CorruptionCounters, HitCount, MeleeRune, MagicRune, " - "DeathSaveSuccessChance, CasterAARank, Persistent) VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u);", - merc->GetMercID(), buffs[BuffCount].spellid, buffs[BuffCount].casterlevel, spells[buffs[BuffCount].spellid].buffdurationformula, - buffs[BuffCount].ticsremaining, - CalculatePoisonCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, - CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, - CalculateCurseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, - CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, - buffs[BuffCount].numhits, buffs[BuffCount].melee_rune, buffs[BuffCount].magic_rune, - buffs[BuffCount].deathSaveSuccessChance, - buffs[BuffCount].deathsaveCasterAARank, IsPersistent), TempErrorMessageBuffer)) { + "TicsRemaining, PoisonCounters, DiseaseCounters, CurseCounters, CorruptionCounters, HitCount, MeleeRune, MagicRune, " + "DeathSaveSuccessChance, CasterAARank, Persistent) VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u);", + merc->GetMercID(), buffs[BuffCount].spellid, buffs[BuffCount].casterlevel, spells[buffs[BuffCount].spellid].buffdurationformula, + buffs[BuffCount].ticsremaining, + CalculatePoisonCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, + CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, + CalculateCurseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, + CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0, + buffs[BuffCount].numhits, buffs[BuffCount].melee_rune, buffs[BuffCount].magic_rune, + buffs[BuffCount].deathSaveSuccessChance, + buffs[BuffCount].deathsaveCasterAARank, IsPersistent), TempErrorMessageBuffer)) { errorMessage = std::string(TempErrorMessageBuffer); safe_delete(Query); Query = 0; @@ -1830,7 +1830,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { void ZoneDatabase::LoadMercBuffs(Merc *merc) { Buffs_Struct *buffs = merc->GetBuffs(); - uint32 max_slots = merc->GetMaxBuffSlots(); + uint32 max_slots = merc->GetMaxBuffSlots(); std::string errorMessage; char* Query = 0; char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE]; @@ -1853,15 +1853,15 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { buffs[BuffCount].casterlevel = atoi(DataRow[1]); buffs[BuffCount].ticsremaining = atoi(DataRow[3]); - if(CalculatePoisonCounters(buffs[BuffCount].spellid) > 0) { - buffs[BuffCount].counters = atoi(DataRow[4]); - } else if(CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0) { - buffs[BuffCount].counters = atoi(DataRow[5]); - } else if(CalculateCurseCounters(buffs[BuffCount].spellid) > 0) { - buffs[BuffCount].counters = atoi(DataRow[6]); - } else if(CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0) { - buffs[BuffCount].counters = atoi(DataRow[7]); - } + if(CalculatePoisonCounters(buffs[BuffCount].spellid) > 0) { + buffs[BuffCount].counters = atoi(DataRow[4]); + } else if(CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0) { + buffs[BuffCount].counters = atoi(DataRow[5]); + } else if(CalculateCurseCounters(buffs[BuffCount].spellid) > 0) { + buffs[BuffCount].counters = atoi(DataRow[6]); + } else if(CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0) { + buffs[BuffCount].counters = atoi(DataRow[7]); + } buffs[BuffCount].numhits = atoi(DataRow[8]); buffs[BuffCount].melee_rune = atoi(DataRow[9]); buffs[BuffCount].magic_rune = atoi(DataRow[10]); @@ -1899,7 +1899,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { } bool ZoneDatabase::DeleteMerc(uint32 merc_id) { - std::string errorMessage; + std::string errorMessage; bool Result = false; int TempCounter = 0; @@ -1930,8 +1930,8 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { } if(!errorMessage.empty()) { - LogFile->write(EQEMuLog::Error, "Error Deleting Merc: %s", errorMessage.c_str()); - } + LogFile->write(EQEMuLog::Error, "Error Deleting Merc: %s", errorMessage.c_str()); + } return Result; } @@ -1953,11 +1953,11 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { if(itemCount == MAX_WORN_INVENTORY) break; - if(atoi(DataRow[0]) > 0) { - merc->AddItem(itemCount, atoi(DataRow[0])); + if(atoi(DataRow[0]) > 0) { + merc->AddItem(itemCount, atoi(DataRow[0])); - itemCount++; - } + itemCount++; + } } mysql_free_result(DatasetResult); @@ -1995,7 +1995,7 @@ uint8 ZoneDatabase::GetGridType(uint32 grid, uint32 zoneid ) { void ZoneDatabase::SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint32 charges){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "replace into merchantlist_temp (npcid,slot,itemid,charges) values(%d,%d,%d,%d)", npcid, slot, item, charges), errbuf)) { cerr << "Error in SaveMerchantTemp query '" << query << "' " << errbuf << endl; @@ -2004,7 +2004,7 @@ void ZoneDatabase::SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint } void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "delete from merchantlist_temp where npcid=%d and slot=%d", npcid, slot), errbuf)) { cerr << "Error in DeleteMerchantTemp query '" << query << "' " << errbuf << endl; @@ -2015,7 +2015,7 @@ void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){ bool ZoneDatabase::UpdateZoneSafeCoords(const char* zonename, float x=0, float y=0, float z=0) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE zone SET safe_x='%f', safe_y='%f', safe_z='%f' WHERE short_name='%s';", x, y, z, zonename), errbuf, 0, &affected_rows)) { @@ -2071,10 +2071,10 @@ uint8 ZoneDatabase::GetUseCFGSafeCoords() uint32 ZoneDatabase::GetServerFilters(char* name, ServerSideFilters_Struct *ssfs) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_ROW row; unsigned long* lengths; @@ -2113,7 +2113,7 @@ uint32 ZoneDatabase::GetServerFilters(char* name, ServerSideFilters_Struct *ssfs bool ZoneDatabase::SetServerFilters(char* name, ServerSideFilters_Struct *ssfs) { char errbuf[MYSQL_ERRMSG_SIZE]; - char query[256+sizeof(ServerSideFilters_Struct)*2+1]; + char query[256+sizeof(ServerSideFilters_Struct)*2+1]; char* end = query; //if (strlen(name) > 15) @@ -2130,15 +2130,15 @@ bool ZoneDatabase::SetServerFilters(char* name, ServerSideFilters_Struct *ssfs) end += sprintf(end, "UPDATE account SET serverfilters="); *end++ = '\''; - end += DoEscapeString(end, (char*)ssfs, sizeof(ServerSideFilters_Struct)); - *end++ = '\''; - end += sprintf(end," WHERE name='%s'", name); + end += DoEscapeString(end, (char*)ssfs, sizeof(ServerSideFilters_Struct)); + *end++ = '\''; + end += sprintf(end," WHERE name='%s'", name); uint32 affected_rows = 0; - if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { - cerr << "Error in SetServerSideFilters query " << errbuf << endl; + if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { + cerr << "Error in SetServerSideFilters query " << errbuf << endl; return false; - } + } if (affected_rows == 0) { return false; @@ -2151,9 +2151,9 @@ bool ZoneDatabase::SetServerFilters(char* name, ServerSideFilters_Struct *ssfs) //New functions for timezone uint32 ZoneDatabase::GetZoneTZ(uint32 zoneid, uint32 version) { 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 timezone FROM zone WHERE zoneidnumber=%i AND (version=%i OR version=0) ORDER BY version DESC", zoneid, version), errbuf, &result)) { @@ -2175,7 +2175,7 @@ uint32 ZoneDatabase::GetZoneTZ(uint32 zoneid, uint32 version) { bool ZoneDatabase::SetZoneTZ(uint32 zoneid, uint32 version, uint32 tz) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if (RunQuery(query, MakeAnyLenString(&query, "UPDATE zone SET timezone=%i WHERE zoneidnumber=%i AND version=%i", tz, zoneid, version), errbuf, 0, &affected_rows)) { @@ -2200,9 +2200,9 @@ bool ZoneDatabase::SetZoneTZ(uint32 zoneid, uint32 version, uint32 tz) { //Functions for weather uint8 ZoneDatabase::GetZoneWeather(uint32 zoneid, uint32 version) { 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 weather FROM zone WHERE zoneidnumber=%i AND (version=%i OR version=0) ORDER BY version DESC", zoneid, version), errbuf, &result)) { @@ -2225,7 +2225,7 @@ uint8 ZoneDatabase::GetZoneWeather(uint32 zoneid, uint32 version) { bool ZoneDatabase::SetZoneWeather(uint32 zoneid, uint32 version, uint8 w) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if (RunQuery(query, MakeAnyLenString(&query, "UPDATE zone SET weather=%i WHERE zoneidnumber=%i AND version=%i", w, zoneid, version), errbuf, 0, &affected_rows)) { @@ -2251,8 +2251,8 @@ bool ZoneDatabase::SetZoneWeather(uint32 zoneid, uint32 version, uint8 w) { */ bool ZoneDatabase::GetAccountInfoForLogin(uint32 account_id, int16* admin, char* account_name, uint32* lsaccountid, uint8* gmspeed, bool* revoked,bool* gmhideme) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; if (RunQuery(query, MakeAnyLenString(&query, "SELECT status, name, lsaccount_id, gmspeed, revoked, hideme FROM account WHERE id=%i", account_id), errbuf, &result)) { safe_delete_array(query); @@ -2331,9 +2331,9 @@ void ZoneDatabase::RefreshGroupFromDB(Client *c){ uint8 ZoneDatabase::GroupCount(uint32 groupid){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; uint8 count=0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(charid) FROM group_id WHERE groupid=%d", groupid), errbuf, &result)) { if((row = mysql_fetch_row(result))!=nullptr) @@ -2348,29 +2348,29 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid){ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - uint8 count=0; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(charid) FROM raid_members WHERE raidid=%d AND groupid=%d;", raidid, groupid), errbuf, &result)) { - if((row = mysql_fetch_row(result))!=nullptr) - count = atoi(row[0]); - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query, errbuf); - } - safe_delete_array(query); - return count; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + uint8 count=0; + if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(charid) FROM raid_members WHERE raidid=%d AND groupid=%d;", raidid, groupid), errbuf, &result)) { + if((row = mysql_fetch_row(result))!=nullptr) + count = atoi(row[0]); + mysql_free_result(result); + } else { + LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query, errbuf); + } + safe_delete_array(query); + return count; } int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; query = new char[256]; sprintf(query, "SELECT count(*) FROM blocked_spells WHERE zoneid=%d", zoneid); if (RunQuery(query, strlen(query), errbuf, &result)) { @@ -2397,9 +2397,9 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked LogFile->write(EQEMuLog::Status, "Loading Blocked Spells from database..."); char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; MakeAnyLenString(&query, "SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message " "FROM blocked_spells WHERE zoneid=%d ORDER BY id asc", zoneid); @@ -2438,9 +2438,9 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked int ZoneDatabase::getZoneShutDownDelay(uint32 zoneID, uint32 version) { 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 shutdowndelay FROM zone WHERE zoneidnumber=%i AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version), errbuf, &result)) { @@ -2494,7 +2494,7 @@ uint32 ZoneDatabase::GetKarma(uint32 acct_id) void ZoneDatabase::UpdateKarma(uint32 acct_id, uint32 amount) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if (RunQuery(query, MakeAnyLenString(&query, "UPDATE account set karma=%i where id=%i", amount, acct_id), errbuf, 0, &affected_rows)){ @@ -2550,7 +2550,7 @@ void ZoneDatabase::QGlobalPurge() void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoor_name, float dxpos, float dypos, float dzpos, float dheading, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "replace into doors (id, doorid,zone,version,name,pos_x,pos_y,pos_z,heading,opentype,guild,lockpick,keyitem,door_param,invert_state,incline,size) values('%i','%i','%s','%i', '%s','%f','%f','%f','%f','%i','%i','%i', '%i','%i','%i','%i','%i')", ddoordbid ,ddoorid ,zone->GetShortName(), zone->GetInstanceVersion(), ddoor_name, dxpos, dypos, dzpos, dheading, dopentype, dguildid, dlockpick, dkeyitem, ddoor_param, dinvert, dincline, dsize), errbuf)) { cerr << "Error in InsertDoor" << query << "' " << errbuf << endl; } @@ -2558,10 +2558,10 @@ void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoo } void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::map ¤cy) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; if (RunQuery(query, MakeAnyLenString(&query, "SELECT currency_id, amount FROM character_alt_currency where char_id='%u'", char_id), errbuf, &result)) { safe_delete_array(query); @@ -2578,112 +2578,112 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapCharacterID()), + database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM `character_buffs` WHERE `character_id`='%u'", c->CharacterID()), errbuf); - uint32 buff_count = c->GetMaxBuffSlots(); - Buffs_Struct *buffs = c->GetBuffs(); - for (int i = 0; i < buff_count; i++) { - if(buffs[i].spellid != SPELL_UNKNOWN) { - if(!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO `character_buffs` (character_id, slot_id, spell_id, " - "caster_level, caster_name, ticsremaining, counters, numhits, melee_rune, magic_rune, persistent, death_save_chance, " - "death_save_aa_chance) VALUES('%u', '%u', '%u', '%u', '%s', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", - c->CharacterID(), i, buffs[i].spellid, buffs[i].casterlevel, buffs[i].caster_name, buffs[i].ticsremaining, - buffs[i].counters, buffs[i].numhits, buffs[i].melee_rune, buffs[i].magic_rune, buffs[i].persistant_buff, - buffs[i].deathSaveSuccessChance, buffs[i].deathsaveCasterAARank), - errbuf)) { - LogFile->write(EQEMuLog::Error, "Error in SaveBuffs query '%s': %s", query, errbuf); - } - } - } - safe_delete_array(query); + uint32 buff_count = c->GetMaxBuffSlots(); + Buffs_Struct *buffs = c->GetBuffs(); + for (int i = 0; i < buff_count; i++) { + if(buffs[i].spellid != SPELL_UNKNOWN) { + if(!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO `character_buffs` (character_id, slot_id, spell_id, " + "caster_level, caster_name, ticsremaining, counters, numhits, melee_rune, magic_rune, persistent, death_save_chance, " + "death_save_aa_chance) VALUES('%u', '%u', '%u', '%u', '%s', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", + c->CharacterID(), i, buffs[i].spellid, buffs[i].casterlevel, buffs[i].caster_name, buffs[i].ticsremaining, + buffs[i].counters, buffs[i].numhits, buffs[i].melee_rune, buffs[i].magic_rune, buffs[i].persistant_buff, + buffs[i].deathSaveSuccessChance, buffs[i].deathsaveCasterAARank), + errbuf)) { + LogFile->write(EQEMuLog::Error, "Error in SaveBuffs query '%s': %s", query, errbuf); + } + } + } + safe_delete_array(query); } void ZoneDatabase::LoadBuffs(Client *c) { - Buffs_Struct *buffs = c->GetBuffs(); - uint32 max_slots = c->GetMaxBuffSlots(); - for(int i = 0; i < max_slots; ++i) { - buffs[i].spellid = SPELL_UNKNOWN; - } + Buffs_Struct *buffs = c->GetBuffs(); + uint32 max_slots = c->GetMaxBuffSlots(); + for(int i = 0; i < max_slots; ++i) { + buffs[i].spellid = SPELL_UNKNOWN; + } - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT spell_id, slot_id, caster_level, caster_name, ticsremaining, counters, " - "numhits, melee_rune, magic_rune, persistent, death_save_chance, death_save_aa_chance FROM `character_buffs` WHERE " - "`character_id`='%u'", - c->CharacterID()), errbuf, &result)) - { + char errbuf[MYSQL_ERRMSG_SIZE]; + char *query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + if (RunQuery(query, MakeAnyLenString(&query, "SELECT spell_id, slot_id, caster_level, caster_name, ticsremaining, counters, " + "numhits, melee_rune, magic_rune, persistent, death_save_chance, death_save_aa_chance FROM `character_buffs` WHERE " + "`character_id`='%u'", + c->CharacterID()), errbuf, &result)) + { safe_delete_array(query); while ((row = mysql_fetch_row(result))) { - uint32 slot_id = atoul(row[1]); - if(slot_id >= c->GetMaxBuffSlots()) { - continue; - } + uint32 slot_id = atoul(row[1]); + if(slot_id >= c->GetMaxBuffSlots()) { + continue; + } uint32 spell_id = atoul(row[0]); - if(!IsValidSpell(spell_id)) { - continue; - } + if(!IsValidSpell(spell_id)) { + continue; + } - Client *caster = entity_list.GetClientByName(row[3]); - uint32 caster_level = atoi(row[2]); - uint32 ticsremaining = atoul(row[4]); - uint32 counters = atoul(row[5]); - uint32 numhits = atoul(row[6]); - uint32 melee_rune = atoul(row[7]); - uint32 magic_rune = atoul(row[8]); - uint8 persistent = atoul(row[9]); - uint32 death_save_chance = atoul(row[10]); - uint32 death_save_aa_chance = atoul(row[11]); + Client *caster = entity_list.GetClientByName(row[3]); + uint32 caster_level = atoi(row[2]); + uint32 ticsremaining = atoul(row[4]); + uint32 counters = atoul(row[5]); + uint32 numhits = atoul(row[6]); + uint32 melee_rune = atoul(row[7]); + uint32 magic_rune = atoul(row[8]); + uint8 persistent = atoul(row[9]); + uint32 death_save_chance = atoul(row[10]); + uint32 death_save_aa_chance = atoul(row[11]); - buffs[slot_id].spellid = spell_id; - buffs[slot_id].casterlevel = caster_level; - if(caster) { - buffs[slot_id].casterid = caster->GetID(); - strcpy(buffs[slot_id].caster_name, caster->GetName()); - buffs[slot_id].client = true; - } else { - buffs[slot_id].casterid = 0; - strcpy(buffs[slot_id].caster_name, ""); - buffs[slot_id].client = false; - } + buffs[slot_id].spellid = spell_id; + buffs[slot_id].casterlevel = caster_level; + if(caster) { + buffs[slot_id].casterid = caster->GetID(); + strcpy(buffs[slot_id].caster_name, caster->GetName()); + buffs[slot_id].client = true; + } else { + buffs[slot_id].casterid = 0; + strcpy(buffs[slot_id].caster_name, ""); + buffs[slot_id].client = false; + } - buffs[slot_id].ticsremaining = ticsremaining; - buffs[slot_id].counters = counters; - buffs[slot_id].numhits = numhits; - buffs[slot_id].melee_rune = melee_rune; - buffs[slot_id].magic_rune = magic_rune; - buffs[slot_id].persistant_buff = persistent ? true : false; - buffs[slot_id].deathSaveSuccessChance = death_save_chance; - buffs[slot_id].deathsaveCasterAARank = death_save_aa_chance; - buffs[slot_id].UpdateClient = false; - if(IsRuneSpell(spell_id)) { - c->SetHasRune(true); - } - else if(IsMagicRuneSpell(spell_id)) { - c->SetHasSpellRune(true); - } + buffs[slot_id].ticsremaining = ticsremaining; + buffs[slot_id].counters = counters; + buffs[slot_id].numhits = numhits; + buffs[slot_id].melee_rune = melee_rune; + buffs[slot_id].magic_rune = magic_rune; + buffs[slot_id].persistant_buff = persistent ? true : false; + buffs[slot_id].deathSaveSuccessChance = death_save_chance; + buffs[slot_id].deathsaveCasterAARank = death_save_aa_chance; + buffs[slot_id].UpdateClient = false; + if(IsRuneSpell(spell_id)) { + c->SetHasRune(true); + } + else if(IsMagicRuneSpell(spell_id)) { + c->SetHasSpellRune(true); + } /* - if(IsDeathSaveSpell(spell_id)) { - c->SetDeathSaveChance(true); - } + if(IsDeathSaveSpell(spell_id)) { + c->SetDeathSaveChance(true); + } */ } mysql_free_result(result); @@ -2691,35 +2691,35 @@ void ZoneDatabase::LoadBuffs(Client *c) { else { LogFile->write(EQEMuLog::Error, "Error in LoadBuffs query '%s': %s", query, errbuf); safe_delete_array(query); - return; + return; } - max_slots = c->GetMaxBuffSlots(); - for(int i = 0; i < max_slots; ++i) { - if(!IsValidSpell(buffs[i].spellid)) { - continue; - } + max_slots = c->GetMaxBuffSlots(); + for(int i = 0; i < max_slots; ++i) { + if(!IsValidSpell(buffs[i].spellid)) { + continue; + } - for(int j = 0; j < 12; ++j) { - bool cont = false; - switch(spells[buffs[i].spellid].effectid[j]) { - case SE_Charm: - buffs[i].spellid = SPELL_UNKNOWN; - cont = true; - break; - case SE_Illusion: - if(!buffs[i].persistant_buff) { - buffs[i].spellid = SPELL_UNKNOWN; - cont = true; - } - break; - } + for(int j = 0; j < 12; ++j) { + bool cont = false; + switch(spells[buffs[i].spellid].effectid[j]) { + case SE_Charm: + buffs[i].spellid = SPELL_UNKNOWN; + cont = true; + break; + case SE_Illusion: + if(!buffs[i].persistant_buff) { + buffs[i].spellid = SPELL_UNKNOWN; + cont = true; + } + break; + } - if(cont) { - break; - } - } - } + if(cont) { + break; + } + } + } } void ZoneDatabase::SavePetInfo(Client *c) { @@ -2817,7 +2817,7 @@ void ZoneDatabase::SavePetInfo(Client *c) { void ZoneDatabase::RemoveTempFactions(Client *c){ char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; if (!RunQuery(query, MakeAnyLenString(&query, "DELETE FROM faction_values WHERE temp = 1 AND char_id=%u", c->CharacterID()), errbuf)) { cerr << "Error in RemoveTempFactions query '" << query << "' " << errbuf << endl; @@ -2829,8 +2829,8 @@ void ZoneDatabase::LoadPetInfo(Client *c) { // Load current pet and suspended pet char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + MYSQL_RES *result; + MYSQL_ROW row; PetInfo *petinfo = c->GetPetInfo(0); PetInfo *suspended = c->GetPetInfo(1); @@ -2870,12 +2870,12 @@ void ZoneDatabase::LoadPetInfo(Client *c) { } - if (RunQuery(query, MakeAnyLenString(&query, + if (RunQuery(query, MakeAnyLenString(&query, "SELECT `pet`, `slot`, `spell_id`, `caster_level`, `castername`, " "`ticsremaining`, `counters` FROM `character_pet_buffs` " "WHERE `char_id`=%u", - c->CharacterID()), errbuf, &result)) - { + c->CharacterID()), errbuf, &result)) + { safe_delete_array(query); while ((row = mysql_fetch_row(result))) { @@ -2917,7 +2917,7 @@ void ZoneDatabase::LoadPetInfo(Client *c) { else { LogFile->write(EQEMuLog::Error, "Error in LoadPetInfo query '%s': %s", query, errbuf); safe_delete_array(query); - return; + return; } if (database.RunQuery(query, MakeAnyLenString(&query, @@ -2945,7 +2945,7 @@ void ZoneDatabase::LoadPetInfo(Client *c) { else { LogFile->write(EQEMuLog::Error, "Error in LoadPetInfo query '%s': %s", query, errbuf); safe_delete_array(query); - return; + return; } } @@ -2953,61 +2953,61 @@ bool ZoneDatabase::GetFactionData(FactionMods* fm, uint32 class_mod, uint32 race if (faction_id <= 0 || faction_id > (int32) max_faction) return false; - if (faction_array[faction_id] == 0){ + if (faction_array[faction_id] == 0){ return false; } - fm->base = faction_array[faction_id]->base; + fm->base = faction_array[faction_id]->base; - if(class_mod > 0) { - char str[32]; - sprintf(str, "c%u", class_mod); + if(class_mod > 0) { + char str[32]; + sprintf(str, "c%u", class_mod); - std::map::const_iterator iter = faction_array[faction_id]->mods.find(str); - if(iter != faction_array[faction_id]->mods.end()) { - fm->class_mod = iter->second; - } else { - fm->class_mod = 0; - } - } else { - fm->class_mod = 0; - } + std::map::const_iterator iter = faction_array[faction_id]->mods.find(str); + if(iter != faction_array[faction_id]->mods.end()) { + fm->class_mod = iter->second; + } else { + fm->class_mod = 0; + } + } else { + fm->class_mod = 0; + } - if(race_mod > 0) { - char str[32]; - sprintf(str, "r%u", race_mod); + if(race_mod > 0) { + char str[32]; + sprintf(str, "r%u", race_mod); - std::map::iterator iter = faction_array[faction_id]->mods.find(str); - if(iter != faction_array[faction_id]->mods.end()) { - fm->race_mod = iter->second; - } else { - fm->race_mod = 0; - } - } else { - fm->race_mod = 0; - } + std::map::iterator iter = faction_array[faction_id]->mods.find(str); + if(iter != faction_array[faction_id]->mods.end()) { + fm->race_mod = iter->second; + } else { + fm->race_mod = 0; + } + } else { + fm->race_mod = 0; + } - if(deity_mod > 0) { - char str[32]; - sprintf(str, "d%u", deity_mod); + if(deity_mod > 0) { + char str[32]; + sprintf(str, "d%u", deity_mod); - std::map::iterator iter = faction_array[faction_id]->mods.find(str); - if(iter != faction_array[faction_id]->mods.end()) { - fm->deity_mod = iter->second; - } else { - fm->deity_mod = 0; - } - } else { - fm->deity_mod = 0; - } + std::map::iterator iter = faction_array[faction_id]->mods.find(str); + if(iter != faction_array[faction_id]->mods.end()) { + fm->deity_mod = iter->second; + } else { + fm->deity_mod = 0; + } + } else { + fm->deity_mod = 0; + } return true; } bool ZoneDatabase::LoadFactionValues(uint32 char_id, faction_map & val_list) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; + char *query = 0; + MYSQL_RES *result; if (RunQuery(query, MakeAnyLenString(&query, "SELECT faction_id,current_value FROM faction_values WHERE char_id = %i",char_id), errbuf, &result)) { safe_delete_array(query); bool ret = LoadFactionValues_result(result, val_list); @@ -3022,7 +3022,7 @@ bool ZoneDatabase::LoadFactionValues(uint32 char_id, faction_map & val_list) { } bool ZoneDatabase::LoadFactionValues_result(MYSQL_RES* result, faction_map & val_list) { - MYSQL_ROW row; + MYSQL_ROW row; while((row = mysql_fetch_row(result))) { val_list[atoi(row[0])] = atoi(row[1]); } @@ -3032,8 +3032,7 @@ bool ZoneDatabase::LoadFactionValues_result(MYSQL_RES* result, faction_map & val //o-------------------------------------------------------------- //| Name: GetFactionName; rembrant, Dec. 16 //o-------------------------------------------------------------- -//| Notes: Retrieves the name of the specified faction -//| Returns false on failure. +//| Notes: Retrieves the name of the specified faction .Returns false on failure. //o-------------------------------------------------------------- bool ZoneDatabase::GetFactionName(int32 faction_id, char* name, uint32 buflen) { if ((faction_id <= 0) || faction_id > int32(max_faction) ||(faction_array[faction_id] == 0)) @@ -3049,9 +3048,7 @@ bool ZoneDatabase::GetFactionName(int32 faction_id, char* name, uint32 buflen) { //o-------------------------------------------------------------- //| Name: GetNPCFactionList; rembrant, Dec. 16, 2001 //o-------------------------------------------------------------- -//| Purpose: Gets a list of faction_id's and values bound to -//| the npc_id. -//| Returns false on failure. +//| Purpose: Gets a list of faction_id's and values bound to the npc_id. Returns false on failure. //o-------------------------------------------------------------- bool ZoneDatabase::GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction) { if (npcfaction_id <= 0) { @@ -3075,14 +3072,12 @@ bool ZoneDatabase::GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, in //o-------------------------------------------------------------- //| Name: SetCharacterFactionLevel; rembrant, Dec. 20, 2001 //o-------------------------------------------------------------- -//| Purpose: Update characters faction level with specified -//| faction_id to specified value. -//| Returns false on failure. +//| Purpose: Update characters faction level with specified faction_id to specified value. Returns false on failure. //o-------------------------------------------------------------- bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list) { char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + char *query = 0; uint32 affected_rows = 0; if (!RunQuery(query, MakeAnyLenString(&query, @@ -3127,9 +3122,9 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in bool ZoneDatabase::LoadFactionData() { 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) FROM faction_list"); @@ -3158,18 +3153,18 @@ bool ZoneDatabase::LoadFactionData() strn0cpy(faction_array[index]->name, row[1], 50); faction_array[index]->base = atoi(row[2]); - char sec_errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *sec_result; - MYSQL_ROW sec_row; - MakeAnyLenString(&query, "SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id=%u", index); - if (RunQuery(query, strlen(query), sec_errbuf, &sec_result)) { - while((sec_row = mysql_fetch_row(sec_result))) - { - faction_array[index]->mods[sec_row[1]] = atoi(sec_row[0]); - } - mysql_free_result(sec_result); - } - safe_delete_array(query); + char sec_errbuf[MYSQL_ERRMSG_SIZE]; + MYSQL_RES *sec_result; + MYSQL_ROW sec_row; + MakeAnyLenString(&query, "SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id=%u", index); + if (RunQuery(query, strlen(query), sec_errbuf, &sec_result)) { + while((sec_row = mysql_fetch_row(sec_result))) + { + faction_array[index]->mods[sec_row[1]] = atoi(sec_row[0]); + } + mysql_free_result(sec_result); + } + safe_delete_array(query); } mysql_free_result(result); } diff --git a/zone/zonedb.h b/zone/zonedb.h index daf035d68..e15ac4268 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -9,11 +9,11 @@ //#include "doors.h" struct wplist { - int index; + int index; float x; float y; float z; - int pause; + int pause; float heading; }; @@ -110,7 +110,7 @@ struct MercTemplate { uint32 MercSubType; // From dbstr_us.txt - 330020105^23^Race: Guktan
Type: Healer
Confidence: High
Proficiency: Apprentice, Tier V... uint16 RaceID; uint8 ClassID; - uint32 MercNPCID; + uint32 MercNPCID; uint8 ProficiencyID; uint8 TierID; uint8 CostFormula; // To determine cost to client @@ -122,10 +122,10 @@ struct MercTemplate { }; struct MercInfo { - uint32 mercid; + uint32 mercid; uint8 slot; char merc_name[64]; - uint32 MercTemplateID; + uint32 MercTemplateID; const MercTemplate* myTemplate; uint32 SuspendedTime; bool IsSuspended; @@ -156,7 +156,7 @@ struct MercSpellEntry { uint8 minlevel; uint8 maxlevel; int16 slot; - uint16 proc_chance; + uint16 proc_chance; uint32 time_cancast; // when we can cast this spell next }; @@ -172,15 +172,15 @@ struct LootTable_Struct; class ZoneDatabase : public SharedDatabase { - typedef list ItemList; + typedef list ItemList; public: ZoneDatabase(); ZoneDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port); virtual ~ZoneDatabase(); /* - * Objects and World Containers - */ + * Objects and World Containers + */ void LoadWorldContainer(uint32 parentid, ItemInst* container); void SaveWorldContainer(uint32 zone_id, uint32 parent_id, const ItemInst* container); void DeleteWorldContainer(uint32 parent_id,uint32 zone_id); @@ -190,11 +190,11 @@ public: Ground_Spawns* LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs); /* - * Traders - */ + * Traders + */ - void SaveTraderItem(uint32 char_id,uint32 itemid,uint32 uniqueid, int32 charges,uint32 itemcost,uint8 slot); - void UpdateTraderItemCharges(int char_id, uint32 ItemInstID, int32 charges); + void SaveTraderItem(uint32 char_id,uint32 itemid,uint32 uniqueid, int32 charges,uint32 itemcost,uint8 slot); + void UpdateTraderItemCharges(int char_id, uint32 ItemInstID, int32 charges); void UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice); ItemInst* LoadSingleTraderItem(uint32 char_id, int uniqueid); void DeleteTraderItem(uint32 char_id); @@ -210,8 +210,8 @@ public: void UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity); /* - * General Character Related Stuff - */ + * General Character Related Stuff + */ bool SetServerFilters(char* name, ServerSideFilters_Struct *ssfs); uint32 GetServerFilters(char* name, ServerSideFilters_Struct *ssfs); bool GetAccountInfoForLogin(uint32 account_id, int16* admin = 0, char* account_name = 0, @@ -221,26 +221,26 @@ public: uint32* account_creation = 0); bool GetCharacterInfoForLogin_result(MYSQL_RES* result, uint32* character_id = 0, char* current_zone = 0, PlayerProfile_Struct* pp = 0, Inventory* inv = 0, ExtendedProfile_Struct *ext = 0, uint32* pplen = 0, - uint32* guilddbid = 0, uint8* guildrank = 0, uint8 *class_= 0, uint8 *level = 0, bool *LFP = 0, + uint32* guilddbid = 0, uint8* guildrank = 0, uint8 *class_= 0, uint8 *level = 0, bool *LFP = 0, bool *LFG = 0, uint8 *NumXTargets = 0, uint8* firstlogon = 0); bool GetCharacterInfoForLogin(const char* name, uint32* character_id = 0, char* current_zone = 0, PlayerProfile_Struct* pp = 0, Inventory* inv = 0, ExtendedProfile_Struct *ext = 0, uint32* pplen = 0, uint32* guilddbid = 0, uint8* guildrank = 0, uint8 *class_ = 0, uint8 *level = 0, bool *LFP = 0, bool *LFG = 0, uint8 *NumXTargets = 0, uint8* firstlogon = 0); void SaveBuffs(Client *c); - void LoadBuffs(Client *c); + void LoadBuffs(Client *c); void LoadPetInfo(Client *c); void SavePetInfo(Client *c); void RemoveTempFactions(Client *c); /* - * Character Inventory - */ + * Character Inventory + */ bool NoRentExpired(const char* name); /* - * Corpses - */ + * Corpses + */ bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes); uint32 CreatePlayerCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading); bool CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading); @@ -260,15 +260,15 @@ public: uint32 NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading); uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id); bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id); - uint32 GetFirstCorpseID(uint32 char_id); - uint32 GetPlayerCorpseCount(uint32 char_id); - uint32 GetPlayerCorpseID(uint32 char_id, uint8 corpse); - uint32 GetPlayerCorpseItemAt(uint32 corpse_id, uint16 slotid); + uint32 GetFirstCorpseID(uint32 char_id); + uint32 GetPlayerCorpseCount(uint32 char_id); + uint32 GetPlayerCorpseID(uint32 char_id, uint8 corpse); + uint32 GetPlayerCorpseItemAt(uint32 corpse_id, uint16 slotid); uint32 GetPlayerCorpseTimeLeft(uint8 corpse, uint8 type); /* - * Faction - */ + * Faction + */ bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0); bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //rembrant, needed for factions Dec, 16 2001 bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // rembrant, needed for factions Dec, 16 2001 @@ -279,11 +279,11 @@ public: bool LoadFactionValues_result(MYSQL_RES* result, faction_map & val_list); /* - * AAs - */ - bool LoadAAEffects(); + * AAs + */ + bool LoadAAEffects(); bool LoadAAEffects2(); - bool LoadSwarmSpells(); + bool LoadSwarmSpells(); SendAA_Struct* GetAASkillVars(uint32 skill_id); uint8 GetTotalAALevels(uint32 skill_id); uint32 GetSizeAA(); @@ -293,8 +293,8 @@ public: void FillAAEffects(SendAA_Struct* aa_struct); /* - * Zone related - */ + * Zone related + */ bool GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city, bool &is_hotzone, bool &allow_mercs, int &ruleset, char **map_filename); bool SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct* zd); bool DumpZoneState(); @@ -302,13 +302,13 @@ public: bool LoadStaticZonePoints(LinkedList* zone_point_list,const char* zonename, uint32 version); bool UpdateZoneSafeCoords(const char* zonename, float x, float y, float z); uint8 GetUseCFGSafeCoords(); - int getZoneShutDownDelay(uint32 zoneID, uint32 version); + int getZoneShutDownDelay(uint32 zoneID, uint32 version); /* - * Spawns and Spawn Points - */ + * Spawns and Spawn Points + */ bool LoadSpawnGroups(const char* zone_name, uint16 version, SpawnGroupList* spawn_group_list); - bool LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_group_list); + bool LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_group_list); bool PopulateZoneSpawnList(uint32 zoneid, LinkedList &spawn2_list, int16 version, uint32 repopdelay = 0); Spawn2* LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2id, uint32 timeleft); bool CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, float heading, float x, float y, float z, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value); @@ -317,8 +317,8 @@ public: void UpdateSpawn2Status(uint32 id, uint8 new_status); /* - * Grids/Paths - */ + * Grids/Paths + */ uint32 GetFreeGrid(uint16 zoneid); void DeleteGrid(Client *c, uint32 sg2, uint32 grid_num, bool grid_too,uint16 zoneid); void DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num,uint16 zoneid); @@ -326,17 +326,17 @@ public: void AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading); uint32 AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading); void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0,uint16 zoneid = 0); - void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script=0,uint16 zoneid =0); - uint8 GetGridType(uint32 grid,uint32 zoneid); - uint8 GetGridType2(uint32 grid, uint16 zoneid); - bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp); + void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script=0,uint16 zoneid =0); + uint8 GetGridType(uint32 grid,uint32 zoneid); + uint8 GetGridType2(uint32 grid, uint16 zoneid); + bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp); void AssignGrid(Client *client, float x, float y, uint32 id); int GetHighestGrid(uint32 zoneid); int GetHighestWaypoint(uint32 zoneid, uint32 gridid); /* - * NPCs - */ + * NPCs + */ const NPCType* GetNPCType(uint32 id); uint32 NPCSpawnDB(uint8 command, const char* zone, uint32 zone_version, Client *c, NPC* spawn = 0, uint32 extra = 0); // 0 = Create 1 = Add; 2 = Update; 3 = Remove; 4 = Delete bool SetSpecialAttkFlag(uint8 id, const char* flag); @@ -349,12 +349,12 @@ public: DBnpcspells_Struct* GetNPCSpells(uint32 iDBSpellsID); /* - * Mercs - */ + * Mercs + */ const NPCType* GetMercType(uint32 id, uint16 raceid, uint32 clientlevel); - void LoadMercEquipment(Merc *merc); + void LoadMercEquipment(Merc *merc); void SaveMercBuffs(Merc *merc); - void LoadMercBuffs(Merc *merc); + void LoadMercBuffs(Merc *merc); bool LoadMercInfo(Client *c); bool LoadCurrentMerc(Client *c); bool SaveMerc(Merc *merc); @@ -363,8 +363,8 @@ public: //void LoadMercsForMercMerchant(NPC *merchant); /* - * Petitions - */ + * Petitions + */ void UpdateBug(BugStruct* bug); void UpdateBug(PetitionBug_Struct* bug); void DeletePetitionFromDB(Petition* wpet); @@ -374,28 +374,28 @@ public: /* - * Merchants - */ + * Merchants + */ void SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint32 charges); void DeleteMerchantTemp(uint32 npcid, uint32 slot); /* - * Tradeskills - */ + * Tradeskills + */ bool GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec); bool GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec); - uint32 GetZoneForage(uint32 ZoneID, uint8 skill); /* for foraging - BoB */ - uint32 GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint8 &npc_chance); + uint32 GetZoneForage(uint32 ZoneID, uint8 skill); /* for foraging - BoB */ + uint32 GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint8 &npc_chance); void UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint32 madecount); /* - * Tribute - */ + * Tribute + */ bool LoadTributes(); /* - * Doors - */ + * Doors + */ bool DoorIsOpen(uint8 door_id,const char* zone_name); void SetDoorPlace(uint8 value,uint8 door_id,const char* zone_name); bool LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version); @@ -409,68 +409,68 @@ public: void InsertDoor(uint32 did, uint16 ddoorid, const char* ddoor_name, float dxpos, float dypos, float dzpos, float dheading, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize); /* - * Blocked Spells - */ + * Blocked Spells + */ int32 GetBlockedSpellsCount(uint32 zoneid); bool LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid); /* - * Traps - */ + * Traps + */ bool LoadTraps(const char* zonename, int16 version); char* GetTrapMessage(uint32 trap_id); /* - * Time - */ + * Time + */ uint32 GetZoneTZ(uint32 zoneid, uint32 version); bool SetZoneTZ(uint32 zoneid, uint32 version, uint32 tz); /* - * Weather - */ + * Weather + */ uint8 GetZoneWeather(uint32 zoneid, uint32 version); bool SetZoneWeather(uint32 zoneid, uint32 version, uint8 w); /* - * Group - */ + * Group + */ void RefreshGroupFromDB(Client *c); uint8 GroupCount(uint32 groupid); /* - * Raid - */ + * Raid + */ uint8 RaidGroupCount(uint32 raidid, uint32 groupid); /* - * Instancing - */ + * Instancing + */ void ListAllInstances(Client* c, uint32 charid); /* - * QGlobals - */ + * QGlobals + */ void QGlobalPurge(); - /* - * Alternate Currency - */ - void LoadAltCurrencyValues(uint32 char_id, std::map ¤cy); - void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value); + /* + * Alternate Currency + */ + void LoadAltCurrencyValues(uint32 char_id, std::map ¤cy); + void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value); /* - * Misc stuff. - * PLEASE DO NOT ADD TO THIS COLLECTION OF CRAP UNLESS YOUR METHOD - * REALLY HAS NO BETTER SECTION - */ - bool logevents(const char* accountname,uint32 accountid,uint8 status,const char* charname,const char* target, const char* descriptiontype, const char* description,int event_nid); + * Misc stuff. + * PLEASE DO NOT ADD TO THIS COLLECTION OF CRAP UNLESS YOUR METHOD + * REALLY HAS NO BETTER SECTION + */ + bool logevents(const char* accountname,uint32 accountid,uint8 status,const char* charname,const char* target, const char* descriptiontype, const char* description,int event_nid); void GetEventLogs(const char* name,char* target,uint32 account_id=0,uint8 eventid=0,char* detail=0,char* timestamp=0, CharacterEventLog_Struct* cel=0); uint32 GetKarma(uint32 acct_id); void UpdateKarma(uint32 acct_id, uint32 amount); /* - * Things which really dont belong here... - */ + * Things which really dont belong here... + */ int16 CommandRequirement(const char* commandname); protected: @@ -488,14 +488,3 @@ extern ZoneDatabase database; #endif /*ZONEDB_H_*/ - - - - - - - - - - - diff --git a/zone/zonedump.h b/zone/zonedump.h index a0f1ac793..815730f88 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.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 */ /* Below are the blob structures for zone state dumping to the database @@ -34,31 +34,31 @@ spawn2 mediumblob, npcs mediumblob, npc_loot mediumblob, gmspawntype mediumblob, struct NPCType { - char name[64]; - char lastname[70]; + char name[64]; + char lastname[70]; - int32 cur_hp; - int32 max_hp; + int32 cur_hp; + int32 max_hp; float size; float runspeed; - uint8 gender; - uint16 race; - uint8 class_; - uint8 bodytype; // added for targettype support - uint8 deity; //not loaded from DB - uint8 level; - uint32 npc_id; + uint8 gender; + uint16 race; + uint8 class_; + uint8 bodytype; // added for targettype support + uint8 deity; //not loaded from DB + uint8 level; + uint32 npc_id; uint8 texture; uint8 helmtexture; uint32 loottable_id; uint32 npc_spells_id; int32 npc_faction_id; uint32 merchanttype; - uint32 alt_currency_type; + uint32 alt_currency_type; uint32 adventure_template; uint32 trap_template; - uint8 light; //not loaded from DB + uint8 light; //not loaded from DB uint16 AC; uint32 Mana; //not loaded from DB uint16 ATK; //not loaded from DB @@ -85,20 +85,20 @@ struct NPCType uint32 drakkin_heritage; uint32 drakkin_tattoo; uint32 drakkin_details; - uint32 armor_tint[MAX_MATERIALS]; + uint32 armor_tint[MAX_MATERIALS]; uint32 min_dmg; uint32 max_dmg; - int16 attack_count; + int16 attack_count; char npc_attacks[30]; - uint16 d_meele_texture1; + uint16 d_meele_texture1; uint16 d_meele_texture2; uint8 prim_melee_type; uint8 sec_melee_type; int32 hp_regen; - int32 mana_regen; + int32 mana_regen; int32 aggroradius; // added for AI improvement - neotokyo uint8 see_invis; // See Invis flag added - bool see_invis_undead; // See Invis vs. Undead flag added + bool see_invis_undead; // See Invis vs. Undead flag added bool see_hide; bool see_improved_hide; bool qglobal; @@ -106,7 +106,7 @@ struct NPCType uint8 spawn_limit; //only this many may be in zone at a time (0=no limit) uint8 mount_color; //only used by horse class float attack_speed; //%+- on attack delay of the mob. - int accuracy_rating; //10 = 1% accuracy + int accuracy_rating; //10 = 1% accuracy bool findable; //can be found with find command bool trackable; float slow_mitigation; // Slow mitigation % in decimal form. @@ -114,7 +114,7 @@ struct NPCType uint32 scalerate; bool private_corpse; bool unique_spawn_by_name; - bool underwater; + bool underwater; uint32 emoteid; float spellscale; float healscale; @@ -239,33 +239,33 @@ namespace classic_db } struct Door { - uint32 db_id; - uint8 door_id; - char zone_name[16]; - char door_name[32]; - float pos_x; - float pos_y; - float pos_z; - float heading; - int incline; - uint8 opentype; - uint32 guild_id; - uint16 lockpick; - uint32 keyitem; - uint8 nokeyring; - uint8 trigger_door; - uint8 trigger_type; - uint32 door_param; - int invert_state; - uint16 size; - char dest_zone[16]; - uint32 dest_instance_id; - float dest_x; - float dest_y; - float dest_z; - float dest_heading; - uint8 is_ldon_door; - uint32 client_version_mask; + uint32 db_id; + uint8 door_id; + char zone_name[16]; + char door_name[32]; + float pos_x; + float pos_y; + float pos_z; + float heading; + int incline; + uint8 opentype; + uint32 guild_id; + uint16 lockpick; + uint32 keyitem; + uint8 nokeyring; + uint8 trigger_door; + uint8 trigger_type; + uint32 door_param; + int invert_state; + uint16 size; + char dest_zone[16]; + uint32 dest_instance_id; + float dest_x; + float dest_y; + float dest_z; + float dest_heading; + uint8 is_ldon_door; + uint32 client_version_mask; }; #pragma pack() diff --git a/zone/zoning.cpp b/zone/zoning.cpp index eaaf680e2..86684187e 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.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" @@ -72,10 +72,10 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { case ZoneToBindPoint: target_zone_id = m_pp.binds[0].zoneId; break; - case ZoneSolicited: //we told the client to zone somewhere, so we know where they are going. + case ZoneSolicited: //we told the client to zone somewhere, so we know where they are going. target_zone_id = zonesummon_id; break; - case ZoneUnsolicited: //client came up with this on its own. + case ZoneUnsolicited: //client came up with this on its own. zone_point = zone->GetClosestZonePointWithoutZone(GetX(), GetY(), GetZ(), this, ZONEPOINT_NOZONE_RANGE); if(zone_point) { //we found a zone point, which is a reasonable distance away @@ -170,7 +170,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { char buf[10]; snprintf(buf, 9, "%d", target_zone_id); buf[9] = '\0'; - parse->EventPlayer(EVENT_ZONE, this, buf, 0); + parse->EventPlayer(EVENT_ZONE, this, buf, 0); //handle circumvention of zone restrictions @@ -205,13 +205,13 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { dest_z = m_pp.binds[0].z; ignorerestrictions = 1; //can always get to our bind point? seems exploitable break; - case ZoneSolicited: //we told the client to zone somewhere, so we know where they are going. + case ZoneSolicited: //we told the client to zone somewhere, so we know where they are going. //recycle zonesummon variables dest_x = zonesummon_x; dest_y = zonesummon_y; dest_z = zonesummon_z; break; - case ZoneUnsolicited: //client came up with this on its own. + case ZoneUnsolicited: //client came up with this on its own. //client requested a zoning... what are the cases when this could happen? //Handle zone point case: @@ -728,10 +728,10 @@ void Client::SetZoneFlag(uint32 zone_id) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - // Retrieve all waypoints for this grid - if(!database.RunQuery(query,MakeAnyLenString(&query, - "INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", - CharacterID(),zone_id),errbuf)) { + // Retrieve all waypoints for this grid + if(!database.RunQuery(query,MakeAnyLenString(&query, + "INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", + CharacterID(),zone_id),errbuf)) { LogFile->write(EQEMuLog::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), errbuf); } } @@ -746,10 +746,10 @@ void Client::ClearZoneFlag(uint32 zone_id) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - // Retrieve all waypoints for this grid - if(!database.RunQuery(query,MakeAnyLenString(&query, - "DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", - CharacterID(),zone_id),errbuf)) { + // Retrieve all waypoints for this grid + if(!database.RunQuery(query,MakeAnyLenString(&query, + "DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", + CharacterID(),zone_id),errbuf)) { LogFile->write(EQEMuLog::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), errbuf); } } @@ -760,21 +760,21 @@ void Client::LoadZoneFlags() { MYSQL_RES *result; MYSQL_ROW row; - // Retrieve all waypoints for this grid - if(database.RunQuery(query,MakeAnyLenString(&query, - "SELECT zoneID from zone_flags WHERE charID=%d", - CharacterID()),errbuf,&result)) - { + // Retrieve all waypoints for this grid + if(database.RunQuery(query,MakeAnyLenString(&query, + "SELECT zoneID from zone_flags WHERE charID=%d", + CharacterID()),errbuf,&result)) + { while((row = mysql_fetch_row(result))) { zone_flags.insert(atoi(row[0])); } mysql_free_result(result); - } - else // DB query error! - { + } + else // DB query error! + { LogFile->write(EQEMuLog::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), errbuf); - } - safe_delete_array(query); + } + safe_delete_array(query); } bool Client::HasZoneFlag(uint32 zone_id) const { @@ -820,8 +820,8 @@ void Client::SendZoneFlagInfo(Client *to) const { bool Client::CanBeInZone() { //check some critial rules to see if this char needs to be booted from the zone - //only enforce rules here which are serious enough to warrant being kicked from - //the zone + //only enforce rules here which are serious enough to warrant being kicked from + //the zone if(Admin() >= RuleI(GM, MinStatusToZoneAnywhere)) return(true);
NameZoneXYZDate" - "RezzedBuried
 " - "
Buried
 " + "