diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 000000000..749ab62c5
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,16 @@
+---
+kind: pipeline
+type: docker
+name: EQEmulator Server Linux CI
+
+# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
+concurrency:
+ limit: 1
+
+steps:
+ - name: server-build
+ # Source build script https://github.com/Akkadius/akk-stack/blob/master/containers/eqemu-server/Dockerfile#L20
+ image: akkadius/eqemu-server:latest
+ commands:
+ - sudo chown eqemu:eqemu /drone/src/ * -R
+ - git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_BOTS=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 287c07412..1db525804 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,4 +37,20 @@ perl/
submodules/*
cmake-build-debug/
-.nfs.*
\ No newline at end of file
+.nfs.*
+
+# Visual Studio and CMAKE Generated Files
+/.vs/
+*.vcxproj
+*.vcxproj.filters
+*.vcxproj.user
+*.cmake
+*.ilk
+*.pdb
+*.sln
+*.dir/
+libs/
+bin/
+/Win32
+/x64
+/client_files/**/CMakeFiles/
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 1c6e5c871..a955aa60c 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -6,7 +6,7 @@
{
"label": "make",
"type": "shell",
- "command": "cd build && make",
+ "command": "cd bin && make",
"group": {
"kind": "build",
"isDefault": true
@@ -18,7 +18,7 @@
{
"label": "make clean",
"type": "shell",
- "command": "cd build && make clean",
+ "command": "cd bin && make clean",
"group": {
"kind": "build",
"isDefault": true
@@ -30,7 +30,7 @@
{
"label": "cmake",
"type": "shell",
- "command": "mkdir -p build && cd build && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
+ "command": "mkdir -p bin && cd bin && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
"group": {
"kind": "build",
"isDefault": true
@@ -52,7 +52,7 @@
{
"label": "download maps",
"type": "shell",
- "command": "mkdir -p build/bin && cd build/bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip",
+ "command": "mkdir -p bin && cd bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip",
"group": {
"kind": "build",
"isDefault": true
@@ -64,7 +64,7 @@
{
"label": "download quests",
"type": "shell",
- "command": "mkdir -p build/bin && cd build/bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
+ "command": "mkdir -p bin && cd bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
"group": {
"kind": "build",
"isDefault": true
@@ -76,7 +76,7 @@
{
"label": "download eqemu_config",
"type": "shell",
- "command": "mkdir -p build/bin && cd build/bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json",
+ "command": "mkdir -p bin && cd bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json",
"group": {
"kind": "build",
"isDefault": true
@@ -88,7 +88,7 @@
{
"label": "rebuild database (mariadb must be started)",
"type": "shell",
- "command": "mkdir -p build/bin && cd build/bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'",
+ "command": "mkdir -p bin && cd bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'",
"group": {
"kind": "build",
"isDefault": true
@@ -100,7 +100,7 @@
{
"label": "zone 7000",
"type": "shell",
- "command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000",
+ "command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000",
"group": {
"kind": "test",
"isDefault": true
@@ -109,7 +109,7 @@
{
"label": "zone 7001",
"type": "shell",
- "command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001",
+ "command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001",
"group": {
"kind": "test",
"isDefault": true
@@ -118,7 +118,7 @@
{
"label": "loginserver",
"type": "shell",
- "command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver",
+ "command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver",
"group": {
"kind": "test",
"isDefault": true
@@ -127,7 +127,7 @@
{
"label": "shared_memory, world",
"type": "shell",
- "command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world",
+ "command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world",
"group": {
"kind": "test",
"isDefault": true
@@ -136,7 +136,7 @@
{
"label": "queryserv",
"type": "shell",
- "command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv",
+ "command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv",
"group": {
"kind": "test",
"isDefault": true
@@ -145,7 +145,16 @@
{
"label": "mariadb",
"type": "shell",
- "command": "docker stop mariadb | true && cd build/bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest",
+ "command": "docker stop mariadb | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest",
+ "group": {
+ "kind": "test",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "ucs",
+ "type": "shell",
+ "command": "docker stop ucs | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src -p 7778:7778 --name ucs --network=eqemu eqemu/server:0.0.3 gdb -ex run ./ucs",
"group": {
"kind": "test",
"isDefault": true
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b12e2ee1..526d68099 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
-SET(CMAKE_CXX_STANDARD 11)
+SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
@@ -55,6 +55,7 @@ FIND_PACKAGE(MariaDB)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(OpenSSL)
FIND_PACKAGE(Lua51)
+FIND_PACKAGE(LuaJit)
FIND_PACKAGE(PerlLibs)
FIND_PACKAGE(Sodium)
FIND_PACKAGE(mbedTLS)
@@ -87,6 +88,12 @@ ELSE()
MESSAGE(STATUS "* Lua: MISSING *")
ENDIF()
+IF(LuaJit_FOUND)
+ MESSAGE(STATUS "* LuaJIT: FOUND *")
+ELSE()
+ MESSAGE(STATUS "* LuaJIT: MISSING *")
+ENDIF()
+
IF(PerlLibs_FOUND)
MESSAGE(STATUS "* Perl: FOUND *")
ELSE()
@@ -122,6 +129,7 @@ OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
+OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
@@ -133,7 +141,7 @@ ENDIF(EQEMU_ENABLE_BOTS)
#database
IF(MySQL_FOUND AND MariaDB_FOUND)
- SET(DATABASE_LIBRARY_SELECTION MySQL CACHE STRING "Database library to use:
+ SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
MySQL
MariaDB"
)
@@ -212,7 +220,12 @@ ELSE()
SET(SODIUM_LIBRARY_ENABLED OFF)
ENDIF()
-IF(Lua51_FOUND)
+IF(LUAJIT_FOUND AND NOT (EQEMU_PREFER_LUA AND Lua51_FOUND))
+ SET(LUA_LIBRARY_TYPE " LuaJIT")
+ SET(LUA_LIBRARY_ENABLED ON)
+ SET(LUA_LIBRARY_LIBS ${LUAJIT_LIBRARY} luabind)
+ SET(LUA_LIBRARY_INCLUDE ${LUAJIT_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
+ELSEIF(Lua51_FOUND )
SET(LUA_LIBRARY_TYPE " Lua 5.1")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
@@ -239,6 +252,7 @@ IF(ZLIB_FOUND)
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
+ INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_BINARY_DIR}/libs/zlibng")
ELSE()
SET(ZLIB_LIBRARY_TYPE " zlib")
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY})
@@ -299,7 +313,7 @@ IF(LUA_LIBRARY_ENABLED)
IF(EQEMU_BUILD_LUA)
ADD_DEFINITIONS(-DLUA_EQEMU)
- SET(SERVER_LIBS ${SERVER_LIBS} ${LUA_LIBRARY_LIBS})
+ SET(ZONE_LIBS ${LUA_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${LUA_LIBRARY_INCLUDE}")
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
@@ -328,9 +342,14 @@ IF(UNIX)
IF(NOT DARWIN)
SET(SERVER_LIBS ${SERVER_LIBS} "rt")
ENDIF()
- SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
+ # Freebsd provides uuids in the C library
+ IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+ SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
+ ENDIF()
ENDIF()
+SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS})
+
IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED)
MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.")
ENDIF()
diff --git a/README.md b/README.md
index f3b829732..fea2c23a4 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# EQEmulator Core Server
-|Travis CI (Linux)|Appveyor w/ Bots (Windows) |Appveyor w/o Bots (Windows) |
+|Travis CI (Linux)|Appveyor (Windows x86) |Appveyor (Windows x64) |
|:---:|:---:|:---:|
-|[](https://travis-ci.org/EQEmu/Server) |[](https://ci.appveyor.com/project/KimLS/server-87crp/branch/master) |[](https://ci.appveyor.com/project/KimLS/server-w0pq2/branch/master) |
+|[](https://travis-ci.org/EQEmu/Server) |[](https://ci.appveyor.com/project/KimLS/server) |[](https://ci.appveyor.com/project/KimLS/server-87crp) |
***
@@ -17,9 +17,13 @@
|:---:|:---:|:---:|
|**Install Count**|||
### > Windows
-* [Install](https://eqemu.gitbook.io/server/categories/how-to-guides/installation/server-installation-windows)
+
+* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-windows)
### > Debian/Ubuntu/CentOS/Fedora
+
+* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-linux)
+
* You can use curl or wget to kick off the installer (whichever your OS has)
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
@@ -52,7 +56,7 @@ forum, although pull requests will be much quicker and easier on all parties.
## Resources
- [EQEmulator Forums](http://www.eqemulator.org/forums)
-- [EQEmulator Wiki](https://github.com/EQEmu/Server/wiki)
+- [EQEmulator Wiki](https://eqemu.gitbook.io/)
## Related Repositories
* [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests)
@@ -76,3 +80,4 @@ forum, although pull requests will be much quicker and easier on all parties.
+
diff --git a/appveyor-bots.yml b/appveyor-bots.yml
index 9edb00593..540d9b3df 100644
--- a/appveyor-bots.yml
+++ b/appveyor-bots.yml
@@ -16,6 +16,6 @@ build:
verbosity: minimal
after_build:
- cmd: >-
- 7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
+ 7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
- appveyor PushArtifact build_x64-bots.zip
\ No newline at end of file
+ appveyor PushArtifact build_x64-bots.zip
diff --git a/appveyor-no-bots.yml b/appveyor-no-bots.yml
index 7aea00332..0b0f5b8a2 100644
--- a/appveyor-no-bots.yml
+++ b/appveyor-no-bots.yml
@@ -16,6 +16,6 @@ build:
verbosity: minimal
after_build:
- cmd: >-
- 7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
+ 7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
- appveyor PushArtifact build_x64-no-bots.zip
\ No newline at end of file
+ appveyor PushArtifact build_x64-no-bots.zip
diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp
index a6f3c3bec..fd8b19026 100644
--- a/client_files/export/main.cpp
+++ b/client_files/export/main.cpp
@@ -26,8 +26,10 @@
#include "../../common/crash.h"
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
+#include "../../common/content/world_content_service.h"
EQEmuLogSys LogSys;
+WorldContentService content_service;
void ExportSpells(SharedDatabase *db);
void ExportSkillCaps(SharedDatabase *db);
diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp
index 3c25fa618..64b2aee41 100644
--- a/client_files/import/main.cpp
+++ b/client_files/import/main.cpp
@@ -24,8 +24,10 @@
#include "../../common/crash.h"
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
+#include "../../common/content/world_content_service.h"
EQEmuLogSys LogSys;
+WorldContentService content_service;
void ImportSpells(SharedDatabase *db);
void ImportSkillCaps(SharedDatabase *db);
@@ -87,7 +89,7 @@ int main(int argc, char **argv) {
ImportDBStrings(&database);
LogSys.CloseFileLogs();
-
+
return 0;
}
@@ -324,10 +326,10 @@ void ImportDBStrings(SharedDatabase *db) {
std::string sql;
int id, type;
std::string value;
-
+
id = atoi(split[0].c_str());
type = atoi(split[1].c_str());
-
+
if(split.size() >= 3) {
value = ::EscapeString(split[2]);
}
diff --git a/cmake/FindLua51.cmake b/cmake/FindLua51.cmake
index 47fa0aaae..0aab2bb82 100644
--- a/cmake/FindLua51.cmake
+++ b/cmake/FindLua51.cmake
@@ -38,7 +38,7 @@ locations other than lua/
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
- PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include/luajit include
+ PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -49,7 +49,7 @@ find_path(LUA_INCLUDE_DIR lua.h
)
find_library(LUA_LIBRARY
- NAMES lua51 lua5.1 lua-5.1 lua luajit
+ NAMES lua51 lua5.1 lua-5.1 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake
new file mode 100644
index 000000000..a7376dee1
--- /dev/null
+++ b/cmake/FindLuaJit.cmake
@@ -0,0 +1,91 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+# Modified from the FindLua51 that comes with CMake
+
+#[=======================================================================[.rst:
+FindLuaJit
+---------
+
+
+
+Locate LuaJit library This module defines
+
+::
+
+ LUAJIT_FOUND, if false, do not try to link to Lua
+ LUAJIT_LIBRARIES
+ LUAJIT_INCLUDE_DIR, where to find lua.h
+ LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
+
+
+
+Note that the expected include convention is
+
+::
+
+ #include "lua.h"
+
+and not
+
+::
+
+ #include
+
+This is because, the lua location is not standardized and may exist in
+locations other than lua/
+#]=======================================================================]
+
+find_path(LUAJIT_INCLUDE_DIR lua.h
+ HINTS
+ ENV LUA_DIR
+ PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1 include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+
+find_library(LUAJIT_LIBRARY
+ NAMES luajit51 luajit5.1 luajit-5.1 luajit lua51
+ HINTS
+ ENV LUA_DIR
+ PATH_SUFFIXES lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+if(LUAJIT_LIBRARY)
+ # include the math library for Unix
+ if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
+ find_library(LUAJIT_MATH_LIBRARY m)
+ set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
+ # For Windows and Mac, don't need to explicitly include the math library
+ else()
+ set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries")
+ endif()
+endif()
+
+if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h")
+ file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
+
+ string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${lua_version_str}")
+ unset(lua_version_str)
+endif()
+
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
+ REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR
+ VERSION_VAR LUAJIT_VERSION_STRING)
+
+mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
+
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index d741ae81d..08db08585 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -6,6 +6,7 @@ SET(common_sources
cli/eqemu_command_handler.cpp
compression.cpp
condition.cpp
+ content/world_content_service.cpp
crash.cpp
crc16.cpp
crc32.cpp
@@ -15,6 +16,7 @@ SET(common_sources
database_instances.cpp
dbcore.cpp
deity.cpp
+ dynamic_zone_base.cpp
emu_constants.cpp
emu_limits.cpp
emu_opcodes.cpp
@@ -30,6 +32,8 @@ SET(common_sources
eq_stream_proxy.cpp
eqtime.cpp
event_sub.cpp
+ expedition_base.cpp
+ expedition_lockout_timer.cpp
extprofile.cpp
faction.cpp
file_util.cpp
@@ -66,6 +70,7 @@ SET(common_sources
rulesys.cpp
say_link.cpp
serialize_buffer.cpp
+ server_event_scheduler.cpp
serverinfo.cpp
shareddb.cpp
skills.cpp
@@ -108,6 +113,343 @@ SET(common_sources
util/directory.cpp
util/uuid.cpp)
+SET(repositories
+
+ # Criteria
+ repositories/criteria/content_filter_criteria.h
+
+ # Base Repositories
+ repositories/base/base_aa_ability_repository.h
+ repositories/base/base_aa_ranks_repository.h
+ repositories/base/base_aa_rank_effects_repository.h
+ repositories/base/base_aa_rank_prereqs_repository.h
+ repositories/base/base_account_repository.h
+ repositories/base/base_account_flags_repository.h
+ repositories/base/base_account_ip_repository.h
+ repositories/base/base_account_rewards_repository.h
+ repositories/base/base_adventure_details_repository.h
+ repositories/base/base_adventure_members_repository.h
+ repositories/base/base_adventure_stats_repository.h
+ repositories/base/base_adventure_template_repository.h
+ repositories/base/base_adventure_template_entry_repository.h
+ repositories/base/base_adventure_template_entry_flavor_repository.h
+ repositories/base/base_alternate_currency_repository.h
+ repositories/base/base_auras_repository.h
+ repositories/base/base_base_data_repository.h
+ repositories/base/base_blocked_spells_repository.h
+ repositories/base/base_bugs_repository.h
+ repositories/base/base_bug_reports_repository.h
+ repositories/base/base_buyer_repository.h
+ repositories/base/base_character_activities_repository.h
+ repositories/base/base_character_alternate_abilities_repository.h
+ repositories/base/base_character_alt_currency_repository.h
+ repositories/base/base_character_auras_repository.h
+ repositories/base/base_character_bandolier_repository.h
+ repositories/base/base_character_bind_repository.h
+ repositories/base/base_character_buffs_repository.h
+ repositories/base/base_character_corpses_repository.h
+ repositories/base/base_character_corpse_items_repository.h
+ repositories/base/base_character_currency_repository.h
+ repositories/base/base_character_data_repository.h
+ repositories/base/base_character_disciplines_repository.h
+ repositories/base/base_character_expedition_lockouts_repository.h
+ repositories/base/base_character_inspect_messages_repository.h
+ repositories/base/base_character_item_recast_repository.h
+ repositories/base/base_character_languages_repository.h
+ repositories/base/base_character_leadership_abilities_repository.h
+ repositories/base/base_character_material_repository.h
+ repositories/base/base_character_memmed_spells_repository.h
+ repositories/base/base_character_pet_buffs_repository.h
+ repositories/base/base_character_pet_info_repository.h
+ repositories/base/base_character_pet_inventory_repository.h
+ repositories/base/base_character_potionbelt_repository.h
+ repositories/base/base_character_skills_repository.h
+ repositories/base/base_character_spells_repository.h
+ repositories/base/base_character_tasks_repository.h
+ repositories/base/base_char_create_combinations_repository.h
+ repositories/base/base_char_create_point_allocations_repository.h
+ repositories/base/base_char_recipe_list_repository.h
+ repositories/base/base_completed_tasks_repository.h
+ repositories/base/base_content_flags_repository.h
+ repositories/base/base_damageshieldtypes_repository.h
+ repositories/base/base_data_buckets_repository.h
+ repositories/base/base_db_str_repository.h
+ repositories/base/base_discovered_items_repository.h
+ repositories/base/base_doors_repository.h
+ repositories/base/base_dynamic_zones_repository.h
+ repositories/base/base_eventlog_repository.h
+ repositories/base/base_expeditions_repository.h
+ repositories/base/base_expedition_lockouts_repository.h
+ repositories/base/base_expedition_members_repository.h
+ repositories/base/base_faction_base_data_repository.h
+ repositories/base/base_faction_list_repository.h
+ repositories/base/base_faction_list_mod_repository.h
+ repositories/base/base_faction_values_repository.h
+ repositories/base/base_fishing_repository.h
+ repositories/base/base_forage_repository.h
+ repositories/base/base_friends_repository.h
+ repositories/base/base_global_loot_repository.h
+ repositories/base/base_gm_ips_repository.h
+ repositories/base/base_goallists_repository.h
+ repositories/base/base_graveyard_repository.h
+ repositories/base/base_grid_repository.h
+ repositories/base/base_grid_entries_repository.h
+ repositories/base/base_ground_spawns_repository.h
+ repositories/base/base_group_id_repository.h
+ repositories/base/base_group_leaders_repository.h
+ repositories/base/base_guilds_repository.h
+ repositories/base/base_guild_members_repository.h
+ repositories/base/base_guild_ranks_repository.h
+ repositories/base/base_guild_relations_repository.h
+ repositories/base/base_hackers_repository.h
+ repositories/base/base_instance_list_repository.h
+ repositories/base/base_instance_list_player_repository.h
+ repositories/base/base_inventory_repository.h
+ repositories/base/base_inventory_snapshots_repository.h
+ repositories/base/base_ip_exemptions_repository.h
+ repositories/base/base_items_repository.h
+ repositories/base/base_item_tick_repository.h
+ repositories/base/base_ldon_trap_entries_repository.h
+ repositories/base/base_ldon_trap_templates_repository.h
+ repositories/base/base_level_exp_mods_repository.h
+ repositories/base/base_lfguild_repository.h
+ repositories/base/base_login_accounts_repository.h
+ repositories/base/base_login_api_tokens_repository.h
+ repositories/base/base_login_server_admins_repository.h
+ repositories/base/base_login_server_list_types_repository.h
+ repositories/base/base_login_world_servers_repository.h
+ repositories/base/base_logsys_categories_repository.h
+ repositories/base/base_lootdrop_repository.h
+ repositories/base/base_lootdrop_entries_repository.h
+ repositories/base/base_loottable_repository.h
+ repositories/base/base_loottable_entries_repository.h
+ repositories/base/base_mail_repository.h
+ repositories/base/base_merchantlist_repository.h
+ repositories/base/base_merchantlist_temp_repository.h
+ repositories/base/base_name_filter_repository.h
+ repositories/base/base_npc_emotes_repository.h
+ repositories/base/base_npc_faction_repository.h
+ repositories/base/base_npc_faction_entries_repository.h
+ repositories/base/base_npc_scale_global_base_repository.h
+ repositories/base/base_npc_spells_repository.h
+ repositories/base/base_npc_spells_effects_repository.h
+ repositories/base/base_npc_spells_effects_entries_repository.h
+ repositories/base/base_npc_spells_entries_repository.h
+ repositories/base/base_npc_types_repository.h
+ repositories/base/base_npc_types_tint_repository.h
+ repositories/base/base_object_repository.h
+ repositories/base/base_object_contents_repository.h
+ repositories/base/base_perl_event_export_settings_repository.h
+ repositories/base/base_petitions_repository.h
+ repositories/base/base_pets_repository.h
+ repositories/base/base_pets_equipmentset_repository.h
+ repositories/base/base_pets_equipmentset_entries_repository.h
+ repositories/base/base_player_titlesets_repository.h
+ repositories/base/base_proximities_repository.h
+ repositories/base/base_quest_globals_repository.h
+ repositories/base/base_raid_details_repository.h
+ repositories/base/base_raid_members_repository.h
+ repositories/base/base_reports_repository.h
+ repositories/base/base_respawn_times_repository.h
+ repositories/base/base_rule_sets_repository.h
+ repositories/base/base_rule_values_repository.h
+ repositories/base/base_saylink_repository.h
+ repositories/base/base_server_scheduled_events_repository.h
+ repositories/base/base_skill_caps_repository.h
+ repositories/base/base_spawn2_repository.h
+ repositories/base/base_spawnentry_repository.h
+ repositories/base/base_spawngroup_repository.h
+ repositories/base/base_spawn_conditions_repository.h
+ repositories/base/base_spawn_condition_values_repository.h
+ repositories/base/base_spawn_events_repository.h
+ repositories/base/base_spells_new_repository.h
+ repositories/base/base_spell_buckets_repository.h
+ repositories/base/base_spell_globals_repository.h
+ repositories/base/base_starting_items_repository.h
+ repositories/base/base_start_zones_repository.h
+ repositories/base/base_tasks_repository.h
+ repositories/base/base_tasksets_repository.h
+ repositories/base/base_task_activities_repository.h
+ repositories/base/base_timers_repository.h
+ repositories/base/base_titles_repository.h
+ repositories/base/base_trader_repository.h
+ repositories/base/base_tradeskill_recipe_repository.h
+ repositories/base/base_tradeskill_recipe_entries_repository.h
+ repositories/base/base_traps_repository.h
+ repositories/base/base_tributes_repository.h
+ repositories/base/base_tribute_levels_repository.h
+ repositories/base/base_veteran_reward_templates_repository.h
+ repositories/base/base_zone_repository.h
+ repositories/base/base_zone_points_repository.h
+
+ # Extended Repositories
+ repositories/aa_ability_repository.h
+ repositories/aa_ranks_repository.h
+ repositories/aa_rank_effects_repository.h
+ repositories/aa_rank_prereqs_repository.h
+ repositories/account_repository.h
+ repositories/account_flags_repository.h
+ repositories/account_ip_repository.h
+ repositories/account_rewards_repository.h
+ repositories/adventure_details_repository.h
+ repositories/adventure_members_repository.h
+ repositories/adventure_stats_repository.h
+ repositories/adventure_template_repository.h
+ repositories/adventure_template_entry_repository.h
+ repositories/adventure_template_entry_flavor_repository.h
+ repositories/alternate_currency_repository.h
+ repositories/auras_repository.h
+ repositories/base_data_repository.h
+ repositories/blocked_spells_repository.h
+ repositories/bugs_repository.h
+ repositories/bug_reports_repository.h
+ repositories/buyer_repository.h
+ repositories/character_activities_repository.h
+ repositories/character_alternate_abilities_repository.h
+ repositories/character_alt_currency_repository.h
+ repositories/character_auras_repository.h
+ repositories/character_bandolier_repository.h
+ repositories/character_bind_repository.h
+ repositories/character_buffs_repository.h
+ repositories/character_corpses_repository.h
+ repositories/character_corpse_items_repository.h
+ repositories/character_currency_repository.h
+ repositories/character_data_repository.h
+ repositories/character_disciplines_repository.h
+ repositories/character_expedition_lockouts_repository.h
+ repositories/character_inspect_messages_repository.h
+ repositories/character_item_recast_repository.h
+ repositories/character_languages_repository.h
+ repositories/character_leadership_abilities_repository.h
+ repositories/character_material_repository.h
+ repositories/character_memmed_spells_repository.h
+ repositories/character_pet_buffs_repository.h
+ repositories/character_pet_info_repository.h
+ repositories/character_pet_inventory_repository.h
+ repositories/character_potionbelt_repository.h
+ repositories/character_skills_repository.h
+ repositories/character_spells_repository.h
+ repositories/character_tasks_repository.h
+ repositories/char_create_combinations_repository.h
+ repositories/char_create_point_allocations_repository.h
+ repositories/char_recipe_list_repository.h
+ repositories/completed_tasks_repository.h
+ repositories/content_flags_repository.h
+ repositories/damageshieldtypes_repository.h
+ repositories/data_buckets_repository.h
+ repositories/db_str_repository.h
+ repositories/discovered_items_repository.h
+ repositories/doors_repository.h
+ repositories/dynamic_zones_repository.h
+ repositories/eventlog_repository.h
+ repositories/expeditions_repository.h
+ repositories/expedition_lockouts_repository.h
+ repositories/expedition_members_repository.h
+ repositories/faction_base_data_repository.h
+ repositories/faction_list_repository.h
+ repositories/faction_list_mod_repository.h
+ repositories/faction_values_repository.h
+ repositories/fishing_repository.h
+ repositories/forage_repository.h
+ repositories/friends_repository.h
+ repositories/global_loot_repository.h
+ repositories/gm_ips_repository.h
+ repositories/goallists_repository.h
+ repositories/graveyard_repository.h
+ repositories/grid_repository.h
+ repositories/grid_entries_repository.h
+ repositories/ground_spawns_repository.h
+ repositories/group_id_repository.h
+ repositories/group_leaders_repository.h
+ repositories/guilds_repository.h
+ repositories/guild_members_repository.h
+ repositories/guild_ranks_repository.h
+ repositories/guild_relations_repository.h
+ repositories/hackers_repository.h
+ repositories/instance_list_repository.h
+ repositories/instance_list_player_repository.h
+ repositories/inventory_repository.h
+ repositories/inventory_snapshots_repository.h
+ repositories/ip_exemptions_repository.h
+ repositories/items_repository.h
+ repositories/item_tick_repository.h
+ repositories/ldon_trap_entries_repository.h
+ repositories/ldon_trap_templates_repository.h
+ repositories/level_exp_mods_repository.h
+ repositories/lfguild_repository.h
+ repositories/login_accounts_repository.h
+ repositories/login_api_tokens_repository.h
+ repositories/login_server_admins_repository.h
+ repositories/login_server_list_types_repository.h
+ repositories/login_world_servers_repository.h
+ repositories/logsys_categories_repository.h
+ repositories/lootdrop_repository.h
+ repositories/lootdrop_entries_repository.h
+ repositories/loottable_repository.h
+ repositories/loottable_entries_repository.h
+ repositories/mail_repository.h
+ repositories/merchantlist_repository.h
+ repositories/merchantlist_temp_repository.h
+ repositories/name_filter_repository.h
+ repositories/npc_emotes_repository.h
+ repositories/npc_faction_repository.h
+ repositories/npc_faction_entries_repository.h
+ repositories/npc_scale_global_base_repository.h
+ repositories/npc_spells_repository.h
+ repositories/npc_spells_effects_repository.h
+ repositories/npc_spells_effects_entries_repository.h
+ repositories/npc_spells_entries_repository.h
+ repositories/npc_types_repository.h
+ repositories/npc_types_tint_repository.h
+ repositories/object_repository.h
+ repositories/object_contents_repository.h
+ repositories/perl_event_export_settings_repository.h
+ repositories/petitions_repository.h
+ repositories/pets_repository.h
+ repositories/pets_equipmentset_repository.h
+ repositories/pets_equipmentset_entries_repository.h
+ repositories/player_titlesets_repository.h
+ repositories/proximities_repository.h
+ repositories/quest_globals_repository.h
+ repositories/raid_details_repository.h
+ repositories/raid_members_repository.h
+ repositories/reports_repository.h
+ repositories/respawn_times_repository.h
+ repositories/rule_sets_repository.h
+ repositories/rule_values_repository.h
+ repositories/saylink_repository.h
+ repositories/server_scheduled_events_repository.h
+ repositories/skill_caps_repository.h
+ repositories/spawn2_repository.h
+ repositories/spawnentry_repository.h
+ repositories/spawngroup_repository.h
+ repositories/spawn_conditions_repository.h
+ repositories/spawn_condition_values_repository.h
+ repositories/spawn_events_repository.h
+ repositories/spells_new_repository.h
+ repositories/spell_buckets_repository.h
+ repositories/spell_globals_repository.h
+ repositories/starting_items_repository.h
+ repositories/start_zones_repository.h
+ repositories/tasks_repository.h
+ repositories/tasksets_repository.h
+ repositories/task_activities_repository.h
+ repositories/timers_repository.h
+ repositories/titles_repository.h
+ repositories/trader_repository.h
+ repositories/tradeskill_recipe_repository.h
+ repositories/tradeskill_recipe_entries_repository.h
+ repositories/traps_repository.h
+ repositories/tributes_repository.h
+ repositories/tribute_levels_repository.h
+ repositories/veteran_reward_templates_repository.h
+ repositories/zone_repository.h
+ repositories/zone_points_repository.h
+
+ # Non-Comformative
+ repositories/character_recipe_list_repository.h
+)
+
SET(common_headers
any.h
base_packet.h
@@ -116,18 +458,21 @@ SET(common_headers
classes.h
compression.h
condition.h
+ content/world_content_service.h
crash.h
crc16.h
crc32.h
cli/argh.h
cli/eqemu_command_handler.h
cli/terminal_color.hpp
+ cron/croncpp.h
database/database_dump_service.h
data_verification.h
database.h
database_schema.h
dbcore.h
deity.h
+ dynamic_zone_base.h
emu_constants.h
emu_limits.h
emu_opcodes.h
@@ -151,6 +496,8 @@ SET(common_headers
eqtime.h
errmsg.h
event_sub.h
+ expedition_base.h
+ expedition_lockout_timer.h
extprofile.h
faction.h
file_util.h
@@ -196,17 +543,13 @@ SET(common_headers
queue.h
races.h
random.h
- repositories/character_recipe_list_repository.h
- repositories/grid_repository.h
- repositories/grid_entries_repository.h
- repositories/spawngroup_repository.h
- repositories/tradeskill_recipe_repository.h
rdtsc.h
rulesys.h
ruletypes.h
say_link.h
seperator.h
serialize_buffer.h
+ server_event_scheduler.h
serverinfo.h
servertalk.h
shareddb.h
@@ -385,7 +728,7 @@ SOURCE_GROUP(Util FILES
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
-ADD_LIBRARY(common ${common_sources} ${common_headers})
+ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories})
IF(UNIX)
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
diff --git a/common/any.h b/common/any.h
index fd80fbc5f..1ec59cdb4 100644
--- a/common/any.h
+++ b/common/any.h
@@ -24,7 +24,7 @@
* DEALINGS IN THE SOFTWARE.
*/
-// EQEmu::Any is a modified version of Boost::Any and as such retains the Boost licensing.
+// EQ::Any is a modified version of Boost::Any and as such retains the Boost licensing.
#ifndef EQEMU_COMMON_ANY_H
#define EQEMU_COMMON_ANY_H
@@ -32,7 +32,7 @@
#include
#include
-namespace EQEmu
+namespace EQ
{
class Any
{
diff --git a/common/classes.cpp b/common/classes.cpp
index 3aaeeded3..b9445443f 100644
--- a/common/classes.cpp
+++ b/common/classes.cpp
@@ -378,6 +378,8 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Berserker Guildmaster";
case MERCHANT:
return "Merchant";
+ case DISCORD_MERCHANT:
+ return "Discord Merchant";
case ADVENTURERECRUITER:
return "Adventure Recruiter";
case ADVENTUREMERCHANT:
@@ -388,6 +390,18 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Tribute Master";
case GUILD_TRIBUTE_MASTER:
return "Guild Tribute Master";
+ case GUILD_BANKER:
+ return "Guild Banker";
+ case NORRATHS_KEEPERS_MERCHANT:
+ return "Radiant Crystal Merchant";
+ case DARK_REIGN_MERCHANT:
+ return "Ebon Crystal Merchant";
+ case FELLOWSHIP_MASTER:
+ return "Fellowship Master";
+ case ALT_CURRENCY_MERCHANT:
+ return "Alternate Currency Merchant";
+ case MERCERNARY_MASTER:
+ return "Mercenary Liaison";
default:
return "Unknown";
}
diff --git a/common/classes.h b/common/classes.h
index f63758937..a35014d94 100644
--- a/common/classes.h
+++ b/common/classes.h
@@ -61,6 +61,7 @@
#define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far..
#define TRIBUTE_MASTER 63
#define GUILD_TRIBUTE_MASTER 64 // not sure
+#define GUILD_BANKER 66
#define NORRATHS_KEEPERS_MERCHANT 67
#define DARK_REIGN_MERCHANT 68
#define FELLOWSHIP_MASTER 69
diff --git a/common/cli/eqemu_command_handler.cpp b/common/cli/eqemu_command_handler.cpp
index 96ed5a155..3162d400a 100644
--- a/common/cli/eqemu_command_handler.cpp
+++ b/common/cli/eqemu_command_handler.cpp
@@ -77,7 +77,7 @@ namespace EQEmuCommand {
index++;
}
- if (!arguments_filled || argc == 2) {
+ if (!arguments_filled || argc == 2 || cmd[{"-h", "--help"}]) {
std::string arguments_string;
for (auto &arg : arguments) {
arguments_string += " " + arg;
@@ -101,7 +101,7 @@ namespace EQEmuCommand {
std::cout << command_string.str() << std::endl;
- exit(1);
+ exit(0);
}
}
@@ -168,6 +168,11 @@ namespace EQEmuCommand {
* Print section header
*/
std::string command_prefix = it.first.substr(0, it.first.find(":"));
+
+ if (command_prefix.find("test") != std::string::npos) {
+ continue;
+ }
+
if (command_section != command_prefix) {
command_section = command_prefix;
std::cout << termcolor::reset << command_prefix << std::endl;
@@ -183,11 +188,11 @@ namespace EQEmuCommand {
std::cout << std::endl;
- std::exit(1);
+ std::exit(0);
}
if (ran_command) {
- std::exit(1);
+ std::exit(0);
}
}
diff --git a/common/compression.cpp b/common/compression.cpp
index c56d9bf6a..07fe13d65 100644
--- a/common/compression.cpp
+++ b/common/compression.cpp
@@ -3,7 +3,7 @@
#include
#include
-namespace EQEmu
+namespace EQ
{
uint32 EstimateDeflateBuffer(uint32 len) {
z_stream zstream;
diff --git a/common/compression.h b/common/compression.h
index cc2fac264..20a4103be 100644
--- a/common/compression.h
+++ b/common/compression.h
@@ -1,6 +1,6 @@
#pragma once
-namespace EQEmu
+namespace EQ
{
uint32 EstimateDeflateBuffer(uint32 len);
uint32 DeflateData(const char *buffer, uint32 len, char *out_buffer, uint32 out_len_max);
diff --git a/common/content/world_content_service.cpp b/common/content/world_content_service.cpp
new file mode 100644
index 000000000..feb0f5b76
--- /dev/null
+++ b/common/content/world_content_service.cpp
@@ -0,0 +1,120 @@
+/**
+ * EQEmulator: Everquest Server Emulator
+ * Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY except by those people which sell it, which
+ * are required to give you total support for your newly bought product;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "world_content_service.h"
+#include "../database.h"
+#include "../rulesys.h"
+#include "../eqemu_logsys.h"
+#include "../repositories/content_flags_repository.h"
+
+
+WorldContentService::WorldContentService()
+{
+ SetCurrentExpansion(Expansion::EXPANSION_ALL);
+}
+
+int WorldContentService::GetCurrentExpansion() const
+{
+ return current_expansion;
+}
+
+void WorldContentService::SetExpansionContext()
+{
+ int expansion = RuleI(Expansion, CurrentExpansion);
+ if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
+ content_service.SetCurrentExpansion(expansion);
+ }
+
+ LogInfo(
+ "Current expansion is [{}] ({})",
+ GetCurrentExpansion(),
+ GetCurrentExpansionName()
+ );
+}
+
+std::string WorldContentService::GetCurrentExpansionName()
+{
+ if (content_service.GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
+ return "All Expansions";
+ }
+
+ if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) {
+ return Expansion::ExpansionName[content_service.GetCurrentExpansion()];
+ }
+
+ return "Unknown Expansion";
+}
+
+/**
+ * @param current_expansion
+ */
+void WorldContentService::SetCurrentExpansion(int current_expansion)
+{
+ WorldContentService::current_expansion = current_expansion;
+}
+
+/**
+ * @return
+ */
+const std::vector &WorldContentService::GetContentFlags() const
+{
+ return content_flags;
+}
+
+/**
+ * @param content_flags
+ */
+void WorldContentService::SetContentFlags(std::vector content_flags)
+{
+ WorldContentService::content_flags = content_flags;
+}
+
+/**
+ * @param content_flag
+ * @return
+ */
+bool WorldContentService::IsContentFlagEnabled(const std::string& content_flag)
+{
+ for (auto &flag : GetContentFlags()) {
+ if (flag == content_flag) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void WorldContentService::ReloadContentFlags(Database &db)
+{
+ std::vector set_content_flags;
+ auto content_flags = ContentFlagsRepository::GetWhere(db, "enabled = 1");
+
+ set_content_flags.reserve(content_flags.size());
+ for (auto &flags: content_flags) {
+ set_content_flags.push_back(flags.flag_name);
+ }
+
+ LogInfo(
+ "Enabled content flags [{}]",
+ implode(", ", set_content_flags)
+ );
+
+ SetContentFlags(set_content_flags);
+}
diff --git a/common/content/world_content_service.h b/common/content/world_content_service.h
new file mode 100644
index 000000000..47220b349
--- /dev/null
+++ b/common/content/world_content_service.h
@@ -0,0 +1,176 @@
+/**
+ * EQEmulator: Everquest Server Emulator
+ * Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY except by those people which sell it, which
+ * are required to give you total support for your newly bought product;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef EQEMU_WORLD_CONTENT_SERVICE_H
+#define EQEMU_WORLD_CONTENT_SERVICE_H
+
+#include
+#include
+
+class Database;
+
+namespace Expansion {
+ static const int EXPANSION_ALL = -1;
+ static const int EXPANSION_FILTER_MAX = 99;
+
+ enum ExpansionNumber {
+ Classic = 0,
+ TheRuinsOfKunark,
+ TheScarsOfVelious,
+ TheShadowsOfLuclin,
+ ThePlanesOfPower,
+ TheLegacyOfYkesha,
+ LostDungeonsOfNorrath,
+ GatesOfDiscord,
+ OmensOfWar,
+ DragonsOfNorrath,
+ DepthsOfDarkhollow,
+ ProphecyOfRo,
+ TheSerpentsSpine,
+ TheBuriedSea,
+ SecretsOfFaydwer,
+ SeedsOfDestruction,
+ Underfoot,
+ HouseOfThule,
+ VeilOfAlaris,
+ RainOfFear,
+ CallOfTheForsaken,
+ TheDarkendSea,
+ TheBrokenMirror,
+ EmpiresOfKunark,
+ RingOfScale,
+ TheBurningLands,
+ TormentOfVelious,
+ MaxId
+ };
+
+ /**
+ * If you add to this, make sure you update LogCategory
+ */
+ static const char *ExpansionName[ExpansionNumber::MaxId] = {
+ "Classic",
+ "The Ruins of Kunark",
+ "The Scars of Velious",
+ "The Shadows of Luclin",
+ "The Planes of Power",
+ "The Legacy of Ykesha",
+ "Lost Dungeons of Norrath",
+ "Gates of Discord",
+ "Omens of War",
+ "Dragons of Norrath",
+ "Depths of Darkhollow",
+ "Prophecy of Ro",
+ "The Serpent's Spine",
+ "The Buried Sea",
+ "Secrets of Faydwer",
+ "Seeds of Destruction",
+ "Underfoot",
+ "House of Thule",
+ "Veil of Alaris",
+ "Rain of Fear",
+ "Call of the Forsaken",
+ "The Darkened Sea",
+ "The Broken Mirror",
+ "Empires of Kunark",
+ "Ring of Scale",
+ "The Burning Lands",
+ "Torment of Velious",
+ };
+}
+
+class WorldContentService {
+public:
+
+ WorldContentService();
+
+ std::string GetCurrentExpansionName();
+ int GetCurrentExpansion() const;
+ void SetCurrentExpansion(int current_expansion);
+
+ bool IsClassicEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Classic || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheRuinsOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheRuinsOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheScarsOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheScarsOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheShadowsOfLuclinEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheShadowsOfLuclin || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsThePlanesOfPowerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ThePlanesOfPower || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheLegacyOfYkeshaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheLegacyOfYkesha || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsLostDungeonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::LostDungeonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsGatesOfDiscordEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::GatesOfDiscord || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsOmensOfWarEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::OmensOfWar || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsDragonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DragonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsDepthsOfDarkhollowEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DepthsOfDarkhollow || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsProphecyOfRoEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ProphecyOfRo || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheSerpentsSpineEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheSerpentsSpine || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheBuriedSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBuriedSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsSecretsOfFaydwerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SecretsOfFaydwer || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsSeedsOfDestructionEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SeedsOfDestruction || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsUnderfootEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Underfoot || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsHouseOfThuleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::HouseOfThule || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsVeilOfAlarisEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::VeilOfAlaris || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsRainOfFearEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RainOfFear || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsCallOfTheForsakenEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::CallOfTheForsaken || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheDarkendSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheDarkendSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheBrokenMirrorEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBrokenMirror || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsEmpiresOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::EmpiresOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsRingOfScaleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RingOfScale || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTheBurningLandsEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBurningLands || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+ bool IsTormentOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TormentOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
+
+ bool IsCurrentExpansionClassic() { return current_expansion == Expansion::ExpansionNumber::Classic; }
+ bool IsCurrentExpansionTheRuinsOfKunark() { return current_expansion == Expansion::ExpansionNumber::TheRuinsOfKunark; }
+ bool IsCurrentExpansionTheScarsOfVelious() { return current_expansion == Expansion::ExpansionNumber::TheScarsOfVelious; }
+ bool IsCurrentExpansionTheShadowsOfLuclin() { return current_expansion == Expansion::ExpansionNumber::TheShadowsOfLuclin; }
+ bool IsCurrentExpansionThePlanesOfPower() { return current_expansion == Expansion::ExpansionNumber::ThePlanesOfPower; }
+ bool IsCurrentExpansionTheLegacyOfYkesha() { return current_expansion == Expansion::ExpansionNumber::TheLegacyOfYkesha; }
+ bool IsCurrentExpansionLostDungeonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::LostDungeonsOfNorrath; }
+ bool IsCurrentExpansionGatesOfDiscord() { return current_expansion == Expansion::ExpansionNumber::GatesOfDiscord; }
+ bool IsCurrentExpansionOmensOfWar() { return current_expansion == Expansion::ExpansionNumber::OmensOfWar; }
+ bool IsCurrentExpansionDragonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::DragonsOfNorrath; }
+ bool IsCurrentExpansionDepthsOfDarkhollow() { return current_expansion == Expansion::ExpansionNumber::DepthsOfDarkhollow; }
+ bool IsCurrentExpansionProphecyOfRo() { return current_expansion == Expansion::ExpansionNumber::ProphecyOfRo; }
+ bool IsCurrentExpansionTheSerpentsSpine() { return current_expansion == Expansion::ExpansionNumber::TheSerpentsSpine; }
+ bool IsCurrentExpansionTheBuriedSea() { return current_expansion == Expansion::ExpansionNumber::TheBuriedSea; }
+ bool IsCurrentExpansionSecretsOfFaydwer() { return current_expansion == Expansion::ExpansionNumber::SecretsOfFaydwer; }
+ bool IsCurrentExpansionSeedsOfDestruction() { return current_expansion == Expansion::ExpansionNumber::SeedsOfDestruction; }
+ bool IsCurrentExpansionUnderfoot() { return current_expansion == Expansion::ExpansionNumber::Underfoot; }
+ bool IsCurrentExpansionHouseOfThule() { return current_expansion == Expansion::ExpansionNumber::HouseOfThule; }
+ bool IsCurrentExpansionVeilOfAlaris() { return current_expansion == Expansion::ExpansionNumber::VeilOfAlaris; }
+ bool IsCurrentExpansionRainOfFear() { return current_expansion == Expansion::ExpansionNumber::RainOfFear; }
+ bool IsCurrentExpansionCallOfTheForsaken() { return current_expansion == Expansion::ExpansionNumber::CallOfTheForsaken; }
+ bool IsCurrentExpansionTheDarkendSea() { return current_expansion == Expansion::ExpansionNumber::TheDarkendSea; }
+ bool IsCurrentExpansionTheBrokenMirror() { return current_expansion == Expansion::ExpansionNumber::TheBrokenMirror; }
+ bool IsCurrentExpansionEmpiresOfKunark() { return current_expansion == Expansion::ExpansionNumber::EmpiresOfKunark; }
+ bool IsCurrentExpansionRingOfScale() { return current_expansion == Expansion::ExpansionNumber::RingOfScale; }
+ bool IsCurrentExpansionTheBurningLands() { return current_expansion == Expansion::ExpansionNumber::TheBurningLands; }
+ bool IsCurrentExpansionTormentOfVelious() { return current_expansion == Expansion::ExpansionNumber::TormentOfVelious; }
+
+private:
+ int current_expansion{};
+ std::vector content_flags;
+public:
+ const std::vector &GetContentFlags() const;
+ bool IsContentFlagEnabled(const std::string& content_flag);
+ void SetContentFlags(std::vector content_flags);
+ void ReloadContentFlags(Database &db);
+ void SetExpansionContext();
+};
+
+extern WorldContentService content_service;
+
+#endif //EQEMU_WORLD_CONTENT_SERVICE_H
diff --git a/common/crash.cpp b/common/crash.cpp
index 155bfcf2a..cecb52f02 100644
--- a/common/crash.cpp
+++ b/common/crash.cpp
@@ -118,6 +118,11 @@ void set_exception_handler() {
#include
#include
+#ifdef __FreeBSD__
+#include
+#include
+#endif
+
void print_trace()
{
auto uid = geteuid();
diff --git a/common/cron/croncpp.h b/common/cron/croncpp.h
new file mode 100644
index 000000000..5a22a7f72
--- /dev/null
+++ b/common/cron/croncpp.h
@@ -0,0 +1,876 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#if __cplusplus > 201402L
+#include
+#define CRONCPP_IS_CPP17
+#endif
+
+namespace cron
+{
+#ifdef CRONCPP_IS_CPP17
+ #define HAS_STRING_VIEW
+ #define STRING_VIEW std::string_view
+ #define STRING_VIEW_NPOS std::string_view::npos
+ #define CONSTEXPTR constexpr
+#else
+#define STRING_VIEW std::string const &
+#define STRING_VIEW_NPOS std::string::npos
+#define CONSTEXPTR
+#endif
+
+ using cron_int = uint8_t;
+
+ constexpr std::time_t INVALID_TIME = static_cast(-1);
+
+ constexpr size_t INVALID_CRON_INDEX = static_cast(-1);
+
+ class cronexpr;
+
+ namespace detail
+ {
+ enum class cron_field
+ {
+ second,
+ minute,
+ hour_of_day,
+ day_of_week,
+ day_of_month,
+ month,
+ year
+ };
+
+ template
+ static bool find_next(cronexpr const & cex,
+ std::tm& date,
+ size_t const dot);
+ }
+
+ struct bad_cronexpr : public std::runtime_error
+ {
+ public:
+ explicit bad_cronexpr(STRING_VIEW message) :
+ std::runtime_error(message.data())
+ {}
+ };
+
+
+ struct cron_standard_traits
+ {
+ static const cron_int CRON_MIN_SECONDS = 0;
+ static const cron_int CRON_MAX_SECONDS = 59;
+
+ static const cron_int CRON_MIN_MINUTES = 0;
+ static const cron_int CRON_MAX_MINUTES = 59;
+
+ static const cron_int CRON_MIN_HOURS = 0;
+ static const cron_int CRON_MAX_HOURS = 23;
+
+ static const cron_int CRON_MIN_DAYS_OF_WEEK = 0;
+ static const cron_int CRON_MAX_DAYS_OF_WEEK = 6;
+
+ static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
+ static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
+
+ static const cron_int CRON_MIN_MONTHS = 1;
+ static const cron_int CRON_MAX_MONTHS = 12;
+
+ static const cron_int CRON_MAX_YEARS_DIFF = 4;
+
+#ifdef CRONCPP_IS_CPP17
+ static const inline std::vector DAYS = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
+ static const inline std::vector MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
+#else
+ static std::vector& DAYS()
+ {
+ static std::vector days = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
+ return days;
+ }
+
+ static std::vector& MONTHS()
+ {
+ static std::vector months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
+ return months;
+ }
+#endif
+ };
+
+ struct cron_oracle_traits
+ {
+ static const cron_int CRON_MIN_SECONDS = 0;
+ static const cron_int CRON_MAX_SECONDS = 59;
+
+ static const cron_int CRON_MIN_MINUTES = 0;
+ static const cron_int CRON_MAX_MINUTES = 59;
+
+ static const cron_int CRON_MIN_HOURS = 0;
+ static const cron_int CRON_MAX_HOURS = 23;
+
+ static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
+ static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
+
+ static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
+ static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
+
+ static const cron_int CRON_MIN_MONTHS = 0;
+ static const cron_int CRON_MAX_MONTHS = 11;
+
+ static const cron_int CRON_MAX_YEARS_DIFF = 4;
+
+#ifdef CRONCPP_IS_CPP17
+ static const inline std::vector DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
+ static const inline std::vector MONTHS = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
+#else
+
+ static std::vector& DAYS()
+ {
+ static std::vector days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
+ return days;
+ }
+
+ static std::vector& MONTHS()
+ {
+ static std::vector months = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
+ return months;
+ }
+#endif
+ };
+
+ struct cron_quartz_traits
+ {
+ static const cron_int CRON_MIN_SECONDS = 0;
+ static const cron_int CRON_MAX_SECONDS = 59;
+
+ static const cron_int CRON_MIN_MINUTES = 0;
+ static const cron_int CRON_MAX_MINUTES = 59;
+
+ static const cron_int CRON_MIN_HOURS = 0;
+ static const cron_int CRON_MAX_HOURS = 23;
+
+ static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
+ static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
+
+ static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
+ static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
+
+ static const cron_int CRON_MIN_MONTHS = 1;
+ static const cron_int CRON_MAX_MONTHS = 12;
+
+ static const cron_int CRON_MAX_YEARS_DIFF = 4;
+
+#ifdef CRONCPP_IS_CPP17
+ static const inline std::vector DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
+ static const inline std::vector MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
+#else
+ static std::vector& DAYS()
+ {
+ static std::vector days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
+ return days;
+ }
+
+ static std::vector& MONTHS()
+ {
+ static std::vector months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
+ return months;
+ }
+#endif
+ };
+
+ class cronexpr;
+
+ template
+ static cronexpr make_cron(STRING_VIEW expr);
+
+ class cronexpr
+ {
+ std::bitset<60> seconds;
+ std::bitset<60> minutes;
+ std::bitset<24> hours;
+ std::bitset<7> days_of_week;
+ std::bitset<31> days_of_month;
+ std::bitset<12> months;
+
+ friend bool operator==(cronexpr const & e1, cronexpr const & e2);
+ friend bool operator!=(cronexpr const & e1, cronexpr const & e2);
+
+ template
+ friend bool detail::find_next(cronexpr const & cex,
+ std::tm& date,
+ size_t const dot);
+
+ friend std::string to_string(cronexpr const & cex);
+
+ template
+ friend cronexpr make_cron(STRING_VIEW expr);
+ };
+
+ inline bool operator==(cronexpr const & e1, cronexpr const & e2)
+ {
+ return
+ e1.seconds == e2.seconds &&
+ e1.minutes == e2.minutes &&
+ e1.hours == e2.hours &&
+ e1.days_of_week == e2.days_of_week &&
+ e1.days_of_month == e2.days_of_month &&
+ e1.months == e2.months;
+ }
+
+ inline bool operator!=(cronexpr const & e1, cronexpr const & e2)
+ {
+ return !(e1 == e2);
+ }
+
+ inline std::string to_string(cronexpr const & cex)
+ {
+ return
+ cex.seconds.to_string() + " " +
+ cex.minutes.to_string() + " " +
+ cex.hours.to_string() + " " +
+ cex.days_of_month.to_string() + " " +
+ cex.months.to_string() + " " +
+ cex.days_of_week.to_string();
+ }
+
+ namespace utils
+ {
+ inline std::time_t tm_to_time(std::tm& date)
+ {
+ return std::mktime(&date);
+ }
+
+ inline std::tm* time_to_tm(std::time_t const * date, std::tm* const out)
+ {
+#ifdef _WIN32
+ errno_t err = localtime_s(out, date);
+ return 0 == err ? out : nullptr;
+#else
+ return localtime_r(date, out);
+#endif
+ }
+
+ inline std::tm to_tm(STRING_VIEW time)
+ {
+ std::istringstream str(time.data());
+ str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
+
+ std::tm result;
+ str >> std::get_time(&result, "%Y-%m-%d %H:%M:%S");
+ if (str.fail()) throw std::runtime_error("Parsing date failed!");
+
+ result.tm_isdst = -1; // DST info not available
+
+ return result;
+ }
+
+ inline std::string to_string(std::tm const & tm)
+ {
+ std::ostringstream str;
+ str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
+ str << std::put_time(&tm, "%Y-%m-%d %H:%M:%S");
+ if (str.fail()) throw std::runtime_error("Writing date failed!");
+
+ return str.str();
+ }
+
+ inline std::string to_upper(std::string text)
+ {
+ std::transform(std::begin(text), std::end(text),
+ std::begin(text), static_cast(std::toupper));
+
+ return text;
+ }
+
+ static std::vector split(STRING_VIEW text, char const delimiter)
+ {
+ std::vector tokens;
+ std::string token;
+ std::istringstream tokenStream(text.data());
+ while (std::getline(tokenStream, token, delimiter))
+ {
+ tokens.push_back(token);
+ }
+ return tokens;
+ }
+
+ CONSTEXPTR inline bool contains(STRING_VIEW text, char const ch) noexcept
+ {
+ return STRING_VIEW_NPOS != text.find_first_of(ch);
+ }
+ }
+
+ namespace detail
+ {
+
+ inline cron_int to_cron_int(STRING_VIEW text)
+ {
+ try
+ {
+ return static_cast(std::stoul(text.data()));
+ }
+ catch (std::exception const & ex)
+ {
+ throw bad_cronexpr(ex.what());
+ }
+ }
+
+ static std::string replace_ordinals(
+ std::string text,
+ std::vector const & replacement)
+ {
+ for (size_t i = 0; i < replacement.size(); ++i)
+ {
+ auto pos = text.find(replacement[i]);
+ if (std::string::npos != pos)
+ text.replace(pos, 3 ,std::to_string(i));
+ }
+
+ return text;
+ }
+
+ static std::pair make_range(
+ STRING_VIEW field,
+ cron_int const minval,
+ cron_int const maxval)
+ {
+ cron_int first = 0;
+ cron_int last = 0;
+ if (field.size() == 1 && field[0] == '*')
+ {
+ first = minval;
+ last = maxval;
+ }
+ else if (!utils::contains(field, '-'))
+ {
+ first = to_cron_int(field);
+ last = first;
+ }
+ else
+ {
+ auto parts = utils::split(field, '-');
+ if (parts.size() != 2)
+ throw bad_cronexpr("Specified range requires two fields");
+
+ first = to_cron_int(parts[0]);
+ last = to_cron_int(parts[1]);
+ }
+
+ if (first > maxval || last > maxval)
+ {
+ throw bad_cronexpr("Specified range exceeds maximum");
+ }
+ if (first < minval || last < minval)
+ {
+ throw bad_cronexpr("Specified range is less than minimum");
+ }
+ if (first > last)
+ {
+ throw bad_cronexpr("Specified range start exceeds range end");
+ }
+
+ return { first, last };
+ }
+
+ template
+ static void set_cron_field(
+ STRING_VIEW value,
+ std::bitset& target,
+ cron_int const minval,
+ cron_int const maxval)
+ {
+ if(value.length() > 0 && value[value.length()-1] == ',')
+ throw bad_cronexpr("Value cannot end with comma");
+
+ auto fields = utils::split(value, ',');
+ if (fields.empty())
+ throw bad_cronexpr("Expression parsing error");
+
+ for (auto const & field : fields)
+ {
+ if (!utils::contains(field, '/'))
+ {
+#ifdef CRONCPP_IS_CPP17
+ auto[first, last] = detail::make_range(field, minval, maxval);
+#else
+ auto range = detail::make_range(field, minval, maxval);
+ auto first = range.first;
+ auto last = range.second;
+#endif
+ for (cron_int i = first - minval; i <= last - minval; ++i)
+ {
+ target.set(i);
+ }
+ }
+ else
+ {
+ auto parts = utils::split(field, '/');
+ if (parts.size() != 2)
+ throw bad_cronexpr("Incrementer must have two fields");
+
+#ifdef CRONCPP_IS_CPP17
+ auto[first, last] = detail::make_range(parts[0], minval, maxval);
+#else
+ auto range = detail::make_range(parts[0], minval, maxval);
+ auto first = range.first;
+ auto last = range.second;
+#endif
+
+ if (!utils::contains(parts[0], '-'))
+ {
+ last = maxval;
+ }
+
+ auto delta = detail::to_cron_int(parts[1]);
+ if(delta <= 0)
+ throw bad_cronexpr("Incrementer must be a positive value");
+
+ for (cron_int i = first - minval; i <= last - minval; i += delta)
+ {
+ target.set(i);
+ }
+ }
+ }
+ }
+
+ template
+ static void set_cron_days_of_week(
+ std::string value,
+ std::bitset<7>& target)
+ {
+ auto days = utils::to_upper(value);
+ auto days_replaced = detail::replace_ordinals(
+ days,
+#ifdef CRONCPP_IS_CPP17
+ Traits::DAYS
+#else
+ Traits::DAYS()
+#endif
+ );
+
+ if (days_replaced.size() == 1 && days_replaced[0] == '?')
+ days_replaced[0] = '*';
+
+ set_cron_field(
+ days_replaced,
+ target,
+ Traits::CRON_MIN_DAYS_OF_WEEK,
+ Traits::CRON_MAX_DAYS_OF_WEEK);
+ }
+
+ template
+ static void set_cron_days_of_month(
+ std::string value,
+ std::bitset<31>& target)
+ {
+ if (value.size() == 1 && value[0] == '?')
+ value[0] = '*';
+
+ set_cron_field(
+ value,
+ target,
+ Traits::CRON_MIN_DAYS_OF_MONTH,
+ Traits::CRON_MAX_DAYS_OF_MONTH);
+ }
+
+ template
+ static void set_cron_month(
+ std::string value,
+ std::bitset<12>& target)
+ {
+ auto month = utils::to_upper(value);
+ auto month_replaced = replace_ordinals(
+ month,
+#ifdef CRONCPP_IS_CPP17
+ Traits::MONTHS
+#else
+ Traits::MONTHS()
+#endif
+ );
+
+ set_cron_field(
+ month_replaced,
+ target,
+ Traits::CRON_MIN_MONTHS,
+ Traits::CRON_MAX_MONTHS);
+ }
+
+ template
+ inline size_t next_set_bit(
+ std::bitset const & target,
+ size_t /*minimum*/,
+ size_t /*maximum*/,
+ size_t offset)
+ {
+ for (auto i = offset; i < N; ++i)
+ {
+ if (target.test(i)) return i;
+ }
+
+ return INVALID_CRON_INDEX;
+ }
+
+ inline void add_to_field(
+ std::tm& date,
+ cron_field const field,
+ int const val)
+ {
+ switch (field)
+ {
+ case cron_field::second:
+ date.tm_sec += val;
+ break;
+ case cron_field::minute:
+ date.tm_min += val;
+ break;
+ case cron_field::hour_of_day:
+ date.tm_hour += val;
+ break;
+ case cron_field::day_of_week:
+ case cron_field::day_of_month:
+ date.tm_mday += val;
+ break;
+ case cron_field::month:
+ date.tm_mon += val;
+ break;
+ case cron_field::year:
+ date.tm_year += val;
+ break;
+ }
+
+ if (INVALID_TIME == utils::tm_to_time(date))
+ throw bad_cronexpr("Invalid time expression");
+ }
+
+ inline void set_field(
+ std::tm& date,
+ cron_field const field,
+ int const val)
+ {
+ switch (field)
+ {
+ case cron_field::second:
+ date.tm_sec = val;
+ break;
+ case cron_field::minute:
+ date.tm_min = val;
+ break;
+ case cron_field::hour_of_day:
+ date.tm_hour = val;
+ break;
+ case cron_field::day_of_week:
+ date.tm_wday = val;
+ break;
+ case cron_field::day_of_month:
+ date.tm_mday = val;
+ break;
+ case cron_field::month:
+ date.tm_mon = val;
+ break;
+ case cron_field::year:
+ date.tm_year = val;
+ break;
+ }
+
+ if (INVALID_TIME == utils::tm_to_time(date))
+ throw bad_cronexpr("Invalid time expression");
+ }
+
+ inline void reset_field(
+ std::tm& date,
+ cron_field const field)
+ {
+ switch (field)
+ {
+ case cron_field::second:
+ date.tm_sec = 0;
+ break;
+ case cron_field::minute:
+ date.tm_min = 0;
+ break;
+ case cron_field::hour_of_day:
+ date.tm_hour = 0;
+ break;
+ case cron_field::day_of_week:
+ date.tm_wday = 0;
+ break;
+ case cron_field::day_of_month:
+ date.tm_mday = 1;
+ break;
+ case cron_field::month:
+ date.tm_mon = 0;
+ break;
+ case cron_field::year:
+ date.tm_year = 0;
+ break;
+ }
+
+ if (INVALID_TIME == utils::tm_to_time(date))
+ throw bad_cronexpr("Invalid time expression");
+ }
+
+ inline void reset_all_fields(
+ std::tm& date,
+ std::bitset<7> const & marked_fields)
+ {
+ for (size_t i = 0; i < marked_fields.size(); ++i)
+ {
+ if (marked_fields.test(i))
+ reset_field(date, static_cast(i));
+ }
+ }
+
+ inline void mark_field(
+ std::bitset<7> & orders,
+ cron_field const field)
+ {
+ if (!orders.test(static_cast(field)))
+ orders.set(static_cast(field));
+ }
+
+ template
+ static size_t find_next(
+ std::bitset const & target,
+ std::tm& date,
+ unsigned int const minimum,
+ unsigned int const maximum,
+ unsigned int const value,
+ cron_field const field,
+ cron_field const next_field,
+ std::bitset<7> const & marked_fields)
+ {
+ auto next_value = next_set_bit(target, minimum, maximum, value);
+ if (INVALID_CRON_INDEX == next_value)
+ {
+ add_to_field(date, next_field, 1);
+ reset_field(date, field);
+ next_value = next_set_bit(target, minimum, maximum, 0);
+ }
+
+ if (INVALID_CRON_INDEX == next_value || next_value != value)
+ {
+ set_field(date, field, static_cast(next_value));
+ reset_all_fields(date, marked_fields);
+ }
+
+ return next_value;
+ }
+
+ template
+ static size_t find_next_day(
+ std::tm& date,
+ std::bitset<31> const & days_of_month,
+ size_t day_of_month,
+ std::bitset<7> const & days_of_week,
+ size_t day_of_week,
+ std::bitset<7> const & marked_fields)
+ {
+ unsigned int count = 0;
+ unsigned int maximum = 366;
+ while (
+ (!days_of_month.test(day_of_month - Traits::CRON_MIN_DAYS_OF_MONTH) ||
+ !days_of_week.test(day_of_week - Traits::CRON_MIN_DAYS_OF_WEEK))
+ && count++ < maximum)
+ {
+ add_to_field(date, cron_field::day_of_month, 1);
+
+ day_of_month = date.tm_mday;
+ day_of_week = date.tm_wday;
+
+ reset_all_fields(date, marked_fields);
+ }
+
+ return day_of_month;
+ }
+
+ template
+ static bool find_next(cronexpr const & cex,
+ std::tm& date,
+ size_t const dot)
+ {
+ bool res = true;
+
+ std::bitset<7> marked_fields{ 0 };
+ std::bitset<7> empty_list{ 0 };
+
+ unsigned int second = date.tm_sec;
+ auto updated_second = find_next(
+ cex.seconds,
+ date,
+ Traits::CRON_MIN_SECONDS,
+ Traits::CRON_MAX_SECONDS,
+ second,
+ cron_field::second,
+ cron_field::minute,
+ empty_list);
+
+ if (second == updated_second)
+ {
+ mark_field(marked_fields, cron_field::second);
+ }
+
+ unsigned int minute = date.tm_min;
+ auto update_minute = find_next(
+ cex.minutes,
+ date,
+ Traits::CRON_MIN_MINUTES,
+ Traits::CRON_MAX_MINUTES,
+ minute,
+ cron_field::minute,
+ cron_field::hour_of_day,
+ marked_fields);
+ if (minute == update_minute)
+ {
+ mark_field(marked_fields, cron_field::minute);
+ }
+ else
+ {
+ res = find_next(cex, date, dot);
+ if (!res) return res;
+ }
+
+ unsigned int hour = date.tm_hour;
+ auto updated_hour = find_next(
+ cex.hours,
+ date,
+ Traits::CRON_MIN_HOURS,
+ Traits::CRON_MAX_HOURS,
+ hour,
+ cron_field::hour_of_day,
+ cron_field::day_of_week,
+ marked_fields);
+ if (hour == updated_hour)
+ {
+ mark_field(marked_fields, cron_field::hour_of_day);
+ }
+ else
+ {
+ res = find_next(cex, date, dot);
+ if (!res) return res;
+ }
+
+ unsigned int day_of_week = date.tm_wday;
+ unsigned int day_of_month = date.tm_mday;
+ auto updated_day_of_month = find_next_day(
+ date,
+ cex.days_of_month,
+ day_of_month,
+ cex.days_of_week,
+ day_of_week,
+ marked_fields);
+ if (day_of_month == updated_day_of_month)
+ {
+ mark_field(marked_fields, cron_field::day_of_month);
+ }
+ else
+ {
+ res = find_next(cex, date, dot);
+ if (!res) return res;
+ }
+
+ unsigned int month = date.tm_mon;
+ auto updated_month = find_next(
+ cex.months,
+ date,
+ Traits::CRON_MIN_MONTHS,
+ Traits::CRON_MAX_MONTHS,
+ month,
+ cron_field::month,
+ cron_field::year,
+ marked_fields);
+ if (month != updated_month)
+ {
+ if (date.tm_year - dot > Traits::CRON_MAX_YEARS_DIFF)
+ return false;
+
+ res = find_next(cex, date, dot);
+ if (!res) return res;
+ }
+
+ return res;
+ }
+ }
+
+ template
+ static cronexpr make_cron(STRING_VIEW expr)
+ {
+ cronexpr cex;
+
+ if (expr.empty())
+ throw bad_cronexpr("Invalid empty cron expression");
+
+ auto fields = utils::split(expr, ' ');
+ fields.erase(
+ std::remove_if(std::begin(fields), std::end(fields),
+ [](STRING_VIEW s) {return s.empty(); }),
+ std::end(fields));
+ if (fields.size() != 6)
+ throw bad_cronexpr("cron expression must have six fields");
+
+ detail::set_cron_field(fields[0], cex.seconds, Traits::CRON_MIN_SECONDS, Traits::CRON_MAX_SECONDS);
+ detail::set_cron_field(fields[1], cex.minutes, Traits::CRON_MIN_MINUTES, Traits::CRON_MAX_MINUTES);
+ detail::set_cron_field(fields[2], cex.hours, Traits::CRON_MIN_HOURS, Traits::CRON_MAX_HOURS);
+
+ detail::set_cron_days_of_week(fields[5], cex.days_of_week);
+
+ detail::set_cron_days_of_month(fields[3], cex.days_of_month);
+
+ detail::set_cron_month(fields[4], cex.months);
+
+ return cex;
+ }
+
+ template
+ static std::tm cron_next(cronexpr const & cex, std::tm date)
+ {
+ time_t original = utils::tm_to_time(date);
+ if (INVALID_TIME == original) return {};
+
+ if (!detail::find_next(cex, date, date.tm_year))
+ return {};
+
+ time_t calculated = utils::tm_to_time(date);
+ if (INVALID_TIME == calculated) return {};
+
+ if (calculated == original)
+ {
+ add_to_field(date, detail::cron_field::second, 1);
+ if (!detail::find_next(cex, date, date.tm_year))
+ return {};
+ }
+
+ return date;
+ }
+
+ template
+ static std::time_t cron_next(cronexpr const & cex, std::time_t const & date)
+ {
+ std::tm val;
+ std::tm* dt = utils::time_to_tm(&date, &val);
+ if (dt == nullptr) return INVALID_TIME;
+
+ time_t original = utils::tm_to_time(*dt);
+ if (INVALID_TIME == original) return INVALID_TIME;
+
+ if(!detail::find_next(cex, *dt, dt->tm_year))
+ return INVALID_TIME;
+
+ time_t calculated = utils::tm_to_time(*dt);
+ if (INVALID_TIME == calculated) return calculated;
+
+ if (calculated == original)
+ {
+ add_to_field(*dt, detail::cron_field::second, 1);
+ if(!detail::find_next(cex, *dt, dt->tm_year))
+ return INVALID_TIME;
+ }
+
+ return utils::tm_to_time(*dt);
+ }
+}
diff --git a/common/data_verification.h b/common/data_verification.h
index c56f3ce04..07a4b3bf0 100644
--- a/common/data_verification.h
+++ b/common/data_verification.h
@@ -23,7 +23,7 @@
#include
#include
-namespace EQEmu {
+namespace EQ {
template
T Clamp(const T &value, const T &lower, const T &upper)
{
diff --git a/common/database.cpp b/common/database.cpp
index b3a4c0bf4..385f07c18 100644
--- a/common/database.cpp
+++ b/common/database.cpp
@@ -61,15 +61,15 @@ Database::Database(const char* host, const char* user, const char* passwd, const
Connect(host, user, passwd, database, port);
}
-bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) {
+bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label) {
uint32 errnum= 0;
char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
- LogError("Failed to connect to database: Error: {}", errbuf);
+ LogError("[MySQL] Connection [{}] Failed to connect to database: Error [{}]", connection_label, errbuf);
return false;
}
else {
- LogInfo("Using database [{}] at [{}]:[{}]", database, host,port);
+ LogInfo("[MySQL] Connection [{}] database [{}] at [{}]:[{}]", connection_label, database, host,port);
return true;
}
}
@@ -339,7 +339,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name);
results = QueryDatabase(query);
if (!results.Success() || results.ErrorMessage() != ""){ return false; }
-
+
// Put character into the default guild if rule is being used.
int guild_id = RuleI(Character, DefaultGuild);
@@ -353,7 +353,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
}
}
}
-
+
return true;
}
@@ -512,96 +512,96 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
"guild_auto_consent,"
"RestTimer) "
"VALUES ("
- "%u," // id
- "%u," // account_id
- "'%s'," // `name`
- "'%s'," // last_name
- "%u," // gender
- "%u," // race
- "%u," // class
- "%u," // `level`
- "%u," // deity
- "%u," // birthday
- "%u," // last_login
- "%u," // time_played
- "%u," // pvp_status
- "%u," // level2
- "%u," // anon
- "%u," // gm
- "%u," // intoxication
- "%u," // hair_color
- "%u," // beard_color
- "%u," // eye_color_1
- "%u," // eye_color_2
- "%u," // hair_style
- "%u," // beard
- "%u," // ability_time_seconds
- "%u," // ability_number
- "%u," // ability_time_minutes
- "%u," // ability_time_hours
- "'%s'," // title
- "'%s'," // suffix
- "%u," // exp
- "%u," // points
- "%u," // mana
- "%u," // cur_hp
- "%u," // str
- "%u," // sta
- "%u," // cha
- "%u," // dex
- "%u," // `int`
- "%u," // agi
- "%u," // wis
- "%u," // face
- "%f," // y
- "%f," // x
- "%f," // z
- "%f," // heading
- "%u," // pvp2
- "%u," // pvp_type
- "%u," // autosplit_enabled
- "%u," // zone_change_count
- "%u," // drakkin_heritage
- "%u," // drakkin_tattoo
- "%u," // drakkin_details
- "%i," // toxicity
- "%i," // hunger_level
- "%i," // thirst_level
- "%u," // ability_up
- "%u," // zone_id
- "%u," // zone_instance
- "%u," // leadership_exp_on
- "%u," // ldon_points_guk
- "%u," // ldon_points_mir
- "%u," // ldon_points_mmc
- "%u," // ldon_points_ruj
- "%u," // ldon_points_tak
- "%u," // ldon_points_available
+ "%u," // id
+ "%u," // account_id
+ "'%s'," // `name`
+ "'%s'," // last_name
+ "%u," // gender
+ "%u," // race
+ "%u," // class
+ "%u," // `level`
+ "%u," // deity
+ "%u," // birthday
+ "%u," // last_login
+ "%u," // time_played
+ "%u," // pvp_status
+ "%u," // level2
+ "%u," // anon
+ "%u," // gm
+ "%u," // intoxication
+ "%u," // hair_color
+ "%u," // beard_color
+ "%u," // eye_color_1
+ "%u," // eye_color_2
+ "%u," // hair_style
+ "%u," // beard
+ "%u," // ability_time_seconds
+ "%u," // ability_number
+ "%u," // ability_time_minutes
+ "%u," // ability_time_hours
+ "'%s'," // title
+ "'%s'," // suffix
+ "%u," // exp
+ "%u," // points
+ "%u," // mana
+ "%u," // cur_hp
+ "%u," // str
+ "%u," // sta
+ "%u," // cha
+ "%u," // dex
+ "%u," // `int`
+ "%u," // agi
+ "%u," // wis
+ "%u," // face
+ "%f," // y
+ "%f," // x
+ "%f," // z
+ "%f," // heading
+ "%u," // pvp2
+ "%u," // pvp_type
+ "%u," // autosplit_enabled
+ "%u," // zone_change_count
+ "%u," // drakkin_heritage
+ "%u," // drakkin_tattoo
+ "%u," // drakkin_details
+ "%i," // toxicity
+ "%i," // hunger_level
+ "%i," // thirst_level
+ "%u," // ability_up
+ "%u," // zone_id
+ "%u," // zone_instance
+ "%u," // leadership_exp_on
+ "%u," // ldon_points_guk
+ "%u," // ldon_points_mir
+ "%u," // ldon_points_mmc
+ "%u," // ldon_points_ruj
+ "%u," // ldon_points_tak
+ "%u," // ldon_points_available
"%u," // tribute_time_remaining
- "%u," // show_helm
- "%u," // career_tribute_points
- "%u," // tribute_points
- "%u," // tribute_active
- "%u," // endurance
- "%u," // group_leadership_exp
- "%u," // raid_leadership_exp
+ "%u," // show_helm
+ "%u," // career_tribute_points
+ "%u," // tribute_points
+ "%u," // tribute_active
+ "%u," // endurance
+ "%u," // group_leadership_exp
+ "%u," // raid_leadership_exp
"%u," // group_leadership_point
"%u," // raid_leadership_points
- "%u," // air_remaining
- "%u," // pvp_kills
- "%u," // pvp_deaths
- "%u," // pvp_current_points
- "%u," // pvp_career_points
- "%u," // pvp_best_kill_streak
+ "%u," // air_remaining
+ "%u," // pvp_kills
+ "%u," // pvp_deaths
+ "%u," // pvp_current_points
+ "%u," // pvp_career_points
+ "%u," // pvp_best_kill_streak
"%u," // pvp_worst_death_streak
"%u," // pvp_current_kill_strea
- "%u," // aa_points_spent
- "%u," // aa_exp
- "%u," // aa_points
- "%u," // group_auto_consent
- "%u," // raid_auto_consent
- "%u," // guild_auto_consent
- "%u" // RestTimer
+ "%u," // aa_points_spent
+ "%u," // aa_exp
+ "%u," // aa_points
+ "%u," // group_auto_consent
+ "%u," // raid_auto_consent
+ "%u," // guild_auto_consent
+ "%u" // RestTimer
")",
character_id, // " id, "
account_id, // " account_id, "
@@ -703,11 +703,11 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
"(%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i)",
- character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
- character_id, pp->binds[1].zoneId, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
- character_id, pp->binds[2].zoneId, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
- character_id, pp->binds[3].zoneId, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
- character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
+ character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
+ character_id, pp->binds[1].zone_id, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
+ character_id, pp->binds[2].zone_id, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
+ character_id, pp->binds[3].zone_id, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
+ character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
); results = QueryDatabase(query);
/* HoTT Ability */
@@ -870,6 +870,42 @@ void Database::GetCharName(uint32 char_id, char* name) {
}
}
+std::string Database::GetCharNameByID(uint32 char_id) {
+ std::string query = fmt::format("SELECT `name` FROM `character_data` WHERE id = {}", char_id);
+ auto results = QueryDatabase(query);
+ std::string res;
+
+ if (!results.Success()) {
+ return res;
+ }
+
+ if (results.RowCount() == 0) {
+ return res;
+ }
+
+ auto row = results.begin();
+ res = row[0];
+ return res;
+}
+
+std::string Database::GetNPCNameByID(uint32 npc_id) {
+ std::string query = fmt::format("SELECT `name` FROM `npc_types` WHERE id = {}", npc_id);
+ auto results = QueryDatabase(query);
+ std::string res;
+
+ if (!results.Success()) {
+ return res;
+ }
+
+ if (results.RowCount() == 0) {
+ return res;
+ }
+
+ auto row = results.begin();
+ res = row[0];
+ return res;
+}
+
bool Database::LoadVariables() {
auto results = QueryDatabase(StringFormat("SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache.last_update));
@@ -939,10 +975,24 @@ bool Database::SetVariable(const std::string varname, const std::string &varvalu
}
// 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) {
+bool Database::GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x, float* safe_y, float* safe_z, float* safe_heading, int16* min_status, uint8* min_level, char *flag_needed) {
- std::string query = StringFormat("SELECT safe_x, safe_y, safe_z, min_status, min_level, flag_needed FROM zone "
- " WHERE short_name='%s' AND (version=%i OR version=0) ORDER BY version DESC", short_name, version);
+ if (zone_short_name == nullptr)
+ return false;
+
+ std::string query = fmt::format(
+ SQL(
+ SELECT
+ `safe_x`, `safe_y`, `safe_z`, `safe_heading`, `min_status`, `min_level`, `flag_needed`
+ FROM
+ zone
+ WHERE
+ `short_name` = '{}'
+ AND
+ (`version` = {} OR `version` = 0)
+ ORDER BY `version` DESC
+ ), zone_short_name, instance_version
+ );
auto results = QueryDatabase(query);
if (!results.Success())
@@ -955,16 +1005,24 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe
if (safe_x != nullptr)
*safe_x = atof(row[0]);
+
if (safe_y != nullptr)
*safe_y = atof(row[1]);
+
if (safe_z != nullptr)
*safe_z = atof(row[2]);
- if (minstatus != nullptr)
- *minstatus = atoi(row[3]);
- if (minlevel != nullptr)
- *minlevel = atoi(row[4]);
+
+ if (safe_heading != nullptr)
+ *safe_heading = atof(row[3]);
+
+ if (min_status != nullptr)
+ *min_status = atoi(row[4]);
+
+ if (min_level != nullptr)
+ *min_level = atoi(row[5]);
+
if (flag_needed != nullptr)
- strcpy(flag_needed, row[5]);
+ strcpy(flag_needed, row[6]);
return true;
}
@@ -1050,50 +1108,6 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
return true;
}
-bool Database::LoadZoneNames() {
- std::string query("SELECT zoneidnumber, short_name FROM zone");
-
- auto results = QueryDatabase(query);
-
- if (!results.Success())
- {
- return false;
- }
-
- for (auto row= results.begin();row != results.end();++row)
- {
- uint32 zoneid = atoi(row[0]);
- std::string zonename = row[1];
- zonename_array.insert(std::pair(zoneid,zonename));
- }
-
- return true;
-}
-
-uint32 Database::GetZoneID(const char* zonename) {
-
- if (zonename == nullptr)
- return 0;
-
- for (auto & iter : zonename_array)
- if (strcasecmp(iter.second.c_str(), zonename) == 0)
- return iter.first;
-
- return 0;
-}
-
-const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
- auto iter = zonename_array.find(zoneID);
-
- if (iter != zonename_array.end())
- return iter->second.c_str();
-
- if (ErrorUnknown)
- return "UNKNOWN";
-
- return 0;
-}
-
uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version);
@@ -1310,29 +1324,31 @@ uint8 Database::GetServerType() {
return atoi(row[0]);
}
-bool Database::MoveCharacterToZone(const char* charname, const char* zonename, uint32 zoneid) {
- if(zonename == nullptr || strlen(zonename) == 0)
- return false;
+bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
+{
+ std::string query = StringFormat(
+ "UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i",
+ zone_id,
+ character_id
+ );
- std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'", zoneid, charname);
auto results = QueryDatabase(query);
if (!results.Success()) {
return false;
}
- if (results.RowsAffected() == 0)
- return false;
-
- return true;
+ return results.RowsAffected() != 0;
}
-bool Database::MoveCharacterToZone(const char* charname, const char* zonename) {
- return MoveCharacterToZone(charname, zonename, GetZoneID(zonename));
-}
+bool Database::MoveCharacterToZone(const char *charname, uint32 zone_id)
+{
+ std::string query = StringFormat(
+ "UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'",
+ zone_id,
+ charname
+ );
-bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) {
- std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i", GetZoneID(iZonename), iCharID);
auto results = QueryDatabase(query);
if (!results.Success()) {
@@ -1366,6 +1382,20 @@ bool Database::SetMQDetectionFlag(const char* accountname, const char* character
return results.RowsAffected() != 0;
}
+bool Database::SetMQDetectionFlag(const char* accountname, const char* charactername, const std::string &hacked, const char* zone) {
+ //Utilize the "hacker" table, but also give zone information.
+ auto query = fmt::format("INSERT INTO hackers(account, name, hacked, zone) values('{}', '{}', '{}', '{}')",
+ accountname, charactername, hacked, zone);
+ auto results = QueryDatabase(query);
+
+ if (!results.Success())
+ {
+ return false;
+ }
+
+ return results.RowsAffected() != 0;
+}
+
uint8 Database::GetRaceSkill(uint8 skillid, uint8 in_race)
{
uint16 race_cap = 0;
@@ -2318,3 +2348,142 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
return 0;
}
+
+/**
+ * @param source_character_name
+ * @param destination_character_name
+ * @param destination_account_name
+ * @return
+ */
+bool Database::CopyCharacter(
+ std::string source_character_name,
+ std::string destination_character_name,
+ std::string destination_account_name
+)
+{
+ auto results = QueryDatabase(
+ fmt::format(
+ "SELECT id FROM character_data WHERE name = '{}' and deleted_at is NULL LIMIT 1",
+ source_character_name
+ )
+ );
+
+ if (results.RowCount() == 0) {
+ LogError("No character found with name [{}]", source_character_name);
+ }
+
+ auto row = results.begin();
+ std::string source_character_id = row[0];
+
+ results = QueryDatabase(
+ fmt::format(
+ "SELECT id FROM account WHERE name = '{}' LIMIT 1",
+ destination_account_name
+ )
+ );
+
+ if (results.RowCount() == 0) {
+ LogError("No account found with name [{}]", destination_account_name);
+ }
+
+ row = results.begin();
+ std::string source_account_id = row[0];
+
+ /**
+ * Fresh ID
+ */
+ results = QueryDatabase("SELECT (MAX(id) + 1) as new_id from character_data");
+ row = results.begin();
+ std::string new_character_id = row[0];
+
+ TransactionBegin();
+ for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
+ std::string table_name = iter.first;
+ std::string character_id_column_name = iter.second;
+
+ /**
+ * Columns
+ */
+ results = QueryDatabase(fmt::format("SHOW COLUMNS FROM {}", table_name));
+ std::vector columns = {};
+ int column_count = 0;
+ for (row = results.begin(); row != results.end(); ++row) {
+ columns.emplace_back(row[0]);
+ column_count++;
+ }
+
+ results = QueryDatabase(
+ fmt::format(
+ "SELECT {} FROM {} WHERE {} = {}",
+ implode(",", wrap(columns, "`")),
+ table_name,
+ character_id_column_name,
+ source_character_id
+ )
+ );
+
+ std::vector> new_rows;
+ for (row = results.begin(); row != results.end(); ++row) {
+ std::vector new_values = {};
+ for (int column_index = 0; column_index < column_count; column_index++) {
+ std::string column = columns[column_index];
+ std::string value = row[column_index] ? row[column_index] : "null";
+
+ if (column == character_id_column_name) {
+ value = new_character_id;
+ }
+
+ if (column == "name" && table_name == "character_data") {
+ value = destination_character_name;
+ }
+
+ if (column == "account_id" && table_name == "character_data") {
+ value = source_account_id;
+ }
+
+ new_values.emplace_back(value);
+ }
+
+ new_rows.emplace_back(new_values);
+ }
+
+ std::string insert_values;
+ std::vector insert_rows;
+
+ for (auto &r: new_rows) {
+ std::string insert_row = "(" + implode(",", wrap(r, "'")) + ")";
+ insert_rows.emplace_back(insert_row);
+ }
+
+ if (!insert_rows.empty()) {
+ QueryDatabase(
+ fmt::format(
+ "DELETE FROM {} WHERE {} = {}",
+ table_name,
+ character_id_column_name,
+ new_character_id
+ )
+ );
+
+ auto insert = QueryDatabase(
+ fmt::format(
+ "INSERT INTO {} ({}) VALUES {}",
+ table_name,
+ implode(",", wrap(columns, "`")),
+ implode(",", insert_rows)
+ )
+ );
+
+ if (!insert.ErrorMessage().empty()) {
+ TransactionRollback();
+ return false;
+ break;
+ }
+ }
+ }
+
+ TransactionCommit();
+
+ return true;
+}
+
diff --git a/common/database.h b/common/database.h
index 2239282ba..f6d93d5aa 100644
--- a/common/database.h
+++ b/common/database.h
@@ -40,29 +40,11 @@
class MySQLRequestResult;
class Client;
-namespace EQEmu
+namespace EQ
{
class InventoryProfile;
}
-struct EventLogDetails_Struct {
- uint32 id;
- char accountname[64];
- uint32 account_id;
- int16 status;
- char charactername[64];
- char targetname[64];
- char timestamp[64];
- char descriptiontype[64];
- char details[128];
-};
-
-struct CharacterEventLog_Struct {
- uint32 count;
- uint8 eventid;
- EventLogDetails_Struct eld[255];
-};
-
struct npcDecayTimes_Struct {
uint16 minlvl;
uint16 maxlvl;
@@ -100,22 +82,41 @@ class Database : public DBcore {
public:
Database();
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
- bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
+ bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label = "default");
~Database();
/* Character Creation */
- bool AddToNameFilter(const char* name);
- bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
- bool DeleteCharacter(char* character_name);
- bool MoveCharacterToZone(const char* charname, const char* zonename);
- bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
- bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
- bool ReserveName(uint32 account_id, char* name);
- bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
- bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
- bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
- bool UpdateName(const char* oldname, const char* newname);
+ bool AddToNameFilter(const char *name);
+ bool CreateCharacter(
+ uint32 account_id,
+ char *name,
+ uint16 gender,
+ uint16 race,
+ uint16 class_,
+ uint8 str,
+ uint8 sta,
+ uint8 cha,
+ uint8 dex,
+ uint8 int_,
+ uint8 agi,
+ uint8 wis,
+ uint8 face
+ );
+ bool DeleteCharacter(char *character_name);
+ bool MoveCharacterToZone(const char *charname, uint32 zone_id);
+ bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
+ bool ReserveName(uint32 account_id, char *name);
+ bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
+ bool SetHackerFlag(const char *accountname, const char *charactername, const char *hacked);
+ bool SetMQDetectionFlag(const char *accountname, const char *charactername, const char *hacked, const char *zone);
+ bool SetMQDetectionFlag(const char *accountname, const char *charactername, const std::string &hacked, const char *zone);
+ bool UpdateName(const char *oldname, const char *newname);
+ bool CopyCharacter(
+ std::string source_character_name,
+ std::string destination_character_name,
+ std::string destination_account_name
+ );
/* General Information Queries */
@@ -137,6 +138,8 @@ public:
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
void GetCharName(uint32 char_id, char* name);
+ std::string GetCharNameByID(uint32 char_id);
+ std::string GetNPCNameByID(uint32 npc_id);
void LoginIP(uint32 AccountID, const char* LoginIP);
/* Instancing */
@@ -153,7 +156,6 @@ public:
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
- uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
uint16 GetInstanceVersion(uint16 instance_id);
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
@@ -193,19 +195,19 @@ public:
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
void SetAgreementFlag(uint32 acctid);
-
+
int GetIPExemption(std::string account_ip);
int GetInstanceID(uint32 char_id, uint32 zone_id);
/* Groups */
-
+
char* GetGroupLeaderForLogin(const char* name,char* leaderbuf);
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
-
+
uint32 GetGroupID(const char* name);
-
+
void ClearGroup(uint32 gid = 0);
void ClearGroupLeader(uint32 gid = 0);
void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
@@ -240,17 +242,12 @@ public:
/* General Queries */
- bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
- bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
+ bool GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, float* safe_heading = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
bool LoadPTimers(uint32 charid, PTimerList &into);
- bool LoadZoneNames();
-
- const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
- uint32 GetZoneID(const char* zonename);
uint8 GetPEQZone(uint32 zoneID, uint32 version);
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
@@ -274,7 +271,6 @@ public:
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
private:
- std::map zonename_array;
Mutex Mvarcache;
VarCache_Struct varcache;
diff --git a/common/database/database_dump_service.cpp b/common/database/database_dump_service.cpp
index c4aa971d6..7efd80f83 100644
--- a/common/database/database_dump_service.cpp
+++ b/common/database/database_dump_service.cpp
@@ -50,7 +50,11 @@ std::string DatabaseDumpService::execute(const std::string &cmd, bool return_res
const char *file_name = "db-exec-result.txt";
if (return_result) {
+#ifdef _WINDOWS
+ std::system((cmd + " > " + file_name + " 2>&1").c_str());
+#else
std::system((cmd + " > " + file_name).c_str());
+#endif
}
else {
std::system((cmd).c_str());
@@ -95,7 +99,7 @@ bool DatabaseDumpService::IsTarAvailable()
*/
bool DatabaseDumpService::Is7ZipAvailable()
{
- std::string version_output = execute("7z -help");
+ std::string version_output = execute("7z --help");
return version_output.find("7-Zip") != std::string::npos;
}
@@ -124,12 +128,23 @@ std::string DatabaseDumpService::GetMySQLVersion()
std::string DatabaseDumpService::GetBaseMySQLDumpCommand()
{
auto config = EQEmuConfig::get();
+ if (IsDumpContentTables() && !config->ContentDbHost.empty()) {
+ return fmt::format(
+ "mysqldump -u {} -p{} -h {} --port={} {}",
+ config->ContentDbUsername,
+ config->ContentDbPassword,
+ config->ContentDbHost,
+ config->ContentDbPort,
+ config->ContentDbName
+ );
+ };
return fmt::format(
- "mysqldump -u {} -p{} -h {} {}",
+ "mysqldump -u {} -p{} -h {} --port={} {}",
config->DatabaseUsername,
config->DatabasePassword,
config->DatabaseHost,
+ config->DatabasePort,
config->DatabaseDB
);
}
@@ -285,8 +300,7 @@ void DatabaseDumpService::Dump()
config->DatabaseUsername
);
- std::string options = "--allow-keywords --extended-insert";
-
+ std::string options = "--allow-keywords --extended-insert --max-allowed-packet=1G --net-buffer-length=32704";
if (IsDumpWithNoData()) {
options += " --no-data";
}
@@ -396,9 +410,8 @@ void DatabaseDumpService::Dump()
else if (Is7ZipAvailable()) {
execute(
fmt::format(
- "7z a -t7z {}.zip -C {} {}.sql",
+ "7z a -t7z {}.zip {}.sql",
GetDumpFileNameWithPath(),
- GetSetDumpPath(),
GetDumpFileNameWithPath()
)
);
diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp
index ec973d9af..561e1679b 100644
--- a/common/database_conversions.cpp
+++ b/common/database_conversions.cpp
@@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
namespace Convert {
struct BindStruct {
- /*000*/ uint32 zoneId;
+ /*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -189,7 +189,7 @@ namespace Convert {
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
- /*510*/ uint32 Items[EQEmu::textures::materialCount];
+ /*510*/ uint32 Items[EQ::textures::materialCount];
/*546*/ char Name[64];
/*610*/
};
@@ -230,9 +230,9 @@ namespace Convert {
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
- /*0312*/ uint32 item_material[EQEmu::textures::materialCount]; // Item texture/material of worn/held items
+ /*0312*/ uint32 item_material[EQ::textures::materialCount]; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44];
- /*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::materialCount];
+ /*0392*/ Convert::Color_Struct item_tint[EQ::textures::materialCount];
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right
@@ -1320,18 +1320,18 @@ bool Database::CheckDatabaseConvertPPDeblob(){
if (rquery != ""){ results = QueryDatabase(rquery); }
/* Run Bind Home Convert */
- if (pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
+ if (pp->binds[4].zone_id < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
- character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
+ character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
if (rquery != ""){ results = QueryDatabase(rquery); }
}
/* Run Bind Convert */
- if (pp->binds[0].zoneId < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
+ if (pp->binds[0].zone_id < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
- character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
+ character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
if (rquery != ""){ results = QueryDatabase(rquery); }
}
/* Run Language Convert */
@@ -1396,7 +1396,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
if (rquery != ""){ results = QueryDatabase(rquery); }
/* Run Material Color Convert */
first_entry = 0; rquery = "";
- for (i = EQEmu::textures::textureBegin; i < EQEmu::textures::materialCount; i++){
+ for (i = EQ::textures::textureBegin; i < EQ::textures::materialCount; i++){
if (pp->item_tint[i].color > 0){
if (first_entry != 1){
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
diff --git a/common/database_instances.cpp b/common/database_instances.cpp
index 68496b61d..0c4be4bd6 100644
--- a/common/database_instances.cpp
+++ b/common/database_instances.cpp
@@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define strcasecmp _stricmp
#else
#include "unix.h"
+#include "../zone/zonedb.h"
#include
#include
#endif
@@ -97,42 +98,53 @@ bool Database::CheckInstanceExists(uint16 instance_id) {
bool Database::CheckInstanceExpired(uint16 instance_id)
{
- int32 start_time = 0;
- int32 duration = 0;
+ int32 start_time = 0;
+ int32 duration = 0;
uint32 never_expires = 0;
- std::string query = StringFormat("SELECT start_time, duration, never_expires FROM instance_list WHERE id=%u", instance_id);
+ std::string query = StringFormat(
+ "SELECT start_time, duration, never_expires FROM instance_list WHERE id=%u",
+ instance_id
+ );
+
auto results = QueryDatabase(query);
- if (!results.Success())
+ if (!results.Success()) {
return true;
+ }
- if (results.RowCount() == 0)
+ if (results.RowCount() == 0) {
return true;
+ }
auto row = results.begin();
- start_time = atoi(row[0]);
- duration = atoi(row[1]);
+ start_time = atoi(row[0]);
+ duration = atoi(row[1]);
never_expires = atoi(row[2]);
- if (never_expires == 1)
+ if (never_expires == 1) {
return false;
+ }
- timeval tv;
+ timeval tv{};
gettimeofday(&tv, nullptr);
- if ((start_time + duration) <= tv.tv_sec)
- return true;
+ return (start_time + duration) <= tv.tv_sec;
- return false;
}
bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration)
{
- std::string query = StringFormat("INSERT INTO instance_list (id, zone, version, start_time, duration)"
- " values(%lu, %lu, %lu, UNIX_TIMESTAMP(), %lu)",
- (unsigned long)instance_id, (unsigned long)zone_id, (unsigned long)version, (unsigned long)duration);
+ std::string query = StringFormat(
+ "INSERT INTO instance_list (id, zone, version, start_time, duration)"
+ " values (%u, %u, %u, UNIX_TIMESTAMP(), %u)",
+ instance_id,
+ zone_id,
+ version,
+ duration
+ );
+
auto results = QueryDatabase(query);
return results.Success();
@@ -140,66 +152,84 @@ bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version
bool Database::GetUnusedInstanceID(uint16 &instance_id)
{
- uint32 count = RuleI(Zone, ReservedInstances);
- uint32 max = 65535;
+ uint32 max_reserved_instance_id = RuleI(Instances, ReservedInstances);
+ uint32 max = 32000;
+
+ std::string query = StringFormat(
+ "SELECT IFNULL(MAX(id),%u)+1 FROM instance_list WHERE id > %u",
+ max_reserved_instance_id,
+ max_reserved_instance_id
+ );
+
+ if (RuleB(Instances, RecycleInstanceIds)) {
+ query = (
+ SQL(
+ SELECT i.id + 1 AS next_available
+ FROM instance_list i
+ LEFT JOIN instance_list i2 ON i2.id = i.id + 1
+ WHERE i2.id IS NULL
+ ORDER BY i.id
+ LIMIT 0, 1;
+
+ )
+ );
+ }
- std::string query = StringFormat("SELECT IFNULL(MAX(id),%u)+1 FROM instance_list WHERE id > %u", count, count);
auto results = QueryDatabase(query);
- if (!results.Success())
- {
+ if (!results.Success()) {
instance_id = 0;
return false;
}
- if (results.RowCount() == 0)
- {
- instance_id = 0;
- return false;
+ if (results.RowCount() == 0) {
+ instance_id = max_reserved_instance_id;
+ return true;
}
auto row = results.begin();
- if (atoi(row[0]) <= max)
- {
+ if (atoi(row[0]) <= max) {
instance_id = atoi(row[0]);
+
return true;
}
- query = StringFormat("SELECT id FROM instance_list where id > %u ORDER BY id", count);
+ if (instance_id < max_reserved_instance_id) {
+ instance_id = max_reserved_instance_id;
+ return true;
+ }
+
+ query = StringFormat("SELECT id FROM instance_list where id > %u ORDER BY id", max_reserved_instance_id);
results = QueryDatabase(query);
- if (!results.Success())
- {
+ if (!results.Success()) {
instance_id = 0;
return false;
}
- if (results.RowCount() == 0)
- {
+ if (results.RowCount() == 0) {
instance_id = 0;
return false;
}
- count++;
- for (auto row = results.begin(); row != results.end(); ++row)
- {
- if (count < atoi(row[0]))
- {
- instance_id = count;
+ max_reserved_instance_id++;
+ for (auto row = results.begin(); row != results.end(); ++row) {
+ if (max_reserved_instance_id < atoi(row[0])) {
+ instance_id = max_reserved_instance_id;
return true;
}
- if (count > max)
- {
+ if (max_reserved_instance_id > max) {
instance_id = 0;
return false;
}
- count++;
+ max_reserved_instance_id++;
}
- instance_id = count;
+ instance_id = max_reserved_instance_id;
+
return true;
}
@@ -276,36 +306,6 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
return true;
}
-uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
-
- std::string query = StringFormat(
- "SELECT "
- "instance_list.id "
- "FROM "
- "instance_list, "
- "instance_list_player "
- "WHERE "
- "instance_list.zone = %u "
- "AND instance_list.version = %u "
- "AND instance_list.id = instance_list_player.id "
- "AND instance_list_player.charid = %u "
- "LIMIT 1 ",
- GetZoneID(zone),
- version,
- character_id
- );
- auto results = QueryDatabase(query);
-
- if (!results.Success())
- return 0;
-
- if (results.RowCount() == 0)
- return 0;
-
- auto row = results.begin();
- return atoi(row[0]);
-}
-
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
{
if (!zone)
@@ -482,9 +482,8 @@ void Database::BuryCorpsesInInstance(uint16 instance_id) {
void Database::DeleteInstance(uint16 instance_id)
{
- std::string query = StringFormat("DELETE FROM instance_list WHERE id=%u", instance_id);
- QueryDatabase(query);
-
+ std::string query;
+
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
QueryDatabase(query);
@@ -494,6 +493,9 @@ void Database::DeleteInstance(uint16 instance_id)
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
QueryDatabase(query);
+ query = fmt::format("DELETE FROM dynamic_zones WHERE instance_id={}", instance_id);
+ QueryDatabase(query);
+
BuryCorpsesInInstance(instance_id);
}
@@ -505,7 +507,7 @@ void Database::FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 char
char ln[128];
memset(ln, 0, 128);
- strcpy(ln, GetGroupLeadershipInfo(gid, ln));
+ GetGroupLeadershipInfo(gid, ln);
uint32 l_charid = GetCharacterID((const char*)ln);
uint16 l_id = GetInstanceID(zone, l_charid, version);
@@ -544,17 +546,46 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch
void Database::PurgeExpiredInstances()
{
- std::string query("SELECT id FROM instance_list where (start_time+duration) <= UNIX_TIMESTAMP() and never_expires = 0");
+
+ /**
+ * Delay purging by a day so that we can continue using adjacent free instance id's
+ * from the table without risking the chance we immediately re-allocate a zone that freshly expired but
+ * has not been fully de-allocated
+ */
+ std::string query =
+ SQL(
+ SELECT
+ id
+ FROM
+ instance_list
+ where
+ (start_time + duration) <= (UNIX_TIMESTAMP() - 86400)
+ and never_expires = 0
+ );
+
auto results = QueryDatabase(query);
- if (!results.Success())
+ if (!results.Success()) {
return;
+ }
- if (results.RowCount() == 0)
+ if (results.RowCount() == 0) {
return;
+ }
- for (auto row = results.begin(); row != results.end(); ++row)
- DeleteInstance(atoi(row[0]));
+ std::vector instance_ids;
+ for (auto row = results.begin(); row != results.end(); ++row) {
+ instance_ids.emplace_back(row[0]);
+ }
+
+ std::string imploded_instance_ids = implode(",", instance_ids);
+
+ QueryDatabase(fmt::format("DELETE FROM instance_list WHERE id IN ({})", imploded_instance_ids));
+ QueryDatabase(fmt::format("DELETE FROM instance_list_player WHERE id IN ({})", imploded_instance_ids));
+ QueryDatabase(fmt::format("DELETE FROM respawn_times WHERE instance_id IN ({})", imploded_instance_ids));
+ QueryDatabase(fmt::format("DELETE FROM spawn_condition_values WHERE instance_id IN ({})", imploded_instance_ids));
+ QueryDatabase(fmt::format("UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id IN ({})", imploded_instance_ids));
+ QueryDatabase(fmt::format("DELETE FROM dynamic_zones WHERE instance_id IN ({})", imploded_instance_ids));
}
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
@@ -562,4 +593,4 @@ void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
std::string query = StringFormat("UPDATE `instance_list` SET start_time=UNIX_TIMESTAMP(), "
"duration=%u WHERE id=%u", new_duration, instance_id);
auto results = QueryDatabase(query);
-}
\ No newline at end of file
+}
diff --git a/common/database_schema.h b/common/database_schema.h
index 6a7ccf612..8d8e81441 100644
--- a/common/database_schema.h
+++ b/common/database_schema.h
@@ -50,6 +50,8 @@ namespace DatabaseSchema {
{"character_data", "id"},
{"character_disciplines", "id"},
{"character_enabledtasks", "charid"},
+ {"character_expedition_lockouts", "character_id"},
+ {"character_exp_modifiers", "character_id"},
{"character_inspect_messages", "id"},
{"character_item_recast", "id"},
{"character_languages", "id"},
@@ -114,6 +116,8 @@ namespace DatabaseSchema {
"character_data",
"character_disciplines",
"character_enabledtasks",
+ "character_expedition_lockouts",
+ "character_exp_modifiers",
"character_inspect_messages",
"character_item_recast",
"character_languages",
@@ -179,6 +183,7 @@ namespace DatabaseSchema {
"books",
"char_create_combinations",
"char_create_point_allocations",
+ "damageshieldtypes",
"doors",
"faction_base_data",
"faction_list",
@@ -218,7 +223,6 @@ namespace DatabaseSchema {
"skill_caps",
"spawn2",
"spawn_conditions",
- "spawn_events",
"spawnentry",
"spawngroup",
"spells_new",
@@ -248,11 +252,13 @@ namespace DatabaseSchema {
return {
"chatchannels",
"command_settings",
+ "content_flags",
"db_str",
"eqtime",
"launcher",
"launcher_zones",
"spawn_condition_values",
+ "spawn_events",
"level_exp_mods",
"logsys_categories",
"name_filter",
@@ -303,7 +309,11 @@ namespace DatabaseSchema {
"banned_ips",
"bug_reports",
"bugs",
+ "dynamic_zones",
"eventlog",
+ "expedition_lockouts",
+ "expedition_members",
+ "expeditions",
"gm_ips",
"group_id",
"group_leaders",
@@ -320,7 +330,7 @@ namespace DatabaseSchema {
"reports",
"respawn_times",
"saylink",
-
+ "server_scheduled_events",
};
}
diff --git a/common/dbcore.cpp b/common/dbcore.cpp
index bc3ce0a72..7f1f52363 100644
--- a/common/dbcore.cpp
+++ b/common/dbcore.cpp
@@ -51,7 +51,11 @@ DBcore::~DBcore()
* are re-using the default database connection pointer when we dont have an
* external configuration setup ex: (content_database)
*/
- std::string mysql_connection_host = mysql.host;
+ std::string mysql_connection_host;
+ if (mysql.host) {
+ mysql_connection_host = mysql.host;
+ }
+
if (GetOriginHost() != mysql_connection_host) {
return;
}
@@ -79,6 +83,13 @@ MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureO
return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
}
+bool DBcore::DoesTableExist(std::string table_name)
+{
+ auto results = QueryDatabase(fmt::format("SHOW TABLES LIKE '{}'", table_name));
+
+ return results.RowCount() > 0;
+}
+
MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce)
{
BenchTimer timer;
@@ -212,10 +223,10 @@ bool DBcore::Open(
)
{
LockMutex lock(&MDatabase);
- safe_delete(pHost);
- safe_delete(pUser);
- safe_delete(pPassword);
- safe_delete(pDatabase);
+ safe_delete_array(pHost);
+ safe_delete_array(pUser);
+ safe_delete_array(pPassword);
+ safe_delete_array(pDatabase);
pHost = strcpy(new char[strlen(iHost) + 1], iHost);
pUser = strcpy(new char[strlen(iUser) + 1], iUser);
pPassword = strcpy(new char[strlen(iPassword) + 1], iPassword);
diff --git a/common/dbcore.h b/common/dbcore.h
index 8c508255b..8e8e6b46b 100644
--- a/common/dbcore.h
+++ b/common/dbcore.h
@@ -35,6 +35,8 @@ public:
const std::string &GetOriginHost() const;
void SetOriginHost(const std::string &origin_host);
+ bool DoesTableExist(std::string table_name);
+
protected:
bool Open(
const char *iHost,
diff --git a/common/deity.cpp b/common/deity.cpp
index b8a2d87d7..0923c43d0 100644
--- a/common/deity.cpp
+++ b/common/deity.cpp
@@ -20,7 +20,7 @@
#include "deity.h"
-EQEmu::deity::DeityTypeBit EQEmu::deity::ConvertDeityTypeToDeityTypeBit(DeityType deity_type)
+EQ::deity::DeityTypeBit EQ::deity::ConvertDeityTypeToDeityTypeBit(DeityType deity_type)
{
switch (deity_type) {
case DeityBertoxxulous:
@@ -63,7 +63,7 @@ EQEmu::deity::DeityTypeBit EQEmu::deity::ConvertDeityTypeToDeityTypeBit(DeityTyp
};
}
-EQEmu::deity::DeityType EQEmu::deity::ConvertDeityTypeBitToDeityType(DeityTypeBit deity_type_bit)
+EQ::deity::DeityType EQ::deity::ConvertDeityTypeBitToDeityType(DeityTypeBit deity_type_bit)
{
switch (deity_type_bit) {
case bit_DeityAgnostic:
@@ -105,7 +105,7 @@ EQEmu::deity::DeityType EQEmu::deity::ConvertDeityTypeBitToDeityType(DeityTypeBi
};
}
-const char* EQEmu::deity::DeityName(DeityType deity_type)
+const char* EQ::deity::DeityName(DeityType deity_type)
{
switch (deity_type) {
case DeityBertoxxulous:
diff --git a/common/deity.h b/common/deity.h
index f754352a0..8d0fe4c7a 100644
--- a/common/deity.h
+++ b/common/deity.h
@@ -23,7 +23,7 @@
#include "types.h"
-namespace EQEmu
+namespace EQ
{
namespace deity {
enum DeityType {
diff --git a/common/dynamic_zone_base.cpp b/common/dynamic_zone_base.cpp
new file mode 100644
index 000000000..8e29722d3
--- /dev/null
+++ b/common/dynamic_zone_base.cpp
@@ -0,0 +1,289 @@
+#include "dynamic_zone_base.h"
+#include "database.h"
+#include "eqemu_logsys.h"
+#include "repositories/instance_list_repository.h"
+#include "repositories/instance_list_player_repository.h"
+#include "servertalk.h"
+
+DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
+{
+ LoadRepositoryResult(std::move(entry));
+}
+
+uint32_t DynamicZoneBase::Create()
+{
+ if (m_id != 0)
+ {
+ return m_id;
+ }
+
+ if (GetInstanceID() == 0)
+ {
+ CreateInstance();
+ }
+
+ m_id = SaveToDatabase();
+
+ return m_id;
+}
+
+uint32_t DynamicZoneBase::CreateInstance()
+{
+ if (m_instance_id)
+ {
+ LogDynamicZones("CreateInstance failed, instance id [{}] already created", m_instance_id);
+ return 0;
+ }
+
+ if (!m_zone_id)
+ {
+ LogDynamicZones("CreateInstance failed, invalid zone id [{}]", m_zone_id);
+ return 0;
+ }
+
+ uint16_t unused_instance_id = 0;
+ if (!GetDatabase().GetUnusedInstanceID(unused_instance_id)) // todo: doesn't this race with insert?
+ {
+ LogDynamicZones("Failed to find unused instance id");
+ return 0;
+ }
+
+ m_start_time = std::chrono::system_clock::now();
+ m_expire_time = m_start_time + m_duration;
+
+ auto insert_instance = InstanceListRepository::NewEntity();
+ insert_instance.id = unused_instance_id;
+ insert_instance.zone = m_zone_id;
+ insert_instance.version = m_zone_version;
+ insert_instance.start_time = static_cast(std::chrono::system_clock::to_time_t(m_start_time));
+ insert_instance.duration = static_cast(m_duration.count());
+ insert_instance.never_expires = m_never_expires;
+
+ auto instance = InstanceListRepository::InsertOne(GetDatabase(), insert_instance);
+ if (instance.id == 0)
+ {
+ LogDynamicZones("Failed to create instance [{}] for zone [{}]", unused_instance_id, m_zone_id);
+ return 0;
+ }
+
+ m_instance_id = instance.id;
+
+ return m_instance_id;
+}
+
+void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry)
+{
+ m_id = dz_entry.id;
+ m_instance_id = dz_entry.instance_id;
+ m_type = static_cast(dz_entry.type);
+ m_compass.zone_id = dz_entry.compass_zone_id;
+ m_compass.x = dz_entry.compass_x;
+ m_compass.y = dz_entry.compass_y;
+ m_compass.z = dz_entry.compass_z;
+ m_safereturn.zone_id = dz_entry.safe_return_zone_id;
+ m_safereturn.x = dz_entry.safe_return_x;
+ m_safereturn.y = dz_entry.safe_return_y;
+ m_safereturn.z = dz_entry.safe_return_z;
+ m_safereturn.heading = dz_entry.safe_return_heading;
+ m_zonein.x = dz_entry.zone_in_x;
+ m_zonein.y = dz_entry.zone_in_y;
+ m_zonein.z = dz_entry.zone_in_z;
+ m_zonein.heading = dz_entry.zone_in_heading;
+ m_has_zonein = (dz_entry.has_zone_in != 0);
+ // instance_list portion
+ m_zone_id = dz_entry.zone;
+ m_zone_version = dz_entry.version;
+ m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
+ m_duration = std::chrono::seconds(dz_entry.duration);
+ m_never_expires = (dz_entry.never_expires != 0);
+ m_expire_time = m_start_time + m_duration;
+}
+
+uint32_t DynamicZoneBase::SaveToDatabase()
+{
+ LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
+
+ if (m_instance_id != 0)
+ {
+ auto insert_dz = DynamicZonesRepository::NewEntity();
+ insert_dz.instance_id = m_instance_id,
+ insert_dz.type = static_cast(m_type);
+ insert_dz.compass_zone_id = m_compass.zone_id;
+ insert_dz.compass_x = m_compass.x;
+ insert_dz.compass_y = m_compass.y;
+ insert_dz.compass_z = m_compass.z;
+ insert_dz.safe_return_zone_id = m_safereturn.zone_id;
+ insert_dz.safe_return_x = m_safereturn.x;
+ insert_dz.safe_return_y = m_safereturn.y;
+ insert_dz.safe_return_z = m_safereturn.z;
+ insert_dz.safe_return_heading = m_safereturn.heading;
+ insert_dz.zone_in_x = m_zonein.x;
+ insert_dz.zone_in_y = m_zonein.y;
+ insert_dz.zone_in_z = m_zonein.z;
+ insert_dz.zone_in_heading = m_zonein.heading;
+ insert_dz.has_zone_in = m_has_zonein;
+
+ auto inserted_dz = DynamicZonesRepository::InsertOne(GetDatabase(), insert_dz);
+ return inserted_dz.id;
+ }
+ return 0;
+}
+
+void DynamicZoneBase::AddCharacter(uint32_t character_id)
+{
+ GetDatabase().AddClientToInstance(m_instance_id, character_id);
+ SendInstanceAddRemoveCharacter(character_id, false); // stops client kick timer
+}
+
+void DynamicZoneBase::RemoveCharacter(uint32_t character_id)
+{
+ GetDatabase().RemoveClientFromInstance(m_instance_id, character_id);
+ SendInstanceAddRemoveCharacter(character_id, true); // start client kick timer
+}
+
+void DynamicZoneBase::RemoveAllCharacters(bool enable_removal_timers)
+{
+ if (GetInstanceID() == 0)
+ {
+ return;
+ }
+
+ if (enable_removal_timers)
+ {
+ SendInstanceRemoveAllCharacters();
+ }
+
+ GetDatabase().RemoveClientsFromInstance(GetInstanceID());
+}
+
+void DynamicZoneBase::SaveInstanceMembersToDatabase(const std::vector& character_ids)
+{
+ LogDynamicZonesDetail("Saving [{}] members for instance [{}]", character_ids.size(), m_instance_id);
+
+ std::vector insert_players;
+
+ for (const auto& character_id : character_ids)
+ {
+ InstanceListPlayerRepository::InstanceListPlayer entry{};
+ entry.id = static_cast(m_instance_id);
+ entry.charid = static_cast(character_id);
+ insert_players.emplace_back(entry);
+ }
+
+ InstanceListPlayerRepository::InsertMany(GetDatabase(), insert_players);
+}
+
+void DynamicZoneBase::SetCompass(const DynamicZoneLocation& location, bool update_db)
+{
+ ProcessCompassChange(location);
+
+ if (update_db)
+ {
+ LogDynamicZonesDetail("Saving [{}] compass zone: [{}] xyz: ([{}], [{}], [{}])",
+ m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
+
+ DynamicZonesRepository::UpdateCompass(GetDatabase(),
+ m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
+
+ SendGlobalLocationChange(ServerOP_DzSetCompass, location);
+ }
+}
+
+void DynamicZoneBase::SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db)
+{
+ SetCompass({ zone_id, x, y, z, 0.0f }, update_db);
+}
+
+void DynamicZoneBase::SetSafeReturn(const DynamicZoneLocation& location, bool update_db)
+{
+ m_safereturn = location;
+
+ if (update_db)
+ {
+ LogDynamicZonesDetail("Saving [{}] safereturn zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
+ m_id, m_safereturn.zone_id, m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
+
+ DynamicZonesRepository::UpdateSafeReturn(GetDatabase(), m_id, m_safereturn.zone_id,
+ m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
+
+ SendGlobalLocationChange(ServerOP_DzSetSafeReturn, location);
+ }
+}
+
+void DynamicZoneBase::SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db)
+{
+ SetSafeReturn({ zone_id, x, y, z, heading }, update_db);
+}
+
+void DynamicZoneBase::SetZoneInLocation(const DynamicZoneLocation& location, bool update_db)
+{
+ m_zonein = location;
+ m_has_zonein = true;
+
+ if (update_db)
+ {
+ LogDynamicZonesDetail("Saving [{}] zonein zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
+ m_id, m_zone_id, m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading);
+
+ DynamicZonesRepository::UpdateZoneIn(GetDatabase(), m_id, m_zone_id,
+ m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading, m_has_zonein);
+
+ SendGlobalLocationChange(ServerOP_DzSetZoneIn, location);
+ }
+}
+
+void DynamicZoneBase::SetZoneInLocation(float x, float y, float z, float heading, bool update_db)
+{
+ SetZoneInLocation({ 0, x, y, z, heading }, update_db);
+}
+
+uint32_t DynamicZoneBase::GetSecondsRemaining() const
+{
+ auto remaining = std::chrono::duration_cast(GetDurationRemaining()).count();
+ return std::max(0, static_cast(remaining));
+}
+
+std::unique_ptr DynamicZoneBase::CreateServerAddRemoveCharacterPacket(
+ uint32_t character_id, bool removed)
+{
+ constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
+ auto pack = std::make_unique(ServerOP_DzAddRemoveCharacter, pack_size);
+ auto buf = reinterpret_cast(pack->pBuffer);
+ buf->zone_id = GetZoneID();
+ buf->instance_id = GetInstanceID();
+ buf->remove = removed;
+ buf->character_id = character_id;
+
+ return pack;
+}
+
+std::unique_ptr DynamicZoneBase::CreateServerRemoveAllCharactersPacket()
+{
+ constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
+ auto pack = std::make_unique(ServerOP_DzRemoveAllCharacters, pack_size);
+ auto buf = reinterpret_cast(pack->pBuffer);
+ buf->zone_id = GetZoneID();
+ buf->instance_id = GetInstanceID();
+ buf->remove = true;
+ buf->character_id = 0;
+
+ return pack;
+}
+
+std::unique_ptr DynamicZoneBase::CreateServerDzLocationPacket(
+ uint16_t server_opcode, const DynamicZoneLocation& location)
+{
+ constexpr uint32_t pack_size = sizeof(ServerDzLocation_Struct);
+ auto pack = std::make_unique(server_opcode, pack_size);
+ auto buf = reinterpret_cast(pack->pBuffer);
+ buf->dz_id = GetID();
+ buf->sender_zone_id = GetCurrentZoneID();
+ buf->sender_instance_id = GetCurrentInstanceID();
+ buf->zone_id = location.zone_id;
+ buf->x = location.x;
+ buf->y = location.y;
+ buf->z = location.z;
+ buf->heading = location.heading;
+
+ return pack;
+}
diff --git a/common/dynamic_zone_base.h b/common/dynamic_zone_base.h
new file mode 100644
index 000000000..5a84fa8fa
--- /dev/null
+++ b/common/dynamic_zone_base.h
@@ -0,0 +1,135 @@
+#ifndef COMMON_DYNAMIC_ZONE_BASE_H
+#define COMMON_DYNAMIC_ZONE_BASE_H
+
+#include "eq_constants.h"
+#include "repositories/dynamic_zones_repository.h"
+#include
+#include
+#include
+#include
+#include
+#include
+
+class Database;
+class ServerPacket;
+
+struct DynamicZoneMember
+{
+ uint32_t id = 0;
+ std::string name;
+ DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Online;
+
+ DynamicZoneMember() = default;
+ DynamicZoneMember(uint32_t id, std::string name_)
+ : id(id), name{std::move(name_)} {}
+ DynamicZoneMember(uint32_t id, std::string name_, DynamicZoneMemberStatus status_)
+ : id(id), name{std::move(name_)}, status(status_) {}
+
+ bool IsOnline() const { return status == DynamicZoneMemberStatus::Online ||
+ status == DynamicZoneMemberStatus::InDynamicZone; }
+ bool IsValid() const { return id != 0 && !name.empty(); }
+};
+
+struct DynamicZoneLocation
+{
+ uint32_t zone_id = 0;
+ float x = 0.0f;
+ float y = 0.0f;
+ float z = 0.0f;
+ float heading = 0.0f;
+
+ DynamicZoneLocation() = default;
+ DynamicZoneLocation(uint32_t zone_id_, float x_, float y_, float z_, float heading_)
+ : zone_id(zone_id_), x(x_), y(y_), z(z_), heading(heading_) {}
+};
+
+class DynamicZoneBase
+{
+public:
+ virtual ~DynamicZoneBase() = default;
+ DynamicZoneBase(const DynamicZoneBase&) = default;
+ DynamicZoneBase(DynamicZoneBase&&) = default;
+ DynamicZoneBase& operator=(const DynamicZoneBase&) = default;
+ DynamicZoneBase& operator=(DynamicZoneBase&&) = default;
+ DynamicZoneBase() = default;
+ DynamicZoneBase(uint32_t dz_id) : m_id(dz_id) {}
+ DynamicZoneBase(DynamicZoneType type) : m_type(type) {}
+ DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry);
+
+ virtual void SetSecondsRemaining(uint32_t seconds_remaining) = 0;
+
+ uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
+ uint32_t GetID() const { return m_id; }
+ uint16_t GetInstanceID() const { return static_cast(m_instance_id); }
+ uint32_t GetMaxPlayers() const { return m_max_players; }
+ uint32_t GetMinPlayers() const { return m_min_players; }
+ uint32_t GetSecondsRemaining() const;
+ uint16_t GetZoneID() const { return static_cast(m_zone_id); }
+ uint32_t GetZoneIndex() const { return (m_instance_id << 16) | (m_zone_id & 0xffff); }
+ uint32_t GetZoneVersion() const { return m_zone_version; }
+ DynamicZoneType GetType() const { return m_type; }
+ const std::string& GetLeaderName() const { return m_leader_name; }
+ const std::string& GetName() const { return m_name; }
+ const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
+ const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
+ const DynamicZoneLocation& GetZoneInLocation() const { return m_zonein; }
+ std::chrono::system_clock::duration GetDurationRemaining() const { return m_expire_time - std::chrono::system_clock::now(); }
+
+ void AddCharacter(uint32_t character_id);
+ uint32_t Create();
+ bool HasZoneInLocation() const { return m_has_zonein; }
+ bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
+ bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
+ bool IsValid() const { return m_instance_id != 0; }
+ bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
+ void RemoveAllCharacters(bool enable_removal_timers = true);
+ void RemoveCharacter(uint32_t character_id);
+ void SaveInstanceMembersToDatabase(const std::vector& character_ids);
+ void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
+ void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
+ void SetLeaderName(const std::string& leader_name) { m_leader_name = leader_name; }
+ void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
+ void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
+ void SetName(const std::string& name) { m_name = name; }
+ void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
+ void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
+ void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
+ void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
+
+protected:
+ virtual uint16_t GetCurrentInstanceID() { return 0; }
+ virtual uint16_t GetCurrentZoneID() { return 0; }
+ virtual Database& GetDatabase() = 0;
+ virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
+ virtual void SendInstanceAddRemoveCharacter(uint32_t character_id, bool remove) = 0;
+ virtual void SendInstanceRemoveAllCharacters() = 0;
+ virtual void SendGlobalLocationChange(uint16_t server_opcode, const DynamicZoneLocation& location) = 0;
+
+ uint32_t CreateInstance();
+ void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
+ uint32_t SaveToDatabase();
+
+ std::unique_ptr CreateServerAddRemoveCharacterPacket(uint32_t character_id, bool removed);
+ std::unique_ptr CreateServerRemoveAllCharactersPacket();
+ std::unique_ptr CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
+
+ uint32_t m_id = 0;
+ uint32_t m_zone_id = 0;
+ uint32_t m_instance_id = 0;
+ uint32_t m_zone_version = 0;
+ uint32_t m_min_players = 0;
+ uint32_t m_max_players = 0;
+ bool m_never_expires = false;
+ bool m_has_zonein = false;
+ std::string m_name;
+ std::string m_leader_name;
+ DynamicZoneType m_type{ DynamicZoneType::None };
+ DynamicZoneLocation m_compass;
+ DynamicZoneLocation m_safereturn;
+ DynamicZoneLocation m_zonein;
+ std::chrono::seconds m_duration;
+ std::chrono::time_point m_start_time;
+ std::chrono::time_point m_expire_time;
+};
+
+#endif
diff --git a/common/emu_constants.cpp b/common/emu_constants.cpp
index 950bc5ebb..8a6d2a8bd 100644
--- a/common/emu_constants.cpp
+++ b/common/emu_constants.cpp
@@ -20,7 +20,7 @@
#include "emu_constants.h"
-int16 EQEmu::invtype::GetInvTypeSize(int16 inv_type) {
+int16 EQ::invtype::GetInvTypeSize(int16 inv_type) {
static const int16 local_array[] = {
POSSESSIONS_SIZE,
BANK_SIZE,
@@ -55,7 +55,7 @@ int16 EQEmu::invtype::GetInvTypeSize(int16 inv_type) {
return local_array[inv_type];
}
-const char* EQEmu::bug::CategoryIDToCategoryName(CategoryID category_id) {
+const char* EQ::bug::CategoryIDToCategoryName(CategoryID category_id) {
switch (category_id) {
case catVideo:
return "Video";
@@ -87,7 +87,7 @@ const char* EQEmu::bug::CategoryIDToCategoryName(CategoryID category_id) {
}
}
-EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category_name) {
+EQ::bug::CategoryID EQ::bug::CategoryNameToCategoryID(const char* category_name) {
if (!category_name)
return catOther;
@@ -119,7 +119,7 @@ EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category
return catOther;
}
-const char *EQEmu::constants::GetStanceName(StanceType stance_type) {
+const char *EQ::constants::GetStanceName(StanceType stance_type) {
switch (stance_type) {
case stanceUnknown:
return "Unknown";
@@ -146,9 +146,9 @@ const char *EQEmu::constants::GetStanceName(StanceType stance_type) {
}
}
-int EQEmu::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
- if (stance_type >= EQEmu::constants::stancePassive && stance_type <= EQEmu::constants::stanceBurnAE)
- return (stance_type - EQEmu::constants::stancePassive);
+int EQ::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
+ if (stance_type >= EQ::constants::stancePassive && stance_type <= EQ::constants::stanceBurnAE)
+ return (stance_type - EQ::constants::stancePassive);
return 0;
}
diff --git a/common/emu_constants.h b/common/emu_constants.h
index 945f513b5..a29418394 100644
--- a/common/emu_constants.h
+++ b/common/emu_constants.h
@@ -27,7 +27,7 @@
// local definitions are the result of using hybrid-client or server-only values and methods
-namespace EQEmu
+namespace EQ
{
using RoF2::IINVALID;
using RoF2::INULL;
@@ -193,7 +193,7 @@ namespace EQEmu
} // namespace invaug
namespace constants {
- const EQEmu::versions::ClientVersion CHARACTER_CREATION_CLIENT = EQEmu::versions::ClientVersion::Titanium;
+ const EQ::versions::ClientVersion CHARACTER_CREATION_CLIENT = EQ::versions::ClientVersion::Titanium;
using RoF2::constants::EXPANSION;
using RoF2::constants::EXPANSION_BIT;
@@ -332,6 +332,6 @@ namespace EQEmu
/* hack list to prevent circular references
- eq_limits.h:EQEmu::inventory::LookupEntry::InventoryTypeSize[n];
+ eq_limits.h:EQ::inventory::LookupEntry::InventoryTypeSize[n];
*/
diff --git a/common/emu_oplist.h b/common/emu_oplist.h
index 5078cca68..46fd564e6 100644
--- a/common/emu_oplist.h
+++ b/common/emu_oplist.h
@@ -136,20 +136,22 @@ N(OP_Dye),
N(OP_DynamicWall),
N(OP_DzAddPlayer),
N(OP_DzChooseZone),
+N(OP_DzChooseZoneReply),
N(OP_DzCompass),
N(OP_DzExpeditionEndsWarning),
N(OP_DzExpeditionInfo),
-N(OP_DzExpeditionList),
-N(OP_DzJoinExpeditionConfirm),
-N(OP_DzJoinExpeditionReply),
-N(OP_DzLeaderStatus),
+N(OP_DzExpeditionInvite),
+N(OP_DzExpeditionInviteResponse),
+N(OP_DzExpeditionLockoutTimers),
N(OP_DzListTimers),
N(OP_DzMakeLeader),
N(OP_DzMemberList),
-N(OP_DzMemberStatus),
+N(OP_DzMemberListName),
+N(OP_DzMemberListStatus),
N(OP_DzPlayerList),
N(OP_DzQuit),
N(OP_DzRemovePlayer),
+N(OP_DzSetLeaderName),
N(OP_DzSwapPlayer),
N(OP_Emote),
N(OP_EndLootRequest),
@@ -271,6 +273,7 @@ N(OP_ItemVerifyRequest),
N(OP_ItemViewUnknown),
N(OP_Jump),
N(OP_KeyRing),
+N(OP_KickPlayers),
N(OP_KnowledgeBase),
N(OP_LDoNButton),
N(OP_LDoNDisarmTraps),
diff --git a/common/emu_versions.cpp b/common/emu_versions.cpp
index e5b3c5e70..ea8ddba73 100644
--- a/common/emu_versions.cpp
+++ b/common/emu_versions.cpp
@@ -21,7 +21,7 @@
#include "emu_constants.h"
-bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
+bool EQ::versions::IsValidClientVersion(ClientVersion client_version)
{
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
return false;
@@ -29,7 +29,7 @@ bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
return true;
}
-EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version)
+EQ::versions::ClientVersion EQ::versions::ValidateClientVersion(ClientVersion client_version)
{
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
return ClientVersion::Unknown;
@@ -37,7 +37,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVers
return client_version;
}
-const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
+const char* EQ::versions::ClientVersionName(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
@@ -61,7 +61,7 @@ const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
};
}
-uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
+uint32 EQ::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Titanium:
@@ -81,7 +81,7 @@ uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion cli
}
}
-EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
+EQ::versions::ClientVersion EQ::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
{
switch (client_version_bit) {
case ((uint32)1 << (static_cast(ClientVersion::Titanium) - 1)) :
@@ -101,7 +101,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientV
}
}
-bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version)
+bool EQ::versions::IsValidMobVersion(MobVersion mob_version)
{
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
return false;
@@ -109,7 +109,7 @@ bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version)
return true;
}
-bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
+bool EQ::versions::IsValidPCMobVersion(MobVersion mob_version)
{
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
return false;
@@ -117,7 +117,7 @@ bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
return true;
}
-bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
+bool EQ::versions::IsValidNonPCMobVersion(MobVersion mob_version)
{
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
return false;
@@ -125,7 +125,7 @@ bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
return true;
}
-bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
+bool EQ::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
{
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
return false;
@@ -133,7 +133,7 @@ bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
return true;
}
-EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_version)
+EQ::versions::MobVersion EQ::versions::ValidateMobVersion(MobVersion mob_version)
{
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
return MobVersion::Unknown;
@@ -141,7 +141,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_v
return mob_version;
}
-EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob_version)
+EQ::versions::MobVersion EQ::versions::ValidatePCMobVersion(MobVersion mob_version)
{
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
return MobVersion::Unknown;
@@ -149,7 +149,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob
return mob_version;
}
-EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion mob_version)
+EQ::versions::MobVersion EQ::versions::ValidateNonPCMobVersion(MobVersion mob_version)
{
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
return MobVersion::Unknown;
@@ -157,7 +157,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion
return mob_version;
}
-EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVersion mob_version)
+EQ::versions::MobVersion EQ::versions::ValidateOfflinePCMobVersion(MobVersion mob_version)
{
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
return MobVersion::Unknown;
@@ -165,7 +165,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVers
return mob_version;
}
-const char* EQEmu::versions::MobVersionName(MobVersion mob_version)
+const char* EQ::versions::MobVersionName(MobVersion mob_version)
{
switch (mob_version) {
case MobVersion::Unknown:
@@ -217,7 +217,7 @@ const char* EQEmu::versions::MobVersionName(MobVersion mob_version)
};
}
-EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion(MobVersion mob_version)
+EQ::versions::ClientVersion EQ::versions::ConvertMobVersionToClientVersion(MobVersion mob_version)
{
switch (mob_version) {
case MobVersion::Unknown:
@@ -240,7 +240,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion
}
}
-EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(ClientVersion client_version)
+EQ::versions::MobVersion EQ::versions::ConvertClientVersionToMobVersion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
@@ -263,7 +263,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(Cl
}
}
-EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version)
+EQ::versions::MobVersion EQ::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version)
{
switch (mob_version) {
case MobVersion::Titanium:
@@ -283,7 +283,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVe
}
}
-EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version)
+EQ::versions::MobVersion EQ::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version)
{
switch (mob_version) {
case MobVersion::OfflineTitanium:
@@ -303,7 +303,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVe
}
}
-EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version)
+EQ::versions::ClientVersion EQ::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version)
{
switch (mob_version) {
case MobVersion::OfflineTitanium:
@@ -323,7 +323,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClie
}
}
-EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version)
+EQ::versions::MobVersion EQ::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Titanium:
@@ -343,7 +343,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobV
}
}
-const char* EQEmu::expansions::ExpansionName(Expansion expansion)
+const char* EQ::expansions::ExpansionName(Expansion expansion)
{
switch (expansion) {
case Expansion::EverQuest:
@@ -393,12 +393,12 @@ const char* EQEmu::expansions::ExpansionName(Expansion expansion)
}
}
-const char* EQEmu::expansions::ExpansionName(uint32 expansion_bit)
+const char* EQ::expansions::ExpansionName(uint32 expansion_bit)
{
return ExpansionName(ConvertExpansionBitToExpansion(expansion_bit));
}
-uint32 EQEmu::expansions::ConvertExpansionToExpansionBit(Expansion expansion)
+uint32 EQ::expansions::ConvertExpansionToExpansionBit(Expansion expansion)
{
switch (expansion) {
case Expansion::RoK:
@@ -446,7 +446,7 @@ uint32 EQEmu::expansions::ConvertExpansionToExpansionBit(Expansion expansion)
}
}
-EQEmu::expansions::Expansion EQEmu::expansions::ConvertExpansionBitToExpansion(uint32 expansion_bit)
+EQ::expansions::Expansion EQ::expansions::ConvertExpansionBitToExpansion(uint32 expansion_bit)
{
switch (expansion_bit) {
case bitRoK:
@@ -494,7 +494,7 @@ EQEmu::expansions::Expansion EQEmu::expansions::ConvertExpansionBitToExpansion(u
}
}
-uint32 EQEmu::expansions::ConvertExpansionToExpansionsMask(Expansion expansion)
+uint32 EQ::expansions::ConvertExpansionToExpansionsMask(Expansion expansion)
{
switch (expansion) {
case Expansion::RoK:
@@ -542,17 +542,17 @@ uint32 EQEmu::expansions::ConvertExpansionToExpansionsMask(Expansion expansion)
}
}
-EQEmu::expansions::Expansion EQEmu::expansions::ConvertClientVersionToExpansion(versions::ClientVersion client_version)
+EQ::expansions::Expansion EQ::expansions::ConvertClientVersionToExpansion(versions::ClientVersion client_version)
{
- return EQEmu::constants::StaticLookup(client_version)->Expansion;
+ return EQ::constants::StaticLookup(client_version)->Expansion;
}
-uint32 EQEmu::expansions::ConvertClientVersionToExpansionBit(versions::ClientVersion client_version)
+uint32 EQ::expansions::ConvertClientVersionToExpansionBit(versions::ClientVersion client_version)
{
- return EQEmu::constants::StaticLookup(client_version)->ExpansionBit;
+ return EQ::constants::StaticLookup(client_version)->ExpansionBit;
}
-uint32 EQEmu::expansions::ConvertClientVersionToExpansionsMask(versions::ClientVersion client_version)
+uint32 EQ::expansions::ConvertClientVersionToExpansionsMask(versions::ClientVersion client_version)
{
- return EQEmu::constants::StaticLookup(client_version)->ExpansionsMask;
+ return EQ::constants::StaticLookup(client_version)->ExpansionsMask;
}
diff --git a/common/emu_versions.h b/common/emu_versions.h
index b55c32267..75f6808c3 100644
--- a/common/emu_versions.h
+++ b/common/emu_versions.h
@@ -25,7 +25,7 @@
#include
-namespace EQEmu
+namespace EQ
{
namespace versions {
enum class ClientVersion : uint32 {
diff --git a/common/eq_constants.h b/common/eq_constants.h
index 4cc61c0b4..a585bdd87 100644
--- a/common/eq_constants.h
+++ b/common/eq_constants.h
@@ -318,7 +318,7 @@ static const uint8 DamageTypeUnknown = 0xFF;
**
** (indexed by 'Skill' of SkillUseTypes)
*/
-static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated
+static const uint8 SkillDamageTypes[EQ::skills::HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated
{
/*1HBlunt*/ 0,
/*1HSlashing*/ 1,
@@ -464,4 +464,23 @@ namespace ZoneBlockedSpellTypes {
const uint8 Region = 2;
};
+enum class DynamicZoneType
+{
+ None = 0,
+ Expedition,
+ Tutorial,
+ Task,
+ Mission, // Shared Task
+ Quest
+};
+
+enum class DynamicZoneMemberStatus : uint8_t
+{
+ Unknown = 0,
+ Online,
+ Offline,
+ InDynamicZone,
+ LinkDead
+};
+
#endif /*COMMON_EQ_CONSTANTS_H*/
diff --git a/common/eq_limits.cpp b/common/eq_limits.cpp
index 9f52de30d..188c8f888 100644
--- a/common/eq_limits.cpp
+++ b/common/eq_limits.cpp
@@ -25,7 +25,7 @@
static bool global_dictionary_init = false;
-void EQEmu::InitializeDynamicLookups() {
+void EQ::InitializeDynamicLookups() {
if (global_dictionary_init == true)
return;
@@ -37,12 +37,12 @@ void EQEmu::InitializeDynamicLookups() {
global_dictionary_init = true;
}
-static std::unique_ptr constants_dynamic_nongm_lookup_entries[EQEmu::versions::ClientVersionCount];
-static std::unique_ptr constants_dynamic_gm_lookup_entries[EQEmu::versions::ClientVersionCount];
-static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu::versions::ClientVersionCount] =
+static std::unique_ptr constants_dynamic_nongm_lookup_entries[EQ::versions::ClientVersionCount];
+static std::unique_ptr constants_dynamic_gm_lookup_entries[EQ::versions::ClientVersionCount];
+static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::versions::ClientVersionCount] =
{
/*[ClientVersion::Unknown] =*/
- EQEmu::constants::LookupEntry(
+ EQ::constants::LookupEntry(
ClientUnknown::constants::EXPANSION,
ClientUnknown::constants::EXPANSION_BIT,
ClientUnknown::constants::EXPANSIONS_MASK,
@@ -50,7 +50,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
ClientUnknown::INULL
),
/*[ClientVersion::Client62] =*/
- EQEmu::constants::LookupEntry(
+ EQ::constants::LookupEntry(
Client62::constants::EXPANSION,
Client62::constants::EXPANSION_BIT,
Client62::constants::EXPANSIONS_MASK,
@@ -58,7 +58,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
Client62::INULL
),
/*[ClientVersion::Titanium] =*/
- EQEmu::constants::LookupEntry(
+ EQ::constants::LookupEntry(
Titanium::constants::EXPANSION,
Titanium::constants::EXPANSION_BIT,
Titanium::constants::EXPANSIONS_MASK,
@@ -66,7 +66,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
Titanium::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::SoF] =*/
- EQEmu::constants::LookupEntry(
+ EQ::constants::LookupEntry(
SoF::constants::EXPANSION,
SoF::constants::EXPANSION_BIT,
SoF::constants::EXPANSIONS_MASK,
@@ -74,7 +74,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
SoF::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::SoD] =*/
- EQEmu::constants::LookupEntry(
+ EQ::constants::LookupEntry(
SoD::constants::EXPANSION,
SoD::constants::EXPANSION_BIT,
SoD::constants::EXPANSIONS_MASK,
@@ -82,7 +82,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
SoD::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::UF] =*/
- EQEmu::constants::LookupEntry(
+ EQ::constants::LookupEntry(
UF::constants::EXPANSION,
UF::constants::EXPANSION_BIT,
UF::constants::EXPANSIONS_MASK,
@@ -90,7 +90,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
UF::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::RoF] =*/
- EQEmu::constants::LookupEntry(
+ EQ::constants::LookupEntry(
RoF::constants::EXPANSION,
RoF::constants::EXPANSION_BIT,
RoF::constants::EXPANSIONS_MASK,
@@ -98,7 +98,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
RoF::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::RoF2] =*/
- EQEmu::constants::LookupEntry(
+ EQ::constants::LookupEntry(
RoF2::constants::EXPANSION,
RoF2::constants::EXPANSION_BIT,
RoF2::constants::EXPANSIONS_MASK,
@@ -108,7 +108,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
};
static bool constants_dictionary_init = false;
-void EQEmu::constants::InitializeDynamicLookups() {
+void EQ::constants::InitializeDynamicLookups() {
if (constants_dictionary_init == true)
return;
constants_dictionary_init = true;
@@ -119,7 +119,7 @@ void EQEmu::constants::InitializeDynamicLookups() {
// use static references for now
}
-const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicLookup(versions::ClientVersion client_version, bool gm_flag)
+const EQ::constants::LookupEntry* EQ::constants::DynamicLookup(versions::ClientVersion client_version, bool gm_flag)
{
if (gm_flag)
return DynamicGMLookup(client_version);
@@ -127,7 +127,7 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicLookup(versions::C
return DynamicNonGMLookup(client_version);
}
-const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicNonGMLookup(versions::ClientVersion client_version)
+const EQ::constants::LookupEntry* EQ::constants::DynamicNonGMLookup(versions::ClientVersion client_version)
{
client_version = versions::ValidateClientVersion(client_version);
if (constants_dynamic_nongm_lookup_entries[static_cast(client_version)])
@@ -136,7 +136,7 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicNonGMLookup(versio
return &constants_static_lookup_entries[static_cast(client_version)];
}
-const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicGMLookup(versions::ClientVersion client_version)
+const EQ::constants::LookupEntry* EQ::constants::DynamicGMLookup(versions::ClientVersion client_version)
{
client_version = versions::ValidateClientVersion(client_version);
if (constants_dynamic_gm_lookup_entries[static_cast(client_version)])
@@ -145,18 +145,18 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicGMLookup(versions:
return &constants_static_lookup_entries[static_cast(client_version)];
}
-const EQEmu::constants::LookupEntry* EQEmu::constants::StaticLookup(versions::ClientVersion client_version)
+const EQ::constants::LookupEntry* EQ::constants::StaticLookup(versions::ClientVersion client_version)
{
return &constants_static_lookup_entries[static_cast(versions::ValidateClientVersion(client_version))];
}
-static std::unique_ptr inventory_dynamic_nongm_lookup_entries[EQEmu::versions::MobVersionCount];
-static std::unique_ptr inventory_dynamic_gm_lookup_entries[EQEmu::versions::MobVersionCount];
-static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu::versions::MobVersionCount] =
+static std::unique_ptr inventory_dynamic_nongm_lookup_entries[EQ::versions::MobVersionCount];
+static std::unique_ptr inventory_dynamic_gm_lookup_entries[EQ::versions::MobVersionCount];
+static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::versions::MobVersionCount] =
{
/*[MobVersion::Unknown] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
@@ -182,8 +182,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::Client62] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
Client62::INULL, Client62::INULL, Client62::INULL,
Client62::INULL, Client62::INULL, Client62::INULL,
Client62::INULL, Client62::INULL, Client62::INULL,
@@ -209,9 +209,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::Titanium] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, Titanium::invtype::BANK_SIZE, Titanium::invtype::SHARED_BANK_SIZE,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, Titanium::invtype::BANK_SIZE, Titanium::invtype::SHARED_BANK_SIZE,
Titanium::invtype::TRADE_SIZE, Titanium::invtype::WORLD_SIZE, Titanium::invtype::LIMBO_SIZE,
Titanium::invtype::TRIBUTE_SIZE, Titanium::INULL, Titanium::invtype::GUILD_TRIBUTE_SIZE,
Titanium::invtype::MERCHANT_SIZE, Titanium::INULL, Titanium::invtype::CORPSE_SIZE,
@@ -236,9 +236,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
Titanium::inventory::AllowOverLevelEquipment
),
/*[MobVersion::SoF] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, SoF::invtype::BANK_SIZE, SoF::invtype::SHARED_BANK_SIZE,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, SoF::invtype::BANK_SIZE, SoF::invtype::SHARED_BANK_SIZE,
SoF::invtype::TRADE_SIZE, SoF::invtype::WORLD_SIZE, SoF::invtype::LIMBO_SIZE,
SoF::invtype::TRIBUTE_SIZE, SoF::INULL, SoF::invtype::GUILD_TRIBUTE_SIZE,
SoF::invtype::MERCHANT_SIZE, SoF::INULL, SoF::invtype::CORPSE_SIZE,
@@ -263,9 +263,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
SoF::inventory::AllowOverLevelEquipment
),
/*[MobVersion::SoD] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, SoD::invtype::BANK_SIZE, SoD::invtype::SHARED_BANK_SIZE,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, SoD::invtype::BANK_SIZE, SoD::invtype::SHARED_BANK_SIZE,
SoD::invtype::TRADE_SIZE, SoD::invtype::WORLD_SIZE, SoD::invtype::LIMBO_SIZE,
SoD::invtype::TRIBUTE_SIZE, SoD::INULL, SoD::invtype::GUILD_TRIBUTE_SIZE,
SoD::invtype::MERCHANT_SIZE, SoD::INULL, SoD::invtype::CORPSE_SIZE,
@@ -290,9 +290,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
SoD::inventory::AllowOverLevelEquipment
),
/*[MobVersion::UF] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, UF::invtype::BANK_SIZE, UF::invtype::SHARED_BANK_SIZE,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, UF::invtype::BANK_SIZE, UF::invtype::SHARED_BANK_SIZE,
UF::invtype::TRADE_SIZE, UF::invtype::WORLD_SIZE, UF::invtype::LIMBO_SIZE,
UF::invtype::TRIBUTE_SIZE, UF::INULL, UF::invtype::GUILD_TRIBUTE_SIZE,
UF::invtype::MERCHANT_SIZE, UF::INULL, UF::invtype::CORPSE_SIZE,
@@ -317,9 +317,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
UF::inventory::AllowOverLevelEquipment
),
/*[MobVersion::RoF] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, RoF::invtype::BANK_SIZE, RoF::invtype::SHARED_BANK_SIZE,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, RoF::invtype::BANK_SIZE, RoF::invtype::SHARED_BANK_SIZE,
RoF::invtype::TRADE_SIZE, RoF::invtype::WORLD_SIZE, RoF::invtype::LIMBO_SIZE,
RoF::invtype::TRIBUTE_SIZE, RoF::invtype::TROPHY_TRIBUTE_SIZE, RoF::invtype::GUILD_TRIBUTE_SIZE,
RoF::invtype::MERCHANT_SIZE, RoF::invtype::DELETED_SIZE, RoF::invtype::CORPSE_SIZE,
@@ -344,9 +344,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
RoF::inventory::AllowOverLevelEquipment
),
/*[MobVersion::RoF2] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, RoF2::invtype::BANK_SIZE, RoF2::invtype::SHARED_BANK_SIZE,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, RoF2::invtype::BANK_SIZE, RoF2::invtype::SHARED_BANK_SIZE,
RoF2::invtype::TRADE_SIZE, RoF2::invtype::WORLD_SIZE, RoF2::invtype::LIMBO_SIZE,
RoF2::invtype::TRIBUTE_SIZE, RoF2::invtype::TROPHY_TRIBUTE_SIZE, RoF2::invtype::GUILD_TRIBUTE_SIZE,
RoF2::invtype::MERCHANT_SIZE, RoF2::invtype::DELETED_SIZE, RoF2::invtype::CORPSE_SIZE,
@@ -371,9 +371,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
RoF2::inventory::AllowOverLevelEquipment
),
/*[MobVersion::NPC] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EntityLimits::NPC::invtype::TRADE_SIZE, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, /*InvTypeCorpseSize,*/
@@ -389,8 +389,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL,
- 0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
- 0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
+ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
+ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -398,9 +398,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::NPCMerchant] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::invtype::TRADE_SIZE, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, /*InvTypeCorpseSize,*/
@@ -416,8 +416,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL,
- 0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
- 0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
+ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
+ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -425,9 +425,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::Merc] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EntityLimits::Merc::invtype::TRADE_SIZE, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, /*InvTypeCorpseSize,*/
@@ -443,8 +443,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL,
- 0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
- 0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
+ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
+ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -452,9 +452,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::Bot] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
EntityLimits::Bot::invtype::TRADE_SIZE, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, /*InvTypeCorpseSize,*/
@@ -470,8 +470,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::Bot::invslot::CURSOR_BITMASK,
EntityLimits::Bot::invslot::POSSESSIONS_BITMASK,
EntityLimits::Bot::INULL,
- 0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
- EQEmu::invaug::SOCKET_COUNT, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
+ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
+ EQ::invaug::SOCKET_COUNT, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -479,9 +479,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::ClientPet] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::invtype::TRADE_SIZE, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, /*InvTypeCorpseSize,*/
@@ -497,8 +497,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL,
- 0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
- 0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
+ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
+ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -506,9 +506,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::NPCPet] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::invtype::TRADE_SIZE, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, /*InvTypeCorpseSize,*/
@@ -524,8 +524,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL,
- 0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
- 0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
+ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
+ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -533,9 +533,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::MercPet] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EntityLimits::MercPet::invtype::TRADE_SIZE, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, /*InvTypeCorpseSize,*/
@@ -551,8 +551,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL,
- 0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
- 0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
+ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
+ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -560,9 +560,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::BotPet] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
- EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EntityLimits::BotPet::invtype::TRADE_SIZE, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, /*InvTypeCorpseSize,*/
@@ -578,8 +578,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL,
- 0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
- 0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
+ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
+ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -587,8 +587,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::OfflineTitanium] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
Titanium::INULL, Titanium::INULL, Titanium::INULL,
Titanium::invtype::TRADE_SIZE, Titanium::INULL, Titanium::INULL,
Titanium::INULL, Titanium::INULL, Titanium::INULL,
@@ -614,8 +614,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::OfflineSoF] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
SoF::INULL, SoF::INULL, SoF::INULL,
SoF::invtype::TRADE_SIZE, SoF::INULL, SoF::INULL,
SoF::INULL, SoF::INULL, SoF::INULL,
@@ -641,8 +641,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::OfflineSoD] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
SoD::INULL, SoD::INULL, SoD::INULL,
SoD::invtype::TRADE_SIZE, SoD::INULL, SoD::INULL,
SoD::INULL, SoD::INULL, SoD::INULL,
@@ -668,8 +668,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::OfflineUF] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
UF::INULL, UF::INULL, UF::INULL,
UF::invtype::TRADE_SIZE, UF::INULL, UF::INULL,
UF::INULL, UF::INULL, UF::INULL,
@@ -695,8 +695,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::OfflineRoF] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
RoF::INULL, RoF::INULL, RoF::INULL,
RoF::invtype::TRADE_SIZE, RoF::INULL, RoF::INULL,
RoF::INULL, RoF::INULL, RoF::INULL,
@@ -722,8 +722,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::OfflineRoF2] =*/
- EQEmu::inventory::LookupEntry(
- EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
+ EQ::inventory::LookupEntry(
+ EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
RoF2::INULL, RoF2::INULL, RoF2::INULL,
RoF2::invtype::TRADE_SIZE, RoF2::INULL, RoF2::INULL,
RoF2::INULL, RoF2::INULL, RoF2::INULL,
@@ -751,7 +751,7 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
};
static bool inventory_dictionary_init = false;
-void EQEmu::inventory::InitializeDynamicLookups() {
+void EQ::inventory::InitializeDynamicLookups() {
if (inventory_dictionary_init == true)
return;
inventory_dictionary_init = true;
@@ -774,9 +774,9 @@ void EQEmu::inventory::InitializeDynamicLookups() {
const uint32 dynamic_check_mask =
(
- EQEmu::expansions::bitPoR |
- EQEmu::expansions::bitTBS |
- EQEmu::expansions::bitHoT
+ EQ::expansions::bitPoR |
+ EQ::expansions::bitTBS |
+ EQ::expansions::bitHoT
);
// if all of the above expansion bits are present, then static references will suffice
@@ -784,7 +784,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
return;
// Dynamic Lookups (promotive methodology) (all mob versions allowed)
- for (uint32 iter = static_cast(EQEmu::versions::MobVersion::Unknown); iter <= static_cast(EQEmu::versions::LastPCMobVersion); ++iter) {
+ for (uint32 iter = static_cast(EQ::versions::MobVersion::Unknown); iter <= static_cast(EQ::versions::LastPCMobVersion); ++iter) {
// no need to dynamic this condition since it is the lowest compatibility standard
if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask)
continue;
@@ -794,7 +794,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
continue;
// direct manipulation of lookup indices is safe so long as (int)ClientVersion:: == (int)MobVersion::
- inventory_dynamic_nongm_lookup_entries[iter] = std::unique_ptr(new LookupEntry(inventory_static_lookup_entries[iter]));
+ inventory_dynamic_nongm_lookup_entries[iter] = std::make_unique(inventory_static_lookup_entries[iter]);
// clamp affected fields to the lowest standard
inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; // bank size
@@ -803,21 +803,21 @@ void EQEmu::inventory::InitializeDynamicLookups() {
inventory_dynamic_nongm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later
inventory_dynamic_nongm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later
- if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitPoR) {
+ if (RuleI(World, ExpansionSettings) & EQ::expansions::bitPoR) {
// update bank size
- if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitPoR)
+ if (constants_static_lookup_entries[iter].ExpansionsMask & EQ::expansions::bitPoR)
inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = SoF::invtype::BANK_SIZE;
}
- if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitTBS) {
+ if (RuleI(World, ExpansionSettings) & EQ::expansions::bitTBS) {
// update power source
- if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitTBS)
+ if (constants_static_lookup_entries[iter].ExpansionsMask & EQ::expansions::bitTBS)
inventory_dynamic_nongm_lookup_entries[iter]->EquipmentBitmask = SoF::invslot::EQUIPMENT_BITMASK;
}
- if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitHoT) {
+ if (RuleI(World, ExpansionSettings) & EQ::expansions::bitHoT) {
// update general size
- if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitHoT)
+ if (constants_static_lookup_entries[iter].ExpansionsMask & EQ::expansions::bitHoT)
inventory_dynamic_nongm_lookup_entries[iter]->GeneralBitmask = RoF::invslot::GENERAL_BITMASK;
}
@@ -841,7 +841,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
}
// Dynamic GM Lookups (demotive methodology) (client-linked mob versions only)
- for (uint32 iter = static_cast(EQEmu::versions::MobVersion::Unknown); iter <= static_cast(EQEmu::versions::LastPCMobVersion); ++iter) {
+ for (uint32 iter = static_cast(EQ::versions::MobVersion::Unknown); iter <= static_cast(EQ::versions::LastPCMobVersion); ++iter) {
// no need to dynamic this condition since it is the lowest compatibility standard
if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask)
continue;
@@ -864,18 +864,18 @@ void EQEmu::inventory::InitializeDynamicLookups() {
}
// direct manipulation of lookup indices is safe so long as (int)ClientVersion:: == (int)MobVersion::
- inventory_dynamic_gm_lookup_entries[iter] = std::unique_ptr(new LookupEntry(inventory_static_lookup_entries[iter]));
+ inventory_dynamic_gm_lookup_entries[iter] = std::make_unique(inventory_static_lookup_entries[iter]);
inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later
inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later
- if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitPoR) {
+ if (~RuleI(World, ExpansionSettings) & EQ::expansions::bitPoR) {
// update bank size
- if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitPoR)
+ if (constants_static_lookup_entries[iter].ExpansionsMask & EQ::expansions::bitPoR)
inventory_dynamic_gm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE;
}
- if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitTBS) {
+ if (~RuleI(World, ExpansionSettings) & EQ::expansions::bitTBS) {
// update power source
switch (iter) {
case versions::bitUF:
@@ -890,7 +890,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
}
}
- if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitHoT) {
+ if (~RuleI(World, ExpansionSettings) & EQ::expansions::bitHoT) {
// update general size
switch (iter) {
case versions::bitUF:
@@ -927,7 +927,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
// only client versions that require a change from their static definitions have been given a dynamic (gm) lookup entry
}
-const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicLookup(versions::MobVersion mob_version, bool gm_flag)
+const EQ::inventory::LookupEntry* EQ::inventory::DynamicLookup(versions::MobVersion mob_version, bool gm_flag)
{
if (gm_flag)
return DynamicGMLookup(mob_version);
@@ -935,7 +935,7 @@ const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicLookup(versions::M
return DynamicNonGMLookup(mob_version);
}
-const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicNonGMLookup(versions::MobVersion mob_version)
+const EQ::inventory::LookupEntry* EQ::inventory::DynamicNonGMLookup(versions::MobVersion mob_version)
{
mob_version = versions::ValidateMobVersion(mob_version);
if (inventory_dynamic_nongm_lookup_entries[static_cast(mob_version)])
@@ -944,7 +944,7 @@ const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicNonGMLookup(versio
return &inventory_static_lookup_entries[static_cast(mob_version)];
}
-const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicGMLookup(versions::MobVersion mob_version)
+const EQ::inventory::LookupEntry* EQ::inventory::DynamicGMLookup(versions::MobVersion mob_version)
{
mob_version = versions::ValidateMobVersion(mob_version);
if (inventory_dynamic_gm_lookup_entries[static_cast(mob_version)])
@@ -953,107 +953,107 @@ const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicGMLookup(versions:
return &inventory_static_lookup_entries[static_cast(mob_version)];
}
-const EQEmu::inventory::LookupEntry* EQEmu::inventory::StaticLookup(versions::MobVersion mob_version)
+const EQ::inventory::LookupEntry* EQ::inventory::StaticLookup(versions::MobVersion mob_version)
{
return &inventory_static_lookup_entries[static_cast(versions::ValidateMobVersion(mob_version))];
}
-static std::unique_ptr behavior_dynamic_nongm_lookup_entries[EQEmu::versions::MobVersionCount];
-static std::unique_ptr behavior_dynamic_gm_lookup_entries[EQEmu::versions::MobVersionCount];
-static const EQEmu::behavior::LookupEntry behavior_static_lookup_entries[EQEmu::versions::MobVersionCount] =
+static std::unique_ptr behavior_dynamic_nongm_lookup_entries[EQ::versions::MobVersionCount];
+static std::unique_ptr behavior_dynamic_gm_lookup_entries[EQ::versions::MobVersionCount];
+static const EQ::behavior::LookupEntry behavior_static_lookup_entries[EQ::versions::MobVersionCount] =
{
/*[MobVersion::Unknown] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
true
),
/*[MobVersion::Client62] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
true
),
/*[MobVersion::Titanium] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
Titanium::behavior::CoinHasWeight
),
/*[MobVersion::SoF] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
SoF::behavior::CoinHasWeight
),
/*[MobVersion::SoD] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
SoD::behavior::CoinHasWeight
),
/*[MobVersion::UF] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
UF::behavior::CoinHasWeight
),
/*[MobVersion::RoF] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
RoF::behavior::CoinHasWeight
),
/*[MobVersion::RoF2] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
RoF2::behavior::CoinHasWeight
),
/*[MobVersion::NPC] =*/
- EQEmu::behavior::LookupEntry(
- EQEmu::behavior::CoinHasWeight
+ EQ::behavior::LookupEntry(
+ EQ::behavior::CoinHasWeight
),
/*[MobVersion::NPCMerchant] =*/
- EQEmu::behavior::LookupEntry(
- EQEmu::behavior::CoinHasWeight
+ EQ::behavior::LookupEntry(
+ EQ::behavior::CoinHasWeight
),
/*[MobVersion::Merc] =*/
- EQEmu::behavior::LookupEntry(
- EQEmu::behavior::CoinHasWeight
+ EQ::behavior::LookupEntry(
+ EQ::behavior::CoinHasWeight
),
/*[MobVersion::Bot] =*/
- EQEmu::behavior::LookupEntry(
- EQEmu::behavior::CoinHasWeight
+ EQ::behavior::LookupEntry(
+ EQ::behavior::CoinHasWeight
),
/*[MobVersion::ClientPet] =*/
- EQEmu::behavior::LookupEntry(
- EQEmu::behavior::CoinHasWeight
+ EQ::behavior::LookupEntry(
+ EQ::behavior::CoinHasWeight
),
/*[MobVersion::NPCPet] =*/
- EQEmu::behavior::LookupEntry(
- EQEmu::behavior::CoinHasWeight
+ EQ::behavior::LookupEntry(
+ EQ::behavior::CoinHasWeight
),
/*[MobVersion::MercPet] =*/
- EQEmu::behavior::LookupEntry(
- EQEmu::behavior::CoinHasWeight
+ EQ::behavior::LookupEntry(
+ EQ::behavior::CoinHasWeight
),
/*[MobVersion::BotPet] =*/
- EQEmu::behavior::LookupEntry(
- EQEmu::behavior::CoinHasWeight
+ EQ::behavior::LookupEntry(
+ EQ::behavior::CoinHasWeight
),
/*[MobVersion::OfflineTitanium] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
Titanium::behavior::CoinHasWeight
),
/*[MobVersion::OfflineSoF] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
SoF::behavior::CoinHasWeight
),
/*[MobVersion::OfflineSoD] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
SoD::behavior::CoinHasWeight
),
/*[MobVersion::OfflineUF] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
UF::behavior::CoinHasWeight
),
/*[MobVersion::OfflineRoF] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
RoF::behavior::CoinHasWeight
),
/*[MobVersion::OfflineRoF2] =*/
- EQEmu::behavior::LookupEntry(
+ EQ::behavior::LookupEntry(
RoF2::behavior::CoinHasWeight
)
};
static bool behavior_dictionary_init = false;
-void EQEmu::behavior::InitializeDynamicLookups() {
+void EQ::behavior::InitializeDynamicLookups() {
if (behavior_dictionary_init == true)
return;
behavior_dictionary_init = true;
@@ -1064,7 +1064,7 @@ void EQEmu::behavior::InitializeDynamicLookups() {
// use static references for now
}
-const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicLookup(versions::MobVersion mob_version, bool gm_flag)
+const EQ::behavior::LookupEntry* EQ::behavior::DynamicLookup(versions::MobVersion mob_version, bool gm_flag)
{
if (gm_flag)
return DynamicGMLookup(mob_version);
@@ -1072,7 +1072,7 @@ const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicLookup(versions::Mob
return DynamicNonGMLookup(mob_version);
}
-const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicNonGMLookup(versions::MobVersion mob_version)
+const EQ::behavior::LookupEntry* EQ::behavior::DynamicNonGMLookup(versions::MobVersion mob_version)
{
mob_version = versions::ValidateMobVersion(mob_version);
if (behavior_dynamic_nongm_lookup_entries[static_cast(mob_version)])
@@ -1081,7 +1081,7 @@ const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicNonGMLookup(versions
return &behavior_static_lookup_entries[static_cast(mob_version)];
}
-const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicGMLookup(versions::MobVersion mob_version)
+const EQ::behavior::LookupEntry* EQ::behavior::DynamicGMLookup(versions::MobVersion mob_version)
{
mob_version = versions::ValidateMobVersion(mob_version);
if (behavior_dynamic_gm_lookup_entries[static_cast(mob_version)])
@@ -1090,17 +1090,17 @@ const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicGMLookup(versions::M
return &behavior_static_lookup_entries[static_cast(mob_version)];
}
-const EQEmu::behavior::LookupEntry* EQEmu::behavior::StaticLookup(versions::MobVersion mob_version)
+const EQ::behavior::LookupEntry* EQ::behavior::StaticLookup(versions::MobVersion mob_version)
{
return &behavior_static_lookup_entries[static_cast(versions::ValidateMobVersion(mob_version))];
}
-static std::unique_ptr spells_dynamic_nongm_lookup_entries[EQEmu::versions::ClientVersionCount];
-static std::unique_ptr spells_dynamic_gm_lookup_entries[EQEmu::versions::ClientVersionCount];
-static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::versions::ClientVersionCount] =
+static std::unique_ptr spells_dynamic_nongm_lookup_entries[EQ::versions::ClientVersionCount];
+static std::unique_ptr spells_dynamic_gm_lookup_entries[EQ::versions::ClientVersionCount];
+static const EQ::spells::LookupEntry spells_static_lookup_entries[EQ::versions::ClientVersionCount] =
{
/*[ClientVersion::Unknown] =*/
- EQEmu::spells::LookupEntry(
+ EQ::spells::LookupEntry(
ClientUnknown::INULL,
ClientUnknown::INULL,
ClientUnknown::INULL,
@@ -1113,7 +1113,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
ClientUnknown::INULL
),
/*[ClientVersion::Client62] =*/
- EQEmu::spells::LookupEntry(
+ EQ::spells::LookupEntry(
Client62::INULL,
Client62::INULL,
Client62::INULL,
@@ -1126,7 +1126,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
Client62::INULL
),
/*[ClientVersion::Titanium] =*/
- EQEmu::spells::LookupEntry(
+ EQ::spells::LookupEntry(
Titanium::spells::SPELL_ID_MAX,
Titanium::spells::SPELLBOOK_SIZE,
Titanium::spells::SPELL_GEM_COUNT,
@@ -1139,7 +1139,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
Titanium::spells::MERC_BUFFS
),
/*[ClientVersion::SoF] =*/
- EQEmu::spells::LookupEntry(
+ EQ::spells::LookupEntry(
SoF::spells::SPELL_ID_MAX,
SoF::spells::SPELLBOOK_SIZE,
SoF::spells::SPELL_GEM_COUNT,
@@ -1152,7 +1152,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
SoF::spells::MERC_BUFFS
),
/*[ClientVersion::SoD] =*/
- EQEmu::spells::LookupEntry(
+ EQ::spells::LookupEntry(
SoD::spells::SPELL_ID_MAX,
SoD::spells::SPELLBOOK_SIZE,
SoD::spells::SPELL_GEM_COUNT,
@@ -1165,7 +1165,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
SoD::spells::MERC_BUFFS
),
/*[ClientVersion::UF] =*/
- EQEmu::spells::LookupEntry(
+ EQ::spells::LookupEntry(
UF::spells::SPELL_ID_MAX,
UF::spells::SPELLBOOK_SIZE,
UF::spells::SPELL_GEM_COUNT,
@@ -1178,7 +1178,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
UF::spells::MERC_BUFFS
),
/*[ClientVersion::RoF] =*/
- EQEmu::spells::LookupEntry(
+ EQ::spells::LookupEntry(
RoF::spells::SPELL_ID_MAX,
RoF::spells::SPELLBOOK_SIZE,
UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case
@@ -1191,7 +1191,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
RoF::spells::MERC_BUFFS
),
/*[ClientVersion::RoF2] =*/
- EQEmu::spells::LookupEntry(
+ EQ::spells::LookupEntry(
RoF2::spells::SPELL_ID_MAX,
RoF2::spells::SPELLBOOK_SIZE,
UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case
@@ -1206,7 +1206,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
};
static bool spells_dictionary_init = false;
-void EQEmu::spells::InitializeDynamicLookups() {
+void EQ::spells::InitializeDynamicLookups() {
if (spells_dictionary_init == true)
return;
spells_dictionary_init = true;
@@ -1217,7 +1217,7 @@ void EQEmu::spells::InitializeDynamicLookups() {
// use static references for now
}
-const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicLookup(versions::ClientVersion client_version, bool gm_flag)
+const EQ::spells::LookupEntry* EQ::spells::DynamicLookup(versions::ClientVersion client_version, bool gm_flag)
{
if (gm_flag)
return DynamicGMLookup(client_version);
@@ -1225,7 +1225,7 @@ const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicLookup(versions::ClientV
return DynamicNonGMLookup(client_version);
}
-const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicNonGMLookup(versions::ClientVersion client_version)
+const EQ::spells::LookupEntry* EQ::spells::DynamicNonGMLookup(versions::ClientVersion client_version)
{
client_version = versions::ValidateClientVersion(client_version);
if (spells_dynamic_nongm_lookup_entries[static_cast(client_version)])
@@ -1234,7 +1234,7 @@ const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicNonGMLookup(versions::Cl
return &spells_static_lookup_entries[static_cast(client_version)];
}
-const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicGMLookup(versions::ClientVersion client_version)
+const EQ::spells::LookupEntry* EQ::spells::DynamicGMLookup(versions::ClientVersion client_version)
{
client_version = versions::ValidateClientVersion(client_version);
if (spells_dynamic_gm_lookup_entries[static_cast(client_version)])
@@ -1243,7 +1243,7 @@ const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicGMLookup(versions::Clien
return &spells_static_lookup_entries[static_cast(client_version)];
}
-const EQEmu::spells::LookupEntry* EQEmu::spells::StaticLookup(versions::ClientVersion client_version)
+const EQ::spells::LookupEntry* EQ::spells::StaticLookup(versions::ClientVersion client_version)
{
return &spells_static_lookup_entries[static_cast(versions::ValidateClientVersion(client_version))];
}
diff --git a/common/eq_limits.h b/common/eq_limits.h
index 5d62ced66..fe944c816 100644
--- a/common/eq_limits.h
+++ b/common/eq_limits.h
@@ -31,13 +31,13 @@
#include "../common/patches/rof2_limits.h"
-namespace EQEmu
+namespace EQ
{
void InitializeDynamicLookups();
namespace constants {
struct LookupEntry {
- EQEmu::expansions::Expansion Expansion;
+ EQ::expansions::Expansion Expansion;
uint32 ExpansionBit;
uint32 ExpansionsMask;
int16 CharacterCreationLimit;
@@ -45,7 +45,7 @@ namespace EQEmu
LookupEntry(const LookupEntry *lookup_entry) { }
LookupEntry(
- EQEmu::expansions::Expansion Expansion,
+ EQ::expansions::Expansion Expansion,
uint32 ExpansionBit,
uint32 ExpansionsMask,
int16 CharacterCreationLimit,
@@ -111,7 +111,7 @@ namespace EQEmu
union {
InventoryTypeSize_Struct InventoryTypeSize;
- int16 InventoryTypeSizeArray[25]; // should reflect EQEmu::invtype::TYPE_COUNT referenced in emu_constants.h
+ int16 InventoryTypeSizeArray[25]; // should reflect EQ::invtype::TYPE_COUNT referenced in emu_constants.h
};
uint64 EquipmentBitmask;
@@ -244,9 +244,9 @@ namespace ClientUnknown
const int16 INULL = 0;
namespace constants {
- const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::EverQuest;
- const uint32 EXPANSION_BIT = EQEmu::expansions::bitEverQuest;
- const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskEverQuest;
+ const EQ::expansions::Expansion EXPANSION = EQ::expansions::Expansion::EverQuest;
+ const uint32 EXPANSION_BIT = EQ::expansions::bitEverQuest;
+ const uint32 EXPANSIONS_MASK = EQ::expansions::maskEverQuest;
} // namespace constants
@@ -258,9 +258,9 @@ namespace Client62
const int16 INULL = 0;
namespace constants {
- const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::EverQuest;
- const uint32 EXPANSION_BIT = EQEmu::expansions::bitEverQuest;
- const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskEverQuest;
+ const EQ::expansions::Expansion EXPANSION = EQ::expansions::Expansion::EverQuest;
+ const uint32 EXPANSION_BIT = EQ::expansions::bitEverQuest;
+ const uint32 EXPANSIONS_MASK = EQ::expansions::maskEverQuest;
} // namespace constants
diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h
index e9e7c5ef3..f5d47546e 100644
--- a/common/eq_packet_structs.h
+++ b/common/eq_packet_structs.h
@@ -129,7 +129,7 @@ struct LDoNTrapTemplate
// All clients translate the character select information to some degree
-struct CharSelectEquip : EQEmu::textures::Texture_Struct, EQEmu::textures::Tint_Struct {};
+struct CharSelectEquip : EQ::textures::Texture_Struct, EQ::textures::Tint_Struct {};
// RoF2-based hybrid struct
struct CharacterSelectEntry_Struct
@@ -144,7 +144,7 @@ struct CharacterSelectEntry_Struct
uint16 Instance;
uint8 Gender;
uint8 Face;
- CharSelectEquip Equip[EQEmu::textures::materialCount];
+ CharSelectEquip Equip[EQ::textures::materialCount];
uint8 Unknown15; // Seen FF
uint8 Unknown19; // Seen FF
uint32 DrakkinTattoo;
@@ -253,7 +253,7 @@ struct Spawn_Struct {
/*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*/ EQEmu::TextureProfile equipment;
+/*0197*/ EQ::TextureProfile equipment;
/*0233*/ float runspeed; // Speed when running
/*0036*/ uint8 afk; // 0=no, 1=afk
/*0238*/ uint32 guildID; // Current guild
@@ -284,7 +284,7 @@ union
/*0340*/ uint32 spawnId; // Spawn Id
/*0344*/ float bounding_radius; // used in melee, overrides calc
/*0347*/ uint8 IsMercenary;
-/*0348*/ EQEmu::TintProfile equipment_tint;
+/*0348*/ EQ::TintProfile equipment_tint;
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
/*0385*/
@@ -375,13 +375,16 @@ struct NewZone_Struct {
/*0686*/ uint16 zone_instance;
/*0688*/ uint32 unknown688;
/*0692*/ uint8 unknown692[8];
+// Titanium doesn't have a translator, but we can still safely add stuff under here without issues since client memcpy's only what it knows
+// Just wastes some bandwidth sending to tit clients /shrug
/*0700*/ float fog_density;
/*0704*/ uint32 SuspendBuffs;
/*0708*/ uint32 FastRegenHP;
/*0712*/ uint32 FastRegenMana;
/*0716*/ uint32 FastRegenEndurance;
/*0720*/ uint32 NPCAggroMaxDist;
-/*0724*/
+/*0724*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, if this value is 0, it prevents you from running off edges that would end up underworld
+/*0728*/
};
/*
@@ -736,7 +739,7 @@ struct BandolierItem_Struct
struct Bandolier_Struct
{
char Name[32];
- BandolierItem_Struct Items[EQEmu::profile::BANDOLIER_ITEM_COUNT];
+ BandolierItem_Struct Items[EQ::profile::BANDOLIER_ITEM_COUNT];
};
//len = 72
@@ -750,7 +753,7 @@ struct PotionBeltItem_Struct
//len = 288
struct PotionBelt_Struct
{
- PotionBeltItem_Struct Items[EQEmu::profile::POTION_BELT_SIZE];
+ PotionBeltItem_Struct Items[EQ::profile::POTION_BELT_SIZE];
};
struct MovePotionToBelt_Struct
@@ -826,7 +829,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
- /*000*/ uint32 zoneId;
+ /*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -841,7 +844,7 @@ struct SuspendedMinion_Struct
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
- /*510*/ EQEmu::TextureMaterialProfile Items;
+ /*510*/ EQ::TextureMaterialProfile Items;
/*546*/ char Name[64];
/*610*/
};
@@ -933,7 +936,7 @@ struct PlayerProfile_Struct
/*0245*/ uint8 guildbanker;
/*0246*/ uint8 unknown0246[6]; //
/*0252*/ uint32 intoxication;
-/*0256*/ uint32 spellSlotRefresh[EQEmu::spells::SPELL_GEM_COUNT]; //in ms
+/*0256*/ uint32 spellSlotRefresh[EQ::spells::SPELL_GEM_COUNT]; //in ms
/*0292*/ uint32 abilitySlotRefresh;
/*0296*/ uint8 haircolor; // Player hair color
/*0297*/ uint8 beardcolor; // Player beard color
@@ -946,9 +949,9 @@ struct PlayerProfile_Struct
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
-/*0312*/ EQEmu::TextureMaterialProfile item_material; // Item texture/material of worn/held items
+/*0312*/ EQ::TextureMaterialProfile item_material; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44];
-/*0392*/ EQEmu::TintProfile item_tint;
+/*0392*/ EQ::TintProfile item_tint;
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right
@@ -972,9 +975,9 @@ struct PlayerProfile_Struct
/*2505*/ uint8 unknown2541[47]; // ?
/*2552*/ uint8 languages[MAX_PP_LANGUAGE];
/*2580*/ uint8 unknown2616[4];
-/*2584*/ uint32 spell_book[EQEmu::spells::SPELLBOOK_SIZE];
+/*2584*/ uint32 spell_book[EQ::spells::SPELLBOOK_SIZE];
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
-/*4632*/ uint32 mem_spells[EQEmu::spells::SPELL_GEM_COUNT];
+/*4632*/ uint32 mem_spells[EQ::spells::SPELL_GEM_COUNT];
/*4668*/ uint8 unknown4704[32]; //
/*4700*/ float y; // Player y position
/*4704*/ float x; // Player x position
@@ -1050,7 +1053,7 @@ struct PlayerProfile_Struct
/*7212*/ uint32 tribute_points;
/*7216*/ uint32 unknown7252;
/*7220*/ uint32 tribute_active; //1=active
-/*7224*/ Tribute_Struct tributes[EQEmu::invtype::TRIBUTE_SIZE];
+/*7224*/ Tribute_Struct tributes[EQ::invtype::TRIBUTE_SIZE];
/*7264*/ Disciplines_Struct disciplines;
/*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use)
/*7744*/ char unknown7780[160];
@@ -1077,7 +1080,7 @@ struct PlayerProfile_Struct
/*12800*/ uint32 expAA;
/*12804*/ uint32 aapoints; //avaliable, unspent
/*12808*/ uint8 unknown12844[36];
-/*12844*/ Bandolier_Struct bandoliers[EQEmu::profile::BANDOLIERS_SIZE];
+/*12844*/ Bandolier_Struct bandoliers[EQ::profile::BANDOLIERS_SIZE];
/*14124*/ uint8 unknown14160[4506];
/*18630*/ SuspendedMinion_Struct SuspendedMinion; // No longer in use
/*19240*/ uint32 timeentitledonaccount;
@@ -1095,16 +1098,16 @@ struct PlayerProfile_Struct
/*19568*/
// All player profile packets are translated and this overhead is ignored in out-bound packets
- PlayerProfile_Struct() : m_player_profile_version(EQEmu::versions::MobVersion::Unknown) { }
+ PlayerProfile_Struct() : m_player_profile_version(EQ::versions::MobVersion::Unknown) { }
- EQEmu::versions::MobVersion PlayerProfileVersion() { return m_player_profile_version; }
- void SetPlayerProfileVersion(EQEmu::versions::MobVersion mob_version) { m_player_profile_version = EQEmu::versions::ValidateMobVersion(mob_version); }
- void SetPlayerProfileVersion(EQEmu::versions::ClientVersion client_version) { SetPlayerProfileVersion(EQEmu::versions::ConvertClientVersionToMobVersion(client_version)); }
+ EQ::versions::MobVersion PlayerProfileVersion() { return m_player_profile_version; }
+ void SetPlayerProfileVersion(EQ::versions::MobVersion mob_version) { m_player_profile_version = EQ::versions::ValidateMobVersion(mob_version); }
+ void SetPlayerProfileVersion(EQ::versions::ClientVersion client_version) { SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(client_version)); }
private:
// No need for gm flag since pp already has one
// No need for lookup pointer since this struct is not tied to any one system
- EQEmu::versions::MobVersion m_player_profile_version;
+ EQ::versions::MobVersion m_player_profile_version;
};
@@ -1215,7 +1218,7 @@ struct WearChange_Struct {
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ uint32 hero_forge_model; // New to VoA
/*018*/ uint32 unknown18; // New to RoF
-/*022*/ EQEmu::textures::Tint_Struct color;
+/*022*/ EQ::textures::Tint_Struct color;
/*026*/ uint8 wear_slot_id;
/*027*/
};
@@ -1769,7 +1772,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
-/*0080*/ char unknown0080[4];
+/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -2123,7 +2126,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
- EQEmu::ItemData item;
+ EQ::ItemData item;
uint8 iss_unknown001[6];
};*/
@@ -2149,7 +2152,7 @@ struct Illusion_Struct { //size: 256 - SoF
/*092*/ uint32 drakkin_heritage; //
/*096*/ uint32 drakkin_tattoo; //
/*100*/ uint32 drakkin_details; //
-/*104*/ EQEmu::TintProfile armor_tint; //
+/*104*/ EQ::TintProfile armor_tint; //
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
/*142*/ uint8 unknown138[114]; //
@@ -3244,7 +3247,7 @@ struct TraderClick_Struct{
};
struct FormattedMessage_Struct{
- uint32 unknown0;
+ uint32 unknown0; // 1 means from world server
uint32 string_id;
uint32 type;
char message[0];
@@ -3252,7 +3255,7 @@ struct FormattedMessage_Struct{
struct SimpleMessage_Struct{
uint32 string_id;
uint32 color;
- uint32 unknown8;
+ uint32 unknown8; // 1 means from world server
};
struct GuildMemberUpdate_Struct {
@@ -3489,8 +3492,8 @@ struct SelectTributeReply_Struct {
struct TributeInfo_Struct {
uint32 active; //0 == inactive, 1 == active
- uint32 tributes[EQEmu::invtype::TRIBUTE_SIZE]; //-1 == NONE
- uint32 tiers[EQEmu::invtype::TRIBUTE_SIZE]; //all 00's
+ uint32 tributes[EQ::invtype::TRIBUTE_SIZE]; //-1 == NONE
+ uint32 tiers[EQ::invtype::TRIBUTE_SIZE]; //all 00's
uint32 tribute_master_id;
};
@@ -4401,7 +4404,7 @@ struct AnnoyingZoneUnknown_Struct {
};
struct LoadSpellSet_Struct {
- uint32 spell[EQEmu::spells::SPELL_GEM_COUNT]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0
+ uint32 spell[EQ::spells::SPELL_GEM_COUNT]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0
uint32 unknown; //there seems to be an extra field in this packet...
};
@@ -4832,17 +4835,99 @@ struct BuffIcon_Struct
BuffIconEntry_Struct entries[0];
};
-struct ExpeditionInfo_Struct
+struct ExpeditionInvite_Struct
{
-/*000*/ uint32 max_players;
-/*004*/ char expedition_name[128];
-/*132*/ char leader_name[64];
+/*000*/ uint32 client_id; // unique character id
+/*004*/ uint32 unknown004; // added after titanium
+/*008*/ char inviter_name[64];
+/*072*/ char expedition_name[128];
+/*200*/ uint8 swapping; // 0: adding 1: swapping
+/*201*/ char swap_name[64]; // if swapping, swap name being removed
+/*265*/ uint8 padding[3];
+/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
+/*270*/ uint16 dz_instance_id;
};
-struct ExpeditionJoinPrompt_Struct
+struct ExpeditionInviteResponse_Struct
{
-/*000*/ char player_name[64];
-/*064*/ char expedition_name[64];
+/*000*/ uint32 unknown000;
+/*004*/ uint32 unknown004; // added after titanium
+/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
+/*010*/ uint16 dz_instance_id;
+/*012*/ uint8 accepted; // 0: declined 1: accepted
+/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
+/*014*/ char swap_name[64]; // swap name sent in invite
+/*078*/ uint8 unknown078; // padding garbage?
+/*079*/ uint8 unknown079; // padding garbage?
+};
+
+struct DynamicZoneInfo_Struct
+{
+/*000*/ uint32 client_id;
+/*004*/ uint32 unknown004; // added after titanium
+/*008*/ uint32 assigned; // padded bool, 0: clear info, 1: fill window info
+/*012*/ uint32 max_players;
+/*016*/ char dz_name[128];
+/*144*/ char leader_name[64];
+//*208*/ uint32 dz_type; // only in newer clients, if not 1 (expedition type) window does not auto show when dz info assigned
+};
+
+struct DynamicZoneMemberEntry_Struct
+{
+/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
+/*064*/ uint8 online_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
+};
+
+struct DynamicZoneMemberList_Struct
+{
+/*000*/ uint32 client_id;
+/*004*/ uint32 member_count;
+/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
+};
+
+struct DynamicZoneMemberListName_Struct
+{
+/*000*/ uint32 client_id;
+/*004*/ uint32 unknown004;
+/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
+/*012*/ char name[64];
+};
+
+struct ExpeditionLockoutTimerEntry_Struct
+{
+/*000*/ char expedition_name[128]; // variable length, null terminated, max 0x80 (128)
+/*000*/ uint32 seconds_remaining;
+/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
+/*000*/ char event_name[256]; // variable length, null terminated, max 0x100 (256)
+};
+
+struct ExpeditionLockoutTimers_Struct
+{
+/*000*/ uint32 client_id;
+/*004*/ uint32 count;
+/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
+};
+
+struct DynamicZoneLeaderName_Struct
+{
+/*000*/ uint32 client_id;
+/*004*/ uint32 unknown004;
+/*008*/ char leader_name[64];
+};
+
+struct ExpeditionCommand_Struct
+{
+/*000*/ uint32 unknown000;
+/*004*/ uint32 unknown004;
+/*008*/ char name[64];
+};
+
+struct ExpeditionCommandSwap_Struct
+{
+/*000*/ uint32 unknown000;
+/*004*/ uint32 unknown004;
+/*008*/ char add_player_name[64]; // swap to (player must confirm)
+/*072*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
@@ -4850,48 +4935,67 @@ struct ExpeditionExpireWarning
/*008*/ uint32 minutes_remaining;
};
-struct ExpeditionCompassEntry_Struct
+struct DynamicZoneCompassEntry_Struct
{
-/*000*/ uint32 enabled; //guess
-/*004*/ float y;
-/*008*/ float x;
-/*012*/ float z;
+/*000*/ uint16 dz_zone_id; // target dz id pair
+/*002*/ uint16 dz_instance_id;
+/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
+/*008*/ uint32 unknown008;
+/*012*/ float y;
+/*016*/ float x;
+/*020*/ float z;
};
-struct ExpeditionCompass_Struct
+struct DynamicZoneCompass_Struct
{
+/*000*/ uint32 client_id;
/*000*/ uint32 count;
-/*004*/ ExpeditionCompassEntry_Struct entries[0];
+/*004*/ DynamicZoneCompassEntry_Struct entries[0];
};
-struct ExpeditionMemberEntry_Struct
+struct DynamicZoneChooseZoneEntry_Struct
{
- char name[64];
- char status;
+/*000*/ uint16 dz_zone_id; // dz_id pair
+/*002*/ uint16 dz_instance_id;
+/*004*/ uint32 unknown_id1; // seen 28 00 00 00 (40), sent back in reply
+/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
+/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
+/*016*/ char description[128]; // variable length, null terminated
+/*144*/ char leader_name[64]; // variable length, null terminated
};
-struct ExpeditionMemberList_Struct
+struct DynamicZoneChooseZone_Struct
{
-/*000*/ uint32 count;
-/*004*/ ExpeditionMemberEntry_Struct entries[0];
+/*000*/ uint32 client_id;
+/*004*/ uint32 count;
+/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
-struct ExpeditionLockoutEntry_Struct
+struct DynamicZoneChooseZoneReply_Struct
{
-/*000*/ uint32 time_left;
-/*004*/ char expedition[128];
-/*132*/ char expedition_event[128];
+/*000*/ uint32 unknown000; // ff ff ff ff
+/*004*/ uint32 unknown004; // seen 69 00 00 00
+/*008*/ uint32 unknown008; // ff ff ff ff
+/*012*/ uint32 unknown_id1; // from choose zone entry message
+/*016*/ uint16 dz_zone_id; // dz_id pair
+/*018*/ uint16 dz_instance_id;
+/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
+/*024*/ uint32 unknown_id2; // from choose zone entry message
+/*028*/ uint32 unknown028; // 00 00 00 00
+/*032*/ uint32 unknown032; // always same as unknown044
+/*036*/ uint32 unknown036;
+/*040*/ uint32 unknown040;
+/*044*/ uint32 unknown044; // always same as unknown032
+/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
};
-struct ExpeditionLockoutList_Struct
+struct KickPlayers_Struct
{
-/*000*/ uint32 count;
-/*004*/ ExpeditionLockoutEntry_Struct entries[0];
-};
-
-struct ExpeditionLeaderSet_Struct
-{
-/*000*/ char leader_name[64];
+/*000*/ char char_name[64];
+/*064*/ uint32 unknown064; // always 0
+/*068*/ uint8 kick_expedition; // true if /kickplayers exp
+/*069*/ uint8 kick_task; // true if /kickplayers task
+/*070*/ uint8 padding[2];
};
struct CorpseDrag_Struct
@@ -5341,18 +5445,20 @@ struct MercenaryMerchantResponse_Struct {
struct ServerLootItem_Struct {
uint32 item_id; // uint32 item_id;
- int16 equip_slot; // int16 equip_slot;
- uint16 charges; // uint8 charges;
- uint16 lootslot; // uint16 lootslot;
- uint32 aug_1; // uint32 aug_1;
- uint32 aug_2; // uint32 aug_2;
- uint32 aug_3; // uint32 aug_3;
- uint32 aug_4; // uint32 aug_4;
- uint32 aug_5; // uint32 aug_5;
- uint32 aug_6; // uint32 aug_5;
- uint8 attuned;
- uint8 min_level;
- uint8 max_level;
+ int16 equip_slot; // int16 equip_slot;
+ uint16 charges; // uint8 charges;
+ uint16 lootslot; // uint16 lootslot;
+ uint32 aug_1; // uint32 aug_1;
+ uint32 aug_2; // uint32 aug_2;
+ uint32 aug_3; // uint32 aug_3;
+ uint32 aug_4; // uint32 aug_4;
+ uint32 aug_5; // uint32 aug_5;
+ uint32 aug_6; // uint32 aug_5;
+ uint8 attuned;
+ uint16 trivial_min_level;
+ uint16 trivial_max_level;
+ uint16 npc_min_level;
+ uint16 npc_max_level;
};
//Found in client near a ref to the string:
diff --git a/common/eq_stream_intf.h b/common/eq_stream_intf.h
index 68a25f41c..b2c889244 100644
--- a/common/eq_stream_intf.h
+++ b/common/eq_stream_intf.h
@@ -100,7 +100,7 @@ public:
virtual MatchState CheckSignature(const Signature *sig) { return MatchFailed; }
virtual EQStreamState GetState() = 0;
virtual void SetOpcodeManager(OpcodeManager **opm) = 0;
- virtual const EQEmu::versions::ClientVersion ClientVersion() const { return EQEmu::versions::ClientVersion::Unknown; }
+ virtual const EQ::versions::ClientVersion ClientVersion() const { return EQ::versions::ClientVersion::Unknown; }
virtual Stats GetStats() const = 0;
virtual void ResetStats() = 0;
virtual EQStreamManagerInterface* GetManager() const = 0;
diff --git a/common/eq_stream_proxy.cpp b/common/eq_stream_proxy.cpp
index 587e55b64..ca8cb2142 100644
--- a/common/eq_stream_proxy.cpp
+++ b/common/eq_stream_proxy.cpp
@@ -22,7 +22,7 @@ std::string EQStreamProxy::Describe() const {
return(m_structs->Describe());
}
-const EQEmu::versions::ClientVersion EQStreamProxy::ClientVersion() const
+const EQ::versions::ClientVersion EQStreamProxy::ClientVersion() const
{
return m_structs->ClientVersion();
}
diff --git a/common/eq_stream_proxy.h b/common/eq_stream_proxy.h
index 92de5a463..9d007b48e 100644
--- a/common/eq_stream_proxy.h
+++ b/common/eq_stream_proxy.h
@@ -28,7 +28,7 @@ public:
virtual void RemoveData();
virtual bool CheckState(EQStreamState state);
virtual std::string Describe() const;
- virtual const EQEmu::versions::ClientVersion ClientVersion() const;
+ virtual const EQ::versions::ClientVersion ClientVersion() const;
virtual EQStreamState GetState();
virtual void SetOpcodeManager(OpcodeManager **opm);
virtual Stats GetStats() const;
diff --git a/common/eqemu_exception.cpp b/common/eqemu_exception.cpp
index 88e1ea225..62376283f 100644
--- a/common/eqemu_exception.cpp
+++ b/common/eqemu_exception.cpp
@@ -18,7 +18,7 @@
#include "eqemu_exception.h"
-namespace EQEmu
+namespace EQ
{
Exception::Exception(const char* name, const std::string& description, const char* file, long line)
: line_(line),
diff --git a/common/eqemu_exception.h b/common/eqemu_exception.h
index 1e888da85..9649c7a98 100644
--- a/common/eqemu_exception.h
+++ b/common/eqemu_exception.h
@@ -22,7 +22,7 @@
#include
#include
-namespace EQEmu
+namespace EQ
{
//! EQEmu Exception Class
/*!
@@ -104,7 +104,7 @@ namespace EQEmu
} // EQEmu
#ifndef EQ_EXCEPT
-#define EQ_EXCEPT(n, d) throw EQEmu::Exception(n, d, __FILE__, __LINE__)
+#define EQ_EXCEPT(n, d) throw EQ::Exception(n, d, __FILE__, __LINE__)
#endif
#endif
diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp
index dca47dfb8..ad43ee61d 100644
--- a/common/eqemu_logsys.cpp
+++ b/common/eqemu_logsys.cpp
@@ -126,6 +126,8 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast(Logs::General);
log_settings[Logs::HotReload].log_to_gmsay = static_cast(Logs::General);
log_settings[Logs::HotReload].log_to_console = static_cast(Logs::General);
+ log_settings[Logs::Loot].log_to_gmsay = static_cast(Logs::General);
+ log_settings[Logs::Scheduler].log_to_console = static_cast(Logs::General);
/**
* RFC 5424
@@ -205,11 +207,7 @@ std::string EQEmuLogSys::FormatOutMessageString(
const std::string &in_message
)
{
- std::string return_string;
-
- if (IsRfc5424LogCategory(log_category)) {
- return_string = "[" + GetPlatformName() + "] ";
- }
+ std::string return_string = "[" + GetPlatformName() + "] ";
return return_string + "[" + Logs::LogCategoryName[log_category] + "] " + in_message;
}
diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h
index 51ec48bfc..0b33b55a3 100644
--- a/common/eqemu_logsys.h
+++ b/common/eqemu_logsys.h
@@ -116,6 +116,11 @@ namespace Logs {
Aura,
HotReload,
Merchants,
+ ZonePoints,
+ Loot,
+ Expeditions,
+ DynamicZones,
+ Scheduler,
MaxCategoryID /* Don't Remove this */
};
@@ -191,6 +196,11 @@ namespace Logs {
"Aura",
"HotReload",
"Merchants",
+ "ZonePoints",
+ "Loot",
+ "Expeditions",
+ "DynamicZones",
+ "Scheduler",
};
}
diff --git a/common/eqemu_logsys_log_aliases.h b/common/eqemu_logsys_log_aliases.h
index 42f973e79..ddd27335f 100644
--- a/common/eqemu_logsys_log_aliases.h
+++ b/common/eqemu_logsys_log_aliases.h
@@ -161,6 +161,16 @@
OutF(LogSys, Logs::Detail, Logs::Doors, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
+#define LogGroup(message, ...) do {\
+ if (LogSys.log_settings[Logs::Group].is_category_enabled == 1)\
+ OutF(LogSys, Logs::General, Logs::Group, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogGroupDetail(message, ...) do {\
+ if (LogSys.log_settings[Logs::Group].is_category_enabled == 1)\
+ OutF(LogSys, Logs::Detail, Logs::Group, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
#define LogGuilds(message, ...) do {\
if (LogSys.log_settings[Logs::Guilds].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Guilds, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -581,6 +591,61 @@
OutF(LogSys, Logs::Detail, Logs::Merchants, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
+#define LogZonePoints(message, ...) do {\
+ if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\
+ OutF(LogSys, Logs::General, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogZonePointsDetail(message, ...) do {\
+ if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\
+ OutF(LogSys, Logs::Detail, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogLoot(message, ...) do {\
+ if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1)\
+ OutF(LogSys, Logs::General, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogLootDetail(message, ...) do {\
+ if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1)\
+ OutF(LogSys, Logs::Detail, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogExpeditions(message, ...) do {\
+ if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
+ OutF(LogSys, Logs::General, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogExpeditionsModerate(message, ...) do {\
+ if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
+ OutF(LogSys, Logs::Moderate, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogExpeditionsDetail(message, ...) do {\
+ if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
+ OutF(LogSys, Logs::Detail, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogDynamicZones(message, ...) do {\
+ if (LogSys.log_settings[Logs::DynamicZones].is_category_enabled == 1)\
+ OutF(LogSys, Logs::General, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogDynamicZonesDetail(message, ...) do {\
+ if (LogSys.log_settings[Logs::DynamicZones].is_category_enabled == 1)\
+ OutF(LogSys, Logs::Detail, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogScheduler(message, ...) do {\
+ if (LogSys.log_settings[Logs::Scheduler].is_category_enabled == 1)\
+ OutF(LogSys, Logs::General, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
+#define LogSchedulerDetail(message, ...) do {\
+ if (LogSys.log_settings[Logs::Scheduler].is_category_enabled == 1)\
+ OutF(LogSys, Logs::Detail, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+} while (0)
+
#define Log(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -674,6 +739,12 @@
#define LogDoorsDetail(message, ...) do {\
} while (0)
+#define LogGroup(message, ...) do {\
+} while (0)
+
+#define LogGroupDetail(message, ...) do {\
+} while (0)
+
#define LogGuilds(message, ...) do {\
} while (0)
@@ -926,6 +997,27 @@
#define LogMerchantsDetail(message, ...) do {\
} while (0)
+#define LogZonePoints(message, ...) do {\
+} while (0)
+
+#define LogZonePointsDetail(message, ...) do {\
+} while (0)
+
+#define LogExpeditions(message, ...) do {\
+} while (0)
+
+#define LogExpeditionsModerate(message, ...) do {\
+} while (0)
+
+#define LogExpeditionsDetail(message, ...) do {\
+} while (0)
+
+#define LogDynamicZones(message, ...) do {\
+} while (0)
+
+#define LogDynamicZonesDetail(message, ...) do {\
+} while (0)
+
#define Log(debug_level, log_category, message, ...) do {\
} while (0)
@@ -933,4 +1025,4 @@
} while (0)
#endif
-#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
\ No newline at end of file
+#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
diff --git a/common/event/event_loop.h b/common/event/event_loop.h
index 295c0532d..537c3280a 100644
--- a/common/event/event_loop.h
+++ b/common/event/event_loop.h
@@ -25,6 +25,10 @@ namespace EQ
uv_run(&m_loop, UV_RUN_DEFAULT);
}
+ void Shutdown() {
+ uv_stop(&m_loop);
+ }
+
uv_loop_t* Handle() { return &m_loop; }
private:
diff --git a/common/event/task.h b/common/event/task.h
index ae19700a2..89077734f 100644
--- a/common/event/task.h
+++ b/common/event/task.h
@@ -8,7 +8,7 @@ namespace EQ {
class Task
{
public:
- typedef std::function ResolveFn;
+ typedef std::function ResolveFn;
typedef std::function RejectFn;
typedef std::function FinallyFn;
typedef std::function TaskFn;
@@ -19,7 +19,7 @@ namespace EQ {
RejectFn on_catch;
FinallyFn on_finally;
bool has_result;
- EQEmu::Any result;
+ EQ::Any result;
bool has_error;
std::exception error;
};
@@ -63,7 +63,7 @@ namespace EQ {
uv_queue_work(EventLoop::Get().Handle(), m_work, [](uv_work_t* req) {
TaskBaton *baton = (TaskBaton*)req->data;
- baton->fn([baton](const EQEmu::Any& result) {
+ baton->fn([baton](const EQ::Any& result) {
baton->has_error = false;
baton->has_result = true;
baton->result = result;
diff --git a/common/event/timer.h b/common/event/timer.h
index e71459630..73ac7af35 100644
--- a/common/event/timer.h
+++ b/common/event/timer.h
@@ -51,7 +51,7 @@ namespace EQ {
void Stop() {
if (m_timer) {
uv_close((uv_handle_t*)m_timer, [](uv_handle_t* handle) {
- delete handle;
+ delete (uv_timer_t *)handle;
});
m_timer = nullptr;
}
diff --git a/common/expedition_base.cpp b/common/expedition_base.cpp
new file mode 100644
index 000000000..a5f890204
--- /dev/null
+++ b/common/expedition_base.cpp
@@ -0,0 +1,113 @@
+#include "expedition_base.h"
+#include "repositories/expeditions_repository.h"
+#include "rulesys.h"
+
+ExpeditionBase::ExpeditionBase(uint32_t id, const std::string& uuid,
+ const std::string& expedition_name, const DynamicZoneMember& leader
+) :
+ m_id(id),
+ m_uuid(uuid),
+ m_expedition_name(expedition_name),
+ m_leader(leader)
+{
+}
+
+void ExpeditionBase::LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry)
+{
+ m_id = entry.id;
+ m_uuid = std::move(entry.uuid);
+ m_expedition_name = std::move(entry.expedition_name);
+ m_add_replay_on_join = entry.add_replay_on_join;
+ m_is_locked = entry.is_locked;
+ m_leader.id = entry.leader_id;
+ m_leader.name = std::move(entry.leader_name);
+}
+
+void ExpeditionBase::AddMemberFromRepositoryResult(
+ ExpeditionMembersRepository::MemberWithName&& entry)
+{
+ auto status = DynamicZoneMemberStatus::Unknown;
+ AddInternalMember({ entry.character_id, std::move(entry.character_name), status });
+}
+
+void ExpeditionBase::AddInternalMember(const DynamicZoneMember& member)
+{
+ if (!HasMember(member.id))
+ {
+ m_members.emplace_back(member);
+ }
+}
+
+void ExpeditionBase::RemoveInternalMember(uint32_t character_id)
+{
+ m_members.erase(std::remove_if(m_members.begin(), m_members.end(),
+ [&](const DynamicZoneMember& member) { return member.id == character_id; }
+ ), m_members.end());
+}
+
+
+bool ExpeditionBase::HasMember(uint32_t character_id)
+{
+ return std::any_of(m_members.begin(), m_members.end(), [&](const DynamicZoneMember& member) {
+ return member.id == character_id;
+ });
+}
+
+bool ExpeditionBase::HasMember(const std::string& character_name)
+{
+ return std::any_of(m_members.begin(), m_members.end(), [&](const DynamicZoneMember& member) {
+ return (strcasecmp(member.name.c_str(), character_name.c_str()) == 0);
+ });
+}
+
+DynamicZoneMember ExpeditionBase::GetMemberData(uint32_t character_id)
+{
+ auto it = std::find_if(m_members.begin(), m_members.end(), [&](const DynamicZoneMember& member) {
+ return member.id == character_id;
+ });
+
+ DynamicZoneMember member_data;
+ if (it != m_members.end())
+ {
+ member_data = *it;
+ }
+ return member_data;
+}
+
+DynamicZoneMember ExpeditionBase::GetMemberData(const std::string& character_name)
+{
+ auto it = std::find_if(m_members.begin(), m_members.end(), [&](const DynamicZoneMember& member) {
+ return (strcasecmp(member.name.c_str(), character_name.c_str()) == 0);
+ });
+
+ DynamicZoneMember member_data;
+ if (it != m_members.end())
+ {
+ member_data = *it;
+ }
+ return member_data;
+}
+
+bool ExpeditionBase::SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status)
+{
+ if (status == DynamicZoneMemberStatus::InDynamicZone && !RuleB(Expedition, EnableInDynamicZoneStatus))
+ {
+ status = DynamicZoneMemberStatus::Online;
+ }
+
+ if (character_id == m_leader.id)
+ {
+ m_leader.status = status;
+ }
+
+ auto it = std::find_if(m_members.begin(), m_members.end(),
+ [&](const DynamicZoneMember& member) { return member.id == character_id; });
+
+ if (it != m_members.end() && it->status != status)
+ {
+ it->status = status;
+ return true;
+ }
+
+ return false;
+}
diff --git a/common/expedition_base.h b/common/expedition_base.h
new file mode 100644
index 000000000..e93c707b5
--- /dev/null
+++ b/common/expedition_base.h
@@ -0,0 +1,56 @@
+#ifndef COMMON_EXPEDITION_BASE_H
+#define COMMON_EXPEDITION_BASE_H
+
+#include "dynamic_zone_base.h"
+#include "repositories/expeditions_repository.h"
+#include "repositories/expedition_members_repository.h"
+#include
+#include
+#include
+
+class ExpeditionBase
+{
+public:
+ virtual ~ExpeditionBase() = default;
+ ExpeditionBase(const ExpeditionBase&) = default;
+ ExpeditionBase(ExpeditionBase&&) = default;
+ ExpeditionBase& operator=(const ExpeditionBase&) = default;
+ ExpeditionBase& operator=(ExpeditionBase&&) = default;
+
+ uint32_t GetID() const { return m_id; }
+ uint32_t GetLeaderID() const { return m_leader.id; }
+ uint32_t GetMemberCount() const { return static_cast(m_members.size()); }
+ const std::string& GetName() const { return m_expedition_name; }
+ const std::string& GetLeaderName() const { return m_leader.name; }
+ const std::string& GetUUID() const { return m_uuid; }
+ const std::vector& GetMembers() const { return m_members; }
+
+ void AddInternalMember(const DynamicZoneMember& member);
+ void ClearInternalMembers() { m_members.clear(); }
+ bool HasMember(const std::string& character_name);
+ bool HasMember(uint32_t character_id);
+ bool IsEmpty() const { return m_members.empty(); }
+ void RemoveInternalMember(uint32_t character_id);
+ bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
+
+ void LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry);
+ void AddMemberFromRepositoryResult(ExpeditionMembersRepository::MemberWithName&& entry);
+
+protected:
+ ExpeditionBase() = default;
+ ExpeditionBase(uint32_t id, const std::string& uuid, const std::string& expedition_name,
+ const DynamicZoneMember& leader);
+
+ DynamicZoneMember GetMemberData(uint32_t character_id);
+ DynamicZoneMember GetMemberData(const std::string& character_name);
+
+ uint32_t m_id = 0;
+ bool m_is_locked = false;
+ bool m_add_replay_on_join = true;
+ std::string m_uuid;
+ std::string m_expedition_name;
+ DynamicZoneMember m_leader;
+ std::vector m_members;
+};
+
+#endif
diff --git a/common/expedition_lockout_timer.cpp b/common/expedition_lockout_timer.cpp
new file mode 100644
index 000000000..dc4cb97c6
--- /dev/null
+++ b/common/expedition_lockout_timer.cpp
@@ -0,0 +1,101 @@
+/**
+ * EQEmulator: Everquest Server Emulator
+ * Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY except by those people which sell it, which
+ * are required to give you total support for your newly bought product;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "expedition_lockout_timer.h"
+#include "../common/string_util.h"
+#include "../common/rulesys.h"
+#include "../common/util/uuid.h"
+#include
+
+const char* const DZ_REPLAY_TIMER_NAME = "Replay Timer"; // see December 14, 2016 patch notes
+
+ExpeditionLockoutTimer::ExpeditionLockoutTimer(
+ std::string expedition_uuid, std::string expedition_name,
+ std::string event_name, uint64_t expire_time, uint32_t duration
+) :
+ m_expedition_uuid{std::move(expedition_uuid)},
+ m_expedition_name{std::move(expedition_name)},
+ m_event_name{std::move(event_name)},
+ m_expire_time(std::chrono::system_clock::from_time_t(expire_time)),
+ m_duration(duration)
+{
+ if (m_event_name == DZ_REPLAY_TIMER_NAME)
+ {
+ m_is_replay_timer = true;
+ }
+}
+
+ExpeditionLockoutTimer ExpeditionLockoutTimer::CreateLockout(
+ const std::string& expedition_name, const std::string& event_name, uint32_t seconds, std::string uuid)
+{
+ seconds = static_cast(seconds * RuleR(Expedition, LockoutDurationMultiplier));
+
+ if (uuid.empty())
+ {
+ uuid = EQ::Util::UUID::Generate().ToString();
+ }
+
+ ExpeditionLockoutTimer lockout{uuid, expedition_name, event_name, 0, seconds};
+ lockout.Reset(); // sets expire time
+ return lockout;
+}
+
+uint32_t ExpeditionLockoutTimer::GetSecondsRemaining() const
+{
+ auto now = std::chrono::system_clock::now();
+ if (m_expire_time > now)
+ {
+ auto remaining = m_expire_time - now;
+ return static_cast(std::chrono::duration_cast(remaining).count());
+ }
+ return 0;
+}
+
+ExpeditionLockoutTimer::DaysHoursMinutes ExpeditionLockoutTimer::GetDaysHoursMinutesRemaining() const
+{
+ auto seconds = GetSecondsRemaining();
+ return ExpeditionLockoutTimer::DaysHoursMinutes{
+ fmt::format_int(seconds / 86400).str(), // days
+ fmt::format_int((seconds / 3600) % 24).str(), // hours
+ fmt::format_int((seconds / 60) % 60).str() // minutes
+ };
+}
+
+bool ExpeditionLockoutTimer::IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const
+{
+ return compare_lockout.IsSameLockout(GetExpeditionName(), GetEventName());
+}
+
+bool ExpeditionLockoutTimer::IsSameLockout(
+ const std::string& expedition_name, const std::string& event_name) const
+{
+ return GetExpeditionName() == expedition_name && GetEventName() == event_name;
+}
+
+void ExpeditionLockoutTimer::AddLockoutTime(int seconds)
+{
+ seconds = static_cast(seconds * RuleR(Expedition, LockoutDurationMultiplier));
+
+ auto new_duration = std::max(0, static_cast(m_duration.count()) + seconds);
+
+ auto start_time = m_expire_time - m_duration;
+ m_duration = std::chrono::seconds(new_duration);
+ m_expire_time = start_time + m_duration;
+}
diff --git a/common/expedition_lockout_timer.h b/common/expedition_lockout_timer.h
new file mode 100644
index 000000000..8cbf3da54
--- /dev/null
+++ b/common/expedition_lockout_timer.h
@@ -0,0 +1,76 @@
+/**
+ * EQEmulator: Everquest Server Emulator
+ * Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY except by those people which sell it, which
+ * are required to give you total support for your newly bought product;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef EXPEDITION_LOCKOUT_TIMER_H
+#define EXPEDITION_LOCKOUT_TIMER_H
+
+#include
+#include
+
+extern const char* const DZ_REPLAY_TIMER_NAME;
+
+class ExpeditionLockoutTimer
+{
+public:
+ ExpeditionLockoutTimer() = default;
+ ExpeditionLockoutTimer(
+ std::string expedition_uuid, std::string expedition_name,
+ std::string event_name, uint64_t expire_time, uint32_t duration);
+
+ static ExpeditionLockoutTimer CreateLockout(
+ const std::string& expedition_name, const std::string& event_name,
+ uint32_t seconds, std::string uuid = {});
+
+ struct DaysHoursMinutes
+ {
+ std::string days;
+ std::string hours;
+ std::string mins;
+ };
+
+ void AddLockoutTime(int seconds);
+ uint32_t GetDuration() const { return static_cast(m_duration.count()); }
+ uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
+ uint64_t GetStartTime() const { return std::chrono::system_clock::to_time_t(m_expire_time - m_duration); }
+ uint32_t GetSecondsRemaining() const;
+ DaysHoursMinutes GetDaysHoursMinutesRemaining() const;
+ const std::string& GetExpeditionName() const { return m_expedition_name; }
+ const std::string& GetExpeditionUUID() const { return m_expedition_uuid; }
+ const std::string& GetEventName() const { return m_event_name; }
+ bool IsExpired() const { return GetSecondsRemaining() == 0; }
+ bool IsFromExpedition(const std::string& uuid) const { return uuid == m_expedition_uuid; }
+ bool IsReplayTimer() const { return m_is_replay_timer; }
+ bool IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const;
+ bool IsSameLockout(const std::string& expedition_name, const std::string& event_name) const;
+ void Reset() { m_expire_time = std::chrono::system_clock::now() + m_duration; }
+ void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
+ void SetExpireTime(uint64_t expire_time) { m_expire_time = std::chrono::system_clock::from_time_t(expire_time); }
+ void SetUUID(const std::string& uuid) { m_expedition_uuid = uuid; }
+
+private:
+ bool m_is_replay_timer = false;
+ std::string m_expedition_uuid; // expedition received in
+ std::string m_expedition_name;
+ std::string m_event_name;
+ std::chrono::seconds m_duration;
+ std::chrono::time_point m_expire_time;
+};
+
+#endif
diff --git a/common/extprofile.h b/common/extprofile.h
index bdb746068..5f69a449d 100644
--- a/common/extprofile.h
+++ b/common/extprofile.h
@@ -40,7 +40,7 @@ struct ExtendedProfile_Struct {
uint16 old_pet_hp; /* Not Used */
uint16 old_pet_mana; /* Not Used */
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
- EQEmu::TextureMaterialProfile pet_items; /* Not Used */
+ EQ::TextureMaterialProfile pet_items; /* Not Used */
char merc_name[64]; /* Used */
uint32 aa_effects; /* Used */
diff --git a/common/fixed_memory_hash_set.h b/common/fixed_memory_hash_set.h
index 2b119bd3f..d02900260 100644
--- a/common/fixed_memory_hash_set.h
+++ b/common/fixed_memory_hash_set.h
@@ -23,7 +23,7 @@
#include "eqemu_exception.h"
#include "types.h"
-namespace EQEmu {
+namespace EQ {
/*! 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
diff --git a/common/fixed_memory_variable_hash_set.h b/common/fixed_memory_variable_hash_set.h
index b25fe5b2f..cc0f7979e 100644
--- a/common/fixed_memory_variable_hash_set.h
+++ b/common/fixed_memory_variable_hash_set.h
@@ -23,7 +23,7 @@
#include "eqemu_exception.h"
#include "types.h"
-namespace EQEmu {
+namespace EQ {
/*! 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
diff --git a/common/inventory_profile.cpp b/common/inventory_profile.cpp
index a51b04998..e93146598 100644
--- a/common/inventory_profile.cpp
+++ b/common/inventory_profile.cpp
@@ -33,7 +33,7 @@
#include
-std::list dirty_inst;
+std::list dirty_inst;
//
@@ -48,50 +48,50 @@ ItemInstQueue::~ItemInstQueue()
}
// Put item onto back of queue
-void ItemInstQueue::push(EQEmu::ItemInstance* inst)
+void ItemInstQueue::push(EQ::ItemInstance* inst)
{
m_list.push_back(inst);
}
// Put item onto front of queue
-void ItemInstQueue::push_front(EQEmu::ItemInstance* inst)
+void ItemInstQueue::push_front(EQ::ItemInstance* inst)
{
m_list.push_front(inst);
}
// Remove item from front of queue
-EQEmu::ItemInstance* ItemInstQueue::pop()
+EQ::ItemInstance* ItemInstQueue::pop()
{
if (m_list.empty())
return nullptr;
- EQEmu::ItemInstance* inst = m_list.front();
+ EQ::ItemInstance* inst = m_list.front();
m_list.pop_front();
return inst;
}
// Remove item from back of queue
-EQEmu::ItemInstance* ItemInstQueue::pop_back()
+EQ::ItemInstance* ItemInstQueue::pop_back()
{
if (m_list.empty())
return nullptr;
- EQEmu::ItemInstance* inst = m_list.back();
+ EQ::ItemInstance* inst = m_list.back();
m_list.pop_back();
return inst;
}
// Look at item at front of queue
-EQEmu::ItemInstance* ItemInstQueue::peek_front() const
+EQ::ItemInstance* ItemInstQueue::peek_front() const
{
return (m_list.empty()) ? nullptr : m_list.front();
}
//
-// class EQEmu::InventoryProfile
+// class EQ::InventoryProfile
//
-EQEmu::InventoryProfile::~InventoryProfile()
+EQ::InventoryProfile::~InventoryProfile()
{
for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) {
safe_delete(iter->second);
@@ -119,18 +119,18 @@ EQEmu::InventoryProfile::~InventoryProfile()
m_trade.clear();
}
-void EQEmu::InventoryProfile::SetInventoryVersion(versions::MobVersion inventory_version) {
+void EQ::InventoryProfile::SetInventoryVersion(versions::MobVersion inventory_version) {
m_mob_version = versions::ValidateMobVersion(inventory_version);
SetGMInventory(m_gm_inventory);
}
-void EQEmu::InventoryProfile::SetGMInventory(bool gmi_flag) {
+void EQ::InventoryProfile::SetGMInventory(bool gmi_flag) {
m_gm_inventory = gmi_flag;
m_lookup = inventory::DynamicLookup(m_mob_version, gmi_flag);
}
-void EQEmu::InventoryProfile::CleanDirty() {
+void EQ::InventoryProfile::CleanDirty() {
auto iter = dirty_inst.begin();
while (iter != dirty_inst.end()) {
delete (*iter);
@@ -139,14 +139,14 @@ void EQEmu::InventoryProfile::CleanDirty() {
dirty_inst.clear();
}
-void EQEmu::InventoryProfile::MarkDirty(ItemInstance *inst) {
+void EQ::InventoryProfile::MarkDirty(ItemInstance *inst) {
if (inst) {
dirty_inst.push_back(inst);
}
}
// Retrieve item at specified slot; returns false if item not found
-EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const
+EQ::ItemInstance* EQ::InventoryProfile::GetItem(int16 slot_id) const
{
ItemInstance* result = nullptr;
@@ -219,31 +219,31 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const
}
// Retrieve item at specified position within bag
-EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id, uint8 bagidx) const
+EQ::ItemInstance* EQ::InventoryProfile::GetItem(int16 slot_id, uint8 bagidx) const
{
return GetItem(InventoryProfile::CalcSlotId(slot_id, bagidx));
}
// Put an item snto specified slot
-int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
+int16 EQ::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
{
- if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) {
+ if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
- return EQEmu::invslot::SLOT_INVALID;
+ return EQ::invslot::SLOT_INVALID;
}
- else if (slot_id <= EQEmu::invbag::GENERAL_BAGS_END && slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
- auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_id - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
+ else if (slot_id <= EQ::invbag::GENERAL_BAGS_END && slot_id >= EQ::invbag::GENERAL_BAGS_BEGIN) {
+ auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((slot_id - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0)
- return EQEmu::invslot::SLOT_INVALID;
+ return EQ::invslot::SLOT_INVALID;
}
- else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
- if ((slot_id - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank)
- return EQEmu::invslot::SLOT_INVALID;
+ else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
+ if ((slot_id - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank)
+ return EQ::invslot::SLOT_INVALID;
}
- else if (slot_id <= EQEmu::invbag::BANK_BAGS_END && slot_id >= EQEmu::invbag::BANK_BAGS_BEGIN) {
- auto temp_slot = (slot_id - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
+ else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) {
+ auto temp_slot = (slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize.Bank)
- return EQEmu::invslot::SLOT_INVALID;
+ return EQ::invslot::SLOT_INVALID;
}
// Clean up item already in slot (if exists)
@@ -259,17 +259,17 @@ int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
return _PutItem(slot_id, inst.Clone());
}
-int16 EQEmu::InventoryProfile::PushCursor(const ItemInstance &inst) {
+int16 EQ::InventoryProfile::PushCursor(const ItemInstance &inst) {
m_cursor.push(inst.Clone());
return invslot::slotCursor;
}
-EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem() {
+EQ::ItemInstance* EQ::InventoryProfile::GetCursorItem() {
return m_cursor.peek_front();
}
// Swap items in inventory
-bool EQEmu::InventoryProfile::SwapItem(
+bool EQ::InventoryProfile::SwapItem(
int16 source_slot,
int16 destination_slot,
SwapItemFailState &fail_state,
@@ -280,54 +280,54 @@ bool EQEmu::InventoryProfile::SwapItem(
) {
fail_state = swapInvalid;
- if (source_slot <= EQEmu::invslot::POSSESSIONS_END && source_slot >= EQEmu::invslot::POSSESSIONS_BEGIN) {
+ if (source_slot <= EQ::invslot::POSSESSIONS_END && source_slot >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64) 1 << source_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed;
return false;
}
}
- else if (source_slot <= EQEmu::invbag::GENERAL_BAGS_END && source_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
- auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((source_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
+ else if (source_slot <= EQ::invbag::GENERAL_BAGS_END && source_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
+ auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((source_slot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed;
return false;
}
}
- else if (source_slot <= EQEmu::invslot::BANK_END && source_slot >= EQEmu::invslot::BANK_BEGIN) {
- if ((source_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
+ else if (source_slot <= EQ::invslot::BANK_END && source_slot >= EQ::invslot::BANK_BEGIN) {
+ if ((source_slot - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed;
return false;
}
}
- else if (source_slot <= EQEmu::invbag::BANK_BAGS_END && source_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
- auto temp_slot = (source_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
+ else if (source_slot <= EQ::invbag::BANK_BAGS_END && source_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
+ auto temp_slot = (source_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed;
return false;
}
}
- if (destination_slot <= EQEmu::invslot::POSSESSIONS_END && destination_slot >= EQEmu::invslot::POSSESSIONS_BEGIN) {
+ if (destination_slot <= EQ::invslot::POSSESSIONS_END && destination_slot >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << destination_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed;
return false;
}
}
- else if (destination_slot <= EQEmu::invbag::GENERAL_BAGS_END && destination_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
- auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((destination_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
+ else if (destination_slot <= EQ::invbag::GENERAL_BAGS_END && destination_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
+ auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((destination_slot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed;
return false;
}
}
- else if (destination_slot <= EQEmu::invslot::BANK_END && destination_slot >= EQEmu::invslot::BANK_BEGIN) {
- if ((destination_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
+ else if (destination_slot <= EQ::invslot::BANK_END && destination_slot >= EQ::invslot::BANK_BEGIN) {
+ if ((destination_slot - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed;
return false;
}
}
- else if (destination_slot <= EQEmu::invbag::BANK_BAGS_END && destination_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
- auto temp_slot = (destination_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
+ else if (destination_slot <= EQ::invbag::BANK_BAGS_END && destination_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
+ auto temp_slot = (destination_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed;
return false;
@@ -399,7 +399,7 @@ bool EQEmu::InventoryProfile::SwapItem(
}
// Remove item from inventory (with memory delete)
-bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
+bool EQ::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
// Pop item out of inventory map (or queue)
ItemInstance *item_to_delete = PopItem(slot_id);
@@ -434,7 +434,7 @@ bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
}
// Checks All items in a bag for No Drop
-bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
+bool EQ::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
{
ItemInstance* inst = GetItem(slot_id);
if (!inst)
@@ -445,7 +445,7 @@ bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
// Remove item from bucket without memory delete
// Returns item pointer if full delete was successful
-EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id)
+EQ::ItemInstance* EQ::InventoryProfile::PopItem(int16 slot_id)
{
ItemInstance* p = nullptr;
@@ -488,7 +488,7 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id)
return p;
}
-bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity) {
+bool EQ::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity) {
if (ItemToTry->Stackable) {
@@ -592,7 +592,7 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
//This function has a flaw in that it only returns the last stack that it looked at
//when quantity is greater than 1 and not all of quantity can be found in 1 stack.
-int16 EQEmu::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 where)
+int16 EQ::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 where)
{
int16 slot_id = INVALID_INDEX;
@@ -642,7 +642,7 @@ int16 EQEmu::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 whe
}
//this function has the same quantity flaw mentioned above in HasItem()
-int16 EQEmu::InventoryProfile::HasItemByUse(uint8 use, uint8 quantity, uint8 where)
+int16 EQ::InventoryProfile::HasItemByUse(uint8 use, uint8 quantity, uint8 where)
{
int16 slot_id = INVALID_INDEX;
@@ -688,7 +688,7 @@ int16 EQEmu::InventoryProfile::HasItemByUse(uint8 use, uint8 quantity, uint8 whe
return slot_id;
}
-int16 EQEmu::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
+int16 EQ::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
{
int16 slot_id = INVALID_INDEX;
@@ -736,7 +736,7 @@ int16 EQEmu::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
// Locate an available inventory slot
// Returns slot_id when there's one available, else SLOT_INVALID
-int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow)
+int16 EQ::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow)
{
// Check basic inventory
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
@@ -786,7 +786,7 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8
}
// This is a mix of HasSpaceForItem and FindFreeSlot..due to existing coding behavior, it was better to add a new helper function...
-int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start, uint8 bag_start) {
+int16 EQ::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start, uint8 bag_start) {
// Do not arbitrarily use this function..it is designed for use with Client::ResetTrade() and Client::FinishTrade().
// If you have a need, use it..but, understand it is not a suitable replacement for InventoryProfile::FindFreeSlot().
//
@@ -924,7 +924,7 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
}
// Opposite of below: Get parent bag slot_id from a slot inside of bag
-int16 EQEmu::InventoryProfile::CalcSlotId(int16 slot_id) {
+int16 EQ::InventoryProfile::CalcSlotId(int16 slot_id) {
int16 parent_slot_id = INVALID_INDEX;
// this is not a bag range... using this risks over-writing existing items
@@ -952,7 +952,7 @@ int16 EQEmu::InventoryProfile::CalcSlotId(int16 slot_id) {
}
// Calculate slot_id for an item within a bag
-int16 EQEmu::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) {
+int16 EQ::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) {
if (!InventoryProfile::SupportsContainers(bagslot_id))
return INVALID_INDEX;
@@ -977,7 +977,7 @@ int16 EQEmu::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) {
return slot_id;
}
-uint8 EQEmu::InventoryProfile::CalcBagIdx(int16 slot_id) {
+uint8 EQ::InventoryProfile::CalcBagIdx(int16 slot_id) {
uint8 index = 0;
// this is not a bag range... using this risks over-writing existing items
@@ -1006,7 +1006,7 @@ uint8 EQEmu::InventoryProfile::CalcBagIdx(int16 slot_id) {
return index;
}
-int16 EQEmu::InventoryProfile::CalcSlotFromMaterial(uint8 material)
+int16 EQ::InventoryProfile::CalcSlotFromMaterial(uint8 material)
{
switch (material)
{
@@ -1033,7 +1033,7 @@ int16 EQEmu::InventoryProfile::CalcSlotFromMaterial(uint8 material)
}
}
-uint8 EQEmu::InventoryProfile::CalcMaterialFromSlot(int16 equipslot)
+uint8 EQ::InventoryProfile::CalcMaterialFromSlot(int16 equipslot)
{
switch (equipslot)
{
@@ -1061,7 +1061,7 @@ uint8 EQEmu::InventoryProfile::CalcMaterialFromSlot(int16 equipslot)
}
}
-bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, const ItemData *Container) {
+bool EQ::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, const ItemData *Container) {
if (!ItemToTry || !Container)
return false;
@@ -1078,7 +1078,7 @@ bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, c
return true;
}
-bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
+bool EQ::InventoryProfile::SupportsClickCasting(int16 slot_id)
{
// there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
@@ -1095,7 +1095,7 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
return false;
}
-bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
+bool EQ::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
{
// does this have the same criteria as 'SupportsClickCasting' above? (bag clicking per client)
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
@@ -1112,7 +1112,7 @@ bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
}
// Test whether a given slot can support a container item
-bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id)
+bool EQ::InventoryProfile::SupportsContainers(int16 slot_id)
{
if ((slot_id == invslot::slotCursor) ||
(slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) ||
@@ -1126,7 +1126,7 @@ bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id)
return false;
}
-int EQEmu::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) {
+int EQ::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) {
if (!inst)
return INVALID_INDEX;
@@ -1162,7 +1162,7 @@ int EQEmu::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) {
return INVALID_INDEX;
}
-uint8 EQEmu::InventoryProfile::FindBrightestLightType()
+uint8 EQ::InventoryProfile::FindBrightestLightType()
{
uint8 brightest_light_type = 0;
@@ -1213,7 +1213,7 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
return brightest_light_type;
}
-void EQEmu::InventoryProfile::dumpEntireInventory() {
+void EQ::InventoryProfile::dumpEntireInventory() {
dumpWornItems();
dumpInventory();
@@ -1223,29 +1223,29 @@ void EQEmu::InventoryProfile::dumpEntireInventory() {
std::cout << std::endl;
}
-void EQEmu::InventoryProfile::dumpWornItems() {
+void EQ::InventoryProfile::dumpWornItems() {
std::cout << "Worn items:" << std::endl;
dumpItemCollection(m_worn);
}
-void EQEmu::InventoryProfile::dumpInventory() {
+void EQ::InventoryProfile::dumpInventory() {
std::cout << "Inventory items:" << std::endl;
dumpItemCollection(m_inv);
}
-void EQEmu::InventoryProfile::dumpBankItems() {
+void EQ::InventoryProfile::dumpBankItems() {
std::cout << "Bank items:" << std::endl;
dumpItemCollection(m_bank);
}
-void EQEmu::InventoryProfile::dumpSharedBankItems() {
+void EQ::InventoryProfile::dumpSharedBankItems() {
std::cout << "Shared Bank items:" << std::endl;
dumpItemCollection(m_shbank);
}
-int EQEmu::InventoryProfile::GetSlotByItemInstCollection(const std::map &collection, ItemInstance *inst) {
+int EQ::InventoryProfile::GetSlotByItemInstCollection(const std::map &collection, ItemInstance *inst) {
for (auto iter = collection.begin(); iter != collection.end(); ++iter) {
ItemInstance *t_inst = iter->second;
if (t_inst == inst) {
@@ -1261,10 +1261,10 @@ int EQEmu::InventoryProfile::GetSlotByItemInstCollection(const std::map &collection)
+void EQ::InventoryProfile::dumpItemCollection(const std::map &collection)
{
for (auto it = collection.cbegin(); it != collection.cend(); ++it) {
auto inst = it->second;
@@ -1278,7 +1278,7 @@ void EQEmu::InventoryProfile::dumpItemCollection(const std::map::const_iterator *it)
+void EQ::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map::const_iterator *it)
{
if (!inst || !inst->IsClassBag())
return;
@@ -1297,14 +1297,14 @@ void EQEmu::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map& bucket, int16 slot_id) const
+EQ::ItemInstance* EQ::InventoryProfile::_GetItem(const std::map& bucket, int16 slot_id) const
{
- if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) {
+ if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
return nullptr;
}
- else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
- if (slot_id - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
+ else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
+ if (slot_id - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
return nullptr;
}
@@ -1319,7 +1319,7 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::_GetItem(const std::map= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) {
- if (slot_id - EQEmu::invslot::BANK_BEGIN < m_lookup->InventoryTypeSize.Bank) {
+ if (slot_id - EQ::invslot::BANK_BEGIN < m_lookup->InventoryTypeSize.Bank) {
m_bank[slot_id] = inst;
result = slot_id;
}
@@ -1389,17 +1389,17 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
}
// Internal Method: Checks an inventory bucket for a particular item
-int16 EQEmu::InventoryProfile::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity)
+int16 EQ::InventoryProfile::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity)
{
uint32 quantity_found = 0;
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
- if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
+ if (iter->first <= EQ::invslot::POSSESSIONS_END && iter->first >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
continue;
}
- else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
- if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
+ else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
+ if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue;
}
@@ -1440,7 +1440,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map& bucket,
}
// Internal Method: Checks an inventory queue type bucket for a particular item
-int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
+int16 EQ::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
{
// The downfall of this (these) queue procedure is that callers presume that when an item is
// found, it is presented as being available on the cursor. In cases of a parity check, this
@@ -1491,17 +1491,17 @@ int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, u
}
// Internal Method: Checks an inventory bucket for a particular item
-int16 EQEmu::InventoryProfile::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity)
+int16 EQ::InventoryProfile::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity)
{
uint32 quantity_found = 0;
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
- if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
+ if (iter->first <= EQ::invslot::POSSESSIONS_END && iter->first >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
continue;
}
- else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
- if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
+ else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
+ if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue;
}
@@ -1532,7 +1532,7 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(std::map& buc
}
// Internal Method: Checks an inventory queue type bucket for a particular item
-int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity)
+int16 EQ::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity)
{
uint32 quantity_found = 0;
@@ -1566,15 +1566,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, u
return INVALID_INDEX;
}
-int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup)
+int16 EQ::InventoryProfile::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup)
{
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
- if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
+ if (iter->first <= EQ::invslot::POSSESSIONS_END && iter->first >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
continue;
}
- else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
- if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
+ else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
+ if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue;
}
@@ -1611,11 +1611,11 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map::const_iterator cbegin() { return m_list.cbegin(); }
- inline std::list::const_iterator cend() { return m_list.cend(); }
+ inline std::list::const_iterator cbegin() { return m_list.cbegin(); }
+ inline std::list::const_iterator cend() { return m_list.cend(); }
inline int size() { return static_cast(m_list.size()); } // TODO: change to size_t
inline bool empty() { return m_list.empty(); }
- void push(EQEmu::ItemInstance* inst);
- void push_front(EQEmu::ItemInstance* inst);
- EQEmu::ItemInstance* pop();
- EQEmu::ItemInstance* pop_back();
- EQEmu::ItemInstance* peek_front() const;
+ void push(EQ::ItemInstance* inst);
+ void push_front(EQ::ItemInstance* inst);
+ EQ::ItemInstance* pop();
+ EQ::ItemInstance* pop_back();
+ EQ::ItemInstance* peek_front() const;
protected:
/////////////////////////
// Protected Members
/////////////////////////
- std::list m_list;
+ std::list m_list;
};
// ########################################
-// Class: EQEmu::InventoryProfile
+// Class: EQ::InventoryProfile
// Character inventory
-namespace EQEmu
+namespace EQ
{
class InventoryProfile
{
diff --git a/common/inventory_slot.cpp b/common/inventory_slot.cpp
index 21af3eb45..b86b5ca91 100644
--- a/common/inventory_slot.cpp
+++ b/common/inventory_slot.cpp
@@ -22,7 +22,7 @@
#include "string_util.h"
-int8 EQEmu::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index)
+int8 EQ::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index)
{
switch (slot_index) {
case invslot::slotHead:
@@ -48,7 +48,7 @@ int8 EQEmu::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index)
}
}
-int8 EQEmu::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& inventory_slot)
+int8 EQ::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& inventory_slot)
{
if ((!inventory_slot.Typeless() && !inventory_slot.IsTypeIndex(invtype::typePossessions)) || !inventory_slot.IsContainerIndex(invbag::SLOT_INVALID) || !inventory_slot.IsSocketIndex(invaug::SOCKET_INVALID))
return textures::textureInvalid;
@@ -56,7 +56,7 @@ int8 EQEmu::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& i
return ConvertEquipmentIndexToTextureIndex(inventory_slot.SlotIndex());
}
-int16 EQEmu::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
+int16 EQ::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
{
switch (texture_index) {
case textures::armorHead:
@@ -82,7 +82,7 @@ int16 EQEmu::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
}
}
-bool EQEmu::InventorySlot::IsValidSlot() const
+bool EQ::InventorySlot::IsValidSlot() const
{
if (_typeless)
return false;
@@ -100,7 +100,7 @@ bool EQEmu::InventorySlot::IsValidSlot() const
return true;
}
-bool EQEmu::InventorySlot::IsDeleteSlot() const
+bool EQ::InventorySlot::IsDeleteSlot() const
{
if (_typeless)
return (_slot_index == invslot::SLOT_INVALID && _container_index == invbag::SLOT_INVALID && _socket_index == invaug::SOCKET_INVALID);
@@ -108,7 +108,7 @@ bool EQEmu::InventorySlot::IsDeleteSlot() const
return (_type_index == invtype::TYPE_INVALID && _slot_index == invslot::SLOT_INVALID && _container_index == invbag::SLOT_INVALID && _socket_index == invaug::SOCKET_INVALID);
}
-bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
+bool EQ::InventorySlot::IsEquipmentIndex(int16 slot_index)
{
if (slot_index < invslot::EQUIPMENT_BEGIN || slot_index > invslot::EQUIPMENT_END)
return false;
@@ -116,7 +116,7 @@ bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
return true;
}
-bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
+bool EQ::InventorySlot::IsGeneralIndex(int16 slot_index)
{
if (slot_index < invslot::GENERAL_BEGIN || slot_index > invslot::GENERAL_END)
return false;
@@ -124,7 +124,7 @@ bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
return true;
}
-bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index)
+bool EQ::InventorySlot::IsCursorIndex(int16 slot_index)
{
if (slot_index == invslot::slotCursor)
return true;
@@ -132,7 +132,7 @@ bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index)
return false;
}
-bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index)
+bool EQ::InventorySlot::IsWeaponIndex(int16 slot_index)
{
if (slot_index == invslot::slotPrimary || slot_index == invslot::slotSecondary || slot_index == invslot::slotRange)
return true;
@@ -140,7 +140,7 @@ bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index)
return false;
}
-bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index)
+bool EQ::InventorySlot::IsTextureIndex(int16 slot_index)
{
switch (slot_index) {
case invslot::slotHead:
@@ -158,7 +158,7 @@ bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index)
}
}
-bool EQEmu::InventorySlot::IsTintableIndex(int16 slot_index)
+bool EQ::InventorySlot::IsTintableIndex(int16 slot_index)
{
switch (slot_index) {
case invslot::slotHead:
@@ -174,7 +174,7 @@ bool EQEmu::InventorySlot::IsTintableIndex(int16 slot_index)
}
}
-bool EQEmu::InventorySlot::IsEquipmentSlot() const
+bool EQ::InventorySlot::IsEquipmentSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -185,7 +185,7 @@ bool EQEmu::InventorySlot::IsEquipmentSlot() const
return IsEquipmentIndex(_slot_index);
}
-bool EQEmu::InventorySlot::IsGeneralSlot() const
+bool EQ::InventorySlot::IsGeneralSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -196,7 +196,7 @@ bool EQEmu::InventorySlot::IsGeneralSlot() const
return IsGeneralIndex(_socket_index);
}
-bool EQEmu::InventorySlot::IsCursorSlot() const
+bool EQ::InventorySlot::IsCursorSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -207,7 +207,7 @@ bool EQEmu::InventorySlot::IsCursorSlot() const
return IsCursorIndex(_slot_index);
}
-bool EQEmu::InventorySlot::IsWeaponSlot() const
+bool EQ::InventorySlot::IsWeaponSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -218,7 +218,7 @@ bool EQEmu::InventorySlot::IsWeaponSlot() const
return IsWeaponIndex(_slot_index);
}
-bool EQEmu::InventorySlot::IsTextureSlot() const
+bool EQ::InventorySlot::IsTextureSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -229,7 +229,7 @@ bool EQEmu::InventorySlot::IsTextureSlot() const
return IsTextureIndex(_slot_index);
}
-bool EQEmu::InventorySlot::IsTintableSlot() const
+bool EQ::InventorySlot::IsTintableSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -240,7 +240,7 @@ bool EQEmu::InventorySlot::IsTintableSlot() const
return IsTintableIndex(_slot_index);
}
-bool EQEmu::InventorySlot::IsSlot() const
+bool EQ::InventorySlot::IsSlot() const
{
if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false;
@@ -254,7 +254,7 @@ bool EQEmu::InventorySlot::IsSlot() const
return true;
}
-bool EQEmu::InventorySlot::IsSlotSocket() const
+bool EQ::InventorySlot::IsSlotSocket() const
{
if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false;
@@ -268,7 +268,7 @@ bool EQEmu::InventorySlot::IsSlotSocket() const
return true;
}
-bool EQEmu::InventorySlot::IsContainer() const
+bool EQ::InventorySlot::IsContainer() const
{
if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false;
@@ -282,7 +282,7 @@ bool EQEmu::InventorySlot::IsContainer() const
return true;
}
-bool EQEmu::InventorySlot::IsContainerSocket() const
+bool EQ::InventorySlot::IsContainerSocket() const
{
if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false;
@@ -296,12 +296,12 @@ bool EQEmu::InventorySlot::IsContainerSocket() const
return true;
}
-EQEmu::InventorySlot EQEmu::InventorySlot::ToTopOwner() const
+EQ::InventorySlot EQ::InventorySlot::ToTopOwner() const
{
return InventorySlot(_type_index, _slot_index);
}
-EQEmu::InventorySlot EQEmu::InventorySlot::ToOwner() const
+EQ::InventorySlot EQ::InventorySlot::ToOwner() const
{
if (IsSlot() || IsSlotSocket() || IsContainer())
return InventorySlot(_type_index, _slot_index);
@@ -312,17 +312,17 @@ EQEmu::InventorySlot EQEmu::InventorySlot::ToOwner() const
return InventorySlot();
}
-const std::string EQEmu::InventorySlot::ToString() const
+const std::string EQ::InventorySlot::ToString() const
{
return StringFormat("(%i%s, %i, %i, %i)", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index);
}
-const std::string EQEmu::InventorySlot::ToName() const
+const std::string EQ::InventorySlot::ToName() const
{
return StringFormat("InventorySlot - _type_index: %i%s, _slot_index: %i, _container_index: %i, _socket_index: %i", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index);
}
-void EQEmu::InventorySlot::SetInvalidSlot()
+void EQ::InventorySlot::SetInvalidSlot()
{
_type_index = invtype::TYPE_INVALID;
_slot_index = invslot::SLOT_INVALID;
@@ -330,7 +330,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
_socket_index = invaug::SOCKET_INVALID;
}
-//bool EQEmu::InventorySlot::IsBonusIndex(int16 slot_index)
+//bool EQ::InventorySlot::IsBonusIndex(int16 slot_index)
//{
// if ((slot_index >= inventory::EquipmentBegin) && (slot_index <= inventory::EquipmentEnd) && (slot_index != inventory::slotAmmo))
// return true;
@@ -338,7 +338,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
// return false;
//}
-//bool EQEmu::InventorySlot::IsBonusSlot() const
+//bool EQ::InventorySlot::IsBonusSlot() const
//{
// if ((_type_index != inventory::typePossessions) || (_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
// return false;
@@ -346,7 +346,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
// return IsBonusIndex(_slot_index);
//}
-bool inventory_slot_typeless_lessthan(const EQEmu::InventorySlot& lhs, const EQEmu::InventorySlot& rhs)
+bool inventory_slot_typeless_lessthan(const EQ::InventorySlot& lhs, const EQ::InventorySlot& rhs)
{
if (lhs.SlotIndex() < rhs.SlotIndex())
return true;
@@ -360,7 +360,7 @@ bool inventory_slot_typeless_lessthan(const EQEmu::InventorySlot& lhs, const EQE
return false;
}
-bool EQEmu::InventorySlot::operator<(const InventorySlot& rhs) const
+bool EQ::InventorySlot::operator<(const InventorySlot& rhs) const
{
if (Typeless() || rhs.Typeless())
return inventory_slot_typeless_lessthan(*this, rhs);
@@ -380,7 +380,7 @@ bool EQEmu::InventorySlot::operator<(const InventorySlot& rhs) const
return false;
}
-bool EQEmu::operator==(const InventorySlot& lhs, const InventorySlot& rhs)
+bool EQ::operator==(const InventorySlot& lhs, const InventorySlot& rhs)
{
if (lhs.Typeless() || rhs.Typeless())
return ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex()));
diff --git a/common/inventory_slot.h b/common/inventory_slot.h
index 967673f99..d61d8acb0 100644
--- a/common/inventory_slot.h
+++ b/common/inventory_slot.h
@@ -23,7 +23,7 @@
#include "emu_constants.h"
-namespace EQEmu
+namespace EQ
{
class InventorySlot;
diff --git a/common/ipc_mutex.cpp b/common/ipc_mutex.cpp
index 75e0a63a1..5eb4eedfc 100644
--- a/common/ipc_mutex.cpp
+++ b/common/ipc_mutex.cpp
@@ -31,7 +31,7 @@
#include "eqemu_exception.h"
#include "eqemu_config.h"
-namespace EQEmu {
+namespace EQ {
struct IPCMutex::Implementation {
#ifdef _WINDOWS
HANDLE mut_;
diff --git a/common/ipc_mutex.h b/common/ipc_mutex.h
index ab0af4817..a8f2fd13c 100644
--- a/common/ipc_mutex.h
+++ b/common/ipc_mutex.h
@@ -21,7 +21,7 @@
#include
-namespace EQEmu {
+namespace EQ {
//! Interprocess Named Binary Semaphore (Mutex)
/*!
diff --git a/common/item_data.cpp b/common/item_data.cpp
index c0e70d72a..f3e13edf7 100644
--- a/common/item_data.cpp
+++ b/common/item_data.cpp
@@ -23,7 +23,7 @@
//#include "deity.h"
-uint32 EQEmu::item::ConvertAugTypeToAugTypeBit(uint8 aug_type)
+uint32 EQ::item::ConvertAugTypeToAugTypeBit(uint8 aug_type)
{
switch (aug_type) {
case AugTypeGeneralSingleStat:
@@ -95,7 +95,7 @@ uint32 EQEmu::item::ConvertAugTypeToAugTypeBit(uint8 aug_type)
}
}
-uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit)
+uint8 EQ::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit)
{
switch (aug_type_bit) {
case bit_AugTypeGeneralSingleStat:
@@ -167,7 +167,7 @@ uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit)
}
}
-bool EQEmu::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const
+bool EQ::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const
{
if (!(Races & GetPlayerRaceBit(race_id)))
return false;
@@ -178,37 +178,37 @@ bool EQEmu::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const
return true;
}
-bool EQEmu::ItemData::IsClassCommon() const
+bool EQ::ItemData::IsClassCommon() const
{
return (ItemClass == item::ItemClassCommon);
}
-bool EQEmu::ItemData::IsClassBag() const
+bool EQ::ItemData::IsClassBag() const
{
return (ItemClass == item::ItemClassBag);
}
-bool EQEmu::ItemData::IsClassBook() const
+bool EQ::ItemData::IsClassBook() const
{
return (ItemClass == item::ItemClassBook);
}
-bool EQEmu::ItemData::IsType1HWeapon() const
+bool EQ::ItemData::IsType1HWeapon() const
{
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing) || (ItemType == item::ItemTypeMartial));
}
-bool EQEmu::ItemData::IsType2HWeapon() const
+bool EQ::ItemData::IsType2HWeapon() const
{
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
}
-bool EQEmu::ItemData::IsTypeShield() const
+bool EQ::ItemData::IsTypeShield() const
{
return (ItemType == item::ItemTypeShield);
}
-bool EQEmu::ItemData::CheckLoreConflict(const ItemData* l_item, const ItemData* r_item)
+bool EQ::ItemData::CheckLoreConflict(const ItemData* l_item, const ItemData* r_item)
{
if (!l_item || !r_item)
return false;
diff --git a/common/item_data.h b/common/item_data.h
index 58bc4c889..d3ae5f928 100644
--- a/common/item_data.h
+++ b/common/item_data.h
@@ -47,7 +47,7 @@
#include "emu_constants.h"
-namespace EQEmu
+namespace EQ
{
namespace item {
enum ItemClass {
@@ -434,6 +434,7 @@ namespace EQEmu
//uint32 Unk054;
int16 MaxCharges; // Maximum charges items can hold: -1 if not a chargeable item
uint8 ItemType; // Item Type/Skill (itemClass* from above)
+ int32 SubType; // Some items have sub types that can be used for other things (unbreakable fishing poles, SE_FFItemClass)
uint8 Material; // Item material type
uint32 HerosForgeModel;// Hero's Forge Armor Model Type (2-13?)
float SellRate; // Sell rate
diff --git a/common/item_fieldlist.h b/common/item_fieldlist.h
index 665783498..3c00f1e44 100644
--- a/common/item_fieldlist.h
+++ b/common/item_fieldlist.h
@@ -203,3 +203,4 @@ F(procname)
F(wornname)
F(focusname)
F(scrollname)
+F(subtype)
diff --git a/common/item_instance.cpp b/common/item_instance.cpp
index 2c186e066..d0bbbca50 100644
--- a/common/item_instance.cpp
+++ b/common/item_instance.cpp
@@ -54,9 +54,9 @@ static inline int32 GetNextItemInstSerialNumber() {
}
//
-// class EQEmu::ItemInstance
+// class EQ::ItemInstance
//
-EQEmu::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
+EQ::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
m_use_type = ItemInstNormal;
if(item) {
m_item = new ItemData(*item);
@@ -87,7 +87,7 @@ EQEmu::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
m_new_id_file = 0;
}
-EQEmu::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges) {
+EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges) {
m_use_type = ItemInstNormal;
m_item = db->GetItem(item_id);
if(m_item) {
@@ -121,7 +121,7 @@ EQEmu::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 char
m_new_id_file = 0;
}
-EQEmu::ItemInstance::ItemInstance(ItemInstTypes use_type) {
+EQ::ItemInstance::ItemInstance(ItemInstTypes use_type) {
m_use_type = use_type;
m_item = nullptr;
m_charges = 0;
@@ -143,8 +143,8 @@ EQEmu::ItemInstance::ItemInstance(ItemInstTypes use_type) {
m_new_id_file = 0;
}
-// Make a copy of an EQEmu::ItemInstance object
-EQEmu::ItemInstance::ItemInstance(const ItemInstance& copy)
+// Make a copy of an EQ::ItemInstance object
+EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
{
m_use_type=copy.m_use_type;
if(copy.m_item)
@@ -202,7 +202,7 @@ EQEmu::ItemInstance::ItemInstance(const ItemInstance& copy)
}
// Clean up container contents
-EQEmu::ItemInstance::~ItemInstance()
+EQ::ItemInstance::~ItemInstance()
{
Clear();
safe_delete(m_item);
@@ -211,7 +211,7 @@ EQEmu::ItemInstance::~ItemInstance()
}
// Query item type
-bool EQEmu::ItemInstance::IsType(item::ItemClass item_class) const
+bool EQ::ItemInstance::IsType(item::ItemClass item_class) const
{
// IsType() does not protect against 'm_item = nullptr'
@@ -225,23 +225,23 @@ bool EQEmu::ItemInstance::IsType(item::ItemClass item_class) const
return (m_item->ItemClass == item_class);
}
-bool EQEmu::ItemInstance::IsClassCommon() const
+bool EQ::ItemInstance::IsClassCommon() const
{
return (m_item && m_item->IsClassCommon());
}
-bool EQEmu::ItemInstance::IsClassBag() const
+bool EQ::ItemInstance::IsClassBag() const
{
return (m_item && m_item->IsClassBag());
}
-bool EQEmu::ItemInstance::IsClassBook() const
+bool EQ::ItemInstance::IsClassBook() const
{
return (m_item && m_item->IsClassBook());
}
// Is item stackable?
-bool EQEmu::ItemInstance::IsStackable() const
+bool EQ::ItemInstance::IsStackable() const
{
if (!m_item)
return false;
@@ -249,7 +249,7 @@ bool EQEmu::ItemInstance::IsStackable() const
return m_item->Stackable;
}
-bool EQEmu::ItemInstance::IsCharged() const
+bool EQ::ItemInstance::IsCharged() const
{
if (!m_item)
return false;
@@ -261,7 +261,7 @@ bool EQEmu::ItemInstance::IsCharged() const
}
// Can item be equipped?
-bool EQEmu::ItemInstance::IsEquipable(uint16 race, uint16 class_) const
+bool EQ::ItemInstance::IsEquipable(uint16 race, uint16 class_) const
{
if (!m_item || (m_item->Slots == 0))
return false;
@@ -270,18 +270,18 @@ bool EQEmu::ItemInstance::IsEquipable(uint16 race, uint16 class_) const
}
// Can equip at this slot?
-bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const
+bool EQ::ItemInstance::IsEquipable(int16 slot_id) const
{
if (!m_item)
return false;
- if (slot_id < EQEmu::invslot::EQUIPMENT_BEGIN || slot_id > EQEmu::invslot::EQUIPMENT_END)
+ if (slot_id < EQ::invslot::EQUIPMENT_BEGIN || slot_id > EQ::invslot::EQUIPMENT_END)
return false;
return ((m_item->Slots & (1 << slot_id)) != 0);
}
-bool EQEmu::ItemInstance::IsAugmentable() const
+bool EQ::ItemInstance::IsAugmentable() const
{
if (!m_item)
return false;
@@ -294,7 +294,7 @@ bool EQEmu::ItemInstance::IsAugmentable() const
return false;
}
-bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
+bool EQ::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
if (!m_item || !m_item->IsClassCommon())
return false;
@@ -306,10 +306,10 @@ bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
}
}
- return (index <= EQEmu::invslot::EQUIPMENT_END);
+ return (index <= EQ::invslot::EQUIPMENT_END);
}
-int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const
+int8 EQ::ItemInstance::AvailableAugmentSlot(int32 augtype) const
{
if (!m_item || !m_item->IsClassCommon())
return INVALID_INDEX;
@@ -324,7 +324,7 @@ int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const
return (index <= invaug::SOCKET_END) ? index : INVALID_INDEX;
}
-bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const
+bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const
{
if (!m_item || !m_item->IsClassCommon())
return false;
@@ -336,7 +336,7 @@ bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) cons
}
// Retrieve item inside container
-EQEmu::ItemInstance* EQEmu::ItemInstance::GetItem(uint8 index) const
+EQ::ItemInstance* EQ::ItemInstance::GetItem(uint8 index) const
{
auto it = m_contents.find(index);
if (it != m_contents.end()) {
@@ -346,7 +346,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetItem(uint8 index) const
return nullptr;
}
-uint32 EQEmu::ItemInstance::GetItemID(uint8 slot) const
+uint32 EQ::ItemInstance::GetItemID(uint8 slot) const
{
ItemInstance *item = GetItem(slot);
if (item)
@@ -355,7 +355,7 @@ uint32 EQEmu::ItemInstance::GetItemID(uint8 slot) const
return 0;
}
-void EQEmu::ItemInstance::PutItem(uint8 index, const ItemInstance& inst)
+void EQ::ItemInstance::PutItem(uint8 index, const ItemInstance& inst)
{
// Clean up item already in slot (if exists)
DeleteItem(index);
@@ -365,7 +365,7 @@ void EQEmu::ItemInstance::PutItem(uint8 index, const ItemInstance& inst)
}
// Remove item inside container
-void EQEmu::ItemInstance::DeleteItem(uint8 index)
+void EQ::ItemInstance::DeleteItem(uint8 index)
{
ItemInstance* inst = PopItem(index);
safe_delete(inst);
@@ -373,7 +373,7 @@ void EQEmu::ItemInstance::DeleteItem(uint8 index)
// Remove item from container without memory delete
// Hands over memory ownership to client of this function call
-EQEmu::ItemInstance* EQEmu::ItemInstance::PopItem(uint8 index)
+EQ::ItemInstance* EQ::ItemInstance::PopItem(uint8 index)
{
auto iter = m_contents.find(index);
if (iter != m_contents.end()) {
@@ -386,7 +386,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::PopItem(uint8 index)
}
// Remove all items from container
-void EQEmu::ItemInstance::Clear()
+void EQ::ItemInstance::Clear()
{
// Destroy container contents
for (auto iter = m_contents.begin(); iter != m_contents.end(); ++iter) {
@@ -396,7 +396,7 @@ void EQEmu::ItemInstance::Clear()
}
// Remove all items from container
-void EQEmu::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
+void EQ::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
{
// TODO: This needs work...
@@ -458,7 +458,7 @@ void EQEmu::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is
}
}
-uint8 EQEmu::ItemInstance::FirstOpenSlot() const
+uint8 EQ::ItemInstance::FirstOpenSlot() const
{
if (!m_item)
return INVALID_INDEX;
@@ -472,7 +472,7 @@ uint8 EQEmu::ItemInstance::FirstOpenSlot() const
return (i < slots) ? i : INVALID_INDEX;
}
-uint8 EQEmu::ItemInstance::GetTotalItemCount() const
+uint8 EQ::ItemInstance::GetTotalItemCount() const
{
if (!m_item)
return 0;
@@ -486,7 +486,7 @@ uint8 EQEmu::ItemInstance::GetTotalItemCount() const
return item_count;
}
-bool EQEmu::ItemInstance::IsNoneEmptyContainer()
+bool EQ::ItemInstance::IsNoneEmptyContainer()
{
if (!m_item || !m_item->IsClassBag())
return false;
@@ -500,7 +500,7 @@ bool EQEmu::ItemInstance::IsNoneEmptyContainer()
}
// Retrieve augment inside item
-EQEmu::ItemInstance* EQEmu::ItemInstance::GetAugment(uint8 slot) const
+EQ::ItemInstance* EQ::ItemInstance::GetAugment(uint8 slot) const
{
if (m_item && m_item->IsClassCommon())
return GetItem(slot);
@@ -508,7 +508,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetAugment(uint8 slot) const
return nullptr;
}
-EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentationAugtype) const
+EQ::ItemInstance* EQ::ItemInstance::GetOrnamentationAug(int32 ornamentationAugtype) const
{
if (!m_item || !m_item->IsClassCommon()) { return nullptr; }
if (ornamentationAugtype == 0) { return nullptr; }
@@ -533,7 +533,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentatio
return nullptr;
}
-uint32 EQEmu::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
+uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
// Not a Hero Forge item.
if (m_ornament_hero_model == 0 || material_slot < 0)
return 0;
@@ -546,7 +546,7 @@ uint32 EQEmu::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
return (m_ornament_hero_model * 100) + material_slot;
}
-bool EQEmu::ItemInstance::UpdateOrnamentationInfo() {
+bool EQ::ItemInstance::UpdateOrnamentationInfo() {
if (!m_item || !m_item->IsClassCommon())
return false;
@@ -582,7 +582,7 @@ bool EQEmu::ItemInstance::UpdateOrnamentationInfo() {
return ornamentSet;
}
-bool EQEmu::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll) {
+bool EQ::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll) {
if (!ItemToTry || !Container) return false;
if (ItemToTry->ItemType == item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0)
@@ -629,7 +629,7 @@ bool EQEmu::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData
return false;
}
-uint32 EQEmu::ItemInstance::GetAugmentItemID(uint8 slot) const
+uint32 EQ::ItemInstance::GetAugmentItemID(uint8 slot) const
{
if (!m_item || !m_item->IsClassCommon())
return 0;
@@ -638,7 +638,7 @@ uint32 EQEmu::ItemInstance::GetAugmentItemID(uint8 slot) const
}
// Add an augment to the item
-void EQEmu::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment)
+void EQ::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment)
{
if (!m_item || !m_item->IsClassCommon())
return;
@@ -646,7 +646,7 @@ void EQEmu::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment)
PutItem(slot, augment);
}
-void EQEmu::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id)
+void EQ::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id)
{
if (item_id == 0) { return; }
if (db == nullptr) { return; /* TODO: add log message for nullptr */ }
@@ -659,7 +659,7 @@ void EQEmu::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item
}
// Remove augment from item and destroy it
-void EQEmu::ItemInstance::DeleteAugment(uint8 index)
+void EQ::ItemInstance::DeleteAugment(uint8 index)
{
if (!m_item || !m_item->IsClassCommon())
return;
@@ -668,7 +668,7 @@ void EQEmu::ItemInstance::DeleteAugment(uint8 index)
}
// Remove augment from item and return it
-EQEmu::ItemInstance* EQEmu::ItemInstance::RemoveAugment(uint8 index)
+EQ::ItemInstance* EQ::ItemInstance::RemoveAugment(uint8 index)
{
if (!m_item || !m_item->IsClassCommon())
return nullptr;
@@ -676,7 +676,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::RemoveAugment(uint8 index)
return PopItem(index);
}
-bool EQEmu::ItemInstance::IsAugmented()
+bool EQ::ItemInstance::IsAugmented()
{
if (!m_item || !m_item->IsClassCommon())
return false;
@@ -690,7 +690,7 @@ bool EQEmu::ItemInstance::IsAugmented()
}
// Has attack/delay?
-bool EQEmu::ItemInstance::IsWeapon() const
+bool EQ::ItemInstance::IsWeapon() const
{
if (!m_item || !m_item->IsClassCommon())
return false;
@@ -701,7 +701,7 @@ bool EQEmu::ItemInstance::IsWeapon() const
return ((m_item->Damage != 0) && (m_item->Delay != 0));
}
-bool EQEmu::ItemInstance::IsAmmo() const
+bool EQ::ItemInstance::IsAmmo() const
{
if (!m_item)
return false;
@@ -717,7 +717,7 @@ bool EQEmu::ItemInstance::IsAmmo() const
}
-const EQEmu::ItemData* EQEmu::ItemInstance::GetItem() const
+const EQ::ItemData* EQ::ItemInstance::GetItem() const
{
if (!m_item)
return nullptr;
@@ -728,13 +728,13 @@ const EQEmu::ItemData* EQEmu::ItemInstance::GetItem() const
return m_item;
}
-const EQEmu::ItemData* EQEmu::ItemInstance::GetUnscaledItem() const
+const EQ::ItemData* EQ::ItemInstance::GetUnscaledItem() const
{
// No operator calls and defaults to nullptr
return m_item;
}
-std::string EQEmu::ItemInstance::GetCustomDataString() const {
+std::string EQ::ItemInstance::GetCustomDataString() const {
std::string ret_val;
auto iter = m_custom_data.begin();
while (iter != m_custom_data.end()) {
@@ -753,7 +753,7 @@ std::string EQEmu::ItemInstance::GetCustomDataString() const {
return ret_val;
}
-std::string EQEmu::ItemInstance::GetCustomData(std::string identifier) {
+std::string EQ::ItemInstance::GetCustomData(std::string identifier) {
std::map::const_iterator iter = m_custom_data.find(identifier);
if (iter != m_custom_data.end()) {
return iter->second;
@@ -762,49 +762,49 @@ std::string EQEmu::ItemInstance::GetCustomData(std::string identifier) {
return "";
}
-void EQEmu::ItemInstance::SetCustomData(std::string identifier, std::string value) {
+void EQ::ItemInstance::SetCustomData(std::string identifier, std::string value) {
DeleteCustomData(identifier);
m_custom_data[identifier] = value;
}
-void EQEmu::ItemInstance::SetCustomData(std::string identifier, int value) {
+void EQ::ItemInstance::SetCustomData(std::string identifier, int value) {
DeleteCustomData(identifier);
std::stringstream ss;
ss << value;
m_custom_data[identifier] = ss.str();
}
-void EQEmu::ItemInstance::SetCustomData(std::string identifier, float value) {
+void EQ::ItemInstance::SetCustomData(std::string identifier, float value) {
DeleteCustomData(identifier);
std::stringstream ss;
ss << value;
m_custom_data[identifier] = ss.str();
}
-void EQEmu::ItemInstance::SetCustomData(std::string identifier, bool value) {
+void EQ::ItemInstance::SetCustomData(std::string identifier, bool value) {
DeleteCustomData(identifier);
std::stringstream ss;
ss << value;
m_custom_data[identifier] = ss.str();
}
-void EQEmu::ItemInstance::DeleteCustomData(std::string identifier) {
+void EQ::ItemInstance::DeleteCustomData(std::string identifier) {
auto iter = m_custom_data.find(identifier);
if (iter != m_custom_data.end()) {
m_custom_data.erase(iter);
}
}
-// Clone a type of EQEmu::ItemInstance object
+// Clone a type of EQ::ItemInstance object
// c++ doesn't allow a polymorphic copy constructor,
// so we have to resort to a polymorphic Clone()
-EQEmu::ItemInstance* EQEmu::ItemInstance::Clone() const
+EQ::ItemInstance* EQ::ItemInstance::Clone() const
{
// Pseudo-polymorphic copy constructor
return new ItemInstance(*this);
}
-bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const {
+bool EQ::ItemInstance::IsSlotAllowed(int16 slot_id) const {
if (!m_item) { return false; }
else if (InventoryProfile::SupportsContainers(slot_id)) { return true; }
else if (m_item->Slots & (1 << slot_id)) { return true; }
@@ -812,7 +812,7 @@ bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const {
else { return false; }
}
-bool EQEmu::ItemInstance::IsDroppable(bool recurse) const
+bool EQ::ItemInstance::IsDroppable(bool recurse) const
{
if (!m_item)
return false;
@@ -838,7 +838,7 @@ bool EQEmu::ItemInstance::IsDroppable(bool recurse) const
return true;
}
-void EQEmu::ItemInstance::Initialize(SharedDatabase *db) {
+void EQ::ItemInstance::Initialize(SharedDatabase *db) {
// if there's no actual item, don't do anything
if (!m_item)
return;
@@ -855,7 +855,7 @@ void EQEmu::ItemInstance::Initialize(SharedDatabase *db) {
}
}
-void EQEmu::ItemInstance::ScaleItem() {
+void EQ::ItemInstance::ScaleItem() {
if (!m_item)
return;
@@ -939,18 +939,18 @@ void EQEmu::ItemInstance::ScaleItem() {
m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself.
}
-bool EQEmu::ItemInstance::EvolveOnAllKills() const {
+bool EQ::ItemInstance::EvolveOnAllKills() const {
return (m_evolveInfo && m_evolveInfo->AllKills);
}
-int8 EQEmu::ItemInstance::GetMaxEvolveLvl() const {
+int8 EQ::ItemInstance::GetMaxEvolveLvl() const {
if (m_evolveInfo)
return m_evolveInfo->MaxLvl;
else
return 0;
}
-uint32 EQEmu::ItemInstance::GetKillsNeeded(uint8 currentlevel) {
+uint32 EQ::ItemInstance::GetKillsNeeded(uint8 currentlevel) {
uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero.
if (m_evolveInfo)
if (currentlevel != m_evolveInfo->MaxLvl)
@@ -962,24 +962,24 @@ uint32 EQEmu::ItemInstance::GetKillsNeeded(uint8 currentlevel) {
return kills;
}
-void EQEmu::ItemInstance::SetTimer(std::string name, uint32 time) {
+void EQ::ItemInstance::SetTimer(std::string name, uint32 time) {
Timer t(time);
t.Start(time, false);
m_timers[name] = t;
}
-void EQEmu::ItemInstance::StopTimer(std::string name) {
+void EQ::ItemInstance::StopTimer(std::string name) {
auto iter = m_timers.find(name);
if(iter != m_timers.end()) {
m_timers.erase(iter);
}
}
-void EQEmu::ItemInstance::ClearTimers() {
+void EQ::ItemInstance::ClearTimers() {
m_timers.clear();
}
-int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const
+int EQ::ItemInstance::GetItemArmorClass(bool augments) const
{
int ac = 0;
const auto item = GetItem();
@@ -993,7 +993,7 @@ int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const
return ac;
}
-int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments) const
+int EQ::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments) const
{
const auto item = GetItem();
if (item) {
@@ -1035,7 +1035,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold
return magic + fire + cold + poison + disease + chromatic + prismatic + physical + corruption;
}
-int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const
+int EQ::ItemInstance::GetItemElementalFlag(bool augments) const
{
int flag = 0;
const auto item = GetItem();
@@ -1056,7 +1056,7 @@ int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const
return flag;
}
-int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const
+int EQ::ItemInstance::GetItemElementalDamage(bool augments) const
{
int damage = 0;
const auto item = GetItem();
@@ -1077,7 +1077,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const
return damage;
}
-int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const
+int EQ::ItemInstance::GetItemRecommendedLevel(bool augments) const
{
int level = 0;
const auto item = GetItem();
@@ -1099,7 +1099,7 @@ int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const
return level;
}
-int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const
+int EQ::ItemInstance::GetItemRequiredLevel(bool augments) const
{
int level = 0;
const auto item = GetItem();
@@ -1121,7 +1121,7 @@ int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const
return level;
}
-int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const
+int EQ::ItemInstance::GetItemWeaponDamage(bool augments) const
{
int damage = 0;
const auto item = GetItem();
@@ -1137,7 +1137,7 @@ int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const
return damage;
}
-int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const
+int EQ::ItemInstance::GetItemBackstabDamage(bool augments) const
{
int damage = 0;
const auto item = GetItem();
@@ -1153,7 +1153,7 @@ int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const
return damage;
}
-int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const
+int EQ::ItemInstance::GetItemBaneDamageBody(bool augments) const
{
int body = 0;
const auto item = GetItem();
@@ -1174,7 +1174,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const
return body;
}
-int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const
+int EQ::ItemInstance::GetItemBaneDamageRace(bool augments) const
{
int race = 0;
const auto item = GetItem();
@@ -1195,7 +1195,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const
return race;
}
-int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) const
+int EQ::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) const
{
int damage = 0;
const auto item = GetItem();
@@ -1212,7 +1212,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments)
return damage;
}
-int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) const
+int EQ::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) const
{
int damage = 0;
const auto item = GetItem();
@@ -1229,7 +1229,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) co
return damage;
}
-int EQEmu::ItemInstance::GetItemMagical(bool augments) const
+int EQ::ItemInstance::GetItemMagical(bool augments) const
{
const auto item = GetItem();
if (item) {
@@ -1245,7 +1245,7 @@ int EQEmu::ItemInstance::GetItemMagical(bool augments) const
return 0;
}
-int EQEmu::ItemInstance::GetItemHP(bool augments) const
+int EQ::ItemInstance::GetItemHP(bool augments) const
{
int hp = 0;
const auto item = GetItem();
@@ -1259,7 +1259,7 @@ int EQEmu::ItemInstance::GetItemHP(bool augments) const
return hp;
}
-int EQEmu::ItemInstance::GetItemMana(bool augments) const
+int EQ::ItemInstance::GetItemMana(bool augments) const
{
int mana = 0;
const auto item = GetItem();
@@ -1273,7 +1273,7 @@ int EQEmu::ItemInstance::GetItemMana(bool augments) const
return mana;
}
-int EQEmu::ItemInstance::GetItemEndur(bool augments) const
+int EQ::ItemInstance::GetItemEndur(bool augments) const
{
int endur = 0;
const auto item = GetItem();
@@ -1287,7 +1287,7 @@ int EQEmu::ItemInstance::GetItemEndur(bool augments) const
return endur;
}
-int EQEmu::ItemInstance::GetItemAttack(bool augments) const
+int EQ::ItemInstance::GetItemAttack(bool augments) const
{
int atk = 0;
const auto item = GetItem();
@@ -1301,7 +1301,7 @@ int EQEmu::ItemInstance::GetItemAttack(bool augments) const
return atk;
}
-int EQEmu::ItemInstance::GetItemStr(bool augments) const
+int EQ::ItemInstance::GetItemStr(bool augments) const
{
int str = 0;
const auto item = GetItem();
@@ -1315,7 +1315,7 @@ int EQEmu::ItemInstance::GetItemStr(bool augments) const
return str;
}
-int EQEmu::ItemInstance::GetItemSta(bool augments) const
+int EQ::ItemInstance::GetItemSta(bool augments) const
{
int sta = 0;
const auto item = GetItem();
@@ -1329,7 +1329,7 @@ int EQEmu::ItemInstance::GetItemSta(bool augments) const
return sta;
}
-int EQEmu::ItemInstance::GetItemDex(bool augments) const
+int EQ::ItemInstance::GetItemDex(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1343,7 +1343,7 @@ int EQEmu::ItemInstance::GetItemDex(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemAgi(bool augments) const
+int EQ::ItemInstance::GetItemAgi(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1357,7 +1357,7 @@ int EQEmu::ItemInstance::GetItemAgi(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemInt(bool augments) const
+int EQ::ItemInstance::GetItemInt(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1371,7 +1371,7 @@ int EQEmu::ItemInstance::GetItemInt(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemWis(bool augments) const
+int EQ::ItemInstance::GetItemWis(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1385,7 +1385,7 @@ int EQEmu::ItemInstance::GetItemWis(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemCha(bool augments) const
+int EQ::ItemInstance::GetItemCha(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1399,7 +1399,7 @@ int EQEmu::ItemInstance::GetItemCha(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemMR(bool augments) const
+int EQ::ItemInstance::GetItemMR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1413,7 +1413,7 @@ int EQEmu::ItemInstance::GetItemMR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemFR(bool augments) const
+int EQ::ItemInstance::GetItemFR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1427,7 +1427,7 @@ int EQEmu::ItemInstance::GetItemFR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemCR(bool augments) const
+int EQ::ItemInstance::GetItemCR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1441,7 +1441,7 @@ int EQEmu::ItemInstance::GetItemCR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemPR(bool augments) const
+int EQ::ItemInstance::GetItemPR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1455,7 +1455,7 @@ int EQEmu::ItemInstance::GetItemPR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemDR(bool augments) const
+int EQ::ItemInstance::GetItemDR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1469,7 +1469,7 @@ int EQEmu::ItemInstance::GetItemDR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemCorrup(bool augments) const
+int EQ::ItemInstance::GetItemCorrup(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1483,7 +1483,7 @@ int EQEmu::ItemInstance::GetItemCorrup(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const
+int EQ::ItemInstance::GetItemHeroicStr(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1497,7 +1497,7 @@ int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const
+int EQ::ItemInstance::GetItemHeroicSta(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1511,7 +1511,7 @@ int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const
+int EQ::ItemInstance::GetItemHeroicDex(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1525,7 +1525,7 @@ int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const
+int EQ::ItemInstance::GetItemHeroicAgi(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1539,7 +1539,7 @@ int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const
+int EQ::ItemInstance::GetItemHeroicInt(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1553,7 +1553,7 @@ int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const
+int EQ::ItemInstance::GetItemHeroicWis(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1567,7 +1567,7 @@ int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const
+int EQ::ItemInstance::GetItemHeroicCha(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1581,7 +1581,7 @@ int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const
+int EQ::ItemInstance::GetItemHeroicMR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1595,7 +1595,7 @@ int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const
+int EQ::ItemInstance::GetItemHeroicFR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1609,7 +1609,7 @@ int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const
+int EQ::ItemInstance::GetItemHeroicCR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1623,7 +1623,7 @@ int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const
+int EQ::ItemInstance::GetItemHeroicPR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1637,7 +1637,7 @@ int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const
+int EQ::ItemInstance::GetItemHeroicDR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1651,7 +1651,7 @@ int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const
+int EQ::ItemInstance::GetItemHeroicCorrup(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1665,7 +1665,7 @@ int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const
return total;
}
-int EQEmu::ItemInstance::GetItemHaste(bool augments) const
+int EQ::ItemInstance::GetItemHaste(bool augments) const
{
int total = 0;
const auto item = GetItem();
diff --git a/common/item_instance.h b/common/item_instance.h
index d38ad0868..297908a50 100644
--- a/common/item_instance.h
+++ b/common/item_instance.h
@@ -38,7 +38,7 @@ class EvolveInfo; // Stores information about an evolving item family
#include