mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-25 02:08:23 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b7eeb3b2f9 | |||
| d2f8eead1f |
+1
-1
@@ -13,4 +13,4 @@ steps:
|
|||||||
image: akkadius/eqemu-server:latest
|
image: akkadius/eqemu-server:latest
|
||||||
commands:
|
commands:
|
||||||
- sudo chown eqemu:eqemu /drone/src/ * -R
|
- sudo chown eqemu:eqemu /drone/src/ * -R
|
||||||
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
|
- 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))
|
||||||
@@ -54,5 +54,3 @@ bin/
|
|||||||
/Win32
|
/Win32
|
||||||
/x64
|
/x64
|
||||||
/client_files/**/CMakeFiles/
|
/client_files/**/CMakeFiles/
|
||||||
|
|
||||||
.idea
|
|
||||||
|
|||||||
+1
-48
@@ -1,4 +1,4 @@
|
|||||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.7)
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||||||
|
|
||||||
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
|
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
@@ -131,47 +131,6 @@ OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
|||||||
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
|
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)
|
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
|
||||||
|
|
||||||
#PRNG options
|
|
||||||
OPTION(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF)
|
|
||||||
MARK_AS_ADVANCED(EQEMU_ADDITIVE_LFIB_PRNG)
|
|
||||||
OPTION(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF)
|
|
||||||
MARK_AS_ADVANCED(EQEMU_BIASED_INT_DIST)
|
|
||||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)")
|
|
||||||
MARK_AS_ADVANCED(EQEMU_CUSTOM_PRNG_ENGINE)
|
|
||||||
|
|
||||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
OPTION(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF)
|
|
||||||
MARK_AS_ADVANCED(EQEMU_SFMT19937)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(EQEMU_ADDITIVE_LFIB_PRNG)
|
|
||||||
ADD_DEFINITIONS(-DUSE_ADDITIVE_LFIB_PRNG)
|
|
||||||
IF(EQEMU_SFMT19937)
|
|
||||||
MESSAGE(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.")
|
|
||||||
SET(EQEMU_SFMT19937 OFF)
|
|
||||||
ENDIF()
|
|
||||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
|
||||||
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.")
|
|
||||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(EQEMU_SFMT19937)
|
|
||||||
ADD_DEFINITIONS(-DUSE_SFMT19937)
|
|
||||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
|
||||||
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.")
|
|
||||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
|
||||||
ADD_DEFINITIONS(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(EQEMU_BIASED_INT_DIST)
|
|
||||||
ADD_DEFINITIONS(-DBIASED_INT_DIST)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(EQEMU_COMMANDS_LOGGING)
|
IF(EQEMU_COMMANDS_LOGGING)
|
||||||
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
|
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
|
||||||
ENDIF(EQEMU_COMMANDS_LOGGING)
|
ENDIF(EQEMU_COMMANDS_LOGGING)
|
||||||
@@ -224,9 +183,6 @@ IF(OpenSSL_FOUND AND MBEDTLS_FOUND)
|
|||||||
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
|
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
|
||||||
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
|
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
|
||||||
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
|
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
|
||||||
IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
|
|
||||||
ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT)
|
|
||||||
ENDIF()
|
|
||||||
ELSEIF(TLS_LIBRARY_SELECTION STREQUAL "mbedTLS")
|
ELSEIF(TLS_LIBRARY_SELECTION STREQUAL "mbedTLS")
|
||||||
SET(TLS_LIBRARY_TYPE " mbedTLS")
|
SET(TLS_LIBRARY_TYPE " mbedTLS")
|
||||||
SET(TLS_LIBRARY_ENABLED ON)
|
SET(TLS_LIBRARY_ENABLED ON)
|
||||||
@@ -242,9 +198,6 @@ ELSEIF(OpenSSL_FOUND)
|
|||||||
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
|
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
|
||||||
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
|
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
|
||||||
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
|
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
|
||||||
IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
|
|
||||||
ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT)
|
|
||||||
ENDIF()
|
|
||||||
ELSEIF(MBEDTLS_FOUND)
|
ELSEIF(MBEDTLS_FOUND)
|
||||||
SET(TLS_LIBRARY_TYPE " mbedTLS")
|
SET(TLS_LIBRARY_TYPE " mbedTLS")
|
||||||
SET(TLS_LIBRARY_ENABLED ON)
|
SET(TLS_LIBRARY_ENABLED ON)
|
||||||
|
|||||||
@@ -18,11 +18,11 @@
|
|||||||
|**Install Count**|||
|
|**Install Count**|||
|
||||||
### > Windows
|
### > Windows
|
||||||
|
|
||||||
* [Install Guide](https://docs.eqemu.io/server/installation/server-installation-windows/)
|
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-windows)
|
||||||
|
|
||||||
### > Debian/Ubuntu/CentOS/Fedora
|
### > Debian/Ubuntu/CentOS/Fedora
|
||||||
|
|
||||||
* [Install Guide](https://docs.eqemu.io/server/installation/server-installation-linux/)
|
* [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)
|
* 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
|
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
|
||||||
@@ -56,7 +56,7 @@ forum, although pull requests will be much quicker and easier on all parties.
|
|||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
||||||
- [EQEmulator Wiki](https://docs.eqemu.io/)
|
- [EQEmulator Wiki](https://eqemu.gitbook.io/)
|
||||||
|
|
||||||
## Related Repositories
|
## Related Repositories
|
||||||
* [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests)
|
* [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests)
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
############################################
|
############################################
|
||||||
#
|
#
|
||||||
# New changelog can be found here
|
# New changelog can be found here
|
||||||
# https://docs.eqemu.io/server/changelog/server
|
# https://eqemu.gitbook.io/changelog/
|
||||||
#
|
#
|
||||||
############################################
|
############################################
|
||||||
# Deprecated
|
# Deprecated
|
||||||
|
|||||||
@@ -83,9 +83,8 @@ int main(int argc, char **argv)
|
|||||||
content_db.SetMysql(database.getMySQL());
|
content_db.SetMysql(database.getMySQL());
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
database.LoadLogSettings(LogSys.log_settings);
|
||||||
->LoadLogDatabaseSettings()
|
LogSys.StartFileLogs();
|
||||||
->StartFileLogs();
|
|
||||||
|
|
||||||
std::string arg_1;
|
std::string arg_1;
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,8 @@ int main(int argc, char **argv) {
|
|||||||
content_db.SetMysql(database.getMySQL());
|
content_db.SetMysql(database.getMySQL());
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
database.LoadLogSettings(LogSys.log_settings);
|
||||||
->LoadLogDatabaseSettings()
|
LogSys.StartFileLogs();
|
||||||
->StartFileLogs();
|
|
||||||
|
|
||||||
ImportSpells(&content_db);
|
ImportSpells(&content_db);
|
||||||
ImportSkillCaps(&content_db);
|
ImportSkillCaps(&content_db);
|
||||||
|
|||||||
+3
-25
@@ -32,6 +32,7 @@ SET(common_sources
|
|||||||
eq_stream_proxy.cpp
|
eq_stream_proxy.cpp
|
||||||
eqtime.cpp
|
eqtime.cpp
|
||||||
event_sub.cpp
|
event_sub.cpp
|
||||||
|
expedition_base.cpp
|
||||||
expedition_lockout_timer.cpp
|
expedition_lockout_timer.cpp
|
||||||
extprofile.cpp
|
extprofile.cpp
|
||||||
faction.cpp
|
faction.cpp
|
||||||
@@ -71,7 +72,6 @@ SET(common_sources
|
|||||||
serialize_buffer.cpp
|
serialize_buffer.cpp
|
||||||
server_event_scheduler.cpp
|
server_event_scheduler.cpp
|
||||||
serverinfo.cpp
|
serverinfo.cpp
|
||||||
shared_tasks.cpp
|
|
||||||
shareddb.cpp
|
shareddb.cpp
|
||||||
skills.cpp
|
skills.cpp
|
||||||
spdat.cpp
|
spdat.cpp
|
||||||
@@ -154,7 +154,6 @@ SET(repositories
|
|||||||
repositories/base/base_character_disciplines_repository.h
|
repositories/base/base_character_disciplines_repository.h
|
||||||
repositories/base/base_character_expedition_lockouts_repository.h
|
repositories/base/base_character_expedition_lockouts_repository.h
|
||||||
repositories/base/base_character_inspect_messages_repository.h
|
repositories/base/base_character_inspect_messages_repository.h
|
||||||
repositories/base/base_character_instance_safereturns_repository.h
|
|
||||||
repositories/base/base_character_item_recast_repository.h
|
repositories/base/base_character_item_recast_repository.h
|
||||||
repositories/base/base_character_languages_repository.h
|
repositories/base/base_character_languages_repository.h
|
||||||
repositories/base/base_character_leadership_abilities_repository.h
|
repositories/base/base_character_leadership_abilities_repository.h
|
||||||
@@ -166,15 +165,11 @@ SET(repositories
|
|||||||
repositories/base/base_character_potionbelt_repository.h
|
repositories/base/base_character_potionbelt_repository.h
|
||||||
repositories/base/base_character_skills_repository.h
|
repositories/base/base_character_skills_repository.h
|
||||||
repositories/base/base_character_spells_repository.h
|
repositories/base/base_character_spells_repository.h
|
||||||
repositories/base/base_character_task_timers_repository.h
|
|
||||||
repositories/base/base_character_tasks_repository.h
|
repositories/base/base_character_tasks_repository.h
|
||||||
repositories/base/base_char_create_combinations_repository.h
|
repositories/base/base_char_create_combinations_repository.h
|
||||||
repositories/base/base_char_create_point_allocations_repository.h
|
repositories/base/base_char_create_point_allocations_repository.h
|
||||||
repositories/base/base_char_recipe_list_repository.h
|
repositories/base/base_char_recipe_list_repository.h
|
||||||
repositories/base/base_completed_tasks_repository.h
|
repositories/base/base_completed_tasks_repository.h
|
||||||
repositories/base/base_completed_shared_tasks_repository.h
|
|
||||||
repositories/base/base_completed_shared_task_members_repository.h
|
|
||||||
repositories/base/base_completed_shared_task_activity_state_repository.h
|
|
||||||
repositories/base/base_content_flags_repository.h
|
repositories/base/base_content_flags_repository.h
|
||||||
repositories/base/base_damageshieldtypes_repository.h
|
repositories/base/base_damageshieldtypes_repository.h
|
||||||
repositories/base/base_data_buckets_repository.h
|
repositories/base/base_data_buckets_repository.h
|
||||||
@@ -260,10 +255,6 @@ SET(repositories
|
|||||||
repositories/base/base_rule_values_repository.h
|
repositories/base/base_rule_values_repository.h
|
||||||
repositories/base/base_saylink_repository.h
|
repositories/base/base_saylink_repository.h
|
||||||
repositories/base/base_server_scheduled_events_repository.h
|
repositories/base/base_server_scheduled_events_repository.h
|
||||||
repositories/base/base_shared_tasks_repository.h
|
|
||||||
repositories/base/base_shared_task_activity_state_repository.h
|
|
||||||
repositories/base/base_shared_task_dynamic_zones_repository.h
|
|
||||||
repositories/base/base_shared_task_members_repository.h
|
|
||||||
repositories/base/base_skill_caps_repository.h
|
repositories/base/base_skill_caps_repository.h
|
||||||
repositories/base/base_spawn2_repository.h
|
repositories/base/base_spawn2_repository.h
|
||||||
repositories/base/base_spawnentry_repository.h
|
repositories/base/base_spawnentry_repository.h
|
||||||
@@ -327,7 +318,6 @@ SET(repositories
|
|||||||
repositories/character_disciplines_repository.h
|
repositories/character_disciplines_repository.h
|
||||||
repositories/character_expedition_lockouts_repository.h
|
repositories/character_expedition_lockouts_repository.h
|
||||||
repositories/character_inspect_messages_repository.h
|
repositories/character_inspect_messages_repository.h
|
||||||
repositories/character_instance_safereturns_repository.h
|
|
||||||
repositories/character_item_recast_repository.h
|
repositories/character_item_recast_repository.h
|
||||||
repositories/character_languages_repository.h
|
repositories/character_languages_repository.h
|
||||||
repositories/character_leadership_abilities_repository.h
|
repositories/character_leadership_abilities_repository.h
|
||||||
@@ -339,15 +329,11 @@ SET(repositories
|
|||||||
repositories/character_potionbelt_repository.h
|
repositories/character_potionbelt_repository.h
|
||||||
repositories/character_skills_repository.h
|
repositories/character_skills_repository.h
|
||||||
repositories/character_spells_repository.h
|
repositories/character_spells_repository.h
|
||||||
repositories/character_task_timers_repository.h
|
|
||||||
repositories/character_tasks_repository.h
|
repositories/character_tasks_repository.h
|
||||||
repositories/char_create_combinations_repository.h
|
repositories/char_create_combinations_repository.h
|
||||||
repositories/char_create_point_allocations_repository.h
|
repositories/char_create_point_allocations_repository.h
|
||||||
repositories/char_recipe_list_repository.h
|
repositories/char_recipe_list_repository.h
|
||||||
repositories/completed_tasks_repository.h
|
repositories/completed_tasks_repository.h
|
||||||
repositories/completed_shared_tasks_repository.h
|
|
||||||
repositories/completed_shared_task_members_repository.h
|
|
||||||
repositories/completed_shared_task_activity_state_repository.h
|
|
||||||
repositories/content_flags_repository.h
|
repositories/content_flags_repository.h
|
||||||
repositories/damageshieldtypes_repository.h
|
repositories/damageshieldtypes_repository.h
|
||||||
repositories/data_buckets_repository.h
|
repositories/data_buckets_repository.h
|
||||||
@@ -433,10 +419,6 @@ SET(repositories
|
|||||||
repositories/rule_values_repository.h
|
repositories/rule_values_repository.h
|
||||||
repositories/saylink_repository.h
|
repositories/saylink_repository.h
|
||||||
repositories/server_scheduled_events_repository.h
|
repositories/server_scheduled_events_repository.h
|
||||||
repositories/shared_tasks_repository.h
|
|
||||||
repositories/shared_task_activity_state_repository.h
|
|
||||||
repositories/shared_task_dynamic_zones_repository.h
|
|
||||||
repositories/shared_task_members_repository.h
|
|
||||||
repositories/skill_caps_repository.h
|
repositories/skill_caps_repository.h
|
||||||
repositories/spawn2_repository.h
|
repositories/spawn2_repository.h
|
||||||
repositories/spawnentry_repository.h
|
repositories/spawnentry_repository.h
|
||||||
@@ -469,7 +451,6 @@ SET(repositories
|
|||||||
)
|
)
|
||||||
|
|
||||||
SET(common_headers
|
SET(common_headers
|
||||||
additive_lagged_fibonacci_engine.h
|
|
||||||
any.h
|
any.h
|
||||||
base_packet.h
|
base_packet.h
|
||||||
base_data.h
|
base_data.h
|
||||||
@@ -515,6 +496,7 @@ SET(common_headers
|
|||||||
eqtime.h
|
eqtime.h
|
||||||
errmsg.h
|
errmsg.h
|
||||||
event_sub.h
|
event_sub.h
|
||||||
|
expedition_base.h
|
||||||
expedition_lockout_timer.h
|
expedition_lockout_timer.h
|
||||||
extprofile.h
|
extprofile.h
|
||||||
faction.h
|
faction.h
|
||||||
@@ -526,7 +508,6 @@ SET(common_headers
|
|||||||
guild_base.h
|
guild_base.h
|
||||||
guilds.h
|
guilds.h
|
||||||
http/httplib.h
|
http/httplib.h
|
||||||
http/uri.h
|
|
||||||
inventory_profile.h
|
inventory_profile.h
|
||||||
inventory_slot.h
|
inventory_slot.h
|
||||||
ipc_mutex.h
|
ipc_mutex.h
|
||||||
@@ -571,13 +552,11 @@ SET(common_headers
|
|||||||
server_event_scheduler.h
|
server_event_scheduler.h
|
||||||
serverinfo.h
|
serverinfo.h
|
||||||
servertalk.h
|
servertalk.h
|
||||||
shared_tasks.h
|
|
||||||
shareddb.h
|
shareddb.h
|
||||||
skills.h
|
skills.h
|
||||||
spdat.h
|
spdat.h
|
||||||
string_util.h
|
string_util.h
|
||||||
struct_strategy.h
|
struct_strategy.h
|
||||||
tasks.h
|
|
||||||
textures.h
|
textures.h
|
||||||
timer.h
|
timer.h
|
||||||
types.h
|
types.h
|
||||||
@@ -639,8 +618,7 @@ SET(common_headers
|
|||||||
StackWalker/StackWalker.h
|
StackWalker/StackWalker.h
|
||||||
util/memory_stream.h
|
util/memory_stream.h
|
||||||
util/directory.h
|
util/directory.h
|
||||||
util/uuid.h
|
util/uuid.h)
|
||||||
)
|
|
||||||
|
|
||||||
SOURCE_GROUP(Event FILES
|
SOURCE_GROUP(Event FILES
|
||||||
event/event_loop.h
|
event/event_loop.h
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
Copyright (C) 2001-2021 EQEMu Development Team (http://eqemulator.net)
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
are required to give you total support for your newly 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <limits>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is an additive lagged fibonacci generator as seen in The Art of Computer Programming, Vol. 2
|
|
||||||
* This should roughly match the implementation that EQ's client uses and be compatible with our Random class
|
|
||||||
*
|
|
||||||
* EQ's rand looks like it was from an example implementation that as posted on pscode.com
|
|
||||||
*
|
|
||||||
* You might also want to consider defining BIASED_INT_DIST as well to more closely match EQ
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace EQ {
|
|
||||||
template<typename UIntType, size_t w, size_t j, size_t k>
|
|
||||||
class additive_lagged_fibonacci_engine {
|
|
||||||
static_assert(std::is_unsigned<UIntType>::value, "result_type must be an unsigned integral type");
|
|
||||||
static_assert(0u < j && j < k, "0 < j < k");
|
|
||||||
static_assert(0u < w && w <= std::numeric_limits<UIntType>::digits,
|
|
||||||
"template argument substituting w out of bounds");
|
|
||||||
|
|
||||||
public:
|
|
||||||
using result_type = UIntType;
|
|
||||||
static constexpr size_t word_size = w;
|
|
||||||
static constexpr size_t short_lag = j;
|
|
||||||
static constexpr size_t long_lag = k;
|
|
||||||
static constexpr result_type default_seed = 19780503u; // default for subtract_with_carry_engine
|
|
||||||
|
|
||||||
additive_lagged_fibonacci_engine() : additive_lagged_fibonacci_engine(default_seed) {}
|
|
||||||
|
|
||||||
explicit additive_lagged_fibonacci_engine(result_type sd) { seed(sd); }
|
|
||||||
|
|
||||||
void seed(result_type seed = default_seed)
|
|
||||||
{
|
|
||||||
state1 = long_lag - long_lag;
|
|
||||||
state2 = long_lag - short_lag;
|
|
||||||
state[0] = static_cast<int>(seed) & ((1u << word_size) - 1);
|
|
||||||
state[1] = 1;
|
|
||||||
for (int i = 2; i < long_lag; ++i)
|
|
||||||
state[i] = (state[i - 1] + state[i - 2]) & ((1u << word_size) - 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// TODO: seed via seed_seq
|
|
||||||
|
|
||||||
static constexpr result_type min() { return 0; }
|
|
||||||
static constexpr result_type max() { return ((1u << word_size) - 1) >> 6; }
|
|
||||||
|
|
||||||
void discard(unsigned long long z) {
|
|
||||||
for (; z != 0ULL; --z)
|
|
||||||
(*this)();
|
|
||||||
}
|
|
||||||
|
|
||||||
result_type operator()() {
|
|
||||||
result_type rand = (state[state1] + state[state2]) & ((1u << word_size) - 1);
|
|
||||||
state[state1] = rand;
|
|
||||||
if (++state1 == long_lag)
|
|
||||||
state1 = 0;
|
|
||||||
if (++state2 == long_lag)
|
|
||||||
state2 = 0;
|
|
||||||
|
|
||||||
return rand >> 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
result_type state1;
|
|
||||||
result_type state2;
|
|
||||||
result_type state[long_lag];
|
|
||||||
|
|
||||||
public:
|
|
||||||
template<typename UInt, size_t W, size_t J, size_t K>
|
|
||||||
friend bool operator==(const additive_lagged_fibonacci_engine<UInt, W, J, K> &x,
|
|
||||||
const additive_lagged_fibonacci_engine<UInt, W, J, K> &y)
|
|
||||||
{
|
|
||||||
return std::equal(x.state, x.state + long_lag, y.state) && x.state1 == y.state1 &&
|
|
||||||
x.state2 == y.state2;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename UInt, size_t W, size_t J, size_t K>
|
|
||||||
friend bool operator!=(const additive_lagged_fibonacci_engine<UInt, W, J, K> &x,
|
|
||||||
const additive_lagged_fibonacci_engine<UInt, W, J, K> &y)
|
|
||||||
{ return !(x == y); }
|
|
||||||
|
|
||||||
template<typename UInt, size_t W, size_t J, size_t K, typename CharT, typename Traits>
|
|
||||||
friend std::basic_ostream<CharT, Traits> &
|
|
||||||
operator<<(std::basic_istream<CharT, Traits> &os, additive_lagged_fibonacci_engine<UInt, W, J, K> &x)
|
|
||||||
{
|
|
||||||
using ios_base = typename std::basic_istream<CharT, Traits>::ios_base;
|
|
||||||
|
|
||||||
const typename ios_base::fmtflags flags = os.flags();
|
|
||||||
const CharT fill = os.fill();
|
|
||||||
const CharT space = os.widen(' ');
|
|
||||||
os.flags(ios_base::dec | ios_base::fixed | ios_base::left);
|
|
||||||
os.fill(space);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < long_lag; ++i)
|
|
||||||
os << x.state[i] << space;
|
|
||||||
os << x.state1 << space << x.state2;
|
|
||||||
|
|
||||||
os.flags(flags);
|
|
||||||
os.fill(fill);
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename UInt, size_t W, size_t J, size_t K, typename CharT, typename Traits>
|
|
||||||
friend std::basic_istream<CharT, Traits> &
|
|
||||||
operator>>(std::basic_istream<CharT, Traits> &is, additive_lagged_fibonacci_engine<UInt, W, J, K> &x)
|
|
||||||
{
|
|
||||||
using ios_base = typename std::basic_istream<CharT, Traits>::ios_base;
|
|
||||||
|
|
||||||
const typename ios_base::fmtflags flags = is.flags();
|
|
||||||
is.flags(ios_base::dec | ios_base::skipws);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < long_lag; ++i)
|
|
||||||
is >> x.state[i];
|
|
||||||
is >> x.state1;
|
|
||||||
is >> x.state2;
|
|
||||||
|
|
||||||
is.flags(flags);
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
using EQRand = additive_lagged_fibonacci_engine<uint32_t, 30, 24, 55>;
|
|
||||||
};
|
|
||||||
|
|
||||||
+8
-10
@@ -27,17 +27,16 @@ typedef enum {
|
|||||||
BT_Extraplanar = 6,
|
BT_Extraplanar = 6,
|
||||||
BT_Magical = 7, //this name might be a bit off,
|
BT_Magical = 7, //this name might be a bit off,
|
||||||
BT_SummonedUndead = 8,
|
BT_SummonedUndead = 8,
|
||||||
BT_RaidGiant = 9, //Velious era Raid Giant
|
BT_RaidGiant = 9,
|
||||||
BT_RaidColdain = 10, //Velious era Raid Coldain
|
// ...
|
||||||
BT_NoTarget = 11, //no name, can't target this bodytype
|
BT_NoTarget = 11, //no name, can't target this bodytype
|
||||||
BT_Vampire = 12,
|
BT_Vampire = 12,
|
||||||
BT_Atenha_Ra = 13,
|
BT_Atenha_Ra = 13,
|
||||||
BT_Greater_Akheva = 14,
|
BT_Greater_Akheva = 14,
|
||||||
BT_Khati_Sha = 15,
|
BT_Khati_Sha = 15,
|
||||||
BT_Seru = 16,
|
BT_Seru = 16, //not confirmed....
|
||||||
BT_Grieg_Veneficus = 17,
|
|
||||||
BT_Draz_Nurakk = 18,
|
BT_Draz_Nurakk = 18,
|
||||||
BT_Zek = 19, //"creatures from the Plane of War."
|
BT_Zek = 19,
|
||||||
BT_Luggald = 20,
|
BT_Luggald = 20,
|
||||||
BT_Animal = 21,
|
BT_Animal = 21,
|
||||||
BT_Insect = 22,
|
BT_Insect = 22,
|
||||||
@@ -47,18 +46,17 @@ typedef enum {
|
|||||||
BT_Dragon = 26,
|
BT_Dragon = 26,
|
||||||
BT_Summoned2 = 27,
|
BT_Summoned2 = 27,
|
||||||
BT_Summoned3 = 28,
|
BT_Summoned3 = 28,
|
||||||
BT_Dragon2 = 29, //database data indicates this is a dragon type (kunark and DoN?)
|
//29
|
||||||
BT_VeliousDragon = 30, //might not be a tight set
|
BT_VeliousDragon = 30, //might not be a tight set
|
||||||
BT_Familiar = 31,
|
// ...
|
||||||
BT_Dragon3 = 32,
|
BT_Dragon3 = 32,
|
||||||
BT_Boxes = 33,
|
BT_Boxes = 33,
|
||||||
BT_Muramite = 34, //tribal dudes
|
BT_Muramite = 34, //tribal dudes
|
||||||
// ...
|
// ...
|
||||||
BT_NoTarget2 = 60,
|
BT_NoTarget2 = 60,
|
||||||
// ...
|
// ...
|
||||||
BT_SwarmPet = 63, //Looks like weapon proc related temp pets and few misc pets, should not be used for checking swarm pets in general.
|
BT_SwarmPet = 63, //is this valid, or made up?
|
||||||
BT_MonsterSummon = 64,
|
// ...
|
||||||
// 65, trap or effect related?
|
|
||||||
BT_InvisMan = 66, //no name, seen on 'InvisMan', can be /targeted
|
BT_InvisMan = 66, //no name, seen on 'InvisMan', can be /targeted
|
||||||
BT_Special = 67
|
BT_Special = 67
|
||||||
} bodyType;
|
} bodyType;
|
||||||
|
|||||||
@@ -35,12 +35,8 @@ int WorldContentService::GetCurrentExpansion() const
|
|||||||
return current_expansion;
|
return current_expansion;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldContentService *WorldContentService::SetExpansionContext()
|
void WorldContentService::SetExpansionContext()
|
||||||
{
|
{
|
||||||
// do a rule manager reload until where we store expansion is changed to somewhere else
|
|
||||||
RuleManager::Instance()->LoadRules(GetDatabase(), "default", true);
|
|
||||||
|
|
||||||
// pull expansion from rules
|
|
||||||
int expansion = RuleI(Expansion, CurrentExpansion);
|
int expansion = RuleI(Expansion, CurrentExpansion);
|
||||||
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
|
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
|
||||||
content_service.SetCurrentExpansion(expansion);
|
content_service.SetCurrentExpansion(expansion);
|
||||||
@@ -51,8 +47,6 @@ WorldContentService *WorldContentService::SetExpansionContext()
|
|||||||
GetCurrentExpansion(),
|
GetCurrentExpansion(),
|
||||||
GetCurrentExpansionName()
|
GetCurrentExpansionName()
|
||||||
);
|
);
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WorldContentService::GetCurrentExpansionName()
|
std::string WorldContentService::GetCurrentExpansionName()
|
||||||
@@ -79,47 +73,15 @@ void WorldContentService::SetCurrentExpansion(int current_expansion)
|
|||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
const std::vector<ContentFlagsRepository::ContentFlags> &WorldContentService::GetContentFlags() const
|
const std::vector<std::string> &WorldContentService::GetContentFlags() const
|
||||||
{
|
{
|
||||||
return content_flags;
|
return content_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
std::vector<std::string> WorldContentService::GetContentFlagsEnabled()
|
|
||||||
{
|
|
||||||
std::vector<std::string> enabled_flags;
|
|
||||||
|
|
||||||
for (auto &f: GetContentFlags()) {
|
|
||||||
if (f.enabled) {
|
|
||||||
enabled_flags.emplace_back(f.flag_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return enabled_flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
std::vector<std::string> WorldContentService::GetContentFlagsDisabled()
|
|
||||||
{
|
|
||||||
std::vector<std::string> disabled_flags;
|
|
||||||
|
|
||||||
for (auto &f: GetContentFlags()) {
|
|
||||||
if (!f.enabled) {
|
|
||||||
disabled_flags.emplace_back(f.flag_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return disabled_flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param content_flags
|
* @param content_flags
|
||||||
*/
|
*/
|
||||||
void WorldContentService::SetContentFlags(std::vector<ContentFlagsRepository::ContentFlags> content_flags)
|
void WorldContentService::SetContentFlags(std::vector<std::string> content_flags)
|
||||||
{
|
{
|
||||||
WorldContentService::content_flags = content_flags;
|
WorldContentService::content_flags = content_flags;
|
||||||
}
|
}
|
||||||
@@ -128,10 +90,10 @@ void WorldContentService::SetContentFlags(std::vector<ContentFlagsRepository::Co
|
|||||||
* @param content_flag
|
* @param content_flag
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag)
|
bool WorldContentService::IsContentFlagEnabled(const std::string& content_flag)
|
||||||
{
|
{
|
||||||
for (auto &f: GetContentFlags()) {
|
for (auto &flag : GetContentFlags()) {
|
||||||
if (f.flag_name == content_flag && f.enabled == true) {
|
if (flag == content_flag) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,58 +101,20 @@ bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldContentService::ReloadContentFlags()
|
void WorldContentService::ReloadContentFlags(Database &db)
|
||||||
{
|
{
|
||||||
std::vector<ContentFlagsRepository::ContentFlags> set_content_flags;
|
std::vector<std::string> set_content_flags;
|
||||||
auto flags = ContentFlagsRepository::All(*GetDatabase());
|
auto content_flags = ContentFlagsRepository::GetWhere(db, "enabled = 1");
|
||||||
|
|
||||||
set_content_flags.reserve(flags.size());
|
set_content_flags.reserve(content_flags.size());
|
||||||
for (auto &f: flags) {
|
for (auto &flags: content_flags) {
|
||||||
set_content_flags.push_back(f);
|
set_content_flags.push_back(flags.flag_name);
|
||||||
|
}
|
||||||
|
|
||||||
LogInfo(
|
LogInfo(
|
||||||
"Loaded content flag [{}] [{}]",
|
"Enabled content flags [{}]",
|
||||||
f.flag_name,
|
implode(", ", set_content_flags)
|
||||||
(f.enabled ? "Enabled" : "Disabled")
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
SetContentFlags(set_content_flags);
|
SetContentFlags(set_content_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
Database *WorldContentService::GetDatabase() const
|
|
||||||
{
|
|
||||||
return m_database;
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldContentService *WorldContentService::SetDatabase(Database *database)
|
|
||||||
{
|
|
||||||
WorldContentService::m_database = database;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldContentService::SetContentFlag(const std::string &content_flag_name, bool enabled)
|
|
||||||
{
|
|
||||||
auto flags = ContentFlagsRepository::GetWhere(
|
|
||||||
*GetDatabase(),
|
|
||||||
fmt::format("flag_name = '{}'", content_flag_name)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto f = ContentFlagsRepository::NewEntity();
|
|
||||||
if (!flags.empty()) {
|
|
||||||
f = flags.front();
|
|
||||||
}
|
|
||||||
|
|
||||||
f.enabled = enabled ? 1 : 0;
|
|
||||||
f.flag_name = content_flag_name;
|
|
||||||
|
|
||||||
if (!flags.empty()) {
|
|
||||||
ContentFlagsRepository::UpdateOne(*GetDatabase(), f);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ContentFlagsRepository::InsertOne(*GetDatabase(), f);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReloadContentFlags();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../repositories/content_flags_repository.h"
|
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
|
|
||||||
@@ -161,25 +160,15 @@ public:
|
|||||||
bool IsCurrentExpansionTheBurningLands() { return current_expansion == Expansion::ExpansionNumber::TheBurningLands; }
|
bool IsCurrentExpansionTheBurningLands() { return current_expansion == Expansion::ExpansionNumber::TheBurningLands; }
|
||||||
bool IsCurrentExpansionTormentOfVelious() { return current_expansion == Expansion::ExpansionNumber::TormentOfVelious; }
|
bool IsCurrentExpansionTormentOfVelious() { return current_expansion == Expansion::ExpansionNumber::TormentOfVelious; }
|
||||||
|
|
||||||
const std::vector<ContentFlagsRepository::ContentFlags> &GetContentFlags() const;
|
|
||||||
std::vector<std::string> GetContentFlagsEnabled();
|
|
||||||
std::vector<std::string> GetContentFlagsDisabled();
|
|
||||||
bool IsContentFlagEnabled(const std::string& content_flag);
|
|
||||||
void SetContentFlags(std::vector<ContentFlagsRepository::ContentFlags> content_flags);
|
|
||||||
void ReloadContentFlags();
|
|
||||||
WorldContentService * SetExpansionContext();
|
|
||||||
|
|
||||||
WorldContentService * SetDatabase(Database *database);
|
|
||||||
Database *GetDatabase() const;
|
|
||||||
|
|
||||||
void SetContentFlag(const std::string &content_flag_name, bool enabled);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int current_expansion{};
|
int current_expansion{};
|
||||||
std::vector<ContentFlagsRepository::ContentFlags> content_flags;
|
std::vector<std::string> content_flags;
|
||||||
|
public:
|
||||||
// reference to database
|
const std::vector<std::string> &GetContentFlags() const;
|
||||||
Database *m_database;
|
bool IsContentFlagEnabled(const std::string& content_flag);
|
||||||
|
void SetContentFlags(std::vector<std::string> content_flags);
|
||||||
|
void ReloadContentFlags(Database &db);
|
||||||
|
void SetExpansionContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern WorldContentService content_service;
|
extern WorldContentService content_service;
|
||||||
|
|||||||
+123
-142
@@ -39,7 +39,6 @@
|
|||||||
#include "unix.h"
|
#include "unix.h"
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
@@ -47,8 +46,6 @@
|
|||||||
#include "extprofile.h"
|
#include "extprofile.h"
|
||||||
#include "string_util.h"
|
#include "string_util.h"
|
||||||
#include "database_schema.h"
|
#include "database_schema.h"
|
||||||
#include "http/httplib.h"
|
|
||||||
#include "http/uri.h"
|
|
||||||
|
|
||||||
extern Client client;
|
extern Client client;
|
||||||
|
|
||||||
@@ -716,7 +713,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
|||||||
/* HoTT Ability */
|
/* HoTT Ability */
|
||||||
if(RuleB(Character, GrantHoTTOnCreate))
|
if(RuleB(Character, GrantHoTTOnCreate))
|
||||||
{
|
{
|
||||||
query = StringFormat("INSERT INTO `character_leadership_abilities` (id, slot, `rank`) VALUES (%u, %i, %i)", character_id, 14, 1);
|
query = StringFormat("INSERT INTO `character_leadership_abilities` (id, slot, rank) VALUES (%u, %i, %i)", character_id, 14, 1);
|
||||||
results = QueryDatabase(query);
|
results = QueryDatabase(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,26 +906,6 @@ std::string Database::GetNPCNameByID(uint32 npc_id) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Database::GetCleanNPCNameByID(uint32 npc_id) {
|
|
||||||
std::string query = fmt::format("SELECT `name` FROM `npc_types` WHERE id = {}", npc_id);
|
|
||||||
auto results = QueryDatabase(query);
|
|
||||||
std::string res;
|
|
||||||
std::string mob_name;
|
|
||||||
|
|
||||||
if (!results.Success()) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (results.RowCount() == 0) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
mob_name = row[0];
|
|
||||||
CleanMobName(mob_name.begin(), mob_name.end(), std::back_inserter(res));
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Database::LoadVariables() {
|
bool Database::LoadVariables() {
|
||||||
auto results = QueryDatabase(StringFormat("SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache.last_update));
|
auto results = QueryDatabase(StringFormat("SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache.last_update));
|
||||||
|
|
||||||
@@ -2044,62 +2021,70 @@ void Database::ClearRaidLeader(uint32 gid, uint32 rid)
|
|||||||
|
|
||||||
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove)
|
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string field;
|
std::string field;
|
||||||
switch(theme) {
|
|
||||||
case LDoNThemes::GUK: {
|
switch(theme)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
field = "guk_";
|
field = "guk_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LDoNThemes::MIR: {
|
case 2:
|
||||||
|
{
|
||||||
field = "mir_";
|
field = "mir_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LDoNThemes::MMC: {
|
case 3:
|
||||||
|
{
|
||||||
field = "mmc_";
|
field = "mmc_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LDoNThemes::RUJ: {
|
case 4:
|
||||||
|
{
|
||||||
field = "ruj_";
|
field = "ruj_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LDoNThemes::TAK: {
|
case 5:
|
||||||
|
{
|
||||||
field = "tak_";
|
field = "tak_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
field += win ? "wins" : "losses";
|
if (win) {
|
||||||
std::string field_operation = remove ? "-" : "+";
|
field += "wins";
|
||||||
|
} else {
|
||||||
|
field += "losses";
|
||||||
|
}
|
||||||
|
|
||||||
std::string query = fmt::format(
|
std::string modification;
|
||||||
"UPDATE `adventure_stats` SET {} = {} {} 1 WHERE player_id = {}",
|
|
||||||
field,
|
if (remove){
|
||||||
field,
|
modification = "-1";
|
||||||
field_operation,
|
} else {
|
||||||
char_id
|
modification = "+1";
|
||||||
);
|
}
|
||||||
|
|
||||||
|
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s%s WHERE player_id=%u",field.c_str(), field.c_str(), modification.c_str(), char_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
if (results.RowsAffected() != 0) {
|
if (results.RowsAffected() != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!remove) {
|
query = StringFormat("INSERT INTO `adventure_stats` SET %s=1, player_id=%u", field.c_str(), char_id);
|
||||||
query = fmt::format(
|
|
||||||
"INSERT INTO `adventure_stats` SET {} = 1, player_id = {}",
|
|
||||||
field,
|
|
||||||
char_id
|
|
||||||
);
|
|
||||||
QueryDatabase(query);
|
QueryDatabase(query);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as)
|
bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as)
|
||||||
{
|
{
|
||||||
std::string query = fmt::format(
|
std::string query = StringFormat(
|
||||||
"SELECT "
|
"SELECT "
|
||||||
"`guk_wins`, "
|
"`guk_wins`, "
|
||||||
"`mir_wins`, "
|
"`mir_wins`, "
|
||||||
@@ -2114,7 +2099,7 @@ bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as)
|
|||||||
"FROM "
|
"FROM "
|
||||||
"`adventure_stats` "
|
"`adventure_stats` "
|
||||||
"WHERE "
|
"WHERE "
|
||||||
"player_id = {}",
|
"player_id = %u ",
|
||||||
char_id
|
char_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
@@ -2196,6 +2181,95 @@ uint32 Database::GetRaidIDByCharID(uint32 character_id) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param log_settings
|
||||||
|
*/
|
||||||
|
void Database::LoadLogSettings(EQEmuLogSys::LogSettings *log_settings)
|
||||||
|
{
|
||||||
|
std::string query =
|
||||||
|
"SELECT "
|
||||||
|
"log_category_id, "
|
||||||
|
"log_category_description, "
|
||||||
|
"log_to_console, "
|
||||||
|
"log_to_file, "
|
||||||
|
"log_to_gmsay "
|
||||||
|
"FROM "
|
||||||
|
"logsys_categories "
|
||||||
|
"ORDER BY log_category_id";
|
||||||
|
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
int log_category_id = 0;
|
||||||
|
|
||||||
|
int *categories_in_database = new int[1000];
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
log_category_id = atoi(row[0]);
|
||||||
|
if (log_category_id <= Logs::None || log_category_id >= Logs::MaxCategoryID) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_settings[log_category_id].log_to_console = static_cast<uint8>(atoi(row[2]));
|
||||||
|
log_settings[log_category_id].log_to_file = static_cast<uint8>(atoi(row[3]));
|
||||||
|
log_settings[log_category_id].log_to_gmsay = static_cast<uint8>(atoi(row[4]));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if any output method is enabled for the category
|
||||||
|
* and set it to 1 so it can used to check if category is enabled
|
||||||
|
*/
|
||||||
|
const bool log_to_console = log_settings[log_category_id].log_to_console > 0;
|
||||||
|
const bool log_to_file = log_settings[log_category_id].log_to_file > 0;
|
||||||
|
const bool log_to_gmsay = log_settings[log_category_id].log_to_gmsay > 0;
|
||||||
|
const bool is_category_enabled = log_to_console || log_to_file || log_to_gmsay;
|
||||||
|
|
||||||
|
if (is_category_enabled) {
|
||||||
|
log_settings[log_category_id].is_category_enabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This determines whether or not the process needs to actually file log anything.
|
||||||
|
* If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open
|
||||||
|
*/
|
||||||
|
if (log_settings[log_category_id].log_to_file > 0) {
|
||||||
|
LogSys.file_logs_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
categories_in_database[log_category_id] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto inject categories that don't exist in the database...
|
||||||
|
*/
|
||||||
|
for (int log_index = Logs::AA; log_index != Logs::MaxCategoryID; log_index++) {
|
||||||
|
if (categories_in_database[log_index] != 1) {
|
||||||
|
|
||||||
|
LogInfo(
|
||||||
|
"New Log Category [{0}] doesn't exist... Automatically adding to [logsys_categories] table...",
|
||||||
|
Logs::LogCategoryName[log_index]
|
||||||
|
);
|
||||||
|
|
||||||
|
auto inject_query = fmt::format(
|
||||||
|
"INSERT INTO logsys_categories "
|
||||||
|
"(log_category_id, "
|
||||||
|
"log_category_description, "
|
||||||
|
"log_to_console, "
|
||||||
|
"log_to_file, "
|
||||||
|
"log_to_gmsay) "
|
||||||
|
"VALUES "
|
||||||
|
"({0}, '{1}', {2}, {3}, {4})",
|
||||||
|
log_index,
|
||||||
|
EscapeString(Logs::LogCategoryName[log_index]),
|
||||||
|
std::to_string(log_settings[log_index].log_to_console),
|
||||||
|
std::to_string(log_settings[log_index].log_to_file),
|
||||||
|
std::to_string(log_settings[log_index].log_to_gmsay)
|
||||||
|
);
|
||||||
|
|
||||||
|
QueryDatabase(inject_query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] categories_in_database;
|
||||||
|
}
|
||||||
|
|
||||||
int Database::CountInvSnapshots() {
|
int Database::CountInvSnapshots() {
|
||||||
std::string query = StringFormat("SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a GROUP BY `charid`, `time_index`) b");
|
std::string query = StringFormat("SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a GROUP BY `charid`, `time_index`) b");
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
@@ -2273,35 +2347,6 @@ int Database::GetIPExemption(std::string account_ip) {
|
|||||||
return RuleI(World, MaxClientsPerIP);
|
return RuleI(World, MaxClientsPerIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetIPExemption(std::string account_ip, int exemption_amount) {
|
|
||||||
std::string query = fmt::format(
|
|
||||||
"SELECT `exemption_id` FROM `ip_exemptions` WHERE `exemption_ip` = '{}'",
|
|
||||||
account_ip
|
|
||||||
);
|
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
|
||||||
uint32 exemption_id = 0;
|
|
||||||
if (results.Success() && results.RowCount() > 0) {
|
|
||||||
auto row = results.begin();
|
|
||||||
exemption_id = atoi(row[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
query = fmt::format(
|
|
||||||
"INSERT INTO `ip_exemptions` (`exemption_ip`, `exemption_amount`) VALUES ('{}', {})",
|
|
||||||
account_ip,
|
|
||||||
exemption_amount
|
|
||||||
);
|
|
||||||
|
|
||||||
if (exemption_id != 0) {
|
|
||||||
query = fmt::format(
|
|
||||||
"UPDATE `ip_exemptions` SET `exemption_amount` = {} WHERE `exemption_ip` = '{}'",
|
|
||||||
exemption_amount,
|
|
||||||
account_ip
|
|
||||||
);
|
|
||||||
}
|
|
||||||
QueryDatabase(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
|
int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
|
||||||
std::string query = StringFormat("SELECT instance_list.id FROM instance_list INNER JOIN instance_list_player ON instance_list.id = instance_list_player.id WHERE instance_list.zone = '%i' AND instance_list_player.charid = '%i'", zone_id, char_id);
|
std::string query = StringFormat("SELECT instance_list.id FROM instance_list INNER JOIN instance_list_player ON instance_list.id = instance_list_player.id WHERE instance_list.zone = '%i' AND instance_list_player.charid = '%i'", zone_id, char_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
@@ -2452,67 +2497,3 @@ bool Database::CopyCharacter(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SourceDatabaseTableFromUrl(std::string table_name, std::string url)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
uri request_uri(url);
|
|
||||||
|
|
||||||
LogHTTP(
|
|
||||||
"[SourceDatabaseTableFromUrl] parsing url [{}] path [{}] host [{}] query_string [{}] protocol [{}] port [{}]",
|
|
||||||
url,
|
|
||||||
request_uri.get_path(),
|
|
||||||
request_uri.get_host(),
|
|
||||||
request_uri.get_query(),
|
|
||||||
request_uri.get_scheme(),
|
|
||||||
request_uri.get_port()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!DoesTableExist(table_name)) {
|
|
||||||
LogMySQLQuery("Table [{}] does not exist. Downloading from Github and installing...", table_name);
|
|
||||||
|
|
||||||
// http get request
|
|
||||||
httplib::Client cli(
|
|
||||||
fmt::format(
|
|
||||||
"{}://{}",
|
|
||||||
request_uri.get_scheme(),
|
|
||||||
request_uri.get_host()
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
cli.set_connection_timeout(0, 60000000); // 60 sec
|
|
||||||
cli.set_read_timeout(60, 0); // 60 seconds
|
|
||||||
cli.set_write_timeout(60, 0); // 60 seconds
|
|
||||||
|
|
||||||
int sourced_queries = 0;
|
|
||||||
|
|
||||||
if (auto res = cli.Get(request_uri.get_path().c_str())) {
|
|
||||||
if (res->status == 200) {
|
|
||||||
for (auto &s: SplitString(res->body, ';')) {
|
|
||||||
if (!trim(s).empty()) {
|
|
||||||
auto results = QueryDatabase(s);
|
|
||||||
if (!results.ErrorMessage().empty()) {
|
|
||||||
LogError("Error sourcing SQL [{}]", results.ErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sourced_queries++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LogError("Error retrieving URL [{}]", url);
|
|
||||||
}
|
|
||||||
|
|
||||||
LogMySQLQuery(
|
|
||||||
"Table [{}] installed. Sourced [{}] queries",
|
|
||||||
table_name,
|
|
||||||
sourced_queries
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (std::invalid_argument iae) {
|
|
||||||
LogError("[SourceDatabaseTableFromUrl] URI parser error [{}]", iae.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
+3
-6
@@ -78,7 +78,6 @@ class PTimerList;
|
|||||||
|
|
||||||
#define SQL(...) #__VA_ARGS__
|
#define SQL(...) #__VA_ARGS__
|
||||||
|
|
||||||
class LogSettings;
|
|
||||||
class Database : public DBcore {
|
class Database : public DBcore {
|
||||||
public:
|
public:
|
||||||
Database();
|
Database();
|
||||||
@@ -141,7 +140,6 @@ public:
|
|||||||
void GetCharName(uint32 char_id, char* name);
|
void GetCharName(uint32 char_id, char* name);
|
||||||
std::string GetCharNameByID(uint32 char_id);
|
std::string GetCharNameByID(uint32 char_id);
|
||||||
std::string GetNPCNameByID(uint32 npc_id);
|
std::string GetNPCNameByID(uint32 npc_id);
|
||||||
std::string GetCleanNPCNameByID(uint32 npc_id);
|
|
||||||
void LoginIP(uint32 AccountID, const char* LoginIP);
|
void LoginIP(uint32 AccountID, const char* LoginIP);
|
||||||
|
|
||||||
/* Instancing */
|
/* Instancing */
|
||||||
@@ -176,7 +174,7 @@ public:
|
|||||||
|
|
||||||
/* Adventure related. */
|
/* Adventure related. */
|
||||||
|
|
||||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win = false, bool remove = false);
|
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove = false);
|
||||||
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
||||||
|
|
||||||
/* Account Related */
|
/* Account Related */
|
||||||
@@ -199,7 +197,6 @@ public:
|
|||||||
void SetAgreementFlag(uint32 acctid);
|
void SetAgreementFlag(uint32 acctid);
|
||||||
|
|
||||||
int GetIPExemption(std::string account_ip);
|
int GetIPExemption(std::string account_ip);
|
||||||
void SetIPExemption(std::string account_ip, int exemption_amount);
|
|
||||||
|
|
||||||
int GetInstanceID(uint32 char_id, uint32 zone_id);
|
int GetInstanceID(uint32 char_id, uint32 zone_id);
|
||||||
|
|
||||||
@@ -270,8 +267,8 @@ public:
|
|||||||
int CountInvSnapshots();
|
int CountInvSnapshots();
|
||||||
void ClearInvSnapshots(bool from_now = false);
|
void ClearInvSnapshots(bool from_now = false);
|
||||||
|
|
||||||
void SourceDatabaseTableFromUrl(std::string table_name, std::string url);
|
/* EQEmuLogSys */
|
||||||
|
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -1452,7 +1452,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
|||||||
for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){
|
for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){
|
||||||
if (pp->leader_abilities.ranks[i] > 0 && pp->leader_abilities.ranks[i] < 6){
|
if (pp->leader_abilities.ranks[i] > 0 && pp->leader_abilities.ranks[i] < 6){
|
||||||
if (first_entry != 1){
|
if (first_entry != 1){
|
||||||
rquery = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, `rank`) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
|
rquery = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, rank) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
|
||||||
first_entry = 1;
|
first_entry = 1;
|
||||||
}
|
}
|
||||||
rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
|
rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ namespace DatabaseSchema {
|
|||||||
{"character_expedition_lockouts", "character_id"},
|
{"character_expedition_lockouts", "character_id"},
|
||||||
{"character_exp_modifiers", "character_id"},
|
{"character_exp_modifiers", "character_id"},
|
||||||
{"character_inspect_messages", "id"},
|
{"character_inspect_messages", "id"},
|
||||||
{"character_instance_safereturns", "character_id"},
|
|
||||||
{"character_item_recast", "id"},
|
{"character_item_recast", "id"},
|
||||||
{"character_languages", "id"},
|
{"character_languages", "id"},
|
||||||
{"character_leadership_abilities", "id"},
|
{"character_leadership_abilities", "id"},
|
||||||
@@ -65,7 +64,6 @@ namespace DatabaseSchema {
|
|||||||
{"character_potionbelt", "id"},
|
{"character_potionbelt", "id"},
|
||||||
{"character_skills", "id"},
|
{"character_skills", "id"},
|
||||||
{"character_spells", "id"},
|
{"character_spells", "id"},
|
||||||
{"character_task_timers", "character_id"},
|
|
||||||
{"character_tasks", "charid"},
|
{"character_tasks", "charid"},
|
||||||
{"character_tribute", "id"},
|
{"character_tribute", "id"},
|
||||||
{"completed_tasks", "charid"},
|
{"completed_tasks", "charid"},
|
||||||
@@ -82,6 +80,7 @@ namespace DatabaseSchema {
|
|||||||
{"player_titlesets", "char_id"},
|
{"player_titlesets", "char_id"},
|
||||||
{"quest_globals", "charid"},
|
{"quest_globals", "charid"},
|
||||||
{"timers", "char_id"},
|
{"timers", "char_id"},
|
||||||
|
{"titles", "char_id"},
|
||||||
{"trader", "char_id"},
|
{"trader", "char_id"},
|
||||||
{"zone_flags", "charID"}
|
{"zone_flags", "charID"}
|
||||||
};
|
};
|
||||||
@@ -120,7 +119,6 @@ namespace DatabaseSchema {
|
|||||||
"character_expedition_lockouts",
|
"character_expedition_lockouts",
|
||||||
"character_exp_modifiers",
|
"character_exp_modifiers",
|
||||||
"character_inspect_messages",
|
"character_inspect_messages",
|
||||||
"character_instance_safereturns",
|
|
||||||
"character_item_recast",
|
"character_item_recast",
|
||||||
"character_languages",
|
"character_languages",
|
||||||
"character_leadership_abilities",
|
"character_leadership_abilities",
|
||||||
@@ -132,7 +130,6 @@ namespace DatabaseSchema {
|
|||||||
"character_potionbelt",
|
"character_potionbelt",
|
||||||
"character_skills",
|
"character_skills",
|
||||||
"character_spells",
|
"character_spells",
|
||||||
"character_task_timers",
|
|
||||||
"character_tasks",
|
"character_tasks",
|
||||||
"character_tribute",
|
"character_tribute",
|
||||||
"completed_tasks",
|
"completed_tasks",
|
||||||
@@ -157,6 +154,7 @@ namespace DatabaseSchema {
|
|||||||
"spell_buckets",
|
"spell_buckets",
|
||||||
"spell_globals",
|
"spell_globals",
|
||||||
"timers",
|
"timers",
|
||||||
|
"titles",
|
||||||
"trader",
|
"trader",
|
||||||
"trader_audit",
|
"trader_audit",
|
||||||
"zone_flags"
|
"zone_flags"
|
||||||
@@ -219,7 +217,6 @@ namespace DatabaseSchema {
|
|||||||
"npc_types_tint",
|
"npc_types_tint",
|
||||||
"object",
|
"object",
|
||||||
"pets",
|
"pets",
|
||||||
"pets_beastlord_data",
|
|
||||||
"pets_equipmentset",
|
"pets_equipmentset",
|
||||||
"pets_equipmentset_entries",
|
"pets_equipmentset_entries",
|
||||||
"proximities",
|
"proximities",
|
||||||
@@ -268,7 +265,6 @@ namespace DatabaseSchema {
|
|||||||
"perl_event_export_settings",
|
"perl_event_export_settings",
|
||||||
"profanity_list",
|
"profanity_list",
|
||||||
"rule_sets",
|
"rule_sets",
|
||||||
"titles",
|
|
||||||
"rule_values",
|
"rule_values",
|
||||||
"variables",
|
"variables",
|
||||||
};
|
};
|
||||||
@@ -313,9 +309,6 @@ namespace DatabaseSchema {
|
|||||||
"banned_ips",
|
"banned_ips",
|
||||||
"bug_reports",
|
"bug_reports",
|
||||||
"bugs",
|
"bugs",
|
||||||
"completed_shared_task_activity_state",
|
|
||||||
"completed_shared_task_members",
|
|
||||||
"completed_shared_tasks",
|
|
||||||
"dynamic_zone_members",
|
"dynamic_zone_members",
|
||||||
"dynamic_zones",
|
"dynamic_zones",
|
||||||
"eventlog",
|
"eventlog",
|
||||||
@@ -325,8 +318,8 @@ namespace DatabaseSchema {
|
|||||||
"group_id",
|
"group_id",
|
||||||
"group_leaders",
|
"group_leaders",
|
||||||
"hackers",
|
"hackers",
|
||||||
"instance_list",
|
|
||||||
"ip_exemptions",
|
"ip_exemptions",
|
||||||
|
"instance_list",
|
||||||
"item_tick",
|
"item_tick",
|
||||||
"lfguild",
|
"lfguild",
|
||||||
"merchantlist_temp",
|
"merchantlist_temp",
|
||||||
@@ -338,10 +331,6 @@ namespace DatabaseSchema {
|
|||||||
"respawn_times",
|
"respawn_times",
|
||||||
"saylink",
|
"saylink",
|
||||||
"server_scheduled_events",
|
"server_scheduled_events",
|
||||||
"shared_task_activity_state",
|
|
||||||
"shared_task_dynamic_zones",
|
|
||||||
"shared_task_members",
|
|
||||||
"shared_tasks",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+47
-216
@@ -5,7 +5,6 @@
|
|||||||
#include "repositories/instance_list_player_repository.h"
|
#include "repositories/instance_list_player_repository.h"
|
||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
#include "servertalk.h"
|
#include "servertalk.h"
|
||||||
#include "util/uuid.h"
|
|
||||||
|
|
||||||
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
||||||
{
|
{
|
||||||
@@ -14,12 +13,16 @@ DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& e
|
|||||||
|
|
||||||
uint32_t DynamicZoneBase::Create()
|
uint32_t DynamicZoneBase::Create()
|
||||||
{
|
{
|
||||||
|
if (m_id != 0)
|
||||||
|
{
|
||||||
|
return m_id;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetInstanceID() == 0)
|
if (GetInstanceID() == 0)
|
||||||
{
|
{
|
||||||
CreateInstance();
|
CreateInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_uuid = EQ::Util::UUID::Generate().ToString();
|
|
||||||
m_id = SaveToDatabase();
|
m_id = SaveToDatabase();
|
||||||
|
|
||||||
return m_id;
|
return m_id;
|
||||||
@@ -72,11 +75,6 @@ uint32_t DynamicZoneBase::CreateInstance()
|
|||||||
void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry)
|
void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry)
|
||||||
{
|
{
|
||||||
m_id = dz_entry.id;
|
m_id = dz_entry.id;
|
||||||
m_uuid = std::move(dz_entry.uuid);
|
|
||||||
m_name = std::move(dz_entry.name);
|
|
||||||
m_leader.id = dz_entry.leader_id;
|
|
||||||
m_min_players = dz_entry.min_players;
|
|
||||||
m_max_players = dz_entry.max_players;
|
|
||||||
m_instance_id = dz_entry.instance_id;
|
m_instance_id = dz_entry.instance_id;
|
||||||
m_type = static_cast<DynamicZoneType>(dz_entry.type);
|
m_type = static_cast<DynamicZoneType>(dz_entry.type);
|
||||||
m_compass.zone_id = dz_entry.compass_zone_id;
|
m_compass.zone_id = dz_entry.compass_zone_id;
|
||||||
@@ -106,12 +104,6 @@ void DynamicZoneBase::AddMemberFromRepositoryResult(
|
|||||||
DynamicZoneMembersRepository::MemberWithName&& entry)
|
DynamicZoneMembersRepository::MemberWithName&& entry)
|
||||||
{
|
{
|
||||||
auto status = DynamicZoneMemberStatus::Unknown;
|
auto status = DynamicZoneMemberStatus::Unknown;
|
||||||
|
|
||||||
if (m_leader.id == entry.character_id)
|
|
||||||
{
|
|
||||||
m_leader.name = entry.character_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddInternalMember({ entry.character_id, std::move(entry.character_name), status });
|
AddInternalMember({ entry.character_id, std::move(entry.character_name), status });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,11 +114,6 @@ uint32_t DynamicZoneBase::SaveToDatabase()
|
|||||||
if (m_instance_id != 0)
|
if (m_instance_id != 0)
|
||||||
{
|
{
|
||||||
auto insert_dz = DynamicZonesRepository::NewEntity();
|
auto insert_dz = DynamicZonesRepository::NewEntity();
|
||||||
insert_dz.uuid = m_uuid;
|
|
||||||
insert_dz.name = m_name;
|
|
||||||
insert_dz.leader_id = m_leader.id;
|
|
||||||
insert_dz.min_players = m_min_players;
|
|
||||||
insert_dz.max_players = m_max_players;
|
|
||||||
insert_dz.instance_id = m_instance_id,
|
insert_dz.instance_id = m_instance_id,
|
||||||
insert_dz.type = static_cast<int>(m_type);
|
insert_dz.type = static_cast<int>(m_type);
|
||||||
insert_dz.compass_zone_id = m_compass.zone_id;
|
insert_dz.compass_zone_id = m_compass.zone_id;
|
||||||
@@ -150,80 +137,34 @@ uint32_t DynamicZoneBase::SaveToDatabase()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
|
void DynamicZoneBase::AddCharacter(uint32_t character_id)
|
||||||
{
|
{
|
||||||
if (HasMember(add_member.id))
|
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, character_id);
|
||||||
|
GetDatabase().AddClientToInstance(m_instance_id, character_id);
|
||||||
|
SendInstanceAddRemoveCharacter(character_id, false); // stops client kick timer
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::RemoveCharacter(uint32_t character_id)
|
||||||
|
{
|
||||||
|
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, 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 false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, add_member.id);
|
if (enable_removal_timers)
|
||||||
GetDatabase().AddClientToInstance(m_instance_id, add_member.id);
|
|
||||||
|
|
||||||
ProcessMemberAddRemove(add_member, false);
|
|
||||||
SendServerPacket(CreateServerMemberAddRemovePacket(add_member, false).get());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DynamicZoneBase::RemoveMember(uint32_t character_id)
|
|
||||||
{
|
|
||||||
auto remove_member = GetMemberData(character_id);
|
|
||||||
return RemoveMember(remove_member);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DynamicZoneBase::RemoveMember(const std::string& character_name)
|
|
||||||
{
|
|
||||||
auto remove_member = GetMemberData(character_name);
|
|
||||||
return RemoveMember(remove_member);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DynamicZoneBase::RemoveMember(const DynamicZoneMember& remove_member)
|
|
||||||
{
|
|
||||||
if (remove_member.id == 0)
|
|
||||||
{
|
{
|
||||||
return false;
|
SendInstanceRemoveAllCharacters();
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, remove_member.id);
|
|
||||||
GetDatabase().RemoveClientFromInstance(m_instance_id, remove_member.id);
|
|
||||||
|
|
||||||
ProcessMemberAddRemove(remove_member, true);
|
|
||||||
SendServerPacket(CreateServerMemberAddRemovePacket(remove_member, true).get());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DynamicZoneBase::SwapMember(
|
|
||||||
const DynamicZoneMember& add_member, const std::string& remove_char_name)
|
|
||||||
{
|
|
||||||
auto remove_member = GetMemberData(remove_char_name);
|
|
||||||
if (!add_member.IsValid() || !remove_member.IsValid())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make remove and add atomic to avoid racing with separate world messages
|
|
||||||
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, remove_member.id);
|
|
||||||
GetDatabase().RemoveClientFromInstance(m_instance_id, remove_member.id);
|
|
||||||
|
|
||||||
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, add_member.id);
|
|
||||||
GetDatabase().AddClientToInstance(m_instance_id, add_member.id);
|
|
||||||
|
|
||||||
ProcessMemberAddRemove(remove_member, true);
|
|
||||||
ProcessMemberAddRemove(add_member, false);
|
|
||||||
SendServerPacket(CreateServerMemberSwapPacket(remove_member, add_member).get());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::RemoveAllMembers()
|
|
||||||
{
|
|
||||||
DynamicZoneMembersRepository::RemoveAllMembers(GetDatabase(), m_id);
|
DynamicZoneMembersRepository::RemoveAllMembers(GetDatabase(), m_id);
|
||||||
GetDatabase().RemoveClientsFromInstance(GetInstanceID());
|
GetDatabase().RemoveClientsFromInstance(GetInstanceID());
|
||||||
|
|
||||||
ProcessRemoveAllMembers();
|
|
||||||
SendServerPacket(CreateServerRemoveAllMembersPacket().get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
||||||
@@ -240,6 +181,7 @@ void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
|||||||
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
||||||
member_entry.dynamic_zone_id = m_id;
|
member_entry.dynamic_zone_id = m_id;
|
||||||
member_entry.character_id = member.id;
|
member_entry.character_id = member.id;
|
||||||
|
member_entry.is_current_member = true;
|
||||||
insert_members.emplace_back(member_entry);
|
insert_members.emplace_back(member_entry);
|
||||||
|
|
||||||
InstanceListPlayerRepository::InstanceListPlayer player_entry;
|
InstanceListPlayerRepository::InstanceListPlayer player_entry;
|
||||||
@@ -264,7 +206,7 @@ void DynamicZoneBase::SetCompass(const DynamicZoneLocation& location, bool updat
|
|||||||
DynamicZonesRepository::UpdateCompass(GetDatabase(),
|
DynamicZonesRepository::UpdateCompass(GetDatabase(),
|
||||||
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
|
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
|
||||||
|
|
||||||
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetCompass, location).get());
|
SendGlobalLocationChange(ServerOP_DzSetCompass, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +227,7 @@ void DynamicZoneBase::SetSafeReturn(const DynamicZoneLocation& location, bool up
|
|||||||
DynamicZonesRepository::UpdateSafeReturn(GetDatabase(), m_id, m_safereturn.zone_id,
|
DynamicZonesRepository::UpdateSafeReturn(GetDatabase(), m_id, m_safereturn.zone_id,
|
||||||
m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
|
m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
|
||||||
|
|
||||||
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetSafeReturn, location).get());
|
SendGlobalLocationChange(ServerOP_DzSetSafeReturn, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +249,7 @@ void DynamicZoneBase::SetZoneInLocation(const DynamicZoneLocation& location, boo
|
|||||||
DynamicZonesRepository::UpdateZoneIn(GetDatabase(), m_id, m_zone_id,
|
DynamicZonesRepository::UpdateZoneIn(GetDatabase(), m_id, m_zone_id,
|
||||||
m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading, m_has_zonein);
|
m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading, m_has_zonein);
|
||||||
|
|
||||||
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetZoneIn, location).get());
|
SendGlobalLocationChange(ServerOP_DzSetZoneIn, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,71 +258,35 @@ void DynamicZoneBase::SetZoneInLocation(float x, float y, float z, float heading
|
|||||||
SetZoneInLocation({ 0, x, y, z, heading }, update_db);
|
SetZoneInLocation({ 0, x, y, z, heading }, update_db);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicZoneBase::SetLeader(const DynamicZoneMember& new_leader, bool update_db)
|
|
||||||
{
|
|
||||||
m_leader = new_leader;
|
|
||||||
|
|
||||||
if (update_db)
|
|
||||||
{
|
|
||||||
DynamicZonesRepository::UpdateLeaderID(GetDatabase(), m_id, new_leader.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
||||||
{
|
{
|
||||||
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
||||||
return std::max(0, static_cast<int>(remaining));
|
return std::max(0, static_cast<int>(remaining));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberAddRemovePacket(
|
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerAddRemoveCharacterPacket(
|
||||||
const DynamicZoneMember& member, bool removed)
|
uint32_t character_id, bool removed)
|
||||||
{
|
{
|
||||||
constexpr uint32_t pack_size = sizeof(ServerDzMember_Struct);
|
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzAddRemoveMember, pack_size);
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzAddRemoveCharacter, pack_size);
|
||||||
auto buf = reinterpret_cast<ServerDzMember_Struct*>(pack->pBuffer);
|
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
|
||||||
buf->dz_id = GetID();
|
buf->zone_id = GetZoneID();
|
||||||
buf->dz_zone_id = GetZoneID();
|
buf->instance_id = GetInstanceID();
|
||||||
buf->dz_instance_id = GetInstanceID();
|
buf->remove = removed;
|
||||||
buf->sender_zone_id = GetCurrentZoneID();
|
buf->character_id = character_id;
|
||||||
buf->sender_instance_id = GetCurrentInstanceID();
|
|
||||||
buf->removed = removed;
|
|
||||||
buf->character_id = member.id;
|
|
||||||
buf->character_status = static_cast<uint8_t>(member.status);
|
|
||||||
strn0cpy(buf->character_name, member.name.c_str(), sizeof(buf->character_name));
|
|
||||||
|
|
||||||
return pack;
|
return pack;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberSwapPacket(
|
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerRemoveAllCharactersPacket()
|
||||||
const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member)
|
|
||||||
{
|
{
|
||||||
constexpr uint32_t pack_size = sizeof(ServerDzMemberSwap_Struct);
|
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzSwapMembers, pack_size);
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllCharacters, pack_size);
|
||||||
auto buf = reinterpret_cast<ServerDzMemberSwap_Struct*>(pack->pBuffer);
|
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
|
||||||
buf->dz_id = GetID();
|
buf->zone_id = GetZoneID();
|
||||||
buf->dz_zone_id = GetZoneID();
|
buf->instance_id = GetInstanceID();
|
||||||
buf->dz_instance_id = GetInstanceID();
|
buf->remove = true;
|
||||||
buf->sender_zone_id = GetCurrentZoneID();
|
buf->character_id = 0;
|
||||||
buf->sender_instance_id = GetCurrentInstanceID();
|
|
||||||
buf->add_character_status = static_cast<uint8_t>(add_member.status);
|
|
||||||
buf->add_character_id = add_member.id;
|
|
||||||
buf->remove_character_id = remove_member.id;
|
|
||||||
strn0cpy(buf->add_character_name, add_member.name.c_str(), sizeof(buf->add_character_name));
|
|
||||||
strn0cpy(buf->remove_character_name, remove_member.name.c_str(), sizeof(buf->remove_character_name));
|
|
||||||
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerRemoveAllMembersPacket()
|
|
||||||
{
|
|
||||||
constexpr uint32_t pack_size = sizeof(ServerDzID_Struct);
|
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllMembers, pack_size);
|
|
||||||
auto buf = reinterpret_cast<ServerDzID_Struct*>(pack->pBuffer);
|
|
||||||
buf->dz_id = GetID();
|
|
||||||
buf->dz_zone_id = GetZoneID();
|
|
||||||
buf->dz_instance_id = GetInstanceID();
|
|
||||||
buf->sender_zone_id = GetCurrentZoneID();
|
|
||||||
buf->sender_instance_id = GetCurrentInstanceID();
|
|
||||||
|
|
||||||
return pack;
|
return pack;
|
||||||
}
|
}
|
||||||
@@ -403,25 +309,10 @@ std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzLocationPacket(
|
|||||||
return pack;
|
return pack;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberStatusPacket(
|
|
||||||
uint32_t character_id, DynamicZoneMemberStatus status)
|
|
||||||
{
|
|
||||||
constexpr uint32_t pack_size = sizeof(ServerDzMemberStatus_Struct);
|
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzUpdateMemberStatus, pack_size);
|
|
||||||
auto buf = reinterpret_cast<ServerDzMemberStatus_Struct*>(pack->pBuffer);
|
|
||||||
buf->dz_id = GetID();
|
|
||||||
buf->sender_zone_id = GetCurrentZoneID();
|
|
||||||
buf->sender_instance_id = GetCurrentInstanceID();
|
|
||||||
buf->status = static_cast<uint8_t>(status);
|
|
||||||
buf->character_id = character_id;
|
|
||||||
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t DynamicZoneBase::GetDatabaseMemberCount()
|
uint32_t DynamicZoneBase::GetDatabaseMemberCount()
|
||||||
{
|
{
|
||||||
return DynamicZoneMembersRepository::GetCountWhere(GetDatabase(),
|
return DynamicZoneMembersRepository::GetCountWhere(GetDatabase(),
|
||||||
fmt::format("dynamic_zone_id = {}", m_id));
|
fmt::format("dynamic_zone_id = {} AND is_current_member = TRUE", m_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
|
bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
|
||||||
@@ -432,7 +323,7 @@ bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto entries = DynamicZoneMembersRepository::GetWhere(GetDatabase(), fmt::format(
|
auto entries = DynamicZoneMembersRepository::GetWhere(GetDatabase(), fmt::format(
|
||||||
"dynamic_zone_id = {} AND character_id = {}",
|
"dynamic_zone_id = {} AND character_id = {} AND is_current_member = TRUE",
|
||||||
m_id, character_id
|
m_id, character_id
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -520,33 +411,6 @@ bool DynamicZoneBase::SetInternalMemberStatus(uint32_t character_id, DynamicZone
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicZoneBase::SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status)
|
|
||||||
{
|
|
||||||
auto update_member = GetMemberData(character_id);
|
|
||||||
if (update_member.IsValid())
|
|
||||||
{
|
|
||||||
ProcessMemberStatusChange(character_id, status);
|
|
||||||
SendServerPacket(CreateServerMemberStatusPacket(character_id, status).get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed)
|
|
||||||
{
|
|
||||||
if (!removed)
|
|
||||||
{
|
|
||||||
AddInternalMember(member);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RemoveInternalMember(member.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DynamicZoneBase::ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status)
|
|
||||||
{
|
|
||||||
return SetInternalMemberStatus(character_id, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
|
std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
|
||||||
{
|
{
|
||||||
switch (dz_type)
|
switch (dz_type)
|
||||||
@@ -564,36 +428,3 @@ std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
|
|||||||
}
|
}
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::DynamicPacket DynamicZoneBase::GetSerializedDzPacket()
|
|
||||||
{
|
|
||||||
EQ::Net::DynamicPacket dyn_pack;
|
|
||||||
dyn_pack.PutSerialize(0, *this);
|
|
||||||
|
|
||||||
LogDynamicZonesDetail("Serialized server dz size [{}]", dyn_pack.Length());
|
|
||||||
return dyn_pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzCreatePacket(
|
|
||||||
uint16_t origin_zone_id, uint16_t origin_instance_id)
|
|
||||||
{
|
|
||||||
EQ::Net::DynamicPacket dyn_pack = GetSerializedDzPacket();
|
|
||||||
|
|
||||||
auto pack_size = sizeof(ServerDzCreateSerialized_Struct) + dyn_pack.Length();
|
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
|
|
||||||
auto buf = reinterpret_cast<ServerDzCreateSerialized_Struct*>(pack->pBuffer);
|
|
||||||
buf->origin_zone_id = origin_zone_id;
|
|
||||||
buf->origin_instance_id = origin_instance_id;
|
|
||||||
buf->cereal_size = static_cast<uint32_t>(dyn_pack.Length());
|
|
||||||
memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
|
|
||||||
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size)
|
|
||||||
{
|
|
||||||
LogDynamicZonesDetail("Deserializing server dz size [{}]", cereal_size);
|
|
||||||
EQ::Util::MemoryStreamReader ss(cereal_data, cereal_size);
|
|
||||||
cereal::BinaryInputArchive archive(ss);
|
|
||||||
archive(*this);
|
|
||||||
}
|
|
||||||
|
|||||||
+15
-72
@@ -2,7 +2,6 @@
|
|||||||
#define COMMON_DYNAMIC_ZONE_BASE_H
|
#define COMMON_DYNAMIC_ZONE_BASE_H
|
||||||
|
|
||||||
#include "eq_constants.h"
|
#include "eq_constants.h"
|
||||||
#include "net/packet.h"
|
|
||||||
#include "repositories/dynamic_zones_repository.h"
|
#include "repositories/dynamic_zones_repository.h"
|
||||||
#include "repositories/dynamic_zone_members_repository.h"
|
#include "repositories/dynamic_zone_members_repository.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -19,7 +18,7 @@ struct DynamicZoneMember
|
|||||||
{
|
{
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
std::string name;
|
std::string name;
|
||||||
DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Unknown;
|
DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Online;
|
||||||
|
|
||||||
DynamicZoneMember() = default;
|
DynamicZoneMember() = default;
|
||||||
DynamicZoneMember(uint32_t id, std::string name_)
|
DynamicZoneMember(uint32_t id, std::string name_)
|
||||||
@@ -30,12 +29,6 @@ struct DynamicZoneMember
|
|||||||
bool IsOnline() const { return status == DynamicZoneMemberStatus::Online ||
|
bool IsOnline() const { return status == DynamicZoneMemberStatus::Online ||
|
||||||
status == DynamicZoneMemberStatus::InDynamicZone; }
|
status == DynamicZoneMemberStatus::InDynamicZone; }
|
||||||
bool IsValid() const { return id != 0 && !name.empty(); }
|
bool IsValid() const { return id != 0 && !name.empty(); }
|
||||||
|
|
||||||
template<class Archive>
|
|
||||||
void serialize(Archive& archive)
|
|
||||||
{
|
|
||||||
archive(id, name, status);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DynamicZoneLocation
|
struct DynamicZoneLocation
|
||||||
@@ -49,12 +42,6 @@ struct DynamicZoneLocation
|
|||||||
DynamicZoneLocation() = default;
|
DynamicZoneLocation() = default;
|
||||||
DynamicZoneLocation(uint32_t zone_id_, float x_, float y_, float z_, float heading_)
|
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_) {}
|
: zone_id(zone_id_), x(x_), y(y_), z(z_), heading(heading_) {}
|
||||||
|
|
||||||
template<class Archive>
|
|
||||||
void serialize(Archive& archive)
|
|
||||||
{
|
|
||||||
archive(zone_id, x, y, z, heading);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DynamicZoneBase
|
class DynamicZoneBase
|
||||||
@@ -77,7 +64,6 @@ public:
|
|||||||
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
||||||
uint32_t GetID() const { return m_id; }
|
uint32_t GetID() const { return m_id; }
|
||||||
uint16_t GetInstanceID() const { return static_cast<uint16_t>(m_instance_id); }
|
uint16_t GetInstanceID() const { return static_cast<uint16_t>(m_instance_id); }
|
||||||
uint32_t GetLeaderID() const { return m_leader.id; }
|
|
||||||
uint32_t GetMaxPlayers() const { return m_max_players; }
|
uint32_t GetMaxPlayers() const { return m_max_players; }
|
||||||
uint32_t GetMemberCount() const { return static_cast<uint32_t>(m_members.size()); }
|
uint32_t GetMemberCount() const { return static_cast<uint32_t>(m_members.size()); }
|
||||||
uint32_t GetMinPlayers() const { return m_min_players; }
|
uint32_t GetMinPlayers() const { return m_min_players; }
|
||||||
@@ -88,7 +74,6 @@ public:
|
|||||||
DynamicZoneType GetType() const { return m_type; }
|
DynamicZoneType GetType() const { return m_type; }
|
||||||
const std::string& GetLeaderName() const { return m_leader.name; }
|
const std::string& GetLeaderName() const { return m_leader.name; }
|
||||||
const std::string& GetName() const { return m_name; }
|
const std::string& GetName() const { return m_name; }
|
||||||
const std::string& GetUUID() const { return m_uuid; }
|
|
||||||
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||||
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
||||||
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
||||||
@@ -96,12 +81,14 @@ public:
|
|||||||
const DynamicZoneLocation& GetZoneInLocation() const { return m_zonein; }
|
const DynamicZoneLocation& GetZoneInLocation() const { return m_zonein; }
|
||||||
std::chrono::system_clock::duration GetDurationRemaining() const { return m_expire_time - std::chrono::system_clock::now(); }
|
std::chrono::system_clock::duration GetDurationRemaining() const { return m_expire_time - std::chrono::system_clock::now(); }
|
||||||
|
|
||||||
bool AddMember(const DynamicZoneMember& add_member);
|
void AddCharacter(uint32_t character_id);
|
||||||
|
void AddInternalMember(const DynamicZoneMember& member);
|
||||||
void AddMemberFromRepositoryResult(DynamicZoneMembersRepository::MemberWithName&& entry);
|
void AddMemberFromRepositoryResult(DynamicZoneMembersRepository::MemberWithName&& entry);
|
||||||
|
void ClearInternalMembers() { m_members.clear(); }
|
||||||
|
uint32_t Create();
|
||||||
uint32_t GetDatabaseMemberCount();
|
uint32_t GetDatabaseMemberCount();
|
||||||
DynamicZoneMember GetMemberData(uint32_t character_id);
|
DynamicZoneMember GetMemberData(uint32_t character_id);
|
||||||
DynamicZoneMember GetMemberData(const std::string& character_name);
|
DynamicZoneMember GetMemberData(const std::string& character_name);
|
||||||
EQ::Net::DynamicPacket GetSerializedDzPacket();
|
|
||||||
bool HasDatabaseMember(uint32_t character_id);
|
bool HasDatabaseMember(uint32_t character_id);
|
||||||
bool HasMember(uint32_t character_id);
|
bool HasMember(uint32_t character_id);
|
||||||
bool HasMember(const std::string& character_name);
|
bool HasMember(const std::string& character_name);
|
||||||
@@ -111,52 +98,38 @@ public:
|
|||||||
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
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 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; }
|
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
||||||
void LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size);
|
void RemoveAllCharacters(bool enable_removal_timers = true);
|
||||||
void RemoveAllMembers();
|
void RemoveCharacter(uint32_t character_id);
|
||||||
bool RemoveMember(uint32_t character_id);
|
void RemoveInternalMember(uint32_t character_id);
|
||||||
bool RemoveMember(const std::string& character_name);
|
|
||||||
bool RemoveMember(const DynamicZoneMember& remove_member);
|
|
||||||
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
||||||
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
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 SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
||||||
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
|
void SetLeader(const DynamicZoneMember& leader) { m_leader = leader; }
|
||||||
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
||||||
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
|
||||||
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
||||||
void SetName(const std::string& name) { m_name = name; }
|
void SetName(const std::string& name) { m_name = name; }
|
||||||
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
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 SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
||||||
void SetType(DynamicZoneType type) { m_type = type; }
|
|
||||||
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
|
|
||||||
void SetZoneInLocation(const DynamicZoneLocation& location, 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);
|
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
||||||
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_char_name);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual uint16_t GetCurrentInstanceID() { return 0; }
|
virtual uint16_t GetCurrentInstanceID() { return 0; }
|
||||||
virtual uint16_t GetCurrentZoneID() { return 0; }
|
virtual uint16_t GetCurrentZoneID() { return 0; }
|
||||||
virtual Database& GetDatabase() = 0;
|
virtual Database& GetDatabase() = 0;
|
||||||
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
||||||
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
|
virtual void SendInstanceAddRemoveCharacter(uint32_t character_id, bool remove) = 0;
|
||||||
virtual bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status);
|
virtual void SendInstanceRemoveAllCharacters() = 0;
|
||||||
virtual void ProcessRemoveAllMembers(bool silent = false) { m_members.clear(); }
|
virtual void SendGlobalLocationChange(uint16_t server_opcode, const DynamicZoneLocation& location) = 0;
|
||||||
virtual bool SendServerPacket(ServerPacket* packet) = 0;
|
|
||||||
|
|
||||||
void AddInternalMember(const DynamicZoneMember& member);
|
|
||||||
uint32_t Create();
|
|
||||||
uint32_t CreateInstance();
|
uint32_t CreateInstance();
|
||||||
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
||||||
void RemoveInternalMember(uint32_t character_id);
|
|
||||||
uint32_t SaveToDatabase();
|
uint32_t SaveToDatabase();
|
||||||
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> CreateServerDzCreatePacket(uint16_t origin_zone_id, uint16_t origin_instance_id);
|
std::unique_ptr<ServerPacket> CreateServerAddRemoveCharacterPacket(uint32_t character_id, bool removed);
|
||||||
|
std::unique_ptr<ServerPacket> CreateServerRemoveAllCharactersPacket();
|
||||||
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
|
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
|
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
|
|
||||||
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
|
|
||||||
|
|
||||||
uint32_t m_id = 0;
|
uint32_t m_id = 0;
|
||||||
uint32_t m_zone_id = 0;
|
uint32_t m_zone_id = 0;
|
||||||
@@ -166,9 +139,7 @@ protected:
|
|||||||
uint32_t m_max_players = 0;
|
uint32_t m_max_players = 0;
|
||||||
bool m_never_expires = false;
|
bool m_never_expires = false;
|
||||||
bool m_has_zonein = false;
|
bool m_has_zonein = false;
|
||||||
bool m_has_member_statuses = false;
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
std::string m_uuid;
|
|
||||||
DynamicZoneMember m_leader;
|
DynamicZoneMember m_leader;
|
||||||
DynamicZoneType m_type{ DynamicZoneType::None };
|
DynamicZoneType m_type{ DynamicZoneType::None };
|
||||||
DynamicZoneLocation m_compass;
|
DynamicZoneLocation m_compass;
|
||||||
@@ -178,34 +149,6 @@ protected:
|
|||||||
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||||
std::vector<DynamicZoneMember> m_members;
|
std::vector<DynamicZoneMember> m_members;
|
||||||
|
|
||||||
public:
|
|
||||||
template<class Archive>
|
|
||||||
void serialize(Archive& archive)
|
|
||||||
{
|
|
||||||
archive(
|
|
||||||
m_id,
|
|
||||||
m_zone_id,
|
|
||||||
m_instance_id,
|
|
||||||
m_zone_version,
|
|
||||||
m_min_players,
|
|
||||||
m_max_players,
|
|
||||||
m_never_expires,
|
|
||||||
m_has_zonein,
|
|
||||||
m_has_member_statuses,
|
|
||||||
m_name,
|
|
||||||
m_uuid,
|
|
||||||
m_leader,
|
|
||||||
m_type,
|
|
||||||
m_compass,
|
|
||||||
m_safereturn,
|
|
||||||
m_zonein,
|
|
||||||
m_duration,
|
|
||||||
m_start_time,
|
|
||||||
m_expire_time,
|
|
||||||
m_members
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-186
@@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "emu_constants.h"
|
#include "emu_constants.h"
|
||||||
#include "languages.h"
|
|
||||||
#include "data_verification.h"
|
|
||||||
#include "bodytypes.h"
|
|
||||||
|
|
||||||
|
|
||||||
int16 EQ::invtype::GetInvTypeSize(int16 inv_type) {
|
int16 EQ::invtype::GetInvTypeSize(int16 inv_type) {
|
||||||
@@ -150,190 +147,8 @@ const char *EQ::constants::GetStanceName(StanceType stance_type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int EQ::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
|
int EQ::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
|
||||||
if (EQ::ValueWithin(stance_type, EQ::constants::stancePassive, EQ::constants::stanceBurnAE)) {
|
if (stance_type >= EQ::constants::stancePassive && stance_type <= EQ::constants::stanceBurnAE)
|
||||||
return (stance_type - EQ::constants::stancePassive);
|
return (stance_type - EQ::constants::stancePassive);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<int, std::string>& EQ::constants::GetLanguageMap()
|
|
||||||
{
|
|
||||||
static const std::map<int, std::string> language_map = {
|
|
||||||
{ LANG_COMMON_TONGUE, "Common Tongue" },
|
|
||||||
{ LANG_BARBARIAN, "Barbarian" },
|
|
||||||
{ LANG_ERUDIAN, "Erudian" },
|
|
||||||
{ LANG_ELVISH, "Elvish" },
|
|
||||||
{ LANG_DARK_ELVISH, "Dark Elvish" },
|
|
||||||
{ LANG_DWARVISH, "Dwarvish" },
|
|
||||||
{ LANG_TROLL, "Troll" },
|
|
||||||
{ LANG_OGRE, "Ogre" },
|
|
||||||
{ LANG_GNOMISH, "Gnomish" },
|
|
||||||
{ LANG_HALFLING, "Halfling" },
|
|
||||||
{ LANG_THIEVES_CANT, "Thieves Cant" },
|
|
||||||
{ LANG_OLD_ERUDIAN, "Old Erudian" },
|
|
||||||
{ LANG_ELDER_ELVISH, "Elder Elvish" },
|
|
||||||
{ LANG_FROGLOK, "Froglok" },
|
|
||||||
{ LANG_GOBLIN, "Goblin" },
|
|
||||||
{ LANG_GNOLL, "Gnoll" },
|
|
||||||
{ LANG_COMBINE_TONGUE, "Combine Tongue" },
|
|
||||||
{ LANG_ELDER_TEIRDAL, "Elder Teirdal" },
|
|
||||||
{ LANG_LIZARDMAN, "Lizardman" },
|
|
||||||
{ LANG_ORCISH, "Orcish" },
|
|
||||||
{ LANG_FAERIE, "Faerie" },
|
|
||||||
{ LANG_DRAGON, "Dragon" },
|
|
||||||
{ LANG_ELDER_DRAGON, "Elder Dragon" },
|
|
||||||
{ LANG_DARK_SPEECH, "Dark Speech" },
|
|
||||||
{ LANG_VAH_SHIR, "Vah Shir" },
|
|
||||||
{ LANG_ALARAN, "Alaran" },
|
|
||||||
{ LANG_HADAL, "Hadal" },
|
|
||||||
{ LANG_UNKNOWN, "Unknown" }
|
|
||||||
};
|
|
||||||
return language_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string EQ::constants::GetLanguageName(int language_id)
|
|
||||||
{
|
|
||||||
if (EQ::ValueWithin(language_id, LANG_COMMON_TONGUE, LANG_UNKNOWN)) {
|
|
||||||
auto languages = EQ::constants::GetLanguageMap();
|
|
||||||
return languages[language_id];
|
|
||||||
}
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::map<uint32, std::string>& EQ::constants::GetLDoNThemeMap()
|
|
||||||
{
|
|
||||||
static const std::map<uint32, std::string> ldon_theme_map = {
|
|
||||||
{ LDoNThemes::Unused, "Unused" },
|
|
||||||
{ LDoNThemes::GUK, "Deepest Guk" },
|
|
||||||
{ LDoNThemes::MIR, "Miragul's Menagerie" },
|
|
||||||
{ LDoNThemes::MMC, "Mistmoore Catacombs" },
|
|
||||||
{ LDoNThemes::RUJ, "Rujarkian Hills" },
|
|
||||||
{ LDoNThemes::TAK, "Takish-Hiz" },
|
|
||||||
};
|
|
||||||
return ldon_theme_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string EQ::constants::GetLDoNThemeName(uint32 theme_id)
|
|
||||||
{
|
|
||||||
if (EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) {
|
|
||||||
auto ldon_themes = EQ::constants::GetLDoNThemeMap();
|
|
||||||
return ldon_themes[theme_id];
|
|
||||||
}
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::map<uint8, std::string>& EQ::constants::GetFlyModeMap()
|
|
||||||
{
|
|
||||||
static const std::map<uint8, std::string> flymode_map = {
|
|
||||||
{ EQ::constants::GravityBehavior::Ground, "Ground" },
|
|
||||||
{ EQ::constants::GravityBehavior::Flying, "Flying" },
|
|
||||||
{ EQ::constants::GravityBehavior::Levitating, "Levitating" },
|
|
||||||
{ EQ::constants::GravityBehavior::Water, "Water" },
|
|
||||||
{ EQ::constants::GravityBehavior::Floating, "Floating" },
|
|
||||||
{ EQ::constants::GravityBehavior::LevitateWhileRunning, "Levitating While Running" },
|
|
||||||
};
|
|
||||||
return flymode_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string EQ::constants::GetFlyModeName(uint8 flymode_id)
|
|
||||||
{
|
|
||||||
if (EQ::ValueWithin(flymode_id, GravityBehavior::Ground, GravityBehavior::LevitateWhileRunning)) {
|
|
||||||
auto flymodes = EQ::constants::GetFlyModeMap();
|
|
||||||
return flymodes[flymode_id];
|
|
||||||
}
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::map<bodyType, std::string>& EQ::constants::GetBodyTypeMap()
|
|
||||||
{
|
|
||||||
static const std::map<bodyType, std::string> bodytype_map = {
|
|
||||||
{ BT_Humanoid, "Humanoid" },
|
|
||||||
{ BT_Lycanthrope, "Lycanthrope" },
|
|
||||||
{ BT_Undead, "Undead" },
|
|
||||||
{ BT_Giant, "Giant" },
|
|
||||||
{ BT_Construct, "Construct" },
|
|
||||||
{ BT_Extraplanar, "Extraplanar" },
|
|
||||||
{ BT_Magical, "Magical" },
|
|
||||||
{ BT_SummonedUndead, "Summoned Undead" },
|
|
||||||
{ BT_RaidGiant, "Raid Giant" },
|
|
||||||
{ BT_RaidColdain, "Raid Coldain" },
|
|
||||||
{ BT_NoTarget, "Untargetable" },
|
|
||||||
{ BT_Vampire, "Vampire" },
|
|
||||||
{ BT_Atenha_Ra, "Aten Ha Ra" },
|
|
||||||
{ BT_Greater_Akheva, "Greater Akheva" },
|
|
||||||
{ BT_Khati_Sha, "Khati Sha" },
|
|
||||||
{ BT_Seru, "Seru" },
|
|
||||||
{ BT_Grieg_Veneficus, "Grieg Veneficus" },
|
|
||||||
{ BT_Draz_Nurakk, "Draz Nurakk" },
|
|
||||||
{ BT_Zek, "Zek" },
|
|
||||||
{ BT_Luggald, "Luggald" },
|
|
||||||
{ BT_Animal, "Animal" },
|
|
||||||
{ BT_Insect, "Insect" },
|
|
||||||
{ BT_Monster, "Monster" },
|
|
||||||
{ BT_Summoned, "Summoned" },
|
|
||||||
{ BT_Plant, "Plant" },
|
|
||||||
{ BT_Dragon, "Dragon" },
|
|
||||||
{ BT_Summoned2, "Summoned 2" },
|
|
||||||
{ BT_Summoned3, "Summoned 3" },
|
|
||||||
{ BT_Dragon2, "Dragon 2" },
|
|
||||||
{ BT_VeliousDragon, "Velious Dragon" },
|
|
||||||
{ BT_Familiar, "Familiar" },
|
|
||||||
{ BT_Dragon3, "Dragon 3" },
|
|
||||||
{ BT_Boxes, "Boxes" },
|
|
||||||
{ BT_Muramite, "Muramite" },
|
|
||||||
{ BT_NoTarget2, "Untargetable 2" },
|
|
||||||
{ BT_SwarmPet, "Swarm Pet" },
|
|
||||||
{ BT_MonsterSummon, "Monster Summon" },
|
|
||||||
{ BT_InvisMan, "Invisible Man" },
|
|
||||||
{ BT_Special, "Special" },
|
|
||||||
};
|
|
||||||
return bodytype_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string EQ::constants::GetBodyTypeName(bodyType bodytype_id)
|
|
||||||
{
|
|
||||||
auto bodytypes = EQ::constants::GetBodyTypeMap();
|
|
||||||
if (!bodytypes[bodytype_id].empty()) {
|
|
||||||
return bodytypes[bodytype_id];
|
|
||||||
}
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::map<uint8, std::string>& EQ::constants::GetAccountStatusMap()
|
|
||||||
{
|
|
||||||
static const std::map<uint8, std::string> account_status_map = {
|
|
||||||
{ AccountStatus::Player, "Player" },
|
|
||||||
{ AccountStatus::Steward, "Steward" },
|
|
||||||
{ AccountStatus::ApprenticeGuide, "Apprentice Guide" },
|
|
||||||
{ AccountStatus::Guide, "Guide" },
|
|
||||||
{ AccountStatus::QuestTroupe, "Quest Troupe" },
|
|
||||||
{ AccountStatus::SeniorGuide, "Senior Guide" },
|
|
||||||
{ AccountStatus::GMTester, "GM Tester" },
|
|
||||||
{ AccountStatus::EQSupport, "EQ Support" },
|
|
||||||
{ AccountStatus::GMStaff, "GM Staff" },
|
|
||||||
{ AccountStatus::GMAdmin, "GM Admin" },
|
|
||||||
{ AccountStatus::GMLeadAdmin, "GM Lead Admin" },
|
|
||||||
{ AccountStatus::QuestMaster, "Quest Master" },
|
|
||||||
{ AccountStatus::GMAreas, "GM Areas" },
|
|
||||||
{ AccountStatus::GMCoder, "GM Coder" },
|
|
||||||
{ AccountStatus::GMMgmt, "GM Mgmt" },
|
|
||||||
{ AccountStatus::GMImpossible, "GM Impossible" },
|
|
||||||
{ AccountStatus::Max, "GM Max" }
|
|
||||||
};
|
|
||||||
return account_status_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string EQ::constants::GetAccountStatusName(uint8 account_status)
|
|
||||||
{
|
|
||||||
auto account_statuses = EQ::constants::GetAccountStatusMap();
|
|
||||||
std::string status_name;
|
|
||||||
for (auto status_level = account_statuses.rbegin(); status_level != account_statuses.rend(); ++status_level) {
|
|
||||||
if (account_status >= status_level->first) {
|
|
||||||
status_name = status_level->second;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return status_name;
|
|
||||||
}
|
|
||||||
|
|||||||
+7
-64
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include "eq_limits.h"
|
#include "eq_limits.h"
|
||||||
#include "emu_versions.h"
|
#include "emu_versions.h"
|
||||||
#include "bodytypes.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -221,33 +220,9 @@ namespace EQ
|
|||||||
stanceBurnAE
|
stanceBurnAE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GravityBehavior : uint8 {
|
|
||||||
Ground,
|
|
||||||
Flying,
|
|
||||||
Levitating,
|
|
||||||
Water,
|
|
||||||
Floating,
|
|
||||||
LevitateWhileRunning
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *GetStanceName(StanceType stance_type);
|
const char *GetStanceName(StanceType stance_type);
|
||||||
int ConvertStanceTypeToIndex(StanceType stance_type);
|
int ConvertStanceTypeToIndex(StanceType stance_type);
|
||||||
|
|
||||||
extern const std::map<int, std::string>& GetLanguageMap();
|
|
||||||
std::string GetLanguageName(int language_id);
|
|
||||||
|
|
||||||
extern const std::map<uint32, std::string>& GetLDoNThemeMap();
|
|
||||||
std::string GetLDoNThemeName(uint32 theme_id);
|
|
||||||
|
|
||||||
extern const std::map<uint8, std::string>& GetFlyModeMap();
|
|
||||||
std::string GetFlyModeName(uint8 flymode_id);
|
|
||||||
|
|
||||||
extern const std::map<bodyType, std::string>& GetBodyTypeMap();
|
|
||||||
std::string GetBodyTypeName(bodyType bodytype_id);
|
|
||||||
|
|
||||||
extern const std::map<uint8, std::string>& GetAccountStatusMap();
|
|
||||||
std::string GetAccountStatusName(uint8 account_status);
|
|
||||||
|
|
||||||
const int STANCE_TYPE_FIRST = stancePassive;
|
const int STANCE_TYPE_FIRST = stancePassive;
|
||||||
const int STANCE_TYPE_LAST = stanceBurnAE;
|
const int STANCE_TYPE_LAST = stanceBurnAE;
|
||||||
const int STANCE_TYPE_COUNT = stanceBurnAE;
|
const int STANCE_TYPE_COUNT = stanceBurnAE;
|
||||||
@@ -350,45 +325,13 @@ namespace EQ
|
|||||||
Guild
|
Guild
|
||||||
};
|
};
|
||||||
}; // namespace consent
|
}; // namespace consent
|
||||||
|
|
||||||
} /*EQEmu*/
|
} /*EQEmu*/
|
||||||
|
|
||||||
enum ServerLockType : int {
|
|
||||||
List,
|
|
||||||
Lock,
|
|
||||||
Unlock
|
|
||||||
};
|
|
||||||
|
|
||||||
enum AccountStatus : uint8 {
|
|
||||||
Player = 0,
|
|
||||||
Steward = 10,
|
|
||||||
ApprenticeGuide = 20,
|
|
||||||
Guide = 50,
|
|
||||||
QuestTroupe = 80,
|
|
||||||
SeniorGuide = 81,
|
|
||||||
GMTester = 85,
|
|
||||||
EQSupport = 90,
|
|
||||||
GMStaff = 95,
|
|
||||||
GMAdmin = 100,
|
|
||||||
GMLeadAdmin = 150,
|
|
||||||
QuestMaster = 160,
|
|
||||||
GMAreas = 170,
|
|
||||||
GMCoder = 180,
|
|
||||||
GMMgmt = 200,
|
|
||||||
GMImpossible = 250,
|
|
||||||
Max = 255
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Invisibility : uint8 {
|
|
||||||
Visible,
|
|
||||||
Invisible,
|
|
||||||
Special = 255
|
|
||||||
};
|
|
||||||
|
|
||||||
enum AugmentActions : int {
|
|
||||||
Insert,
|
|
||||||
Remove,
|
|
||||||
Swap,
|
|
||||||
Destroy
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*COMMON_EMU_CONSTANTS_H*/
|
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||||
|
|
||||||
|
/* hack list to prevent circular references
|
||||||
|
|
||||||
|
eq_limits.h:EQ::inventory::LookupEntry::InventoryTypeSize[n];
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
+4
-18
@@ -129,8 +129,8 @@ N(OP_DisciplineTimer),
|
|||||||
N(OP_DisciplineUpdate),
|
N(OP_DisciplineUpdate),
|
||||||
N(OP_DiscordMerchantInventory),
|
N(OP_DiscordMerchantInventory),
|
||||||
N(OP_DoGroupLeadershipAbility),
|
N(OP_DoGroupLeadershipAbility),
|
||||||
N(OP_DuelDecline),
|
N(OP_DuelResponse),
|
||||||
N(OP_DuelAccept),
|
N(OP_DuelResponse2),
|
||||||
N(OP_DumpName),
|
N(OP_DumpName),
|
||||||
N(OP_Dye),
|
N(OP_Dye),
|
||||||
N(OP_DynamicWall),
|
N(OP_DynamicWall),
|
||||||
@@ -355,6 +355,7 @@ N(OP_OpenContainer),
|
|||||||
N(OP_OpenDiscordMerchant),
|
N(OP_OpenDiscordMerchant),
|
||||||
N(OP_OpenGuildTributeMaster),
|
N(OP_OpenGuildTributeMaster),
|
||||||
N(OP_OpenInventory),
|
N(OP_OpenInventory),
|
||||||
|
N(OP_OpenNewTasksWindow),
|
||||||
N(OP_OpenTributeMaster),
|
N(OP_OpenTributeMaster),
|
||||||
N(OP_PDeletePetition),
|
N(OP_PDeletePetition),
|
||||||
N(OP_PetBuffWindow),
|
N(OP_PetBuffWindow),
|
||||||
@@ -463,19 +464,6 @@ N(OP_SetServerFilter),
|
|||||||
N(OP_SetStartCity),
|
N(OP_SetStartCity),
|
||||||
N(OP_SetTitle),
|
N(OP_SetTitle),
|
||||||
N(OP_SetTitleReply),
|
N(OP_SetTitleReply),
|
||||||
N(OP_SharedTaskMemberList),
|
|
||||||
N(OP_SharedTaskAddPlayer),
|
|
||||||
N(OP_SharedTaskRemovePlayer),
|
|
||||||
N(OP_SharedTaskMakeLeader),
|
|
||||||
N(OP_SharedTaskMemberInvite),
|
|
||||||
N(OP_SharedTaskInvite),
|
|
||||||
N(OP_SharedTaskInviteResponse),
|
|
||||||
N(OP_SharedTaskAcceptNew),
|
|
||||||
N(OP_SharedTaskMemberChange),
|
|
||||||
N(OP_SharedTaskPlayerList),
|
|
||||||
N(OP_SharedTaskSelectWindow),
|
|
||||||
N(OP_SharedTaskQuit),
|
|
||||||
N(OP_TaskTimers),
|
|
||||||
N(OP_Shielding),
|
N(OP_Shielding),
|
||||||
N(OP_ShopDelItem),
|
N(OP_ShopDelItem),
|
||||||
N(OP_ShopEnd),
|
N(OP_ShopEnd),
|
||||||
@@ -511,8 +499,7 @@ N(OP_TaskActivityComplete),
|
|||||||
N(OP_TaskDescription),
|
N(OP_TaskDescription),
|
||||||
N(OP_TaskHistoryReply),
|
N(OP_TaskHistoryReply),
|
||||||
N(OP_TaskHistoryRequest),
|
N(OP_TaskHistoryRequest),
|
||||||
N(OP_TaskRequestTimer),
|
N(OP_TaskMemberList),
|
||||||
N(OP_TaskSelectWindow),
|
|
||||||
N(OP_Taunt),
|
N(OP_Taunt),
|
||||||
N(OP_TestBuff),
|
N(OP_TestBuff),
|
||||||
N(OP_TGB),
|
N(OP_TGB),
|
||||||
@@ -580,5 +567,4 @@ N(OP_ZoneServerReady),
|
|||||||
N(OP_ZoneSpawns),
|
N(OP_ZoneSpawns),
|
||||||
N(OP_ZoneUnavail),
|
N(OP_ZoneUnavail),
|
||||||
N(OP_ResetAA),
|
N(OP_ResetAA),
|
||||||
N(OP_UnderWorld),
|
|
||||||
// mail and chat opcodes located in ../mail_oplist.h
|
// mail and chat opcodes located in ../mail_oplist.h
|
||||||
|
|||||||
+3
-522
@@ -65,7 +65,6 @@
|
|||||||
#define AT_FindBits 46 // set FindBits, whatever those are!
|
#define AT_FindBits 46 // set FindBits, whatever those are!
|
||||||
#define AT_TextureType 48 // TextureType
|
#define AT_TextureType 48 // TextureType
|
||||||
#define AT_FacePick 49 // Turns off face pick window? maybe ...
|
#define AT_FacePick 49 // Turns off face pick window? maybe ...
|
||||||
#define AT_AntiCheat 51 // sent by the client randomly telling the server how long since last action has occured
|
|
||||||
#define AT_GuildShow 52 // this is what MQ2 call sit, not sure
|
#define AT_GuildShow 52 // this is what MQ2 call sit, not sure
|
||||||
#define AT_Offline 53 // Offline mode
|
#define AT_Offline 53 // Offline mode
|
||||||
|
|
||||||
@@ -198,492 +197,6 @@ namespace Chat {
|
|||||||
const uint16 Stun = 340;
|
const uint16 Stun = 340;
|
||||||
};
|
};
|
||||||
|
|
||||||
// generation SQL:
|
|
||||||
// SELECT CONCAT(' constexpr uint16 ', UPPER(short_name), ' = ' , zoneidnumber, '; // ', long_name) from zone group by zoneidnumber ORDER BY zoneidnumber;
|
|
||||||
namespace Zones {
|
|
||||||
constexpr uint16 QEYNOS = 1; // South Qeynos
|
|
||||||
constexpr uint16 QEYNOS2 = 2; // North Qeynos
|
|
||||||
constexpr uint16 QRG = 3; // The Surefall Glade
|
|
||||||
constexpr uint16 QEYTOQRG = 4; // The Qeynos Hills
|
|
||||||
constexpr uint16 HIGHPASS = 5; // Highpass Hold
|
|
||||||
constexpr uint16 HIGHKEEP = 6; // High Keep
|
|
||||||
constexpr uint16 FREPORTN = 8; // North Freeport
|
|
||||||
constexpr uint16 FREPORTW = 9; // West Freeport
|
|
||||||
constexpr uint16 FREPORTE = 10; // East Freeport
|
|
||||||
constexpr uint16 RUNNYEYE = 11; // The Liberated Citadel of Runnyeye
|
|
||||||
constexpr uint16 QEY2HH1 = 12; // The Western Plains of Karana
|
|
||||||
constexpr uint16 NORTHKARANA = 13; // The Northern Plains of Karana
|
|
||||||
constexpr uint16 SOUTHKARANA = 14; // The Southern Plains of Karana
|
|
||||||
constexpr uint16 EASTKARANA = 15; // Eastern Plains of Karana
|
|
||||||
constexpr uint16 BEHOLDER = 16; // Gorge of King Xorbb
|
|
||||||
constexpr uint16 BLACKBURROW = 17; // Blackburrow
|
|
||||||
constexpr uint16 PAW = 18; // The Lair of the Splitpaw
|
|
||||||
constexpr uint16 RIVERVALE = 19; // Rivervale
|
|
||||||
constexpr uint16 KITHICOR = 20; // Kithicor Forest
|
|
||||||
constexpr uint16 COMMONS = 21; // West Commonlands
|
|
||||||
constexpr uint16 ECOMMONS = 22; // East Commonlands
|
|
||||||
constexpr uint16 ERUDNINT = 23; // The Erudin Palace
|
|
||||||
constexpr uint16 ERUDNEXT = 24; // Erudin
|
|
||||||
constexpr uint16 NEKTULOS = 25; // The Nektulos Forest
|
|
||||||
constexpr uint16 CSHOME = 26; // Sunset Home
|
|
||||||
constexpr uint16 LAVASTORM = 27; // The Lavastorm Mountains
|
|
||||||
constexpr uint16 NEKTROPOS = 28; // Nektropos
|
|
||||||
constexpr uint16 HALAS = 29; // Halas
|
|
||||||
constexpr uint16 EVERFROST = 30; // Everfrost Peaks
|
|
||||||
constexpr uint16 SOLDUNGA = 31; // Solusek's Eye
|
|
||||||
constexpr uint16 SOLDUNGB = 32; // Nagafen's Lair
|
|
||||||
constexpr uint16 MISTY = 33; // Misty Thicket
|
|
||||||
constexpr uint16 NRO = 34; // Northern Desert of Ro
|
|
||||||
constexpr uint16 SRO = 35; // Southern Desert of Ro
|
|
||||||
constexpr uint16 BEFALLEN = 36; // Befallen
|
|
||||||
constexpr uint16 OASIS = 37; // Oasis of Marr
|
|
||||||
constexpr uint16 TOX = 38; // Toxxulia Forest
|
|
||||||
constexpr uint16 HOLE = 39; // The Hole
|
|
||||||
constexpr uint16 NERIAKA = 40; // Neriak - Foreign Quarter
|
|
||||||
constexpr uint16 NERIAKB = 41; // Neriak - Commons
|
|
||||||
constexpr uint16 NERIAKC = 42; // Neriak - 3rd Gate
|
|
||||||
constexpr uint16 NERIAKD = 43; // Neriak Palace
|
|
||||||
constexpr uint16 NAJENA = 44; // Najena
|
|
||||||
constexpr uint16 QCAT = 45; // The Qeynos Aqueduct System
|
|
||||||
constexpr uint16 INNOTHULE = 46; // Innothule Swamp
|
|
||||||
constexpr uint16 FEERROTT = 47; // The Feerrott
|
|
||||||
constexpr uint16 CAZICTHULE = 48; // Accursed Temple of CazicThule
|
|
||||||
constexpr uint16 OGGOK = 49; // Oggok
|
|
||||||
constexpr uint16 RATHEMTN = 50; // The Rathe Mountains
|
|
||||||
constexpr uint16 LAKERATHE = 51; // Lake Rathetear
|
|
||||||
constexpr uint16 GROBB = 52; // Grobb
|
|
||||||
constexpr uint16 AVIAK = 53; // Aviak Village
|
|
||||||
constexpr uint16 GFAYDARK = 54; // The Greater Faydark
|
|
||||||
constexpr uint16 AKANON = 55; // Ak'Anon
|
|
||||||
constexpr uint16 STEAMFONT = 56; // Steamfont Mountains
|
|
||||||
constexpr uint16 LFAYDARK = 57; // The Lesser Faydark
|
|
||||||
constexpr uint16 CRUSHBONE = 58; // Crushbone
|
|
||||||
constexpr uint16 MISTMOORE = 59; // The Castle of Mistmoore
|
|
||||||
constexpr uint16 KALADIMA = 60; // South Kaladim
|
|
||||||
constexpr uint16 FELWITHEA = 61; // Northern Felwithe
|
|
||||||
constexpr uint16 FELWITHEB = 62; // Southern Felwithe
|
|
||||||
constexpr uint16 UNREST = 63; // The Estate of Unrest
|
|
||||||
constexpr uint16 KEDGE = 64; // Kedge Keep
|
|
||||||
constexpr uint16 GUKTOP = 65; // The City of Guk
|
|
||||||
constexpr uint16 GUKBOTTOM = 66; // The Ruins of Old Guk
|
|
||||||
constexpr uint16 KALADIMB = 67; // North Kaladim
|
|
||||||
constexpr uint16 BUTCHER = 68; // Butcherblock Mountains
|
|
||||||
constexpr uint16 OOT = 69; // Ocean of Tears
|
|
||||||
constexpr uint16 CAULDRON = 70; // Dagnor's Cauldron
|
|
||||||
constexpr uint16 AIRPLANE = 71; // The Plane of Sky
|
|
||||||
constexpr uint16 FEARPLANE = 72; // The Plane of Fear
|
|
||||||
constexpr uint16 PERMAFROST = 73; // The Permafrost Caverns
|
|
||||||
constexpr uint16 KERRARIDGE = 74; // Kerra Isle
|
|
||||||
constexpr uint16 PAINEEL = 75; // Paineel
|
|
||||||
constexpr uint16 HATEPLANE = 76; // Plane of Hate
|
|
||||||
constexpr uint16 ARENA = 77; // The Arena
|
|
||||||
constexpr uint16 FIELDOFBONE = 78; // The Field of Bone
|
|
||||||
constexpr uint16 WARSLIKSWOOD = 79; // The Warsliks Woods
|
|
||||||
constexpr uint16 SOLTEMPLE = 80; // The Temple of Solusek Ro
|
|
||||||
constexpr uint16 DROGA = 81; // The Temple of Droga
|
|
||||||
constexpr uint16 CABWEST = 82; // Cabilis West
|
|
||||||
constexpr uint16 SWAMPOFNOHOPE = 83; // The Swamp of No Hope
|
|
||||||
constexpr uint16 FIRIONA = 84; // Firiona Vie
|
|
||||||
constexpr uint16 LAKEOFILLOMEN = 85; // Lake of Ill Omen
|
|
||||||
constexpr uint16 DREADLANDS = 86; // The Dreadlands
|
|
||||||
constexpr uint16 BURNINGWOOD = 87; // The Burning Wood
|
|
||||||
constexpr uint16 KAESORA = 88; // Kaesora
|
|
||||||
constexpr uint16 SEBILIS = 89; // The Ruins of Sebilis
|
|
||||||
constexpr uint16 CITYMIST = 90; // The City of Mist
|
|
||||||
constexpr uint16 SKYFIRE = 91; // The Skyfire Mountains
|
|
||||||
constexpr uint16 FRONTIERMTNS = 92; // Frontier Mountains
|
|
||||||
constexpr uint16 OVERTHERE = 93; // The Overthere
|
|
||||||
constexpr uint16 EMERALDJUNGLE = 94; // The Emerald Jungle
|
|
||||||
constexpr uint16 TRAKANON = 95; // Trakanon's Teeth
|
|
||||||
constexpr uint16 TIMOROUS = 96; // Timorous Deep
|
|
||||||
constexpr uint16 KURN = 97; // Kurn's Tower
|
|
||||||
constexpr uint16 ERUDSXING = 98; // Erud's Crossing
|
|
||||||
constexpr uint16 STONEBRUNT = 100; // The Stonebrunt Mountains
|
|
||||||
constexpr uint16 WARRENS = 101; // The Warrens
|
|
||||||
constexpr uint16 KARNOR = 102; // Karnor's Castle
|
|
||||||
constexpr uint16 CHARDOK = 103; // Chardok
|
|
||||||
constexpr uint16 DALNIR = 104; // The Crypt of Dalnir
|
|
||||||
constexpr uint16 CHARASIS = 105; // The Howling Stones
|
|
||||||
constexpr uint16 CABEAST = 106; // Cabilis East
|
|
||||||
constexpr uint16 NURGA = 107; // The Mines of Nurga
|
|
||||||
constexpr uint16 VEESHAN = 108; // Veeshan's Peak
|
|
||||||
constexpr uint16 VEKSAR = 109; // Veksar
|
|
||||||
constexpr uint16 ICECLAD = 110; // The Iceclad Ocean
|
|
||||||
constexpr uint16 FROZENSHADOW = 111; // The Tower of Frozen Shadow
|
|
||||||
constexpr uint16 VELKETOR = 112; // Velketor's Labyrinth
|
|
||||||
constexpr uint16 KAEL = 113; // Kael Drakkel
|
|
||||||
constexpr uint16 SKYSHRINE = 114; // Skyshrine
|
|
||||||
constexpr uint16 THURGADINA = 115; // The City of Thurgadin
|
|
||||||
constexpr uint16 EASTWASTES = 116; // Eastern Wastes
|
|
||||||
constexpr uint16 COBALTSCAR = 117; // Cobaltscar
|
|
||||||
constexpr uint16 GREATDIVIDE = 118; // The Great Divide
|
|
||||||
constexpr uint16 WAKENING = 119; // The Wakening Land
|
|
||||||
constexpr uint16 WESTWASTES = 120; // The Western Wastes
|
|
||||||
constexpr uint16 CRYSTAL = 121; // The Crystal Caverns
|
|
||||||
constexpr uint16 NECROPOLIS = 123; // Dragon Necropolis
|
|
||||||
constexpr uint16 TEMPLEVEESHAN = 124; // The Temple of Veeshan
|
|
||||||
constexpr uint16 SIRENS = 125; // Siren's Grotto
|
|
||||||
constexpr uint16 MISCHIEFPLANE = 126; // The Plane of Mischief
|
|
||||||
constexpr uint16 GROWTHPLANE = 127; // The Plane of Growth
|
|
||||||
constexpr uint16 SLEEPER = 128; // The Sleeper's Tomb
|
|
||||||
constexpr uint16 THURGADINB = 129; // Icewell Keep
|
|
||||||
constexpr uint16 ERUDSXING2 = 130; // Marauders Mire
|
|
||||||
constexpr uint16 SHADOWHAVEN = 150; // Shadow Haven
|
|
||||||
constexpr uint16 BAZAAR = 151; // The Bazaar
|
|
||||||
constexpr uint16 NEXUS = 152; // Nexus
|
|
||||||
constexpr uint16 ECHO_ = 153; // The Echo Caverns
|
|
||||||
constexpr uint16 ACRYLIA = 154; // The Acrylia Caverns
|
|
||||||
constexpr uint16 SHARVAHL = 155; // The City of Shar Vahl
|
|
||||||
constexpr uint16 PALUDAL = 156; // The Paludal Caverns
|
|
||||||
constexpr uint16 FUNGUSGROVE = 157; // The Fungus Grove
|
|
||||||
constexpr uint16 VEXTHAL = 158; // Vex Thal
|
|
||||||
constexpr uint16 SSERU = 159; // Sanctus Seru
|
|
||||||
constexpr uint16 KATTA = 160; // Katta Castellum
|
|
||||||
constexpr uint16 NETHERBIAN = 161; // Netherbian Lair
|
|
||||||
constexpr uint16 SSRATEMPLE = 162; // Ssraeshza Temple
|
|
||||||
constexpr uint16 GRIEGSEND = 163; // Grieg's End
|
|
||||||
constexpr uint16 THEDEEP = 164; // The Deep
|
|
||||||
constexpr uint16 SHADEWEAVER = 165; // Shadeweaver's Thicket
|
|
||||||
constexpr uint16 HOLLOWSHADE = 166; // Hollowshade Moor
|
|
||||||
constexpr uint16 GRIMLING = 167; // Grimling Forest
|
|
||||||
constexpr uint16 MSERU = 168; // Marus Seru
|
|
||||||
constexpr uint16 LETALIS = 169; // Mons Letalis
|
|
||||||
constexpr uint16 TWILIGHT = 170; // The Twilight Sea
|
|
||||||
constexpr uint16 THEGREY = 171; // The Grey
|
|
||||||
constexpr uint16 TENEBROUS = 172; // The Tenebrous Mountains
|
|
||||||
constexpr uint16 MAIDEN = 173; // The Maiden's Eye
|
|
||||||
constexpr uint16 DAWNSHROUD = 174; // The Dawnshroud Peaks
|
|
||||||
constexpr uint16 SCARLET = 175; // The Scarlet Desert
|
|
||||||
constexpr uint16 UMBRAL = 176; // The Umbral Plains
|
|
||||||
constexpr uint16 AKHEVA = 179; // The Akheva Ruins
|
|
||||||
constexpr uint16 ARENA2 = 180; // The Arena Two
|
|
||||||
constexpr uint16 JAGGEDPINE = 181; // The Jaggedpine Forest
|
|
||||||
constexpr uint16 NEDARIA = 182; // Nedaria's Landing
|
|
||||||
constexpr uint16 TUTORIAL = 183; // EverQuest Tutorial
|
|
||||||
constexpr uint16 LOAD = 184; // Loading Zone
|
|
||||||
constexpr uint16 LOAD2 = 185; // New Loading Zone
|
|
||||||
constexpr uint16 HATEPLANEB = 186; // The Plane of Hate
|
|
||||||
constexpr uint16 SHADOWREST = 187; // Shadowrest
|
|
||||||
constexpr uint16 TUTORIALA = 188; // The Mines of Gloomingdeep
|
|
||||||
constexpr uint16 TUTORIALB = 189; // The Mines of Gloomingdeep
|
|
||||||
constexpr uint16 CLZ = 190; // Loading
|
|
||||||
constexpr uint16 CODECAY = 200; // The Crypt of Decay
|
|
||||||
constexpr uint16 POJUSTICE = 201; // The Plane of Justice
|
|
||||||
constexpr uint16 POKNOWLEDGE = 202; // The Plane of Knowledge
|
|
||||||
constexpr uint16 POTRANQUILITY = 203; // The Plane of Tranquility
|
|
||||||
constexpr uint16 PONIGHTMARE = 204; // The Plane of Nightmares
|
|
||||||
constexpr uint16 PODISEASE = 205; // The Plane of Disease
|
|
||||||
constexpr uint16 POINNOVATION = 206; // The Plane of Innovation
|
|
||||||
constexpr uint16 POTORMENT = 207; // Torment, the Plane of Pain
|
|
||||||
constexpr uint16 POVALOR = 208; // The Plane of Valor
|
|
||||||
constexpr uint16 BOTHUNDER = 209; // Bastion of Thunder
|
|
||||||
constexpr uint16 POSTORMS = 210; // The Plane of Storms
|
|
||||||
constexpr uint16 HOHONORA = 211; // The Halls of Honor
|
|
||||||
constexpr uint16 SOLROTOWER = 212; // The Tower of Solusek Ro
|
|
||||||
constexpr uint16 POWAR = 213; // Plane of War
|
|
||||||
constexpr uint16 POTACTICS = 214; // Drunder, the Fortress of Zek
|
|
||||||
constexpr uint16 POAIR = 215; // The Plane of Air
|
|
||||||
constexpr uint16 POWATER = 216; // The Plane of Water
|
|
||||||
constexpr uint16 POFIRE = 217; // The Plane of Fire
|
|
||||||
constexpr uint16 POEARTHA = 218; // The Plane of Earth
|
|
||||||
constexpr uint16 POTIMEA = 219; // The Plane of Time
|
|
||||||
constexpr uint16 HOHONORB = 220; // The Temple of Marr
|
|
||||||
constexpr uint16 NIGHTMAREB = 221; // The Lair of Terris Thule
|
|
||||||
constexpr uint16 POEARTHB = 222; // The Plane of Earth
|
|
||||||
constexpr uint16 POTIMEB = 223; // The Plane of Time
|
|
||||||
constexpr uint16 GUNTHAK = 224; // The Gulf of Gunthak
|
|
||||||
constexpr uint16 DULAK = 225; // Dulak's Harbor
|
|
||||||
constexpr uint16 TORGIRAN = 226; // The Torgiran Mines
|
|
||||||
constexpr uint16 NADOX = 227; // The Crypt of Nadox
|
|
||||||
constexpr uint16 HATESFURY = 228; // Hate's Fury
|
|
||||||
constexpr uint16 GUKA = 229; // Deepest Guk: Cauldron of Lost Souls
|
|
||||||
constexpr uint16 RUJA = 230; // The Rujarkian Hills: Bloodied Quarries
|
|
||||||
constexpr uint16 TAKA = 231; // Takish-Hiz: Sunken Library
|
|
||||||
constexpr uint16 MIRA = 232; // Miragul's Menagerie: Silent Gallery
|
|
||||||
constexpr uint16 MMCA = 233; // Mistmoore's Catacombs: Forlorn Caverns
|
|
||||||
constexpr uint16 GUKB = 234; // The Drowning Crypt
|
|
||||||
constexpr uint16 RUJB = 235; // The Rujarkian Hills: Halls of War
|
|
||||||
constexpr uint16 TAKB = 236; // Takish-Hiz: Shifting Tower
|
|
||||||
constexpr uint16 MIRB = 237; // Miragul's Menagerie: Frozen Nightmare
|
|
||||||
constexpr uint16 MMCB = 238; // Mistmoore's Catacombs: Dreary Grotto
|
|
||||||
constexpr uint16 GUKC = 239; // Deepest Guk: Ancient Aqueducts
|
|
||||||
constexpr uint16 RUJC = 240; // The Rujarkian Hills: Wind Bridges
|
|
||||||
constexpr uint16 TAKC = 241; // Takish-Hiz: Within the Compact
|
|
||||||
constexpr uint16 MIRC = 242; // The Spider Den
|
|
||||||
constexpr uint16 MMCC = 243; // Mistmoore's Catacombs: Struggles within the Progeny
|
|
||||||
constexpr uint16 GUKD = 244; // The Mushroom Grove
|
|
||||||
constexpr uint16 RUJD = 245; // The Rujarkian Hills: Prison Break
|
|
||||||
constexpr uint16 TAKD = 246; // Takish-Hiz: Royal Observatory
|
|
||||||
constexpr uint16 MIRD = 247; // Miragul's Menagerie: Hushed Banquet
|
|
||||||
constexpr uint16 MMCD = 248; // Mistmoore's Catacombs: Chambers of Eternal Affliction
|
|
||||||
constexpr uint16 GUKE = 249; // Deepest Guk: The Curse Reborn
|
|
||||||
constexpr uint16 RUJE = 250; // The Rujarkian Hills: Drudge Hollows
|
|
||||||
constexpr uint16 TAKE = 251; // Takish-Hiz: River of Recollection
|
|
||||||
constexpr uint16 MIRE = 252; // The Frosted Halls
|
|
||||||
constexpr uint16 MMCE = 253; // Mistmoore's Catacombs: Sepulcher of the Damned
|
|
||||||
constexpr uint16 GUKF = 254; // Deepest Guk: Chapel of the Witnesses
|
|
||||||
constexpr uint16 RUJF = 255; // The Rujarkian Hills: Fortified Lair of the Taskmasters
|
|
||||||
constexpr uint16 TAKF = 256; // Takish-Hiz: Sandfall Corridors
|
|
||||||
constexpr uint16 MIRF = 257; // The Forgotten Wastes
|
|
||||||
constexpr uint16 MMCF = 258; // Mistmoore's Catacombs: Scion Lair of Fury
|
|
||||||
constexpr uint16 GUKG = 259; // The Root Garden
|
|
||||||
constexpr uint16 RUJG = 260; // The Rujarkian Hills: Hidden Vale of Deceit
|
|
||||||
constexpr uint16 TAKG = 261; // Takish-Hiz: Balancing Chamber
|
|
||||||
constexpr uint16 MIRG = 262; // Miragul's Menagerie: Heart of the Menagerie
|
|
||||||
constexpr uint16 MMCG = 263; // Mistmoore's Catacombs: Cesspits of Putrescence
|
|
||||||
constexpr uint16 GUKH = 264; // Deepest Guk: Accursed Sanctuary
|
|
||||||
constexpr uint16 RUJH = 265; // The Rujarkian Hills: Blazing Forge
|
|
||||||
constexpr uint16 TAKH = 266; // Takish-Hiz: Sweeping Tides
|
|
||||||
constexpr uint16 MIRH = 267; // The Morbid Laboratory
|
|
||||||
constexpr uint16 MMCH = 268; // Mistmoore's Catacombs: Aisles of Blood
|
|
||||||
constexpr uint16 RUJI = 269; // The Rujarkian Hills: Arena of Chance
|
|
||||||
constexpr uint16 TAKI = 270; // Takish-Hiz: Antiquated Palace
|
|
||||||
constexpr uint16 MIRI = 271; // The Theater of Imprisoned Horror
|
|
||||||
constexpr uint16 MMCI = 272; // Mistmoore's Catacombs: Halls of Sanguinary Rites
|
|
||||||
constexpr uint16 RUJJ = 273; // The Rujarkian Hills: Barracks of War
|
|
||||||
constexpr uint16 TAKJ = 274; // Takish-Hiz: Prismatic Corridors
|
|
||||||
constexpr uint16 MIRJ = 275; // Miragul's Menagerie: Grand Library
|
|
||||||
constexpr uint16 MMCJ = 276; // Mistmoore's Catacombs: Infernal Sanctuary
|
|
||||||
constexpr uint16 CHARDOKB = 277; // Chardok: The Halls of Betrayal
|
|
||||||
constexpr uint16 SOLDUNGC = 278; // The Caverns of Exile
|
|
||||||
constexpr uint16 ABYSMAL = 279; // The Abysmal Sea
|
|
||||||
constexpr uint16 NATIMBI = 280; // Natimbi, the Broken Shores
|
|
||||||
constexpr uint16 QINIMI = 281; // Qinimi, Court of Nihilia
|
|
||||||
constexpr uint16 RIWWI = 282; // Riwwi, Coliseum of Games
|
|
||||||
constexpr uint16 BARINDU = 283; // Barindu, Hanging Gardens
|
|
||||||
constexpr uint16 FERUBI = 284; // Ferubi, Forgotten Temple of Taelosia
|
|
||||||
constexpr uint16 SNPOOL = 285; // Sewers of Nihilia, Pool of Sludg
|
|
||||||
constexpr uint16 SNLAIR = 286; // Sewers of Nihilia, Lair of Trapp
|
|
||||||
constexpr uint16 SNPLANT = 287; // Sewers of Nihilia, Purifying Pla
|
|
||||||
constexpr uint16 SNCREMATORY = 288; // Sewers of Nihilia, Emanating Cre
|
|
||||||
constexpr uint16 TIPT = 289; // Tipt, Treacherous Crags
|
|
||||||
constexpr uint16 VXED = 290; // Vxed, the Crumbling Caverns
|
|
||||||
constexpr uint16 YXTTA = 291; // Yxtta, Pulpit of Exiles
|
|
||||||
constexpr uint16 UQUA = 292; // Uqua, the Ocean God Chantry
|
|
||||||
constexpr uint16 KODTAZ = 293; // Kod'Taz, Broken Trial Grounds
|
|
||||||
constexpr uint16 IKKINZ = 294; // Ikkinz, Chambers of Transcendence
|
|
||||||
constexpr uint16 QVIC = 295; // Qvic, Prayer Grounds of Calling
|
|
||||||
constexpr uint16 INKTUTA = 296; // Inktu'Ta, the Unmasked Chapel
|
|
||||||
constexpr uint16 TXEVU = 297; // Txevu, Lair of the Elite
|
|
||||||
constexpr uint16 TACVI = 298; // Tacvi, The Broken Temple
|
|
||||||
constexpr uint16 QVICB = 299; // Qvic, the Hidden Vault
|
|
||||||
constexpr uint16 WALLOFSLAUGHTER = 300; // Wall of Slaughter
|
|
||||||
constexpr uint16 BLOODFIELDS = 301; // The Bloodfields
|
|
||||||
constexpr uint16 DRANIKSSCAR = 302; // Dranik's Scar
|
|
||||||
constexpr uint16 CAUSEWAY = 303; // Nobles' Causeway
|
|
||||||
constexpr uint16 CHAMBERSA = 304; // Muramite Proving Grounds
|
|
||||||
constexpr uint16 CHAMBERSB = 305; // Muramite Proving Grounds
|
|
||||||
constexpr uint16 CHAMBERSC = 306; // Muramite Proving Grounds
|
|
||||||
constexpr uint16 CHAMBERSD = 307; // Muramite Proving Grounds
|
|
||||||
constexpr uint16 CHAMBERSE = 308; // Muramite Proving Grounds
|
|
||||||
constexpr uint16 CHAMBERSF = 309; // Muramite Proving Grounds
|
|
||||||
constexpr uint16 PROVINGGROUNDS = 316; // Muramite Proving Grounds
|
|
||||||
constexpr uint16 ANGUISH = 317; // Anguish, the Fallen Palace
|
|
||||||
constexpr uint16 DRANIKHOLLOWSA = 318; // Dranik's Hollows
|
|
||||||
constexpr uint16 DRANIKHOLLOWSB = 319; // Dranik's Hollows
|
|
||||||
constexpr uint16 DRANIKHOLLOWSC = 320; // Dranik's Hollows
|
|
||||||
constexpr uint16 DRANIKCATACOMBSA = 328; // Catacombs of Dranik
|
|
||||||
constexpr uint16 DRANIKCATACOMBSB = 329; // Catacombs of Dranik
|
|
||||||
constexpr uint16 DRANIKCATACOMBSC = 330; // Catacombs of Dranik
|
|
||||||
constexpr uint16 DRANIKSEWERSA = 331; // Sewers of Dranik
|
|
||||||
constexpr uint16 DRANIKSEWERSB = 332; // Sewers of Dranik
|
|
||||||
constexpr uint16 DRANIKSEWERSC = 333; // Sewers of Dranik
|
|
||||||
constexpr uint16 RIFTSEEKERS = 334; // Riftseekers' Sanctum
|
|
||||||
constexpr uint16 HARBINGERS = 335; // Harbinger's Spire
|
|
||||||
constexpr uint16 DRANIK = 336; // The Ruined City of Dranik
|
|
||||||
constexpr uint16 BROODLANDS = 337; // The Broodlands
|
|
||||||
constexpr uint16 STILLMOONA = 338; // Stillmoon Temple
|
|
||||||
constexpr uint16 STILLMOONB = 339; // The Ascent
|
|
||||||
constexpr uint16 THUNDERCREST = 340; // Thundercrest Isles
|
|
||||||
constexpr uint16 DELVEA = 341; // Lavaspinner's Lair
|
|
||||||
constexpr uint16 DELVEB = 342; // Tirranun's Delve
|
|
||||||
constexpr uint16 THENEST = 343; // The Nest
|
|
||||||
constexpr uint16 GUILDLOBBY = 344; // Guild Lobby
|
|
||||||
constexpr uint16 GUILDHALL = 345; // Guild Hall
|
|
||||||
constexpr uint16 BARTER = 346; // The Barter Hall
|
|
||||||
constexpr uint16 ILLSALIN = 347; // Ruins of Illsalin
|
|
||||||
constexpr uint16 ILLSALINA = 348; // Illsalin Marketplace
|
|
||||||
constexpr uint16 ILLSALINB = 349; // Temple of Korlach
|
|
||||||
constexpr uint16 ILLSALINC = 350; // The Nargil Pits
|
|
||||||
constexpr uint16 DREADSPIRE = 351; // Dreadspire Keep
|
|
||||||
constexpr uint16 DRACHNIDHIVE = 354; // The Hive
|
|
||||||
constexpr uint16 DRACHNIDHIVEA = 355; // The Hatchery
|
|
||||||
constexpr uint16 DRACHNIDHIVEB = 356; // The Cocoons
|
|
||||||
constexpr uint16 DRACHNIDHIVEC = 357; // Queen Sendaii`s Lair
|
|
||||||
constexpr uint16 WESTKORLACH = 358; // Stoneroot Falls
|
|
||||||
constexpr uint16 WESTKORLACHA = 359; // Prince's Manor
|
|
||||||
constexpr uint16 WESTKORLACHB = 360; // Caverns of the Lost
|
|
||||||
constexpr uint16 WESTKORLACHC = 361; // Lair of the Korlach
|
|
||||||
constexpr uint16 EASTKORLACH = 362; // The Undershore
|
|
||||||
constexpr uint16 EASTKORLACHA = 363; // Snarlstone Dens
|
|
||||||
constexpr uint16 SHADOWSPINE = 364; // Shadow Spine
|
|
||||||
constexpr uint16 CORATHUS = 365; // Corathus Creep
|
|
||||||
constexpr uint16 CORATHUSA = 366; // Sporali Caverns
|
|
||||||
constexpr uint16 CORATHUSB = 367; // The Corathus Mines
|
|
||||||
constexpr uint16 NEKTULOSA = 368; // Shadowed Grove
|
|
||||||
constexpr uint16 ARCSTONE = 369; // Arcstone, Isle of Spirits
|
|
||||||
constexpr uint16 RELIC = 370; // Relic, the Artifact City
|
|
||||||
constexpr uint16 SKYLANCE = 371; // Skylance
|
|
||||||
constexpr uint16 DEVASTATION = 372; // The Devastation
|
|
||||||
constexpr uint16 DEVASTATIONA = 373; // The Seething Wall
|
|
||||||
constexpr uint16 RAGE = 374; // Sverag, Stronghold of Rage
|
|
||||||
constexpr uint16 RAGEA = 375; // Razorthorn, Tower of Sullon Zek
|
|
||||||
constexpr uint16 TAKISHRUINS = 376; // Ruins of Takish-Hiz
|
|
||||||
constexpr uint16 TAKISHRUINSA = 377; // The Root of Ro
|
|
||||||
constexpr uint16 ELDDAR = 378; // The Elddar Forest
|
|
||||||
constexpr uint16 ELDDARA = 379; // Tunare's Shrine
|
|
||||||
constexpr uint16 THEATER = 380; // Theater of Blood
|
|
||||||
constexpr uint16 THEATERA = 381; // Deathknell, Tower of Dissonance
|
|
||||||
constexpr uint16 FREEPORTEAST = 382; // East Freeport
|
|
||||||
constexpr uint16 FREEPORTWEST = 383; // West Freeport
|
|
||||||
constexpr uint16 FREEPORTSEWERS = 384; // Freeport Sewers
|
|
||||||
constexpr uint16 FREEPORTACADEMY = 385; // Academy of Arcane Sciences
|
|
||||||
constexpr uint16 FREEPORTTEMPLE = 386; // Temple of Marr
|
|
||||||
constexpr uint16 FREEPORTMILITIA = 387; // Freeport Militia House: My Precious
|
|
||||||
constexpr uint16 FREEPORTARENA = 388; // Arena
|
|
||||||
constexpr uint16 FREEPORTCITYHALL = 389; // City Hall
|
|
||||||
constexpr uint16 FREEPORTTHEATER = 390; // Theater of the Tranquil
|
|
||||||
constexpr uint16 FREEPORTHALL = 391; // Hall of Truth: Bounty
|
|
||||||
constexpr uint16 NORTHRO = 392; // North Desert of Ro
|
|
||||||
constexpr uint16 SOUTHRO = 393; // South Desert of Ro
|
|
||||||
constexpr uint16 CRESCENT = 394; // Crescent Reach
|
|
||||||
constexpr uint16 MOORS = 395; // Blightfire Moors
|
|
||||||
constexpr uint16 STONEHIVE = 396; // Stone Hive
|
|
||||||
constexpr uint16 MESA = 397; // Goru`kar Mesa
|
|
||||||
constexpr uint16 ROOST = 398; // Blackfeather Roost
|
|
||||||
constexpr uint16 STEPPES = 399; // The Steppes
|
|
||||||
constexpr uint16 ICEFALL = 400; // Icefall Glacier
|
|
||||||
constexpr uint16 VALDEHOLM = 401; // Valdeholm
|
|
||||||
constexpr uint16 FROSTCRYPT = 402; // Frostcrypt, Throne of the Shade King
|
|
||||||
constexpr uint16 SUNDEROCK = 403; // Sunderock Springs
|
|
||||||
constexpr uint16 VERGALID = 404; // Vergalid Mines
|
|
||||||
constexpr uint16 DIREWIND = 405; // Direwind Cliffs
|
|
||||||
constexpr uint16 ASHENGATE = 406; // Ashengate, Reliquary of the Scale
|
|
||||||
constexpr uint16 HIGHPASSHOLD = 407; // Highpass Hold
|
|
||||||
constexpr uint16 COMMONLANDS = 408; // The Commonlands
|
|
||||||
constexpr uint16 OCEANOFTEARS = 409; // The Ocean of Tears
|
|
||||||
constexpr uint16 KITHFOREST = 410; // Kithicor Forest
|
|
||||||
constexpr uint16 BEFALLENB = 411; // Befallen
|
|
||||||
constexpr uint16 HIGHPASSKEEP = 412; // HighKeep
|
|
||||||
constexpr uint16 INNOTHULEB = 413; // The Innothule Swamp
|
|
||||||
constexpr uint16 TOXXULIA = 414; // Toxxulia Forest
|
|
||||||
constexpr uint16 MISTYTHICKET = 415; // The Misty Thicket
|
|
||||||
constexpr uint16 KATTACASTRUM = 416; // Katta Castrum
|
|
||||||
constexpr uint16 THALASSIUS = 417; // Thalassius, the Coral Keep
|
|
||||||
constexpr uint16 ATIIKI = 418; // Jewel of Atiiki
|
|
||||||
constexpr uint16 ZHISZA = 419; // Zhisza, the Shissar Sanctuary
|
|
||||||
constexpr uint16 SILYSSAR = 420; // Silyssar, New Chelsith
|
|
||||||
constexpr uint16 SOLTERIS = 421; // Solteris, the Throne of Ro
|
|
||||||
constexpr uint16 BARREN = 422; // Barren Coast
|
|
||||||
constexpr uint16 BURIEDSEA = 423; // The Buried Sea
|
|
||||||
constexpr uint16 JARDELSHOOK = 424; // Jardel's Hook
|
|
||||||
constexpr uint16 MONKEYROCK = 425; // Monkey Rock
|
|
||||||
constexpr uint16 SUNCREST = 426; // Suncrest Isle
|
|
||||||
constexpr uint16 DEADBONE = 427; // Deadbone Reef
|
|
||||||
constexpr uint16 BLACKSAIL = 428; // Blacksail Folly
|
|
||||||
constexpr uint16 MAIDENSGRAVE = 429; // Maiden's Grave
|
|
||||||
constexpr uint16 REDFEATHER = 430; // Redfeather Isle
|
|
||||||
constexpr uint16 SHIPMVP = 431; // The Open Sea
|
|
||||||
constexpr uint16 SHIPMVU = 432; // The Open Sea
|
|
||||||
constexpr uint16 SHIPPVU = 433; // The Open Sea
|
|
||||||
constexpr uint16 SHIPUVU = 434; // The Open Sea
|
|
||||||
constexpr uint16 SHIPMVM = 435; // The Open Sea
|
|
||||||
constexpr uint16 MECHANOTUS = 436; // Fortress Mechanotus
|
|
||||||
constexpr uint16 MANSION = 437; // Meldrath's Majestic Mansion
|
|
||||||
constexpr uint16 STEAMFACTORY = 438; // The Steam Factory
|
|
||||||
constexpr uint16 SHIPWORKSHOP = 439; // S.H.I.P. Workshop
|
|
||||||
constexpr uint16 GYROSPIREB = 440; // Gyrospire Beza
|
|
||||||
constexpr uint16 GYROSPIREZ = 441; // Gyrospire Zeka
|
|
||||||
constexpr uint16 DRAGONSCALE = 442; // Dragonscale Hills
|
|
||||||
constexpr uint16 LOPINGPLAINS = 443; // Loping Plains
|
|
||||||
constexpr uint16 HILLSOFSHADE = 444; // Hills of Shade
|
|
||||||
constexpr uint16 BLOODMOON = 445; // Bloodmoon Keep
|
|
||||||
constexpr uint16 CRYSTALLOS = 446; // Crystallos, Lair of the Awakened
|
|
||||||
constexpr uint16 GUARDIAN = 447; // The Mechamatic Guardian
|
|
||||||
constexpr uint16 STEAMFONTMTS = 448; // The Steamfont Mountains
|
|
||||||
constexpr uint16 CRYPTOFSHADE = 449; // Crypt of Shade
|
|
||||||
constexpr uint16 DRAGONSCALEB = 451; // Deepscar's Den
|
|
||||||
constexpr uint16 OLDFIELDOFBONE = 452; // Field of Scale
|
|
||||||
constexpr uint16 OLDKAESORAA = 453; // Kaesora Library
|
|
||||||
constexpr uint16 OLDKAESORAB = 454; // Kaesora Hatchery
|
|
||||||
constexpr uint16 OLDKURN = 455; // Kurn's Tower
|
|
||||||
constexpr uint16 OLDKITHICOR = 456; // Bloody Kithicor
|
|
||||||
constexpr uint16 OLDCOMMONS = 457; // Old Commonlands
|
|
||||||
constexpr uint16 OLDHIGHPASS = 458; // Highpass Hold
|
|
||||||
constexpr uint16 THEVOIDA = 459; // The Void
|
|
||||||
constexpr uint16 THEVOIDB = 460; // The Void
|
|
||||||
constexpr uint16 THEVOIDC = 461; // The Void
|
|
||||||
constexpr uint16 THEVOIDD = 462; // The Void
|
|
||||||
constexpr uint16 THEVOIDE = 463; // The Void
|
|
||||||
constexpr uint16 THEVOIDF = 464; // The Void
|
|
||||||
constexpr uint16 THEVOIDG = 465; // The Void
|
|
||||||
constexpr uint16 OCEANGREENHILLS = 466; // Oceangreen Hills
|
|
||||||
constexpr uint16 OCEANGREENVILLAGE = 467; // Oceangreen Village
|
|
||||||
constexpr uint16 OLDBLACKBURROW = 468; // BlackBurrow
|
|
||||||
constexpr uint16 BERTOXTEMPLE = 469; // Temple of Bertoxxulous
|
|
||||||
constexpr uint16 DISCORD = 470; // Korafax, Home of the Riders
|
|
||||||
constexpr uint16 DISCORDTOWER = 471; // Citadel of the Worldslayer
|
|
||||||
constexpr uint16 OLDBLOODFIELD = 472; // Old Bloodfields
|
|
||||||
constexpr uint16 PRECIPICEOFWAR = 473; // The Precipice of War
|
|
||||||
constexpr uint16 OLDDRANIK = 474; // City of Dranik
|
|
||||||
constexpr uint16 TOSKIRAKK = 475; // Toskirakk
|
|
||||||
constexpr uint16 KORASCIAN = 476; // Korascian Warrens
|
|
||||||
constexpr uint16 RATHECHAMBER = 477; // Rathe Council Chamber
|
|
||||||
constexpr uint16 BRELLSREST = 480; // Brell's Rest
|
|
||||||
constexpr uint16 FUNGALFOREST = 481; // Fungal Forest
|
|
||||||
constexpr uint16 UNDERQUARRY = 482; // The Underquarry
|
|
||||||
constexpr uint16 COOLINGCHAMBER = 483; // The Cooling Chamber
|
|
||||||
constexpr uint16 SHININGCITY = 484; // Kernagir, the Shining City
|
|
||||||
constexpr uint16 ARTHICREX = 485; // Arthicrex
|
|
||||||
constexpr uint16 FOUNDATION = 486; // The Foundation
|
|
||||||
constexpr uint16 LICHENCREEP = 487; // Lichen Creep
|
|
||||||
constexpr uint16 PELLUCID = 488; // Pellucid Grotto
|
|
||||||
constexpr uint16 STONESNAKE = 489; // Volska's Husk
|
|
||||||
constexpr uint16 BRELLSTEMPLE = 490; // Brell's Temple
|
|
||||||
constexpr uint16 CONVORTEUM = 491; // The Convorteum
|
|
||||||
constexpr uint16 BRELLSARENA = 492; // Brell's Arena
|
|
||||||
constexpr uint16 WEDDINGCHAPEL = 493; // Wedding Chapel
|
|
||||||
constexpr uint16 WEDDINGCHAPELDARK = 494; // Wedding Chapel
|
|
||||||
constexpr uint16 DRAGONCRYPT = 495; // Lair of the Risen
|
|
||||||
constexpr uint16 FEERROTT2 = 700; // The Feerrott
|
|
||||||
constexpr uint16 THULEHOUSE1 = 701; // House of Thule
|
|
||||||
constexpr uint16 THULEHOUSE2 = 702; // House of Thule, Upper Floors
|
|
||||||
constexpr uint16 HOUSEGARDEN = 703; // The Grounds
|
|
||||||
constexpr uint16 THULELIBRARY = 704; // The Library
|
|
||||||
constexpr uint16 WELL = 705; // The Well
|
|
||||||
constexpr uint16 FALLEN = 706; // Erudin Burning
|
|
||||||
constexpr uint16 MORELLCASTLE = 707; // Morell's Castle
|
|
||||||
constexpr uint16 SOMNIUM = 708; // Sanctum Somnium
|
|
||||||
constexpr uint16 ALKABORMARE = 709; // Al'Kabor's Nightmare
|
|
||||||
constexpr uint16 MIRAGULMARE = 710; // Miragul's Nightmare
|
|
||||||
constexpr uint16 THULEDREAM = 711; // Fear Itself
|
|
||||||
constexpr uint16 NEIGHBORHOOD = 712; // Sunrise Hills
|
|
||||||
constexpr uint16 ARGATH = 724; // Argath, Bastion of Illdaera
|
|
||||||
constexpr uint16 ARELIS = 725; // Valley of Lunanyn
|
|
||||||
constexpr uint16 SARITHCITY = 726; // Sarith, City of Tides
|
|
||||||
constexpr uint16 RUBAK = 727; // Rubak Oseka, Temple of the Sea
|
|
||||||
constexpr uint16 BEASTDOMAIN = 728; // Beasts' Domain
|
|
||||||
constexpr uint16 RESPLENDENT = 729; // The Resplendent Temple
|
|
||||||
constexpr uint16 PILLARSALRA = 730; // Pillars of Alra
|
|
||||||
constexpr uint16 WINDSONG = 731; // Windsong Sanctuary
|
|
||||||
constexpr uint16 CITYOFBRONZE = 732; // Erillion, City of Bronze
|
|
||||||
constexpr uint16 SEPULCHER = 733; // Sepulcher of Order
|
|
||||||
constexpr uint16 EASTSEPULCHER = 734; // Sepulcher East
|
|
||||||
constexpr uint16 WESTSEPULCHER = 735; // Sepulcher West
|
|
||||||
constexpr uint16 SHARDSLANDING = 752; // Shard's Landing
|
|
||||||
constexpr uint16 XORBB = 753; // Valley of King Xorbb
|
|
||||||
constexpr uint16 KAELSHARD = 754; // Kael Drakkel: The King's Madness
|
|
||||||
constexpr uint16 EASTWASTESSHARD = 755; // East Wastes: Zeixshi-Kar's Awakening
|
|
||||||
constexpr uint16 CRYSTALSHARD = 756; // The Crystal Caverns: Fragment of Fear
|
|
||||||
constexpr uint16 BREEDINGGROUNDS = 757; // The Breeding Grounds
|
|
||||||
constexpr uint16 EVILTREE = 758; // Evantil, the Vile Oak
|
|
||||||
constexpr uint16 GRELLETH = 759; // Grelleth's Palace, the Chateau of Filth
|
|
||||||
constexpr uint16 CHAPTERHOUSE = 760; // Chapterhouse of the Fallen
|
|
||||||
constexpr uint16 ARTTEST = 996; // Art Testing Domain
|
|
||||||
constexpr uint16 FHALLS = 998; // The Forgotten Halls
|
|
||||||
constexpr uint16 APPRENTICE = 999; // Designer Apprentice
|
|
||||||
}
|
|
||||||
|
|
||||||
//ZoneChange_Struct->success values
|
//ZoneChange_Struct->success values
|
||||||
#define ZONE_ERROR_NOMSG 0
|
#define ZONE_ERROR_NOMSG 0
|
||||||
#define ZONE_ERROR_NOTREADY -1
|
#define ZONE_ERROR_NOTREADY -1
|
||||||
@@ -925,6 +438,9 @@ static const uint8 SkillDamageTypes[EQ::skills::HIGHEST_SKILL + 1] = // change t
|
|||||||
|
|
||||||
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
||||||
|
|
||||||
|
static const uint32 DB_SPELL_CAZIC_TOUCH = 982;
|
||||||
|
static const uint32 DB_SPELL_TOUCH_OF_VINITRAS = 2859;
|
||||||
|
|
||||||
static const uint32 DB_FACTION_GEM_CHOPPERS = 255;
|
static const uint32 DB_FACTION_GEM_CHOPPERS = 255;
|
||||||
static const uint32 DB_FACTION_HERETICS = 265;
|
static const uint32 DB_FACTION_HERETICS = 265;
|
||||||
static const uint32 DB_FACTION_KING_AKANON = 333;
|
static const uint32 DB_FACTION_KING_AKANON = 333;
|
||||||
@@ -974,39 +490,4 @@ enum class DynamicZoneMemberStatus : uint8_t
|
|||||||
LinkDead
|
LinkDead
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LDoNThemes {
|
|
||||||
Unused = 0,
|
|
||||||
GUK,
|
|
||||||
MIR,
|
|
||||||
MMC,
|
|
||||||
RUJ,
|
|
||||||
TAK
|
|
||||||
};
|
|
||||||
|
|
||||||
enum LDoNThemeBits {
|
|
||||||
UnusedBit = 0,
|
|
||||||
GUKBit = 1,
|
|
||||||
MIRBit = 2,
|
|
||||||
MMCBit = 4,
|
|
||||||
RUJBit = 8,
|
|
||||||
TAKBit = 16
|
|
||||||
};
|
|
||||||
|
|
||||||
enum StartZoneIndex {
|
|
||||||
Odus = 0,
|
|
||||||
Qeynos,
|
|
||||||
Halas,
|
|
||||||
Rivervale,
|
|
||||||
Freeport,
|
|
||||||
Neriak,
|
|
||||||
Grobb,
|
|
||||||
Oggok,
|
|
||||||
Kaladim,
|
|
||||||
GreaterFaydark,
|
|
||||||
Felwithe,
|
|
||||||
Akanon,
|
|
||||||
Cabilis,
|
|
||||||
SharVahl
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||||
|
|||||||
@@ -384,9 +384,7 @@ struct NewZone_Struct {
|
|||||||
/*0716*/ uint32 FastRegenEndurance;
|
/*0716*/ uint32 FastRegenEndurance;
|
||||||
/*0720*/ uint32 NPCAggroMaxDist;
|
/*0720*/ uint32 NPCAggroMaxDist;
|
||||||
/*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
|
/*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*/ uint32 LavaDamage; // Seen 50
|
/*0728*/
|
||||||
/*0732*/ uint32 MinLavaDamage; // Seen 10
|
|
||||||
/*0736*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -448,7 +446,6 @@ struct ManaChange_Struct
|
|||||||
/*08*/ uint32 spell_id;
|
/*08*/ uint32 spell_id;
|
||||||
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
|
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
|
||||||
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
|
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
|
||||||
/*16*/ int32 slot; // -1 normal, otherwise clear ETA and GCD
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SwapSpell_Struct
|
struct SwapSpell_Struct
|
||||||
@@ -3717,66 +3714,17 @@ struct SetTitleReply_Struct {
|
|||||||
uint32 entity_id;
|
uint32 entity_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SharedTaskMemberList_Struct {
|
struct TaskMemberList_Struct {
|
||||||
/*00*/ uint32 gopher_id;
|
/*00*/ uint32 gopher_id;
|
||||||
/*04*/ uint32 unknown04;
|
/*04*/ uint32 unknown04;
|
||||||
/*08*/ uint32 member_count; //1 less than the number of members
|
/*08*/ uint32 member_count; //1 less than the number of members
|
||||||
///*12*/ char list_pointer[0];
|
/*12*/ char list_pointer[0];
|
||||||
char member_name[1]; //null terminated string
|
|
||||||
uint32 monster_mission; // class chosen
|
|
||||||
uint8 task_leader; //boolean flag
|
|
||||||
|
|
||||||
/* list is of the form:
|
/* list is of the form:
|
||||||
|
char member_name[1] //null terminated string
|
||||||
uint8 task_leader //boolean flag
|
uint8 task_leader //boolean flag
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SharedTaskQuit_Struct {
|
|
||||||
int32 field1;
|
|
||||||
int32 field2;
|
|
||||||
int32 field3;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SharedTaskAddPlayer_Struct {
|
|
||||||
int32 field1;
|
|
||||||
int32 field2;
|
|
||||||
char player_name[64];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SharedTaskMakeLeader_Struct {
|
|
||||||
int32 field1;
|
|
||||||
int32 field2;
|
|
||||||
char player_name[64];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SharedTaskRemovePlayer_Struct {
|
|
||||||
int32 field1;
|
|
||||||
int32 field2;
|
|
||||||
char player_name[64];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SharedTaskInvite_Struct {
|
|
||||||
int32_t unknown00; // probably the unique character id sent in some packets
|
|
||||||
int32_t invite_id; // invite id sent back in response
|
|
||||||
char task_name[64];
|
|
||||||
char inviter_name[64];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SharedTaskInviteResponse_Struct {
|
|
||||||
int32_t unknown00; // 0
|
|
||||||
int32_t invite_id; // same id sent in the invite, probably for server verification
|
|
||||||
int8_t accepted; // 0: declined 1: accepted
|
|
||||||
int8_t padding[3]; // padding garbage probably
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SharedTaskAccept_Struct {
|
|
||||||
int32_t unknown00;
|
|
||||||
int32_t unknown04;
|
|
||||||
uint32_t npc_entity_id; // npc task giver entity id (sent in selection window)
|
|
||||||
uint32_t task_id;
|
|
||||||
float reward_multiplier; // added after titanium (sent in selection window)
|
|
||||||
};
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
// Old struct not used by Task System implementation but left for reference
|
// Old struct not used by Task System implementation but left for reference
|
||||||
@@ -3869,7 +3817,7 @@ struct TaskHistory_Struct {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct AcceptNewTask_Struct {
|
struct AcceptNewTask_Struct {
|
||||||
uint32 task_type; // type sent in selection window
|
uint32 unknown00;
|
||||||
uint32 task_id; //set to 0 for 'decline'
|
uint32 task_id; //set to 0 for 'decline'
|
||||||
uint32 task_master_id; //entity ID
|
uint32 task_master_id; //entity ID
|
||||||
};
|
};
|
||||||
@@ -4343,8 +4291,8 @@ struct AARankPrereq_Struct
|
|||||||
struct AARankEffect_Struct
|
struct AARankEffect_Struct
|
||||||
{
|
{
|
||||||
int32 effect_id;
|
int32 effect_id;
|
||||||
int32 base_value;
|
int32 base1;
|
||||||
int32 limit_value;
|
int32 base2;
|
||||||
int32 slot;
|
int32 slot;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4352,8 +4300,8 @@ struct AARankEffect_Struct
|
|||||||
|
|
||||||
struct AA_Ability {
|
struct AA_Ability {
|
||||||
/*00*/ uint32 skill_id;
|
/*00*/ uint32 skill_id;
|
||||||
/*04*/ uint32 base_value;
|
/*04*/ uint32 base1;
|
||||||
/*08*/ uint32 limit_value;
|
/*08*/ uint32 base2;
|
||||||
/*12*/ uint32 slot;
|
/*12*/ uint32 slot;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5582,23 +5530,6 @@ struct SayLinkBodyFrame_Struct {
|
|||||||
/*056*/
|
/*056*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UpdateMovementEntry {
|
|
||||||
/* 00 */ float Y;
|
|
||||||
/* 04 */ float X;
|
|
||||||
/* 08 */ float Z;
|
|
||||||
/* 12 */ uint8 type;
|
|
||||||
/* 13 */ unsigned int timestamp;
|
|
||||||
/* 17 */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UnderWorld {
|
|
||||||
/* 00 */ int spawn_id;
|
|
||||||
/* 04 */ float y;
|
|
||||||
/* 08 */ float x;
|
|
||||||
/* 12 */ float z;
|
|
||||||
/* 16 */
|
|
||||||
};
|
|
||||||
|
|
||||||
// Restore structure packing to default
|
// Restore structure packing to default
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|||||||
@@ -44,12 +44,6 @@ void EQEmuConfig::parse_config()
|
|||||||
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") { LoginLegacy = true; }
|
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") { LoginLegacy = true; }
|
||||||
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
|
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
|
||||||
LoginPassword = _root["server"]["world"]["loginserver"].get("password", "").asString();
|
LoginPassword = _root["server"]["world"]["loginserver"].get("password", "").asString();
|
||||||
|
|
||||||
// at least today, this is wrong a majority of the time
|
|
||||||
// remove this if eqemulator ever upgrades its loginserver
|
|
||||||
if (LoginHost.find("login.eqemulator.net") != std::string::npos) {
|
|
||||||
LoginLegacy = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char str[32];
|
char str[32];
|
||||||
@@ -68,13 +62,6 @@ void EQEmuConfig::parse_config()
|
|||||||
|
|
||||||
loginconfig->LoginLegacy = false;
|
loginconfig->LoginLegacy = false;
|
||||||
if (_root["server"]["world"][str].get("legacy", "0").asString() == "1") { loginconfig->LoginLegacy = true; }
|
if (_root["server"]["world"][str].get("legacy", "0").asString() == "1") { loginconfig->LoginLegacy = true; }
|
||||||
|
|
||||||
// at least today, this is wrong a majority of the time
|
|
||||||
// remove this if eqemulator ever upgrades its loginserver
|
|
||||||
if (loginconfig->LoginHost.find("login.eqemulator.net") != std::string::npos) {
|
|
||||||
loginconfig->LoginLegacy = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
loginlist.Insert(loginconfig);
|
loginlist.Insert(loginconfig);
|
||||||
} while (LoginCount < 100);
|
} while (LoginCount < 100);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-85
@@ -22,8 +22,8 @@
|
|||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "string_util.h"
|
#include "string_util.h"
|
||||||
|
#include "database.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "repositories/logsys_categories_repository.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -31,7 +31,6 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
std::ofstream process_log;
|
std::ofstream process_log;
|
||||||
|
|
||||||
@@ -97,7 +96,7 @@ EQEmuLogSys::EQEmuLogSys()
|
|||||||
*/
|
*/
|
||||||
EQEmuLogSys::~EQEmuLogSys() = default;
|
EQEmuLogSys::~EQEmuLogSys() = default;
|
||||||
|
|
||||||
EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get Executable platform currently running this code (Zone/World/etc)
|
* Get Executable platform currently running this code (Zone/World/etc)
|
||||||
@@ -129,9 +128,6 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
|||||||
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::Cheat].log_to_console = static_cast<uint8>(Logs::General);
|
|
||||||
log_settings[Logs::HTTP].log_to_console = static_cast<uint8>(Logs::General);
|
|
||||||
log_settings[Logs::HTTP].log_to_gmsay = static_cast<uint8>(Logs::General);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC 5424
|
* RFC 5424
|
||||||
@@ -181,8 +177,6 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
|||||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformHC) {
|
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformHC) {
|
||||||
platform_file_name = "hc";
|
platform_file_name = "hc";
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -237,11 +231,9 @@ void EQEmuLogSys::ProcessGMSay(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes that actually support hooks
|
* Check to see if the process that actually ran this is zone
|
||||||
*/
|
*/
|
||||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone ||
|
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) {
|
||||||
EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld
|
|
||||||
) {
|
|
||||||
on_log_gmsay_hook(log_category, message);
|
on_log_gmsay_hook(log_category, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,76 +601,3 @@ void EQEmuLogSys::EnableConsoleLogging()
|
|||||||
log_settings[log_index].is_category_enabled = 1;
|
log_settings[log_index].is_category_enabled = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
|
||||||
{
|
|
||||||
auto categories = LogsysCategoriesRepository::GetWhere(
|
|
||||||
*m_database,
|
|
||||||
"TRUE ORDER BY log_category_id"
|
|
||||||
);
|
|
||||||
|
|
||||||
// keep track of categories
|
|
||||||
std::vector<int> db_categories{};
|
|
||||||
db_categories.reserve(categories.size());
|
|
||||||
|
|
||||||
// loop through database categories
|
|
||||||
for (auto &c: categories) {
|
|
||||||
if (c.log_category_id <= Logs::None || c.log_category_id >= Logs::MaxCategoryID) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_settings[c.log_category_id].log_to_console = static_cast<uint8>(c.log_to_console);
|
|
||||||
log_settings[c.log_category_id].log_to_file = static_cast<uint8>(c.log_to_file);
|
|
||||||
log_settings[c.log_category_id].log_to_gmsay = static_cast<uint8>(c.log_to_gmsay);
|
|
||||||
|
|
||||||
// Determine if any output method is enabled for the category
|
|
||||||
// and set it to 1 so it can used to check if category is enabled
|
|
||||||
const bool log_to_console = log_settings[c.log_category_id].log_to_console > 0;
|
|
||||||
const bool log_to_file = log_settings[c.log_category_id].log_to_file > 0;
|
|
||||||
const bool log_to_gmsay = log_settings[c.log_category_id].log_to_gmsay > 0;
|
|
||||||
const bool is_category_enabled = log_to_console || log_to_file || log_to_gmsay;
|
|
||||||
|
|
||||||
if (is_category_enabled) {
|
|
||||||
log_settings[c.log_category_id].is_category_enabled = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This determines whether or not the process needs to actually file log anything.
|
|
||||||
// If we go through this whole loop and nothing is set to any debug level, there
|
|
||||||
// is no point to create a file or keep anything open
|
|
||||||
if (log_settings[c.log_category_id].log_to_file > 0) {
|
|
||||||
LogSys.file_logs_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
db_categories.emplace_back(c.log_category_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auto inject categories that don't exist in the database...
|
|
||||||
for (int i = Logs::AA; i != Logs::MaxCategoryID; i++) {
|
|
||||||
if (std::find(db_categories.begin(), db_categories.end(), i) == db_categories.end()) {
|
|
||||||
LogInfo(
|
|
||||||
"Automatically adding new log category [{0}]",
|
|
||||||
Logs::LogCategoryName[i]
|
|
||||||
);
|
|
||||||
|
|
||||||
auto new_category = LogsysCategoriesRepository::NewEntity();
|
|
||||||
new_category.log_category_id = i;
|
|
||||||
new_category.log_category_description = EscapeString(Logs::LogCategoryName[i]);
|
|
||||||
new_category.log_to_console = log_settings[i].log_to_console;
|
|
||||||
new_category.log_to_gmsay = log_settings[i].log_to_gmsay;
|
|
||||||
new_category.log_to_file = log_settings[i].log_to_file;
|
|
||||||
|
|
||||||
LogsysCategoriesRepository::InsertOne(*m_database, new_category);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInfo("Loaded [{}] log categories", categories.size());
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
EQEmuLogSys *EQEmuLogSys::SetDatabase(Database *db)
|
|
||||||
{
|
|
||||||
m_database = db;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|||||||
+78
-44
@@ -23,9 +23,8 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdio>
|
#include <stdio.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef utf16_to_utf8
|
#ifdef utf16_to_utf8
|
||||||
@@ -38,9 +37,9 @@
|
|||||||
|
|
||||||
namespace Logs {
|
namespace Logs {
|
||||||
enum DebugLevel {
|
enum DebugLevel {
|
||||||
General = 1, // 1 - Low-Level general debugging, useful info on single line
|
General = 1, /* 1 - Low-Level general debugging, useful info on single line */
|
||||||
Moderate, // 2 - Informational based, used in functions, when particular things load
|
Moderate, /* 2 - Informational based, used in functions, when particular things load */
|
||||||
Detail // 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication
|
Detail /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,18 +121,13 @@ namespace Logs {
|
|||||||
Expeditions,
|
Expeditions,
|
||||||
DynamicZones,
|
DynamicZones,
|
||||||
Scheduler,
|
Scheduler,
|
||||||
Cheat,
|
|
||||||
ClientList,
|
|
||||||
DiaWind,
|
|
||||||
HTTP,
|
|
||||||
Saylink,
|
|
||||||
MaxCategoryID /* Don't Remove this */
|
MaxCategoryID /* Don't Remove this */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you add to this, make sure you update LogCategory
|
* If you add to this, make sure you update LogCategory
|
||||||
*/
|
*/
|
||||||
static const char *LogCategoryName[LogCategory::MaxCategoryID] = {
|
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
||||||
"",
|
"",
|
||||||
"AA",
|
"AA",
|
||||||
"AI",
|
"AI",
|
||||||
@@ -207,18 +201,11 @@ namespace Logs {
|
|||||||
"Expeditions",
|
"Expeditions",
|
||||||
"DynamicZones",
|
"DynamicZones",
|
||||||
"Scheduler",
|
"Scheduler",
|
||||||
"Cheat",
|
|
||||||
"ClientList",
|
|
||||||
"DialogueWindow",
|
|
||||||
"HTTP",
|
|
||||||
"Saylink",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "eqemu_logsys_log_aliases.h"
|
#include "eqemu_logsys_log_aliases.h"
|
||||||
|
|
||||||
class Database;
|
|
||||||
|
|
||||||
class EQEmuLogSys {
|
class EQEmuLogSys {
|
||||||
public:
|
public:
|
||||||
EQEmuLogSys();
|
EQEmuLogSys();
|
||||||
@@ -229,8 +216,7 @@ public:
|
|||||||
* This should be handled on deconstructor but to be safe we use it anyways.
|
* This should be handled on deconstructor but to be safe we use it anyways.
|
||||||
*/
|
*/
|
||||||
void CloseFileLogs();
|
void CloseFileLogs();
|
||||||
EQEmuLogSys *LoadLogSettingsDefaults();
|
void LoadLogSettingsDefaults();
|
||||||
EQEmuLogSys *LoadLogDatabaseSettings();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param directory_name
|
* @param directory_name
|
||||||
@@ -260,7 +246,7 @@ public:
|
|||||||
* Used in file logs to prepend a timestamp entry for logs
|
* Used in file logs to prepend a timestamp entry for logs
|
||||||
* @param time_stamp
|
* @param time_stamp
|
||||||
*/
|
*/
|
||||||
void SetCurrentTimeStamp(char *time_stamp);
|
void SetCurrentTimeStamp(char* time_stamp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param log_name
|
* @param log_name
|
||||||
@@ -287,53 +273,101 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Internally used memory reference for all log settings per category
|
* Internally used memory reference for all log settings per category
|
||||||
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
|
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
|
||||||
* Database loaded via LogSys.SetDatabase(&database)->LoadLogDatabaseSettings();
|
* Database loaded via Database::LoadLogSettings(log_settings)
|
||||||
*/
|
*/
|
||||||
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
|
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
|
||||||
|
|
||||||
bool file_logs_enabled = false;
|
bool file_logs_enabled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets Executable platform (Zone/World/UCS) etc.
|
||||||
|
*/
|
||||||
int log_platform = 0;
|
int log_platform = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File name used in writing logs
|
||||||
|
*/
|
||||||
std::string platform_file_name;
|
std::string platform_file_name;
|
||||||
|
|
||||||
|
/**
|
||||||
// gmsay
|
* GMSay Client Message colors mapped by category
|
||||||
|
*
|
||||||
|
* @param log_category
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
uint16 GetGMSayColorFromCategory(uint16 log_category);
|
uint16 GetGMSayColorFromCategory(uint16 log_category);
|
||||||
|
|
||||||
EQEmuLogSys * SetGMSayHandler(std::function<void(uint16 log_type, const std::string &)> f) {
|
/**
|
||||||
on_log_gmsay_hook = f;
|
* @param f
|
||||||
return this;
|
*/
|
||||||
}
|
void SetGMSayHandler(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
|
||||||
|
|
||||||
// console
|
/**
|
||||||
void SetConsoleHandler(
|
* @param f
|
||||||
std::function<void(
|
*/
|
||||||
uint16 debug_level,
|
void SetConsoleHandler(std::function<void(uint16 debug_level, uint16 log_type, const std::string&)> f) { on_log_console_hook = f; }
|
||||||
uint16 log_type,
|
|
||||||
const std::string &
|
/**
|
||||||
)> f
|
* Silence console logging
|
||||||
) { on_log_console_hook = f; }
|
*/
|
||||||
void SilenceConsoleLogging();
|
void SilenceConsoleLogging();
|
||||||
void EnableConsoleLogging();
|
|
||||||
|
|
||||||
// database
|
/**
|
||||||
EQEmuLogSys *SetDatabase(Database *db);
|
* Turn on all console logging
|
||||||
|
*/
|
||||||
|
void EnableConsoleLogging();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// reference to database
|
/**
|
||||||
Database *m_database;
|
* Callback pointer to zone process for hooking logs to zone using GMSay
|
||||||
|
*/
|
||||||
std::function<void(uint16 log_category, const std::string &)> on_log_gmsay_hook;
|
std::function<void(uint16 log_category, const std::string&)> on_log_gmsay_hook;
|
||||||
std::function<void(uint16 debug_level, uint16 log_category, const std::string &)> on_log_console_hook;
|
std::function<void(uint16 debug_level, uint16 log_category, const std::string&)> on_log_console_hook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats log messages like '[Category] This is a log message'
|
||||||
|
*/
|
||||||
std::string FormatOutMessageString(uint16 log_category, const std::string &in_message);
|
std::string FormatOutMessageString(uint16 log_category, const std::string &in_message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Linux console color messages mapped by category
|
||||||
|
*
|
||||||
|
* @param log_category
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
std::string GetLinuxConsoleColorFromCategory(uint16 log_category);
|
std::string GetLinuxConsoleColorFromCategory(uint16 log_category);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Windows console color messages mapped by category
|
||||||
|
*/
|
||||||
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category);
|
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param debug_level
|
||||||
|
* @param log_category
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message);
|
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param debug_level
|
||||||
|
* @param log_category
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message);
|
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param debug_level
|
||||||
|
* @param log_category
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message);
|
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param log_category
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
bool IsRfc5424LogCategory(uint16 log_category);
|
bool IsRfc5424LogCategory(uint16 log_category);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -646,56 +646,6 @@
|
|||||||
OutF(LogSys, Logs::Detail, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
OutF(LogSys, Logs::Detail, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define LogCheat(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::Cheat].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::General, Logs::Cheat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogCheatDetail(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::Cheat].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::Cheat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogClientList(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::ClientList].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::General, Logs::ClientList, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogClientListDetail(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::ClientList].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::ClientList, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogDiaWind(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::DiaWind].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::General, Logs::DiaWind, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogDiaWindDetail(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::DiaWind].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::DiaWind, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogHTTP(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::HTTP].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::General, Logs::HTTP, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogHTTPDetail(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::HTTP].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::HTTP, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogSaylink(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::Saylink].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::General, Logs::Saylink, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogSaylinkDetail(message, ...) do {\
|
|
||||||
if (LogSys.log_settings[Logs::Saylink].is_category_enabled == 1)\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::Saylink, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define Log(debug_level, log_category, message, ...) do {\
|
#define Log(debug_level, log_category, message, ...) do {\
|
||||||
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
||||||
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
@@ -1068,30 +1018,6 @@
|
|||||||
#define LogDynamicZonesDetail(message, ...) do {\
|
#define LogDynamicZonesDetail(message, ...) do {\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define LogCheatList(message, ...) do {\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogCheatDetail(message, ...) do {\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogClientList(message, ...) do {\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogClientListDetail(message, ...) do {\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogDiaWind(message, ...) do {\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogDiaWindDetail(message, ...) do {\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogHTTP(message, ...) do {\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogHTTPDetail(message, ...) do {\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define Log(debug_level, log_category, message, ...) do {\
|
#define Log(debug_level, log_category, message, ...) do {\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include "expedition_base.h"
|
||||||
|
#include "repositories/expeditions_repository.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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#ifndef COMMON_EXPEDITION_BASE_H
|
||||||
|
#define COMMON_EXPEDITION_BASE_H
|
||||||
|
|
||||||
|
#include "dynamic_zone_base.h"
|
||||||
|
#include "repositories/expeditions_repository.h"
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
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; }
|
||||||
|
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 DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||||
|
|
||||||
|
void LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ExpeditionBase() = default;
|
||||||
|
ExpeditionBase(uint32_t id, const std::string& uuid, const std::string& expedition_name,
|
||||||
|
const DynamicZoneMember& leader);
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
+22
-22
@@ -20,31 +20,31 @@
|
|||||||
#include "races.h"
|
#include "races.h"
|
||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
|
|
||||||
const char *FactionValueToString(FACTION_VALUE faction_value)
|
const char *FactionValueToString(FACTION_VALUE fv)
|
||||||
{
|
{
|
||||||
switch (faction_value) {
|
switch (fv) {
|
||||||
case FACTION_ALLY:
|
case FACTION_ALLY:
|
||||||
return "Ally";
|
return ("Ally");
|
||||||
case FACTION_WARMLY:
|
case FACTION_WARMLY:
|
||||||
return "Warmly";
|
return ("Warmly");
|
||||||
case FACTION_KINDLY:
|
case FACTION_KINDLY:
|
||||||
return "Kindly";
|
return ("Kindly");
|
||||||
case FACTION_AMIABLY:
|
case FACTION_AMIABLE:
|
||||||
return "Amiably";
|
return ("Amiable");
|
||||||
case FACTION_INDIFFERENTLY:
|
case FACTION_INDIFFERENT:
|
||||||
return "Indifferently";
|
return ("Indifferent");
|
||||||
case FACTION_APPREHENSIVELY:
|
case FACTION_APPREHENSIVE:
|
||||||
return "Apprehensively";
|
return ("Apprehensive");
|
||||||
case FACTION_DUBIOUSLY:
|
case FACTION_DUBIOUS:
|
||||||
return "Dubiously";
|
return ("Dubious");
|
||||||
case FACTION_THREATENINGLY:
|
case FACTION_THREATENLY:
|
||||||
return "Threateningly";
|
return ("Threatenly");
|
||||||
case FACTION_SCOWLS:
|
case FACTION_SCOWLS:
|
||||||
return "Scowls";
|
return ("Scowls, ready to attack.");
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return "Unknown";
|
return ("Unknown Faction Con");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -70,19 +70,19 @@ FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value)
|
|||||||
return FACTION_KINDLY;
|
return FACTION_KINDLY;
|
||||||
}
|
}
|
||||||
if (character_value >= RuleI(Faction, AmiablyFactionMinimum)) {
|
if (character_value >= RuleI(Faction, AmiablyFactionMinimum)) {
|
||||||
return FACTION_AMIABLY;
|
return FACTION_AMIABLE;
|
||||||
}
|
}
|
||||||
if (character_value >= RuleI(Faction, IndifferentlyFactionMinimum)) {
|
if (character_value >= RuleI(Faction, IndifferentlyFactionMinimum)) {
|
||||||
return FACTION_INDIFFERENTLY;
|
return FACTION_INDIFFERENT;
|
||||||
}
|
}
|
||||||
if (character_value >= RuleI(Faction, ApprehensivelyFactionMinimum)) {
|
if (character_value >= RuleI(Faction, ApprehensivelyFactionMinimum)) {
|
||||||
return FACTION_APPREHENSIVELY;
|
return FACTION_APPREHENSIVE;
|
||||||
}
|
}
|
||||||
if (character_value >= RuleI(Faction, DubiouslyFactionMinimum)) {
|
if (character_value >= RuleI(Faction, DubiouslyFactionMinimum)) {
|
||||||
return FACTION_DUBIOUSLY;
|
return FACTION_DUBIOUS;
|
||||||
}
|
}
|
||||||
if (character_value >= RuleI(Faction, ThreateninglyFactionMinimum)) {
|
if (character_value >= RuleI(Faction, ThreateninglyFactionMinimum)) {
|
||||||
return FACTION_THREATENINGLY;
|
return FACTION_THREATENLY;
|
||||||
}
|
}
|
||||||
return FACTION_SCOWLS;
|
return FACTION_SCOWLS;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -27,13 +27,13 @@ enum FACTION_VALUE {
|
|||||||
FACTION_ALLY = 1,
|
FACTION_ALLY = 1,
|
||||||
FACTION_WARMLY = 2,
|
FACTION_WARMLY = 2,
|
||||||
FACTION_KINDLY = 3,
|
FACTION_KINDLY = 3,
|
||||||
FACTION_AMIABLY = 4,
|
FACTION_AMIABLE = 4,
|
||||||
|
|
||||||
FACTION_INDIFFERENTLY = 5,
|
FACTION_INDIFFERENT = 5,
|
||||||
|
|
||||||
FACTION_APPREHENSIVELY = 6,
|
FACTION_APPREHENSIVE = 6,
|
||||||
FACTION_DUBIOUSLY = 7,
|
FACTION_DUBIOUS = 7,
|
||||||
FACTION_THREATENINGLY = 8,
|
FACTION_THREATENLY = 8,
|
||||||
FACTION_SCOWLS = 9
|
FACTION_SCOWLS = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ struct NPCFactionList {
|
|||||||
struct FactionMods
|
struct FactionMods
|
||||||
{
|
{
|
||||||
int32 base;
|
int32 base;
|
||||||
int16 min; // The lowest your personal earned faction can go - before race/class/deity adjustments.
|
int16 min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
int16 max; // The highest your personal earned faction can go - before race/class/deity adjustments.
|
int16 max; // The highest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
int32 class_mod;
|
int32 class_mod;
|
||||||
int32 race_mod;
|
int32 race_mod;
|
||||||
int32 deity_mod;
|
int32 deity_mod;
|
||||||
@@ -61,8 +61,8 @@ struct Faction {
|
|||||||
int32 id;
|
int32 id;
|
||||||
std::map<std::string, int16> mods;
|
std::map<std::string, int16> mods;
|
||||||
int16 base;
|
int16 base;
|
||||||
int16 min; // The lowest your personal earned faction can go - before race/class/deity adjustments.
|
int16 min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
int16 max; // The highest your personal earned faction can go - before race/class/deity adjustments.
|
int16 max; // The highest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
char name[50];
|
char name[50];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,6 +75,6 @@ struct NPCFaction
|
|||||||
uint8 temp;
|
uint8 temp;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *FactionValueToString(FACTION_VALUE faction_value);
|
const char *FactionValueToString(FACTION_VALUE fv);
|
||||||
FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value);
|
FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -204,7 +204,7 @@ enum { //some random constants
|
|||||||
#define MIN_LEVEL_ALCHEMY 25
|
#define MIN_LEVEL_ALCHEMY 25
|
||||||
|
|
||||||
//chance ratio that a
|
//chance ratio that a
|
||||||
#define THREATENINGLY_AGGRO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly
|
#define THREATENLY_ARRGO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly
|
||||||
|
|
||||||
//max factions per npc faction list
|
//max factions per npc faction list
|
||||||
#define MAX_NPC_FACTIONS 20
|
#define MAX_NPC_FACTIONS 20
|
||||||
|
|||||||
@@ -65,8 +65,3 @@ void FileUtil::mkdir(const std::string& directory_name)
|
|||||||
::mkdir(directory_name.c_str(), 0755);
|
::mkdir(directory_name.c_str(), 0755);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool file_exists(const std::string& name) {
|
|
||||||
std::ifstream f(name.c_str());
|
|
||||||
return f.good();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -28,6 +28,5 @@ public:
|
|||||||
static void mkdir(const std::string& directory_name);
|
static void mkdir(const std::string& directory_name);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool file_exists(const std::string& name);
|
|
||||||
|
|
||||||
#endif //EQEMU_FILE_UTIL_H
|
#endif //EQEMU_FILE_UTIL_H
|
||||||
|
|||||||
+6
-66
@@ -63,7 +63,7 @@ bool BaseGuildManager::LoadGuilds() {
|
|||||||
for (auto row=results.begin();row!=results.end();++row)
|
for (auto row=results.begin();row!=results.end();++row)
|
||||||
_CreateGuild(atoi(row[0]), row[1], atoi(row[2]), atoi(row[3]), row[4], row[5], row[6], row[7]);
|
_CreateGuild(atoi(row[0]), row[1], atoi(row[2]), atoi(row[3]), row[4], row[5], row[6], row[7]);
|
||||||
|
|
||||||
query = "SELECT guild_id,`rank`,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks";
|
query = "SELECT guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks";
|
||||||
results = m_db->QueryDatabase(query);
|
results = m_db->QueryDatabase(query);
|
||||||
|
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
@@ -131,7 +131,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
|
|||||||
|
|
||||||
info = _CreateGuild(guild_id, row[0], atoi(row[1]), atoi(row[2]), row[3], row[4], row[5], row[6]);
|
info = _CreateGuild(guild_id, row[0], atoi(row[1]), atoi(row[2]), row[3], row[4], row[5], row[6]);
|
||||||
|
|
||||||
query = StringFormat("SELECT guild_id, `rank`, title, can_hear, can_speak, can_invite, can_remove, can_promote, can_demote, can_motd, can_warpeace "
|
query = StringFormat("SELECT guild_id, rank, title, can_hear, can_speak, can_invite, can_remove, can_promote, can_demote, can_motd, can_warpeace "
|
||||||
"FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id);
|
"FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id);
|
||||||
results = m_db->QueryDatabase(query);
|
results = m_db->QueryDatabase(query);
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) {
|
|||||||
m_db->DoEscapeString(title_esc, rankInfo.name.c_str(), rankInfo.name.length());
|
m_db->DoEscapeString(title_esc, rankInfo.name.c_str(), rankInfo.name.length());
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO guild_ranks "
|
query = StringFormat("INSERT INTO guild_ranks "
|
||||||
"(guild_id,`rank`,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace)"
|
"(guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace)"
|
||||||
" VALUES(%d,%d,'%s',%d,%d,%d,%d,%d,%d,%d,%d)",
|
" VALUES(%d,%d,'%s',%d,%d,%d,%d,%d,%d,%d,%d)",
|
||||||
guild_id, rank, title_esc,
|
guild_id, rank, title_esc,
|
||||||
rankInfo.permissions[GUILD_HEAR],
|
rankInfo.permissions[GUILD_HEAR],
|
||||||
@@ -738,7 +738,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
|
|||||||
std::string query;
|
std::string query;
|
||||||
|
|
||||||
if(guild_id != GUILD_NONE) {
|
if(guild_id != GUILD_NONE) {
|
||||||
query = StringFormat("REPLACE INTO guild_members (char_id,guild_id,`rank`,public_note) VALUES(%d,%d,%d,'')", charid, guild_id, rank);
|
query = StringFormat("REPLACE INTO guild_members (char_id,guild_id,rank,public_note) VALUES(%d,%d,%d,'')", charid, guild_id, rank);
|
||||||
auto results = m_db->QueryDatabase(query);
|
auto results = m_db->QueryDatabase(query);
|
||||||
|
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
@@ -758,7 +758,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool BaseGuildManager::DBSetGuildRank(uint32 charid, uint8 rank) {
|
bool BaseGuildManager::DBSetGuildRank(uint32 charid, uint8 rank) {
|
||||||
std::string query = StringFormat("UPDATE guild_members SET `rank`=%d WHERE char_id=%d", rank, charid);
|
std::string query = StringFormat("UPDATE guild_members SET rank=%d WHERE char_id=%d", rank, charid);
|
||||||
return(QueryWithLogging(query, "setting a guild member's rank"));
|
return(QueryWithLogging(query, "setting a guild member's rank"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1208,7 +1208,7 @@ BaseGuildManager::RankInfo::RankInfo() {
|
|||||||
|
|
||||||
BaseGuildManager::GuildInfo::GuildInfo() {
|
BaseGuildManager::GuildInfo::GuildInfo() {
|
||||||
leader_char_id = 0;
|
leader_char_id = 0;
|
||||||
minstatus = AccountStatus::Player;
|
minstatus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID)
|
uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID)
|
||||||
@@ -1225,66 +1225,6 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID)
|
|||||||
return results.RowCount();
|
return results.RowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BaseGuildManager::GetGuildNameByID(uint32 guild_id) const {
|
|
||||||
if(guild_id == GUILD_NONE) {
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<uint32, GuildInfo *>::const_iterator res;
|
|
||||||
res = m_guilds.find(guild_id);
|
|
||||||
if(res == m_guilds.end()) {
|
|
||||||
return "Invalid Guild";
|
|
||||||
}
|
|
||||||
|
|
||||||
return res->second->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string BaseGuildManager::GetGuildRankName(uint32 guild_id, uint8 rank) const
|
|
||||||
{
|
|
||||||
if(rank > GUILD_MAX_RANK) {
|
|
||||||
return "Invalid Rank";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<uint32, GuildInfo *>::const_iterator res;
|
|
||||||
res = m_guilds.find(guild_id);
|
|
||||||
if(res == m_guilds.end()) {
|
|
||||||
return "Invalid Guild Rank";
|
|
||||||
}
|
|
||||||
|
|
||||||
return res->second->ranks[rank].name;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 BaseGuildManager::GetGuildIDByCharacterID(uint32 character_id)
|
|
||||||
{
|
|
||||||
if(!m_db) {
|
|
||||||
return GUILD_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string query = fmt::format(
|
|
||||||
"SELECT `guild_id` FROM `guild_members` WHERE char_id = {} LIMIT 1",
|
|
||||||
character_id
|
|
||||||
);
|
|
||||||
auto results = m_db->QueryDatabase(query);
|
|
||||||
if(!results.Success() || !results.RowCount()) {
|
|
||||||
return GUILD_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
auto guild_id = std::stoul(row[0]);
|
|
||||||
return guild_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BaseGuildManager::IsCharacterInGuild(uint32 character_id, uint32 guild_id)
|
|
||||||
{
|
|
||||||
auto current_guild_id = GetGuildIDByCharacterID(character_id);
|
|
||||||
|
|
||||||
if (current_guild_id == GUILD_NONE) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guild_id && current_guild_id != guild_id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -76,12 +76,8 @@ class BaseGuildManager
|
|||||||
bool GetGuildChannel(uint32 GuildID, char *ChannelBuffer) const;
|
bool GetGuildChannel(uint32 GuildID, char *ChannelBuffer) const;
|
||||||
const char *GetRankName(uint32 guild_id, uint8 rank) const;
|
const char *GetRankName(uint32 guild_id, uint8 rank) const;
|
||||||
const char *GetGuildName(uint32 guild_id) const;
|
const char *GetGuildName(uint32 guild_id) const;
|
||||||
std::string GetGuildNameByID(uint32 guild_id) const;
|
|
||||||
std::string GetGuildRankName(uint32 guild_id, uint8 rank) const;
|
|
||||||
bool IsCharacterInGuild(uint32 character_id, uint32 guild_id = 0);
|
|
||||||
bool GetGuildNameByID(uint32 guild_id, std::string &into) const;
|
bool GetGuildNameByID(uint32 guild_id, std::string &into) const;
|
||||||
uint32 GetGuildIDByName(const char *GuildName);
|
uint32 GetGuildIDByName(const char *GuildName);
|
||||||
uint32 GetGuildIDByCharacterID(uint32 character_id);
|
|
||||||
bool IsGuildLeader(uint32 guild_id, uint32 char_id) const;
|
bool IsGuildLeader(uint32 guild_id, uint32 char_id) const;
|
||||||
uint8 GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 char_id) const;
|
uint8 GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 char_id) const;
|
||||||
bool CheckGMStatus(uint32 guild_id, uint8 status) const;
|
bool CheckGMStatus(uint32 guild_id, uint8 status) const;
|
||||||
|
|||||||
+1418
-6387
File diff suppressed because it is too large
Load Diff
@@ -1,633 +0,0 @@
|
|||||||
// Copyright (C) 2015 Ben Lewis <benjf5+github@gmail.com>
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
// https://github.com/ben-zen/uri-library
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cctype>
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
class uri {
|
|
||||||
/* URIs are broadly divided into two categories: hierarchical and
|
|
||||||
* non-hierarchical. Both hierarchical URIs and non-hierarchical URIs have a
|
|
||||||
* few elements in common; all URIs have a scheme of one or more alphanumeric
|
|
||||||
* characters followed by a colon, and they all may optionally have a query
|
|
||||||
* component preceded by a question mark, and a fragment component preceded by
|
|
||||||
* an octothorpe (hash mark: '#'). The query consists of stanzas separated by
|
|
||||||
* either ampersands ('&') or semicolons (';') (but only one or the other),
|
|
||||||
* and each stanza consists of a key and an optional value; if the value
|
|
||||||
* exists, the key and value must be divided by an equals sign.
|
|
||||||
*
|
|
||||||
* The following is an example from Wikipedia of a hierarchical URI:
|
|
||||||
* scheme:[//[user:password@]domain[:port]][/]path[?query][#fragment]
|
|
||||||
*/
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
enum class scheme_category {
|
|
||||||
Hierarchical,
|
|
||||||
NonHierarchical
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class component {
|
|
||||||
Scheme,
|
|
||||||
Content,
|
|
||||||
Username,
|
|
||||||
Password,
|
|
||||||
Host,
|
|
||||||
Port,
|
|
||||||
Path,
|
|
||||||
Query,
|
|
||||||
Fragment
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class query_argument_separator {
|
|
||||||
ampersand,
|
|
||||||
semicolon
|
|
||||||
};
|
|
||||||
|
|
||||||
uri(
|
|
||||||
char const *uri_text, scheme_category category = scheme_category::Hierarchical,
|
|
||||||
query_argument_separator separator = query_argument_separator::ampersand
|
|
||||||
) :
|
|
||||||
m_category(category),
|
|
||||||
m_path_is_rooted(false),
|
|
||||||
m_port(0),
|
|
||||||
m_separator(separator)
|
|
||||||
{
|
|
||||||
setup(std::string(uri_text), category);
|
|
||||||
};
|
|
||||||
|
|
||||||
uri(
|
|
||||||
std::string const &uri_text, scheme_category category = scheme_category::Hierarchical,
|
|
||||||
query_argument_separator separator = query_argument_separator::ampersand
|
|
||||||
) :
|
|
||||||
m_category(category),
|
|
||||||
m_path_is_rooted(false),
|
|
||||||
m_port(0),
|
|
||||||
m_separator(separator)
|
|
||||||
{
|
|
||||||
setup(uri_text, category);
|
|
||||||
};
|
|
||||||
|
|
||||||
uri(
|
|
||||||
std::map<component, std::string> const &components,
|
|
||||||
scheme_category category,
|
|
||||||
bool rooted_path,
|
|
||||||
query_argument_separator separator = query_argument_separator::ampersand
|
|
||||||
) :
|
|
||||||
m_category(category),
|
|
||||||
m_path_is_rooted(rooted_path),
|
|
||||||
m_separator(separator)
|
|
||||||
{
|
|
||||||
if (components.count(component::Scheme)) {
|
|
||||||
if (components.at(component::Scheme).length() == 0) {
|
|
||||||
throw std::invalid_argument("Scheme cannot be empty.");
|
|
||||||
}
|
|
||||||
m_scheme = components.at(component::Scheme);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw std::invalid_argument("A URI must have a scheme.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (category == scheme_category::Hierarchical) {
|
|
||||||
if (components.count(component::Content)) {
|
|
||||||
throw std::invalid_argument("The content component is only for use in non-hierarchical URIs.");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool has_username = components.count(component::Username);
|
|
||||||
bool has_password = components.count(component::Password);
|
|
||||||
if (has_username && has_password) {
|
|
||||||
m_username = components.at(component::Username);
|
|
||||||
m_password = components.at(component::Password);
|
|
||||||
}
|
|
||||||
else if ((has_username && !has_password) || (!has_username && has_password)) {
|
|
||||||
throw std::invalid_argument("If a username or password is supplied, both must be provided.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (components.count(component::Host)) {
|
|
||||||
m_host = components.at(component::Host);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (components.count(component::Port)) {
|
|
||||||
m_port = std::stoul(components.at(component::Port));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (components.count(component::Path)) {
|
|
||||||
m_path = components.at(component::Path);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw std::invalid_argument("A path is required on a hierarchical URI, even an empty path.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (components.count(component::Username)
|
|
||||||
|| components.count(component::Password)
|
|
||||||
|| components.count(component::Host)
|
|
||||||
|| components.count(component::Port)
|
|
||||||
|| components.count(component::Path)) {
|
|
||||||
throw std::invalid_argument("None of the hierarchical components are allowed in a non-hierarchical URI.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (components.count(component::Content)) {
|
|
||||||
m_content = components.at(component::Content);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw std::invalid_argument(
|
|
||||||
"Content is a required component for a non-hierarchical URI, even an empty string."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (components.count(component::Query)) {
|
|
||||||
m_query = components.at(component::Query);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (components.count(component::Fragment)) {
|
|
||||||
m_fragment = components.at(component::Fragment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uri(uri const &other, std::map<component, std::string> const &replacements) :
|
|
||||||
m_category(other.m_category),
|
|
||||||
m_path_is_rooted(other.m_path_is_rooted),
|
|
||||||
m_separator(other.m_separator)
|
|
||||||
{
|
|
||||||
m_scheme = (replacements.count(component::Scheme))
|
|
||||||
? replacements.at(component::Scheme) : other.m_scheme;
|
|
||||||
|
|
||||||
if (m_category == scheme_category::Hierarchical) {
|
|
||||||
m_username = (replacements.count(component::Username))
|
|
||||||
? replacements.at(component::Username) : other.m_username;
|
|
||||||
|
|
||||||
m_password = (replacements.count(component::Password))
|
|
||||||
? replacements.at(component::Password) : other.m_password;
|
|
||||||
|
|
||||||
m_host = (replacements.count(component::Host))
|
|
||||||
? replacements.at(component::Host) : other.m_host;
|
|
||||||
|
|
||||||
m_port = (replacements.count(component::Port))
|
|
||||||
? std::stoul(replacements.at(component::Port)) : other.m_port;
|
|
||||||
|
|
||||||
m_path = (replacements.count(component::Path))
|
|
||||||
? replacements.at(component::Path) : other.m_path;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_content = (replacements.count(component::Content))
|
|
||||||
? replacements.at(component::Content) : other.m_content;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_query = (replacements.count(component::Query))
|
|
||||||
? replacements.at(component::Query) : other.m_query;
|
|
||||||
|
|
||||||
m_fragment = (replacements.count(component::Fragment))
|
|
||||||
? replacements.at(component::Fragment) : other.m_fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy constructor; just use the copy assignment operator internally.
|
|
||||||
uri(uri const &other)
|
|
||||||
{
|
|
||||||
*this = other;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Copy assignment operator
|
|
||||||
uri &operator=(uri const &other)
|
|
||||||
{
|
|
||||||
if (this != &other) {
|
|
||||||
m_scheme = other.m_scheme;
|
|
||||||
m_content = other.m_content;
|
|
||||||
m_username = other.m_username;
|
|
||||||
m_password = other.m_password;
|
|
||||||
m_host = other.m_host;
|
|
||||||
m_path = other.m_path;
|
|
||||||
m_query = other.m_query;
|
|
||||||
m_fragment = other.m_fragment;
|
|
||||||
m_query_dict = other.m_query_dict;
|
|
||||||
m_category = other.m_category;
|
|
||||||
m_port = other.m_port;
|
|
||||||
m_path_is_rooted = other.m_path_is_rooted;
|
|
||||||
m_separator = other.m_separator;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
~uri() {};
|
|
||||||
|
|
||||||
std::string const &get_scheme() const
|
|
||||||
{
|
|
||||||
return m_scheme;
|
|
||||||
};
|
|
||||||
|
|
||||||
scheme_category get_scheme_category() const
|
|
||||||
{
|
|
||||||
return m_category;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string const &get_content() const
|
|
||||||
{
|
|
||||||
if (m_category != scheme_category::NonHierarchical) {
|
|
||||||
throw std::domain_error("The content component is only valid for non-hierarchical URIs.");
|
|
||||||
}
|
|
||||||
return m_content;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string const &get_username() const
|
|
||||||
{
|
|
||||||
if (m_category != scheme_category::Hierarchical) {
|
|
||||||
throw std::domain_error("The username component is only valid for hierarchical URIs.");
|
|
||||||
}
|
|
||||||
return m_username;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string const &get_password() const
|
|
||||||
{
|
|
||||||
if (m_category != scheme_category::Hierarchical) {
|
|
||||||
throw std::domain_error("The password component is only valid for hierarchical URIs.");
|
|
||||||
}
|
|
||||||
return m_password;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string const &get_host() const
|
|
||||||
{
|
|
||||||
if (m_category != scheme_category::Hierarchical) {
|
|
||||||
throw std::domain_error("The host component is only valid for hierarchical URIs.");
|
|
||||||
}
|
|
||||||
return m_host;
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned long get_port() const
|
|
||||||
{
|
|
||||||
if (m_category != scheme_category::Hierarchical) {
|
|
||||||
throw std::domain_error("The port component is only valid for hierarchical URIs.");
|
|
||||||
}
|
|
||||||
return m_port;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string const &get_path() const
|
|
||||||
{
|
|
||||||
if (m_category != scheme_category::Hierarchical) {
|
|
||||||
throw std::domain_error("The path component is only valid for hierarchical URIs.");
|
|
||||||
}
|
|
||||||
return m_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string const &get_query() const
|
|
||||||
{
|
|
||||||
return m_query;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::map<std::string, std::string> const &get_query_dictionary() const
|
|
||||||
{
|
|
||||||
return m_query_dict;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string const &get_fragment() const
|
|
||||||
{
|
|
||||||
return m_fragment;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string to_string() const
|
|
||||||
{
|
|
||||||
std::string full_uri;
|
|
||||||
full_uri.append(m_scheme);
|
|
||||||
full_uri.append(":");
|
|
||||||
|
|
||||||
if (m_content.length() > m_path.length()) {
|
|
||||||
full_uri.append("//");
|
|
||||||
if (!(m_username.empty() || m_password.empty())) {
|
|
||||||
full_uri.append(m_username);
|
|
||||||
full_uri.append(":");
|
|
||||||
full_uri.append(m_password);
|
|
||||||
full_uri.append("@");
|
|
||||||
}
|
|
||||||
|
|
||||||
full_uri.append(m_host);
|
|
||||||
|
|
||||||
if (m_port != 0) {
|
|
||||||
full_uri.append(":");
|
|
||||||
full_uri.append(std::to_string(m_port));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_path_is_rooted) {
|
|
||||||
full_uri.append("/");
|
|
||||||
}
|
|
||||||
full_uri.append(m_path);
|
|
||||||
|
|
||||||
if (!m_query.empty()) {
|
|
||||||
full_uri.append("?");
|
|
||||||
full_uri.append(m_query);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_fragment.empty()) {
|
|
||||||
full_uri.append("#");
|
|
||||||
full_uri.append(m_fragment);
|
|
||||||
}
|
|
||||||
|
|
||||||
return full_uri;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void setup(std::string const &uri_text, scheme_category category)
|
|
||||||
{
|
|
||||||
size_t const uri_length = uri_text.length();
|
|
||||||
|
|
||||||
if (uri_length == 0) {
|
|
||||||
throw std::invalid_argument("URIs cannot be of zero length.");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string::const_iterator cursor = parse_scheme(
|
|
||||||
uri_text,
|
|
||||||
uri_text.begin());
|
|
||||||
// After calling parse_scheme, *cursor == ':'; none of the following parsers
|
|
||||||
// expect a separator character, so we advance the cursor upon calling them.
|
|
||||||
cursor = parse_content(uri_text, (cursor + 1));
|
|
||||||
|
|
||||||
if ((cursor != uri_text.end()) && (*cursor == '?')) {
|
|
||||||
cursor = parse_query(uri_text, (cursor + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((cursor != uri_text.end()) && (*cursor == '#')) {
|
|
||||||
cursor = parse_fragment(uri_text, (cursor + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
init_query_dictionary(); // If the query string is empty, this will be empty too.
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string::const_iterator parse_scheme(
|
|
||||||
std::string const &uri_text,
|
|
||||||
std::string::const_iterator scheme_start
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::string::const_iterator scheme_end = scheme_start;
|
|
||||||
while ((scheme_end != uri_text.end()) && (*scheme_end != ':')) {
|
|
||||||
if (!(std::isalnum(*scheme_end) || (*scheme_end == '-')
|
|
||||||
|| (*scheme_end == '+') || (*scheme_end == '.'))) {
|
|
||||||
throw std::invalid_argument(
|
|
||||||
"Invalid character found in the scheme component. Supplied URI was: \""
|
|
||||||
+ uri_text + "\"."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
++scheme_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scheme_end == uri_text.end()) {
|
|
||||||
throw std::invalid_argument(
|
|
||||||
"End of URI found while parsing the scheme. Supplied URI was: \""
|
|
||||||
+ uri_text + "\"."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scheme_start == scheme_end) {
|
|
||||||
throw std::invalid_argument(
|
|
||||||
"Scheme component cannot be zero-length. Supplied URI was: \""
|
|
||||||
+ uri_text + "\"."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_scheme = std::move(std::string(scheme_start, scheme_end));
|
|
||||||
return scheme_end;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string::const_iterator parse_content(
|
|
||||||
std::string const &uri_text,
|
|
||||||
std::string::const_iterator content_start
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::string::const_iterator content_end = content_start;
|
|
||||||
while ((content_end != uri_text.end()) && (*content_end != '?') && (*content_end != '#')) {
|
|
||||||
++content_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_content = std::move(std::string(content_start, content_end));
|
|
||||||
|
|
||||||
if ((m_category == scheme_category::Hierarchical) && (m_content.length() > 0)) {
|
|
||||||
// If it's a hierarchical URI, the content should be parsed for the hierarchical components.
|
|
||||||
std::string::const_iterator path_start = m_content.begin();
|
|
||||||
std::string::const_iterator path_end = m_content.end();
|
|
||||||
if (!m_content.compare(0, 2, "//")) {
|
|
||||||
// In this case an authority component is present.
|
|
||||||
std::string::const_iterator authority_cursor = (m_content.begin() + 2);
|
|
||||||
if (m_content.find_first_of('@') != std::string::npos) {
|
|
||||||
std::string::const_iterator userpass_divider = parse_username(
|
|
||||||
uri_text,
|
|
||||||
m_content,
|
|
||||||
authority_cursor
|
|
||||||
);
|
|
||||||
authority_cursor = parse_password(uri_text, m_content, (userpass_divider + 1));
|
|
||||||
// After this call, *authority_cursor == '@', so we skip over it.
|
|
||||||
++authority_cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
authority_cursor = parse_host(uri_text, m_content, authority_cursor);
|
|
||||||
|
|
||||||
if ((authority_cursor != m_content.end()) && (*authority_cursor == ':')) {
|
|
||||||
authority_cursor = parse_port(uri_text, m_content, (authority_cursor + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((authority_cursor != m_content.end()) && (*authority_cursor == '/')) {
|
|
||||||
// Then the path is rooted, and we should note this.
|
|
||||||
m_path_is_rooted = true;
|
|
||||||
path_start = authority_cursor + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we've reached the end and no path is present then set path_start
|
|
||||||
// to the end.
|
|
||||||
if (authority_cursor == m_content.end()) {
|
|
||||||
path_start = m_content.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!m_content.compare(0, 1, "/")) {
|
|
||||||
m_path_is_rooted = true;
|
|
||||||
++path_start;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We can now build the path based on what remains in the content string,
|
|
||||||
// since that's all that exists after the host and optional port component.
|
|
||||||
m_path = std::move(std::string(path_start, path_end));
|
|
||||||
}
|
|
||||||
return content_end;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string::const_iterator parse_username(
|
|
||||||
std::string const &uri_text,
|
|
||||||
std::string const &content,
|
|
||||||
std::string::const_iterator username_start
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::string::const_iterator username_end = username_start;
|
|
||||||
// Since this is only reachable when '@' was in the content string, we can
|
|
||||||
// ignore the end-of-string case.
|
|
||||||
while (*username_end != ':') {
|
|
||||||
if (*username_end == '@') {
|
|
||||||
throw std::invalid_argument(
|
|
||||||
"Username must be followed by a password. Supplied URI was: \""
|
|
||||||
+ uri_text + "\"."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
++username_end;
|
|
||||||
}
|
|
||||||
m_username = std::move(std::string(username_start, username_end));
|
|
||||||
return username_end;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string::const_iterator parse_password(
|
|
||||||
std::string const &uri_text,
|
|
||||||
std::string const &content,
|
|
||||||
std::string::const_iterator password_start
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::string::const_iterator password_end = password_start;
|
|
||||||
while (*password_end != '@') {
|
|
||||||
++password_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_password = std::move(std::string(password_start, password_end));
|
|
||||||
return password_end;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string::const_iterator parse_host(
|
|
||||||
std::string const &uri_text,
|
|
||||||
std::string const &content,
|
|
||||||
std::string::const_iterator host_start
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::string::const_iterator host_end = host_start;
|
|
||||||
// So, the host can contain a few things. It can be a domain, it can be an
|
|
||||||
// IPv4 address, it can be an IPv6 address, or an IPvFuture literal. In the
|
|
||||||
// case of those last two, it's of the form [...] where what's between the
|
|
||||||
// brackets is a matter of which IPv?? version it is.
|
|
||||||
while (host_end != content.end()) {
|
|
||||||
if (*host_end == '[') {
|
|
||||||
// We're parsing an IPv6 or IPvFuture address, so we should handle that
|
|
||||||
// instead of the normal procedure.
|
|
||||||
while ((host_end != content.end()) && (*host_end != ']')) {
|
|
||||||
++host_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (host_end == content.end()) {
|
|
||||||
throw std::invalid_argument(
|
|
||||||
"End of content component encountered "
|
|
||||||
"while parsing the host component. "
|
|
||||||
"Supplied URI was: \""
|
|
||||||
+ uri_text + "\"."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
++host_end;
|
|
||||||
break;
|
|
||||||
// We can stop looping, we found the end of the IP literal, which is the
|
|
||||||
// whole of the host component when one's in use.
|
|
||||||
}
|
|
||||||
else if ((*host_end == ':') || (*host_end == '/')) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
++host_end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_host = std::move(std::string(host_start, host_end));
|
|
||||||
return host_end;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string::const_iterator parse_port(
|
|
||||||
std::string const &uri_text,
|
|
||||||
std::string const &content,
|
|
||||||
std::string::const_iterator port_start
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::string::const_iterator port_end = port_start;
|
|
||||||
while ((port_end != content.end()) && (*port_end != '/')) {
|
|
||||||
if (!std::isdigit(*port_end)) {
|
|
||||||
throw std::invalid_argument(
|
|
||||||
"Invalid character while parsing the port. "
|
|
||||||
"Supplied URI was: \"" + uri_text + "\"."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
++port_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_port = std::stoul(std::string(port_start, port_end));
|
|
||||||
return port_end;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string::const_iterator parse_query(
|
|
||||||
std::string const &uri_text,
|
|
||||||
std::string::const_iterator query_start
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::string::const_iterator query_end = query_start;
|
|
||||||
while ((query_end != uri_text.end()) && (*query_end != '#')) {
|
|
||||||
// Queries can contain almost any character except hash, which is reserved
|
|
||||||
// for the start of the fragment.
|
|
||||||
++query_end;
|
|
||||||
}
|
|
||||||
m_query = std::move(std::string(query_start, query_end));
|
|
||||||
return query_end;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string::const_iterator parse_fragment(
|
|
||||||
std::string const &uri_text,
|
|
||||||
std::string::const_iterator fragment_start
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m_fragment = std::move(std::string(fragment_start, uri_text.end()));
|
|
||||||
return uri_text.end();
|
|
||||||
};
|
|
||||||
|
|
||||||
void init_query_dictionary()
|
|
||||||
{
|
|
||||||
if (!m_query.empty()) {
|
|
||||||
// Loop over the query string looking for '&'s, then check each one for
|
|
||||||
// an '=' to find keys and values; if there's not an '=' then the key
|
|
||||||
// will have an empty value in the map.
|
|
||||||
char separator = (m_separator == query_argument_separator::ampersand) ? '&' : ';';
|
|
||||||
size_t carat = 0;
|
|
||||||
size_t stanza_end = m_query.find_first_of(separator);
|
|
||||||
do {
|
|
||||||
std::string stanza = m_query.substr(
|
|
||||||
carat,
|
|
||||||
((stanza_end != std::string::npos) ? (stanza_end - carat) : std::string::npos));
|
|
||||||
size_t key_value_divider = stanza.find_first_of('=');
|
|
||||||
std::string key = stanza.substr(0, key_value_divider);
|
|
||||||
std::string value;
|
|
||||||
if (key_value_divider != std::string::npos) {
|
|
||||||
value = stanza.substr((key_value_divider + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_query_dict.count(key) != 0) {
|
|
||||||
throw std::invalid_argument("Bad key in the query string!");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_query_dict.emplace(key, value);
|
|
||||||
carat = ((stanza_end != std::string::npos) ? (stanza_end + 1)
|
|
||||||
: std::string::npos);
|
|
||||||
stanza_end = m_query.find_first_of(separator, carat);
|
|
||||||
} while ((stanza_end != std::string::npos)
|
|
||||||
|| (carat != std::string::npos));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string m_scheme;
|
|
||||||
std::string m_content;
|
|
||||||
std::string m_username;
|
|
||||||
std::string m_password;
|
|
||||||
std::string m_host;
|
|
||||||
std::string m_path;
|
|
||||||
std::string m_query;
|
|
||||||
std::string m_fragment;
|
|
||||||
|
|
||||||
std::map<std::string, std::string> m_query_dict;
|
|
||||||
|
|
||||||
scheme_category m_category;
|
|
||||||
unsigned long m_port;
|
|
||||||
bool m_path_is_rooted;
|
|
||||||
query_argument_separator m_separator;
|
|
||||||
};
|
|
||||||
@@ -224,7 +224,7 @@ EQ::ItemInstance* EQ::InventoryProfile::GetItem(int16 slot_id, uint8 bagidx) con
|
|||||||
return GetItem(InventoryProfile::CalcSlotId(slot_id, bagidx));
|
return GetItem(InventoryProfile::CalcSlotId(slot_id, bagidx));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put an item into specified slot
|
// Put an item snto specified slot
|
||||||
int16 EQ::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
|
int16 EQ::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
|
||||||
{
|
{
|
||||||
if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
|
if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
|
||||||
@@ -399,7 +399,7 @@ bool EQ::InventoryProfile::SwapItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove item from inventory (with memory delete)
|
// Remove item from inventory (with memory delete)
|
||||||
bool EQ::InventoryProfile::DeleteItem(int16 slot_id, int16 quantity) {
|
bool EQ::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
|
||||||
// Pop item out of inventory map (or queue)
|
// Pop item out of inventory map (or queue)
|
||||||
ItemInstance *item_to_delete = PopItem(slot_id);
|
ItemInstance *item_to_delete = PopItem(slot_id);
|
||||||
|
|
||||||
@@ -590,68 +590,6 @@ bool EQ::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quan
|
|||||||
// Checks that user has at least 'quantity' number of items in a given inventory slot
|
// Checks that user has at least 'quantity' number of items in a given inventory slot
|
||||||
// Returns first slot it was found in, or SLOT_INVALID if not found
|
// Returns first slot it was found in, or SLOT_INVALID if not found
|
||||||
|
|
||||||
bool EQ::InventoryProfile::HasAugmentEquippedByID(uint32 item_id)
|
|
||||||
{
|
|
||||||
bool has_equipped = false;
|
|
||||||
ItemInstance* item = nullptr;
|
|
||||||
|
|
||||||
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
|
|
||||||
item = GetItem(slot_id);
|
|
||||||
if (item && item->ContainsAugmentByID(item_id)) {
|
|
||||||
has_equipped = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return has_equipped;
|
|
||||||
}
|
|
||||||
|
|
||||||
int EQ::InventoryProfile::CountAugmentEquippedByID(uint32 item_id)
|
|
||||||
{
|
|
||||||
int quantity = 0;
|
|
||||||
ItemInstance* item = nullptr;
|
|
||||||
|
|
||||||
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
|
|
||||||
item = GetItem(slot_id);
|
|
||||||
if (item && item->ContainsAugmentByID(item_id)) {
|
|
||||||
quantity += item->CountAugmentByID(item_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EQ::InventoryProfile::HasItemEquippedByID(uint32 item_id)
|
|
||||||
{
|
|
||||||
bool has_equipped = false;
|
|
||||||
ItemInstance* item = nullptr;
|
|
||||||
|
|
||||||
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
|
|
||||||
item = GetItem(slot_id);
|
|
||||||
if (item && item->GetID() == item_id) {
|
|
||||||
has_equipped = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return has_equipped;
|
|
||||||
}
|
|
||||||
|
|
||||||
int EQ::InventoryProfile::CountItemEquippedByID(uint32 item_id)
|
|
||||||
{
|
|
||||||
int quantity = 0;
|
|
||||||
ItemInstance* item = nullptr;
|
|
||||||
|
|
||||||
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
|
|
||||||
item = GetItem(slot_id);
|
|
||||||
if (item && item->GetID() == item_id) {
|
|
||||||
quantity += item->IsStackable() ? item->GetCharges() : 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
//This function has a flaw in that it only returns the last stack that it looked at
|
//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.
|
//when quantity is greater than 1 and not all of quantity can be found in 1 stack.
|
||||||
int16 EQ::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 where)
|
int16 EQ::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 where)
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace EQ
|
|||||||
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0);
|
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0);
|
||||||
|
|
||||||
// Remove item from inventory
|
// Remove item from inventory
|
||||||
bool DeleteItem(int16 slot_id, int16 quantity = 0);
|
bool DeleteItem(int16 slot_id, uint8 quantity = 0);
|
||||||
|
|
||||||
// Checks All items in a bag for No Drop
|
// Checks All items in a bag for No Drop
|
||||||
bool CheckNoDrop(int16 slot_id, bool recurse = true);
|
bool CheckNoDrop(int16 slot_id, bool recurse = true);
|
||||||
@@ -140,18 +140,6 @@ namespace EQ
|
|||||||
// Remove item from inventory (and take control of memory)
|
// Remove item from inventory (and take control of memory)
|
||||||
ItemInstance* PopItem(int16 slot_id);
|
ItemInstance* PopItem(int16 slot_id);
|
||||||
|
|
||||||
// Check if player has a specific item equipped by Item ID
|
|
||||||
bool HasItemEquippedByID(uint32 item_id);
|
|
||||||
|
|
||||||
// Check how many of a specific item the player has equipped by Item ID
|
|
||||||
int CountItemEquippedByID(uint32 item_id);
|
|
||||||
|
|
||||||
// Check if player has a specific augment equipped by Item ID
|
|
||||||
bool HasAugmentEquippedByID(uint32 item_id);
|
|
||||||
|
|
||||||
// Check how many of a specific augment the player has equipped by Item ID
|
|
||||||
int CountAugmentEquippedByID(uint32 item_id);
|
|
||||||
|
|
||||||
// Check whether there is space for the specified number of the specified item.
|
// Check whether there is space for the specified number of the specified item.
|
||||||
bool HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity);
|
bool HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity);
|
||||||
|
|
||||||
@@ -202,7 +190,6 @@ namespace EQ
|
|||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
|
||||||
std::string GetCustomItemData(int16 slot_id, std::string identifier);
|
std::string GetCustomItemData(int16 slot_id, std::string identifier);
|
||||||
static int GetItemStatValue(uint32 item_id, const char* identifier);
|
|
||||||
protected:
|
protected:
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// Protected Methods
|
// Protected Methods
|
||||||
|
|||||||
+1
-1
@@ -482,7 +482,7 @@ namespace EQ
|
|||||||
uint32 Haste;
|
uint32 Haste;
|
||||||
uint32 DamageShield;
|
uint32 DamageShield;
|
||||||
uint32 RecastDelay;
|
uint32 RecastDelay;
|
||||||
int RecastType;
|
uint32 RecastType;
|
||||||
uint32 AugDistiller;
|
uint32 AugDistiller;
|
||||||
bool Attuneable;
|
bool Attuneable;
|
||||||
bool NoPet;
|
bool NoPet;
|
||||||
|
|||||||
@@ -689,45 +689,6 @@ bool EQ::ItemInstance::IsAugmented()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQ::ItemInstance::ContainsAugmentByID(uint32 item_id)
|
|
||||||
{
|
|
||||||
if (!m_item || !m_item->IsClassCommon()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!item_id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8 augment_slot = invaug::SOCKET_BEGIN; augment_slot <= invaug::SOCKET_END; ++augment_slot) {
|
|
||||||
if (GetAugmentItemID(augment_slot) == item_id) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int EQ::ItemInstance::CountAugmentByID(uint32 item_id)
|
|
||||||
{
|
|
||||||
int quantity = 0;
|
|
||||||
if (!m_item || !m_item->IsClassCommon()) {
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!item_id) {
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8 augment_slot = invaug::SOCKET_BEGIN; augment_slot <= invaug::SOCKET_END; ++augment_slot) {
|
|
||||||
if (GetAugmentItemID(augment_slot) == item_id) {
|
|
||||||
quantity++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Has attack/delay?
|
// Has attack/delay?
|
||||||
bool EQ::ItemInstance::IsWeapon() const
|
bool EQ::ItemInstance::IsWeapon() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,8 +132,6 @@ namespace EQ
|
|||||||
void DeleteAugment(uint8 slot);
|
void DeleteAugment(uint8 slot);
|
||||||
ItemInstance* RemoveAugment(uint8 index);
|
ItemInstance* RemoveAugment(uint8 index);
|
||||||
bool IsAugmented();
|
bool IsAugmented();
|
||||||
bool ContainsAugmentByID(uint32 item_id);
|
|
||||||
int CountAugmentByID(uint32 item_id);
|
|
||||||
ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const;
|
ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const;
|
||||||
bool UpdateOrnamentationInfo();
|
bool UpdateOrnamentationInfo();
|
||||||
static bool CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll = false);
|
static bool CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll = false);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ EQ::Net::ConsoleServerConnection::ConsoleServerConnection(ConsoleServer *parent,
|
|||||||
memset(m_line, 0, MaxConsoleLineLength);
|
memset(m_line, 0, MaxConsoleLineLength);
|
||||||
m_accept_messages = false;
|
m_accept_messages = false;
|
||||||
m_user_id = 0;
|
m_user_id = 0;
|
||||||
m_admin = AccountStatus::Player;
|
m_admin = 0;
|
||||||
|
|
||||||
m_connection->OnRead(std::bind(&ConsoleServerConnection::OnRead, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_connection->OnRead(std::bind(&ConsoleServerConnection::OnRead, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
m_connection->OnDisconnect(std::bind(&ConsoleServerConnection::OnDisconnect, this, std::placeholders::_1));
|
m_connection->OnDisconnect(std::bind(&ConsoleServerConnection::OnDisconnect, this, std::placeholders::_1));
|
||||||
@@ -29,7 +29,7 @@ EQ::Net::ConsoleServerConnection::ConsoleServerConnection(ConsoleServer *parent,
|
|||||||
if (addr.find("127.0.0.1") != std::string::npos || addr.find("::0") != std::string::npos) {
|
if (addr.find("127.0.0.1") != std::string::npos || addr.find("::0") != std::string::npos) {
|
||||||
SendLine("Connection established from localhost, assuming admin");
|
SendLine("Connection established from localhost, assuming admin");
|
||||||
m_status = ConsoleStatusLoggedIn;
|
m_status = ConsoleStatusLoggedIn;
|
||||||
m_admin = AccountStatus::Max;
|
m_admin = 255;
|
||||||
SendPrompt();
|
SendPrompt();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -21,16 +21,32 @@ EQ::Net::ServertalkClient::~ServertalkClient()
|
|||||||
|
|
||||||
void EQ::Net::ServertalkClient::Send(uint16_t opcode, EQ::Net::Packet &p)
|
void EQ::Net::ServertalkClient::Send(uint16_t opcode, EQ::Net::Packet &p)
|
||||||
{
|
{
|
||||||
// pad zero size packets
|
EQ::Net::DynamicPacket out;
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
if (m_encrypted) {
|
||||||
if (p.Length() == 0) {
|
if (p.Length() == 0) {
|
||||||
p.PutUInt8(0, 0);
|
p.PutUInt8(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::DynamicPacket out;
|
out.PutUInt32(0, p.Length() + crypto_secretbox_MACBYTES);
|
||||||
|
out.PutUInt16(4, opcode);
|
||||||
|
|
||||||
|
std::unique_ptr<unsigned char[]> cipher(new unsigned char[p.Length() + crypto_secretbox_MACBYTES]);
|
||||||
|
|
||||||
|
crypto_box_easy_afternm(&cipher[0], (unsigned char*)p.Data(), p.Length(), m_nonce_ours, m_shared_key);
|
||||||
|
(*(uint64_t*)&m_nonce_ours[0])++;
|
||||||
|
out.PutData(6, &cipher[0], p.Length() + crypto_secretbox_MACBYTES);
|
||||||
|
}
|
||||||
|
else {
|
||||||
out.PutUInt32(0, p.Length());
|
out.PutUInt32(0, p.Length());
|
||||||
out.PutUInt16(4, opcode);
|
out.PutUInt16(4, opcode);
|
||||||
out.PutPacket(6, p);
|
out.PutPacket(6, p);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
out.PutUInt32(0, p.Length());
|
||||||
|
out.PutUInt16(4, opcode);
|
||||||
|
out.PutPacket(6, p);
|
||||||
|
#endif
|
||||||
InternalSend(ServertalkMessage, out);
|
InternalSend(ServertalkMessage, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,18 +87,14 @@ void EQ::Net::ServertalkClient::Connect()
|
|||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
m_connection->OnDisconnect([this](EQ::Net::TCPConnection *c) {
|
m_connection->OnDisconnect([this](EQ::Net::TCPConnection *c) {
|
||||||
LogF(Logs::General, Logs::TCPConnection, "Connection lost to {0}:{1}, attempting to reconnect...", m_addr, m_port);
|
LogF(Logs::General, Logs::TCPConnection, "Connection lost to {0}:{1}, attempting to reconnect...", m_addr, m_port);
|
||||||
|
m_encrypted = false;
|
||||||
m_connection.reset();
|
m_connection.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
m_connection->OnRead(std::bind(&EQ::Net::ServertalkClient::ProcessData, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_connection->OnRead(std::bind(&EQ::Net::ServertalkClient::ProcessData, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
m_connection->Start();
|
m_connection->Start();
|
||||||
|
|
||||||
SendHandshake();
|
SendHello();
|
||||||
|
|
||||||
if (m_on_connect_cb) {
|
|
||||||
m_on_connect_cb(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_connecting = false;
|
m_connecting = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -176,12 +188,68 @@ void EQ::Net::ServertalkClient::ProcessReadBuffer()
|
|||||||
|
|
||||||
void EQ::Net::ServertalkClient::ProcessHello(EQ::Net::Packet &p)
|
void EQ::Net::ServertalkClient::ProcessHello(EQ::Net::Packet &p)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
memset(m_public_key_ours, 0, crypto_box_PUBLICKEYBYTES);
|
||||||
|
memset(m_public_key_theirs, 0, crypto_box_PUBLICKEYBYTES);
|
||||||
|
memset(m_private_key_ours, 0, crypto_box_SECRETKEYBYTES);
|
||||||
|
memset(m_nonce_ours, 0, crypto_box_NONCEBYTES);
|
||||||
|
memset(m_nonce_theirs, 0, crypto_box_NONCEBYTES);
|
||||||
|
memset(m_shared_key, 0, crypto_box_BEFORENMBYTES);
|
||||||
|
m_encrypted = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
bool enc = p.GetInt8(0) == 1 ? true : false;
|
||||||
|
|
||||||
|
if (enc) {
|
||||||
|
if (p.Length() == (1 + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES)) {
|
||||||
|
memcpy(m_public_key_theirs, (char*)p.Data() + 1, crypto_box_PUBLICKEYBYTES);
|
||||||
|
memcpy(m_nonce_theirs, (char*)p.Data() + 1 + crypto_box_PUBLICKEYBYTES, crypto_box_NONCEBYTES);
|
||||||
|
m_encrypted = true;
|
||||||
|
|
||||||
SendHandshake();
|
SendHandshake();
|
||||||
|
|
||||||
if (m_on_connect_cb) {
|
if (m_on_connect_cb) {
|
||||||
m_on_connect_cb(this);
|
m_on_connect_cb(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LogError("Could not process hello, size != {0}", 1 + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SendHandshake();
|
||||||
|
|
||||||
|
if (m_on_connect_cb) {
|
||||||
|
m_on_connect_cb(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (std::exception &ex) {
|
||||||
|
LogError("Error parsing hello from server: {0}", ex.what());
|
||||||
|
m_connection->Disconnect();
|
||||||
|
|
||||||
|
if (m_on_connect_cb) {
|
||||||
|
m_on_connect_cb(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
try {
|
||||||
|
bool enc = p.GetInt8(0) == 1 ? true : false;
|
||||||
|
|
||||||
|
if (enc) {
|
||||||
|
SendHandshake(true);
|
||||||
|
|
||||||
|
if (m_on_connect_cb) {
|
||||||
|
m_on_connect_cb(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SendHandshake();
|
||||||
|
|
||||||
|
if (m_on_connect_cb) {
|
||||||
|
m_on_connect_cb(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception &ex) {
|
catch (std::exception &ex) {
|
||||||
LogError("Error parsing hello from server: {0}", ex.what());
|
LogError("Error parsing hello from server: {0}", ex.what());
|
||||||
@@ -191,6 +259,7 @@ void EQ::Net::ServertalkClient::ProcessHello(EQ::Net::Packet &p)
|
|||||||
m_on_connect_cb(nullptr);
|
m_on_connect_cb(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkClient::ProcessMessage(EQ::Net::Packet &p)
|
void EQ::Net::ServertalkClient::ProcessMessage(EQ::Net::Packet &p)
|
||||||
@@ -200,7 +269,31 @@ void EQ::Net::ServertalkClient::ProcessMessage(EQ::Net::Packet &p)
|
|||||||
auto opcode = p.GetUInt16(4);
|
auto opcode = p.GetUInt16(4);
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
auto data = p.GetString(6, length);
|
auto data = p.GetString(6, length);
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
if (m_encrypted) {
|
||||||
|
size_t message_len = length - crypto_secretbox_MACBYTES;
|
||||||
|
std::unique_ptr<unsigned char[]> decrypted_text(new unsigned char[message_len]);
|
||||||
|
if (crypto_box_open_easy_afternm(&decrypted_text[0], (unsigned char*)&data[0], length, m_nonce_theirs, m_shared_key))
|
||||||
|
{
|
||||||
|
LogError("Error decrypting message from server");
|
||||||
|
(*(uint64_t*)&m_nonce_theirs[0])++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EQ::Net::StaticPacket decrypted_packet(&decrypted_text[0], message_len);
|
||||||
|
|
||||||
|
(*(uint64_t*)&m_nonce_theirs[0])++;
|
||||||
|
|
||||||
|
auto cb = m_message_callbacks.find(opcode);
|
||||||
|
if (cb != m_message_callbacks.end()) {
|
||||||
|
cb->second(opcode, decrypted_packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_message_callback) {
|
||||||
|
m_message_callback(opcode, decrypted_packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
size_t message_len = length;
|
size_t message_len = length;
|
||||||
EQ::Net::StaticPacket packet(&data[0], message_len);
|
EQ::Net::StaticPacket packet(&data[0], message_len);
|
||||||
|
|
||||||
@@ -213,17 +306,75 @@ void EQ::Net::ServertalkClient::ProcessMessage(EQ::Net::Packet &p)
|
|||||||
m_message_callback(opcode, packet);
|
m_message_callback(opcode, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
size_t message_len = length;
|
||||||
|
EQ::Net::StaticPacket packet(&data[0], message_len);
|
||||||
|
|
||||||
|
auto cb = m_message_callbacks.find(opcode);
|
||||||
|
if (cb != m_message_callbacks.end()) {
|
||||||
|
cb->second(opcode, packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_message_callback) {
|
||||||
|
m_message_callback(opcode, packet);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception &ex) {
|
catch (std::exception &ex) {
|
||||||
LogError("Error parsing message from server: {0}", ex.what());
|
LogError("Error parsing message from server: {0}", ex.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkClient::SendHandshake()
|
void EQ::Net::ServertalkClient::SendHandshake(bool downgrade)
|
||||||
{
|
{
|
||||||
EQ::Net::DynamicPacket handshake;
|
EQ::Net::DynamicPacket handshake;
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
if (m_encrypted) {
|
||||||
|
crypto_box_keypair(m_public_key_ours, m_private_key_ours);
|
||||||
|
randombytes_buf(m_nonce_ours, crypto_box_NONCEBYTES);
|
||||||
|
|
||||||
|
crypto_box_beforenm(m_shared_key, m_public_key_theirs, m_private_key_ours);
|
||||||
|
|
||||||
|
handshake.PutData(0, m_public_key_ours, crypto_box_PUBLICKEYBYTES);
|
||||||
|
handshake.PutData(crypto_box_PUBLICKEYBYTES, m_nonce_ours, crypto_box_NONCEBYTES);
|
||||||
|
|
||||||
|
memset(m_public_key_ours, 0, crypto_box_PUBLICKEYBYTES);
|
||||||
|
memset(m_public_key_theirs, 0, crypto_box_PUBLICKEYBYTES);
|
||||||
|
memset(m_private_key_ours, 0, crypto_box_SECRETKEYBYTES);
|
||||||
|
|
||||||
|
size_t cipher_length = m_identifier.length() + 1 + m_credentials.length() + 1 + crypto_secretbox_MACBYTES;
|
||||||
|
size_t data_length = m_identifier.length() + 1 + m_credentials.length() + 1;
|
||||||
|
|
||||||
|
std::unique_ptr<unsigned char[]> signed_buffer(new unsigned char[cipher_length]);
|
||||||
|
std::unique_ptr<unsigned char[]> data_buffer(new unsigned char[data_length]);
|
||||||
|
|
||||||
|
memset(&data_buffer[0], 0, data_length);
|
||||||
|
memcpy(&data_buffer[0], m_identifier.c_str(), m_identifier.length());
|
||||||
|
memcpy(&data_buffer[1 + m_identifier.length()], m_credentials.c_str(), m_credentials.length());
|
||||||
|
|
||||||
|
crypto_box_easy_afternm(&signed_buffer[0], &data_buffer[0], data_length, m_nonce_ours, m_shared_key);
|
||||||
|
|
||||||
|
(*(uint64_t*)&m_nonce_ours[0])++;
|
||||||
|
|
||||||
|
handshake.PutData(crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES, &signed_buffer[0], cipher_length);
|
||||||
|
}
|
||||||
|
else {
|
||||||
handshake.PutString(0, m_identifier);
|
handshake.PutString(0, m_identifier);
|
||||||
handshake.PutString(m_identifier.length() + 1, m_credentials);
|
handshake.PutString(m_identifier.length() + 1, m_credentials);
|
||||||
handshake.PutUInt8(m_identifier.length() + 1 + m_credentials.length(), 0);
|
handshake.PutUInt8(m_identifier.length() + 1 + m_credentials.length(), 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
handshake.PutString(0, m_identifier);
|
||||||
|
handshake.PutString(m_identifier.length() + 1, m_credentials);
|
||||||
|
handshake.PutUInt8(m_identifier.length() + 1 + m_credentials.length(), 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (downgrade) {
|
||||||
InternalSend(ServertalkClientDowngradeSecurityHandshake, handshake);
|
InternalSend(ServertalkClientDowngradeSecurityHandshake, handshake);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
InternalSend(ServertalkClientHandshake, handshake);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
#include "../event/timer.h"
|
#include "../event/timer.h"
|
||||||
#include "servertalk_common.h"
|
#include "servertalk_common.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
#include <sodium.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace EQ
|
namespace EQ
|
||||||
{
|
{
|
||||||
@@ -31,7 +34,8 @@ namespace EQ
|
|||||||
void ProcessReadBuffer();
|
void ProcessReadBuffer();
|
||||||
void ProcessHello(EQ::Net::Packet &p);
|
void ProcessHello(EQ::Net::Packet &p);
|
||||||
void ProcessMessage(EQ::Net::Packet &p);
|
void ProcessMessage(EQ::Net::Packet &p);
|
||||||
void SendHandshake();
|
void SendHandshake() { SendHandshake(false); }
|
||||||
|
void SendHandshake(bool downgrade);
|
||||||
|
|
||||||
std::unique_ptr<EQ::Timer> m_timer;
|
std::unique_ptr<EQ::Timer> m_timer;
|
||||||
|
|
||||||
@@ -41,11 +45,23 @@ namespace EQ
|
|||||||
bool m_connecting;
|
bool m_connecting;
|
||||||
int m_port;
|
int m_port;
|
||||||
bool m_ipv6;
|
bool m_ipv6;
|
||||||
|
bool m_encrypted;
|
||||||
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
|
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
|
||||||
std::vector<char> m_buffer;
|
std::vector<char> m_buffer;
|
||||||
std::unordered_map<uint16_t, std::function<void(uint16_t, EQ::Net::Packet&)>> m_message_callbacks;
|
std::unordered_map<uint16_t, std::function<void(uint16_t, EQ::Net::Packet&)>> m_message_callbacks;
|
||||||
std::function<void(uint16_t, EQ::Net::Packet&)> m_message_callback;
|
std::function<void(uint16_t, EQ::Net::Packet&)> m_message_callback;
|
||||||
std::function<void(ServertalkClient*)> m_on_connect_cb;
|
std::function<void(ServertalkClient*)> m_on_connect_cb;
|
||||||
|
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
unsigned char m_public_key_ours[crypto_box_PUBLICKEYBYTES];
|
||||||
|
unsigned char m_private_key_ours[crypto_box_SECRETKEYBYTES];
|
||||||
|
unsigned char m_nonce_ours[crypto_box_NONCEBYTES];
|
||||||
|
|
||||||
|
unsigned char m_public_key_theirs[crypto_box_PUBLICKEYBYTES];
|
||||||
|
unsigned char m_nonce_theirs[crypto_box_NONCEBYTES];
|
||||||
|
|
||||||
|
unsigned char m_shared_key[crypto_box_BEFORENMBYTES];
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ EQ::Net::ServertalkServer::~ServertalkServer()
|
|||||||
|
|
||||||
void EQ::Net::ServertalkServer::Listen(const ServertalkServerOptions& opts)
|
void EQ::Net::ServertalkServer::Listen(const ServertalkServerOptions& opts)
|
||||||
{
|
{
|
||||||
|
m_encrypted = opts.encrypted;
|
||||||
m_credentials = opts.credentials;
|
m_credentials = opts.credentials;
|
||||||
|
m_allow_downgrade = opts.allow_downgrade;
|
||||||
m_server = std::make_unique<EQ::Net::TCPServer>();
|
m_server = std::make_unique<EQ::Net::TCPServer>();
|
||||||
m_server->Listen(opts.port, opts.ipv6, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
m_server->Listen(opts.port, opts.ipv6, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||||
m_unident_connections.push_back(std::make_shared<ServertalkServerConnection>(connection, this));
|
m_unident_connections.push_back(std::make_shared<ServertalkServerConnection>(connection, this, m_encrypted, m_allow_downgrade));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
#include <sodium.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace EQ
|
namespace EQ
|
||||||
{
|
{
|
||||||
namespace Net
|
namespace Net
|
||||||
@@ -13,9 +17,18 @@ namespace EQ
|
|||||||
{
|
{
|
||||||
int port;
|
int port;
|
||||||
bool ipv6;
|
bool ipv6;
|
||||||
|
bool encrypted;
|
||||||
|
bool allow_downgrade;
|
||||||
std::string credentials;
|
std::string credentials;
|
||||||
|
|
||||||
ServertalkServerOptions() {
|
ServertalkServerOptions() {
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
encrypted = true;
|
||||||
|
allow_downgrade = true;
|
||||||
|
#else
|
||||||
|
encrypted = false;
|
||||||
|
allow_downgrade = true;
|
||||||
|
#endif
|
||||||
ipv6 = false;
|
ipv6 = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
#include "../eqemu_logsys.h"
|
#include "../eqemu_logsys.h"
|
||||||
#include "../util/uuid.h"
|
#include "../util/uuid.h"
|
||||||
|
|
||||||
EQ::Net::ServertalkServerConnection::ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, EQ::Net::ServertalkServer *parent)
|
EQ::Net::ServertalkServerConnection::ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, EQ::Net::ServertalkServer *parent, bool encrypted, bool allow_downgrade)
|
||||||
{
|
{
|
||||||
m_connection = c;
|
m_connection = c;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
m_encrypted = encrypted;
|
||||||
|
m_allow_downgrade = allow_downgrade;
|
||||||
m_uuid = EQ::Util::UUID::Generate().ToString();
|
m_uuid = EQ::Util::UUID::Generate().ToString();
|
||||||
m_connection->OnRead(std::bind(&ServertalkServerConnection::OnRead, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_connection->OnRead(std::bind(&ServertalkServerConnection::OnRead, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
m_connection->OnDisconnect(std::bind(&ServertalkServerConnection::OnDisconnect, this, std::placeholders::_1));
|
m_connection->OnDisconnect(std::bind(&ServertalkServerConnection::OnDisconnect, this, std::placeholders::_1));
|
||||||
m_connection->Start();
|
m_connection->Start();
|
||||||
m_legacy_mode = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::ServertalkServerConnection::~ServertalkServerConnection()
|
EQ::Net::ServertalkServerConnection::~ServertalkServerConnection()
|
||||||
@@ -20,73 +21,32 @@ EQ::Net::ServertalkServerConnection::~ServertalkServerConnection()
|
|||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet & p)
|
void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet & p)
|
||||||
{
|
{
|
||||||
if (m_legacy_mode) {
|
|
||||||
if (!m_connection)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (opcode == ServerOP_UsertoWorldReq) {
|
|
||||||
auto req_in = (UsertoWorldRequest_Struct*)p.Data();
|
|
||||||
|
|
||||||
EQ::Net::DynamicPacket req;
|
|
||||||
size_t i = 0;
|
|
||||||
req.PutUInt32(i, req_in->lsaccountid); i += 4;
|
|
||||||
req.PutUInt32(i, req_in->worldid); i += 4;
|
|
||||||
req.PutUInt32(i, req_in->FromID); i += 4;
|
|
||||||
req.PutUInt32(i, req_in->ToID); i += 4;
|
|
||||||
req.PutData(i, req_in->IPAddr, 64); i += 64;
|
|
||||||
|
|
||||||
EQ::Net::DynamicPacket out;
|
EQ::Net::DynamicPacket out;
|
||||||
out.PutUInt16(0, ServerOP_UsertoWorldReqLeg);
|
#ifdef ENABLE_SECURITY
|
||||||
out.PutUInt16(2, req.Length() + 4);
|
if (m_encrypted) {
|
||||||
out.PutPacket(4, req);
|
if (p.Length() == 0) {
|
||||||
|
|
||||||
m_connection->Write((const char*)out.Data(), out.Length());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opcode == ServerOP_LSClientAuth) {
|
|
||||||
auto req_in = (ClientAuth_Struct*)p.Data();
|
|
||||||
|
|
||||||
EQ::Net::DynamicPacket req;
|
|
||||||
size_t i = 0;
|
|
||||||
req.PutUInt32(i, req_in->loginserver_account_id); i += 4;
|
|
||||||
req.PutData(i, req_in->account_name, 30); i += 30;
|
|
||||||
req.PutData(i, req_in->key, 30); i += 30;
|
|
||||||
req.PutUInt8(i, req_in->lsadmin); i += 1;
|
|
||||||
req.PutUInt16(i, req_in->is_world_admin); i += 2;
|
|
||||||
req.PutUInt32(i, req_in->ip); i += 4;
|
|
||||||
req.PutUInt8(i, req_in->is_client_from_local_network); i += 1;
|
|
||||||
|
|
||||||
EQ::Net::DynamicPacket out;
|
|
||||||
out.PutUInt16(0, ServerOP_LSClientAuthLeg);
|
|
||||||
out.PutUInt16(2, req.Length() + 4);
|
|
||||||
out.PutPacket(4, req);
|
|
||||||
|
|
||||||
m_connection->Write((const char*)out.Data(), out.Length());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EQ::Net::DynamicPacket out;
|
|
||||||
out.PutUInt16(0, opcode);
|
|
||||||
out.PutUInt16(2, p.Length() + 4);
|
|
||||||
out.PutPacket(4, p);
|
|
||||||
|
|
||||||
m_connection->Write((const char*)out.Data(), out.Length());
|
|
||||||
} else {
|
|
||||||
// pad zero size packets
|
|
||||||
// pad packets that would cause a collision with legacy identification code
|
|
||||||
// It's unlikely we'd send a 4MB msg for any reason but just incase.
|
|
||||||
if (p.Length() == 0 || p.Length() == 43061256) {
|
|
||||||
p.PutUInt8(0, 0);
|
p.PutUInt8(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::DynamicPacket out;
|
out.PutUInt32(0, p.Length() + crypto_secretbox_MACBYTES);
|
||||||
|
out.PutUInt16(4, opcode);
|
||||||
|
|
||||||
|
std::unique_ptr<unsigned char[]> cipher(new unsigned char[p.Length() + crypto_secretbox_MACBYTES]);
|
||||||
|
crypto_box_easy_afternm(&cipher[0], (unsigned char*)p.Data(), p.Length(), m_nonce_ours, m_shared_key);
|
||||||
|
(*(uint64_t*)&m_nonce_ours[0])++;
|
||||||
|
out.PutData(6, &cipher[0], p.Length() + crypto_secretbox_MACBYTES);
|
||||||
|
}
|
||||||
|
else {
|
||||||
out.PutUInt32(0, p.Length());
|
out.PutUInt32(0, p.Length());
|
||||||
out.PutUInt16(4, opcode);
|
out.PutUInt16(4, opcode);
|
||||||
out.PutPacket(6, p);
|
out.PutPacket(6, p);
|
||||||
|
|
||||||
InternalSend(ServertalkMessage, out);
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
out.PutUInt32(0, p.Length());
|
||||||
|
out.PutUInt16(4, opcode);
|
||||||
|
out.PutPacket(6, p);
|
||||||
|
#endif
|
||||||
|
InternalSend(ServertalkMessage, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::SendPacket(ServerPacket *p)
|
void EQ::Net::ServertalkServerConnection::SendPacket(ServerPacket *p)
|
||||||
@@ -111,41 +71,17 @@ void EQ::Net::ServertalkServerConnection::OnMessage(std::function<void(uint16_t,
|
|||||||
void EQ::Net::ServertalkServerConnection::OnRead(TCPConnection *c, const unsigned char *data, size_t sz)
|
void EQ::Net::ServertalkServerConnection::OnRead(TCPConnection *c, const unsigned char *data, size_t sz)
|
||||||
{
|
{
|
||||||
m_buffer.insert(m_buffer.end(), (const char*)data, (const char*)data + sz);
|
m_buffer.insert(m_buffer.end(), (const char*)data, (const char*)data + sz);
|
||||||
|
|
||||||
if (m_legacy_mode) {
|
|
||||||
ProcessOldReadBuffer();
|
|
||||||
} else {
|
|
||||||
ProcessReadBuffer();
|
ProcessReadBuffer();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
|
void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
|
||||||
{
|
{
|
||||||
size_t current = 0;
|
size_t current = 0;
|
||||||
size_t total = m_buffer.size();
|
size_t total = m_buffer.size();
|
||||||
constexpr size_t ls_info_size = sizeof(ServerNewLSInfo_Struct);
|
|
||||||
|
|
||||||
while (current < total) {
|
while (current < total) {
|
||||||
auto left = total - current;
|
auto left = total - current;
|
||||||
|
|
||||||
if (left < 4) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto leg_opcode = *(uint16_t*)&m_buffer[current];
|
|
||||||
auto leg_size = *(uint16_t*)&m_buffer[current + 2] - 4;
|
|
||||||
|
|
||||||
//this creates a small edge case where the exact size of a
|
|
||||||
//packet from the modern protocol can't be "43061256"
|
|
||||||
//so in send we pad it one byte if that's the case
|
|
||||||
if (leg_opcode == ServerOP_NewLSInfo && leg_size == sizeof(ServerNewLSInfo_Struct)) {
|
|
||||||
m_legacy_mode = true;
|
|
||||||
m_identifier = "World";
|
|
||||||
m_parent->ConnectionIdentified(this);
|
|
||||||
ProcessOldReadBuffer();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//header:
|
//header:
|
||||||
//uint32 length;
|
//uint32 length;
|
||||||
@@ -173,7 +109,6 @@ void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ServertalkClientHandshake:
|
case ServertalkClientHandshake:
|
||||||
case ServertalkClientDowngradeSecurityHandshake:
|
|
||||||
ProcessHandshake(p);
|
ProcessHandshake(p);
|
||||||
break;
|
break;
|
||||||
case ServertalkMessage:
|
case ServertalkMessage:
|
||||||
@@ -190,9 +125,11 @@ void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ServertalkClientHandshake:
|
case ServertalkClientHandshake:
|
||||||
case ServertalkClientDowngradeSecurityHandshake:
|
|
||||||
ProcessHandshake(p);
|
ProcessHandshake(p);
|
||||||
break;
|
break;
|
||||||
|
case ServertalkClientDowngradeSecurityHandshake:
|
||||||
|
ProcessHandshake(p, true);
|
||||||
|
break;
|
||||||
case ServertalkMessage:
|
case ServertalkMessage:
|
||||||
ProcessMessage(p);
|
ProcessMessage(p);
|
||||||
break;
|
break;
|
||||||
@@ -210,57 +147,6 @@ void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::ProcessOldReadBuffer()
|
|
||||||
{
|
|
||||||
size_t current = 0;
|
|
||||||
size_t total = m_buffer.size();
|
|
||||||
|
|
||||||
while (current < total) {
|
|
||||||
auto left = total - current;
|
|
||||||
|
|
||||||
/*
|
|
||||||
//header:
|
|
||||||
//uint32 length;
|
|
||||||
//uint8 type;
|
|
||||||
*/
|
|
||||||
uint16_t length = 0;
|
|
||||||
uint16_t opcode = 0;
|
|
||||||
if (left < 4) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
opcode = *(uint16_t*)&m_buffer[current];
|
|
||||||
length = *(uint16_t*)&m_buffer[current + 2];
|
|
||||||
if (length < 4) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
length -= 4;
|
|
||||||
|
|
||||||
if (current + 4 + length > total) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (length == 0) {
|
|
||||||
EQ::Net::DynamicPacket p;
|
|
||||||
ProcessMessageOld(opcode, p);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
EQ::Net::StaticPacket p(&m_buffer[current + 4], length);
|
|
||||||
ProcessMessageOld(opcode, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
current += length + 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current == total) {
|
|
||||||
m_buffer.clear();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_buffer.erase(m_buffer.begin(), m_buffer.begin() + current);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::OnDisconnect(TCPConnection *c)
|
void EQ::Net::ServertalkServerConnection::OnDisconnect(TCPConnection *c)
|
||||||
{
|
{
|
||||||
m_parent->ConnectionDisconnected(this);
|
m_parent->ConnectionDisconnected(this);
|
||||||
@@ -269,14 +155,36 @@ void EQ::Net::ServertalkServerConnection::OnDisconnect(TCPConnection *c)
|
|||||||
void EQ::Net::ServertalkServerConnection::SendHello()
|
void EQ::Net::ServertalkServerConnection::SendHello()
|
||||||
{
|
{
|
||||||
EQ::Net::DynamicPacket hello;
|
EQ::Net::DynamicPacket hello;
|
||||||
|
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
memset(m_public_key_ours, 0, crypto_box_PUBLICKEYBYTES);
|
||||||
|
memset(m_public_key_theirs, 0, crypto_box_PUBLICKEYBYTES);
|
||||||
|
memset(m_private_key_ours, 0, crypto_box_SECRETKEYBYTES);
|
||||||
|
memset(m_nonce_ours, 0, crypto_box_NONCEBYTES);
|
||||||
|
memset(m_nonce_theirs, 0, crypto_box_NONCEBYTES);
|
||||||
|
|
||||||
|
if (m_encrypted) {
|
||||||
|
hello.PutInt8(0, 1);
|
||||||
|
|
||||||
|
crypto_box_keypair(m_public_key_ours, m_private_key_ours);
|
||||||
|
randombytes_buf(m_nonce_ours, crypto_box_NONCEBYTES);
|
||||||
|
|
||||||
|
hello.PutData(1, m_public_key_ours, crypto_box_PUBLICKEYBYTES);
|
||||||
|
hello.PutData(1 + crypto_box_PUBLICKEYBYTES, m_nonce_ours, crypto_box_NONCEBYTES);
|
||||||
|
}
|
||||||
|
else {
|
||||||
hello.PutInt8(0, 0);
|
hello.PutInt8(0, 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
hello.PutInt8(0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
InternalSend(ServertalkServerHello, hello);
|
InternalSend(ServertalkServerHello, hello);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::InternalSend(ServertalkPacketType type, EQ::Net::Packet &p)
|
void EQ::Net::ServertalkServerConnection::InternalSend(ServertalkPacketType type, EQ::Net::Packet &p)
|
||||||
{
|
{
|
||||||
if (!m_connection || m_legacy_mode)
|
if (!m_connection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EQ::Net::DynamicPacket out;
|
EQ::Net::DynamicPacket out;
|
||||||
@@ -289,8 +197,53 @@ void EQ::Net::ServertalkServerConnection::InternalSend(ServertalkPacketType type
|
|||||||
m_connection->Write((const char*)out.Data(), out.Length());
|
m_connection->Write((const char*)out.Data(), out.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::ProcessHandshake(EQ::Net::Packet &p)
|
void EQ::Net::ServertalkServerConnection::ProcessHandshake(EQ::Net::Packet &p, bool downgrade_security)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
if (downgrade_security && m_allow_downgrade && m_encrypted) {
|
||||||
|
LogF(Logs::General, Logs::TCPConnection, "Downgraded encrypted connection to plaintext because otherside didn't support encryption {0}:{1}",
|
||||||
|
m_connection->RemoteIP(), m_connection->RemotePort());
|
||||||
|
m_encrypted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_encrypted) {
|
||||||
|
try {
|
||||||
|
if (p.Length() > (crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES)) {
|
||||||
|
memcpy(m_public_key_theirs, (char*)p.Data(), crypto_box_PUBLICKEYBYTES);
|
||||||
|
memcpy(m_nonce_theirs, (char*)p.Data() + crypto_box_PUBLICKEYBYTES, crypto_box_NONCEBYTES);
|
||||||
|
|
||||||
|
crypto_box_beforenm(m_shared_key, m_public_key_theirs, m_private_key_ours);
|
||||||
|
|
||||||
|
size_t cipher_len = p.Length() - crypto_box_PUBLICKEYBYTES - crypto_box_NONCEBYTES;
|
||||||
|
size_t message_len = cipher_len - crypto_secretbox_MACBYTES;
|
||||||
|
std::unique_ptr<unsigned char[]> decrypted_text(new unsigned char[message_len]);
|
||||||
|
|
||||||
|
if (crypto_box_open_easy_afternm(&decrypted_text[0], (unsigned char*)p.Data() + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES, cipher_len, m_nonce_theirs, m_shared_key))
|
||||||
|
{
|
||||||
|
LogError("Error decrypting handshake from client, dropping connection.");
|
||||||
|
m_connection->Disconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_identifier = (const char*)&decrypted_text[0];
|
||||||
|
std::string credentials = (const char*)&decrypted_text[0] + (m_identifier.length() + 1);
|
||||||
|
|
||||||
|
if (!m_parent->CheckCredentials(credentials)) {
|
||||||
|
LogError("Got incoming connection with invalid credentials during handshake, dropping connection.");
|
||||||
|
m_connection->Disconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_parent->ConnectionIdentified(this);
|
||||||
|
(*(uint64_t*)&m_nonce_theirs[0])++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (std::exception &ex) {
|
||||||
|
LogError("Error parsing handshake from client: {0}", ex.what());
|
||||||
|
m_connection->Disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
try {
|
try {
|
||||||
m_identifier = p.GetCString(0);
|
m_identifier = p.GetCString(0);
|
||||||
auto credentials = p.GetCString(m_identifier.length() + 1);
|
auto credentials = p.GetCString(m_identifier.length() + 1);
|
||||||
@@ -307,6 +260,25 @@ void EQ::Net::ServertalkServerConnection::ProcessHandshake(EQ::Net::Packet &p)
|
|||||||
LogError("Error parsing handshake from client: {0}", ex.what());
|
LogError("Error parsing handshake from client: {0}", ex.what());
|
||||||
m_connection->Disconnect();
|
m_connection->Disconnect();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
try {
|
||||||
|
m_identifier = p.GetCString(0);
|
||||||
|
auto credentials = p.GetCString(m_identifier.length() + 1);
|
||||||
|
|
||||||
|
if (!m_parent->CheckCredentials(credentials)) {
|
||||||
|
LogError("Got incoming connection with invalid credentials during handshake, dropping connection.");
|
||||||
|
m_connection->Disconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_parent->ConnectionIdentified(this);
|
||||||
|
}
|
||||||
|
catch (std::exception &ex) {
|
||||||
|
LogError("Error parsing handshake from client: {0}", ex.what());
|
||||||
|
m_connection->Disconnect();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
|
void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
|
||||||
@@ -316,6 +288,32 @@ void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
|
|||||||
auto opcode = p.GetUInt16(4);
|
auto opcode = p.GetUInt16(4);
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
auto data = p.GetString(6, length);
|
auto data = p.GetString(6, length);
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
if (m_encrypted) {
|
||||||
|
size_t message_len = length - crypto_secretbox_MACBYTES;
|
||||||
|
std::unique_ptr<unsigned char[]> decrypted_text(new unsigned char[message_len]);
|
||||||
|
|
||||||
|
if (crypto_box_open_easy_afternm(&decrypted_text[0], (unsigned char*)&data[0], length, m_nonce_theirs, m_shared_key))
|
||||||
|
{
|
||||||
|
LogError("Error decrypting message from client");
|
||||||
|
(*(uint64_t*)&m_nonce_theirs[0])++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EQ::Net::StaticPacket decrypted_packet(&decrypted_text[0], message_len);
|
||||||
|
|
||||||
|
(*(uint64_t*)&m_nonce_theirs[0])++;
|
||||||
|
|
||||||
|
auto cb = m_message_callbacks.find(opcode);
|
||||||
|
if (cb != m_message_callbacks.end()) {
|
||||||
|
cb->second(opcode, decrypted_packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_message_callback) {
|
||||||
|
m_message_callback(opcode, decrypted_packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
size_t message_len = length;
|
size_t message_len = length;
|
||||||
EQ::Net::StaticPacket packet(&data[0], message_len);
|
EQ::Net::StaticPacket packet(&data[0], message_len);
|
||||||
|
|
||||||
@@ -328,25 +326,23 @@ void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
|
|||||||
m_message_callback(opcode, packet);
|
m_message_callback(opcode, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
size_t message_len = length;
|
||||||
|
EQ::Net::StaticPacket packet(&data[0], message_len);
|
||||||
|
|
||||||
|
auto cb = m_message_callbacks.find(opcode);
|
||||||
|
if (cb != m_message_callbacks.end()) {
|
||||||
|
cb->second(opcode, packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_message_callback) {
|
||||||
|
m_message_callback(opcode, packet);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception &ex) {
|
catch (std::exception &ex) {
|
||||||
LogError("Error parsing message from client: {0}", ex.what());
|
LogError("Error parsing message from client: {0}", ex.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::ServertalkServerConnection::ProcessMessageOld(uint16_t opcode, EQ::Net::Packet &p)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
auto cb = m_message_callbacks.find(opcode);
|
|
||||||
if (cb != m_message_callbacks.end()) {
|
|
||||||
cb->second(opcode, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_message_callback) {
|
|
||||||
m_message_callback(opcode, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (std::exception &ex) {
|
|
||||||
LogError("Error parsing legacy message from client: {0}", ex.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
#include "servertalk_common.h"
|
#include "servertalk_common.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
#include <sodium.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace EQ
|
namespace EQ
|
||||||
{
|
{
|
||||||
@@ -13,7 +16,7 @@ namespace EQ
|
|||||||
class ServertalkServerConnection
|
class ServertalkServerConnection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, ServertalkServer *parent);
|
ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, ServertalkServer *parent, bool encrypted, bool allow_downgrade);
|
||||||
~ServertalkServerConnection();
|
~ServertalkServerConnection();
|
||||||
|
|
||||||
void Send(uint16_t opcode, EQ::Net::Packet &p);
|
void Send(uint16_t opcode, EQ::Net::Packet &p);
|
||||||
@@ -27,13 +30,12 @@ namespace EQ
|
|||||||
private:
|
private:
|
||||||
void OnRead(TCPConnection* c, const unsigned char* data, size_t sz);
|
void OnRead(TCPConnection* c, const unsigned char* data, size_t sz);
|
||||||
void ProcessReadBuffer();
|
void ProcessReadBuffer();
|
||||||
void ProcessOldReadBuffer();
|
|
||||||
void OnDisconnect(TCPConnection* c);
|
void OnDisconnect(TCPConnection* c);
|
||||||
void SendHello();
|
void SendHello();
|
||||||
void InternalSend(ServertalkPacketType type, EQ::Net::Packet &p);
|
void InternalSend(ServertalkPacketType type, EQ::Net::Packet &p);
|
||||||
void ProcessHandshake(EQ::Net::Packet &p);
|
void ProcessHandshake(EQ::Net::Packet &p) { ProcessHandshake(p, false); }
|
||||||
|
void ProcessHandshake(EQ::Net::Packet &p, bool security_downgrade);
|
||||||
void ProcessMessage(EQ::Net::Packet &p);
|
void ProcessMessage(EQ::Net::Packet &p);
|
||||||
void ProcessMessageOld(uint16_t opcode, EQ::Net::Packet &p);
|
|
||||||
|
|
||||||
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
|
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
|
||||||
ServertalkServer *m_parent;
|
ServertalkServer *m_parent;
|
||||||
@@ -43,7 +45,19 @@ namespace EQ
|
|||||||
std::function<void(uint16_t, EQ::Net::Packet&)> m_message_callback;
|
std::function<void(uint16_t, EQ::Net::Packet&)> m_message_callback;
|
||||||
std::string m_identifier;
|
std::string m_identifier;
|
||||||
std::string m_uuid;
|
std::string m_uuid;
|
||||||
bool m_legacy_mode;
|
|
||||||
|
bool m_encrypted;
|
||||||
|
bool m_allow_downgrade;
|
||||||
|
#ifdef ENABLE_SECURITY
|
||||||
|
unsigned char m_public_key_ours[crypto_box_PUBLICKEYBYTES];
|
||||||
|
unsigned char m_private_key_ours[crypto_box_SECRETKEYBYTES];
|
||||||
|
unsigned char m_nonce_ours[crypto_box_NONCEBYTES];
|
||||||
|
|
||||||
|
unsigned char m_public_key_theirs[crypto_box_PUBLICKEYBYTES];
|
||||||
|
unsigned char m_nonce_theirs[crypto_box_NONCEBYTES];
|
||||||
|
|
||||||
|
unsigned char m_shared_key[crypto_box_BEFORENMBYTES];
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include "../emu_constants.h"
|
|
||||||
|
|
||||||
struct MethodHandlerEntry
|
struct MethodHandlerEntry
|
||||||
{
|
{
|
||||||
@@ -175,13 +174,13 @@ Json::Value EQ::Net::WebsocketServer::Login(WebsocketServerConnection *connectio
|
|||||||
auto r = _impl->login_handler(connection, user, pass);
|
auto r = _impl->login_handler(connection, user, pass);
|
||||||
|
|
||||||
if (r.logged_in) {
|
if (r.logged_in) {
|
||||||
connection->SetAuthorized(true, r.account_name, r.account_id, AccountStatus::Max);
|
connection->SetAuthorized(true, r.account_name, r.account_id, 255);
|
||||||
ret["status"] = "Ok";
|
ret["status"] = "Ok";
|
||||||
}
|
}
|
||||||
else if (user == "admin" && (connection->RemoteIP() == "127.0.0.1" || connection->RemoteIP() == "::")) {
|
else if (user == "admin" && (connection->RemoteIP() == "127.0.0.1" || connection->RemoteIP() == "::")) {
|
||||||
r.logged_in = true;
|
r.logged_in = true;
|
||||||
r.account_id = 0;
|
r.account_id = 0;
|
||||||
connection->SetAuthorized(true, r.account_name, r.account_id, AccountStatus::Max);
|
connection->SetAuthorized(true, r.account_name, r.account_id, 255);
|
||||||
ret["status"] = "Ok";
|
ret["status"] = "Ok";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ IN(OP_GMTraining, GMTrainee_Struct);
|
|||||||
IN(OP_GMEndTraining, GMTrainEnd_Struct);
|
IN(OP_GMEndTraining, GMTrainEnd_Struct);
|
||||||
IN(OP_GMTrainSkill, GMSkillChange_Struct);
|
IN(OP_GMTrainSkill, GMSkillChange_Struct);
|
||||||
IN(OP_RequestDuel, Duel_Struct);
|
IN(OP_RequestDuel, Duel_Struct);
|
||||||
IN(OP_DuelDecline, DuelResponse_Struct);
|
IN(OP_DuelResponse, DuelResponse_Struct);
|
||||||
IN(OP_DuelAccept, Duel_Struct);
|
IN(OP_DuelResponse2, Duel_Struct);
|
||||||
IN(OP_SpawnAppearance, SpawnAppearance_Struct);
|
IN(OP_SpawnAppearance, SpawnAppearance_Struct);
|
||||||
IN(OP_BazaarInspect, BazaarInspect_Struct);
|
IN(OP_BazaarInspect, BazaarInspect_Struct);
|
||||||
IN(OP_Death, Death_Struct);
|
IN(OP_Death, Death_Struct);
|
||||||
|
|||||||
@@ -240,8 +240,8 @@ void load_opcode_names()
|
|||||||
opcode_map[0x00a1] = "LiveOP_SaveOnZoneReq";
|
opcode_map[0x00a1] = "LiveOP_SaveOnZoneReq";
|
||||||
opcode_map[0x0185] = "LiveOP_Logout";
|
opcode_map[0x0185] = "LiveOP_Logout";
|
||||||
opcode_map[0x0298] = "LiveOP_RequestDuel";
|
opcode_map[0x0298] = "LiveOP_RequestDuel";
|
||||||
opcode_map[0x0a5d] = "LiveOP_DuelDecline";
|
opcode_map[0x0a5d] = "LiveOP_DuelResponse";
|
||||||
opcode_map[0x016e] = "LiveOP_DuelAccept";
|
opcode_map[0x016e] = "LiveOP_DuelResponse2";
|
||||||
opcode_map[0x007c] = "LiveOP_InstillDoubt";
|
opcode_map[0x007c] = "LiveOP_InstillDoubt";
|
||||||
opcode_map[0x00ac] = "LiveOP_SafeFallSuccess";
|
opcode_map[0x00ac] = "LiveOP_SafeFallSuccess";
|
||||||
opcode_map[0x02fb] = "LiveOP_DisciplineUpdate";
|
opcode_map[0x02fb] = "LiveOP_DisciplineUpdate";
|
||||||
|
|||||||
+16
-2
@@ -1634,6 +1634,20 @@ namespace RoF
|
|||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENCODE(OP_ManaChange)
|
||||||
|
{
|
||||||
|
ENCODE_LENGTH_EXACT(ManaChange_Struct);
|
||||||
|
SETUP_DIRECT_ENCODE(ManaChange_Struct, structs::ManaChange_Struct);
|
||||||
|
|
||||||
|
OUT(new_mana);
|
||||||
|
OUT(stamina);
|
||||||
|
OUT(spell_id);
|
||||||
|
OUT(keepcasting);
|
||||||
|
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
|
||||||
|
|
||||||
|
FINISH_ENCODE();
|
||||||
|
}
|
||||||
|
|
||||||
ENCODE(OP_MercenaryDataResponse)
|
ENCODE(OP_MercenaryDataResponse)
|
||||||
{
|
{
|
||||||
//consume the packet
|
//consume the packet
|
||||||
@@ -1849,8 +1863,8 @@ namespace RoF
|
|||||||
/*fill in some unknowns with observed values, hopefully it will help */
|
/*fill in some unknowns with observed values, hopefully it will help */
|
||||||
eq->unknown800 = -1;
|
eq->unknown800 = -1;
|
||||||
eq->unknown844 = 600;
|
eq->unknown844 = 600;
|
||||||
OUT(LavaDamage);
|
eq->unknown880 = 50;
|
||||||
OUT(MinLavaDamage);
|
eq->unknown884 = 10;
|
||||||
eq->unknown888 = 1;
|
eq->unknown888 = 1;
|
||||||
eq->unknown889 = 0;
|
eq->unknown889 = 0;
|
||||||
eq->unknown890 = 1;
|
eq->unknown890 = 1;
|
||||||
|
|||||||
+16
-2
@@ -1683,6 +1683,20 @@ namespace RoF2
|
|||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENCODE(OP_ManaChange)
|
||||||
|
{
|
||||||
|
ENCODE_LENGTH_EXACT(ManaChange_Struct);
|
||||||
|
SETUP_DIRECT_ENCODE(ManaChange_Struct, structs::ManaChange_Struct);
|
||||||
|
|
||||||
|
OUT(new_mana);
|
||||||
|
OUT(stamina);
|
||||||
|
OUT(spell_id);
|
||||||
|
OUT(keepcasting);
|
||||||
|
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
|
||||||
|
|
||||||
|
FINISH_ENCODE();
|
||||||
|
}
|
||||||
|
|
||||||
ENCODE(OP_MercenaryDataResponse)
|
ENCODE(OP_MercenaryDataResponse)
|
||||||
{
|
{
|
||||||
//consume the packet
|
//consume the packet
|
||||||
@@ -1905,8 +1919,8 @@ namespace RoF2
|
|||||||
eq->SkyRelated2 = -1;
|
eq->SkyRelated2 = -1;
|
||||||
eq->NPCAggroMaxDist = 600;
|
eq->NPCAggroMaxDist = 600;
|
||||||
eq->FilterID = 2008; // Guild Lobby observed value
|
eq->FilterID = 2008; // Guild Lobby observed value
|
||||||
OUT(LavaDamage);
|
eq->LavaDamage = 50;
|
||||||
OUT(MinLavaDamage);
|
eq->MinLavaDamage = 10;
|
||||||
eq->bDisallowManaStone = 1;
|
eq->bDisallowManaStone = 1;
|
||||||
eq->bNoBind = 0;
|
eq->bNoBind = 0;
|
||||||
eq->bNoAttack = 0;
|
eq->bNoAttack = 0;
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ E(OP_ItemVerifyReply)
|
|||||||
E(OP_LeadershipExpUpdate)
|
E(OP_LeadershipExpUpdate)
|
||||||
E(OP_LogServer)
|
E(OP_LogServer)
|
||||||
E(OP_LootItem)
|
E(OP_LootItem)
|
||||||
|
E(OP_ManaChange)
|
||||||
E(OP_MercenaryDataResponse)
|
E(OP_MercenaryDataResponse)
|
||||||
E(OP_MercenaryDataUpdate)
|
E(OP_MercenaryDataUpdate)
|
||||||
E(OP_MoveItem)
|
E(OP_MoveItem)
|
||||||
|
|||||||
@@ -4361,8 +4361,8 @@ struct UseAA_Struct {
|
|||||||
|
|
||||||
struct AA_Ability {
|
struct AA_Ability {
|
||||||
/*00*/ uint32 skill_id;
|
/*00*/ uint32 skill_id;
|
||||||
/*04*/ uint32 base_value;
|
/*04*/ uint32 base1;
|
||||||
/*08*/ uint32 limit_value;
|
/*08*/ uint32 base2;
|
||||||
/*12*/ uint32 slot;
|
/*12*/ uint32 slot;
|
||||||
/*16*/
|
/*16*/
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ E(OP_ItemVerifyReply)
|
|||||||
E(OP_LeadershipExpUpdate)
|
E(OP_LeadershipExpUpdate)
|
||||||
E(OP_LogServer)
|
E(OP_LogServer)
|
||||||
E(OP_LootItem)
|
E(OP_LootItem)
|
||||||
|
E(OP_ManaChange)
|
||||||
E(OP_MercenaryDataResponse)
|
E(OP_MercenaryDataResponse)
|
||||||
E(OP_MercenaryDataUpdate)
|
E(OP_MercenaryDataUpdate)
|
||||||
E(OP_MoveItem)
|
E(OP_MoveItem)
|
||||||
|
|||||||
@@ -581,8 +581,8 @@ struct NewZone_Struct {
|
|||||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||||
/*0872*/ uint32 scriptIDSomething3;
|
/*0872*/ uint32 scriptIDSomething3;
|
||||||
/*0876*/ uint32 SuspendBuffs;
|
/*0876*/ uint32 SuspendBuffs;
|
||||||
/*0880*/ uint32 LavaDamage; // Seen 50
|
/*0880*/ uint32 unknown880; // Seen 50
|
||||||
/*0884*/ uint32 MinLavaDamage; // Seen 10
|
/*0884*/ uint32 unknown884; // Seen 10
|
||||||
/*0888*/ uint8 unknown888; // Seen 1
|
/*0888*/ uint8 unknown888; // Seen 1
|
||||||
/*0889*/ uint8 unknown889; // Seen 0 (POK) or 1 (rujj)
|
/*0889*/ uint8 unknown889; // Seen 0 (POK) or 1 (rujj)
|
||||||
/*0890*/ uint8 unknown890; // Seen 1
|
/*0890*/ uint8 unknown890; // Seen 1
|
||||||
@@ -4305,8 +4305,8 @@ struct UseAA_Struct {
|
|||||||
|
|
||||||
struct AA_Ability {
|
struct AA_Ability {
|
||||||
/*00*/ uint32 skill_id;
|
/*00*/ uint32 skill_id;
|
||||||
/*04*/ uint32 base_value;
|
/*04*/ uint32 base1;
|
||||||
/*08*/ uint32 limit_value;
|
/*08*/ uint32 base2;
|
||||||
/*12*/ uint32 slot;
|
/*12*/ uint32 slot;
|
||||||
/*16*/
|
/*16*/
|
||||||
};
|
};
|
||||||
|
|||||||
+18
-4
@@ -1170,6 +1170,20 @@ namespace SoD
|
|||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENCODE(OP_ManaChange)
|
||||||
|
{
|
||||||
|
ENCODE_LENGTH_EXACT(ManaChange_Struct);
|
||||||
|
SETUP_DIRECT_ENCODE(ManaChange_Struct, structs::ManaChange_Struct);
|
||||||
|
|
||||||
|
OUT(new_mana);
|
||||||
|
OUT(stamina);
|
||||||
|
OUT(spell_id);
|
||||||
|
OUT(keepcasting);
|
||||||
|
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
|
||||||
|
|
||||||
|
FINISH_ENCODE();
|
||||||
|
}
|
||||||
|
|
||||||
ENCODE(OP_MercenaryDataResponse)
|
ENCODE(OP_MercenaryDataResponse)
|
||||||
{
|
{
|
||||||
//consume the packet
|
//consume the packet
|
||||||
@@ -1374,8 +1388,8 @@ namespace SoD
|
|||||||
/*fill in some unknowns with observed values, hopefully it will help */
|
/*fill in some unknowns with observed values, hopefully it will help */
|
||||||
eq->unknown800 = -1;
|
eq->unknown800 = -1;
|
||||||
eq->unknown844 = 600;
|
eq->unknown844 = 600;
|
||||||
OUT(LavaDamage);
|
eq->unknown880 = 50;
|
||||||
OUT(MinLavaDamage);
|
eq->unknown884 = 10;
|
||||||
eq->unknown888 = 1;
|
eq->unknown888 = 1;
|
||||||
eq->unknown889 = 0;
|
eq->unknown889 = 0;
|
||||||
eq->unknown890 = 1;
|
eq->unknown890 = 1;
|
||||||
@@ -1860,8 +1874,8 @@ namespace SoD
|
|||||||
|
|
||||||
for(auto i = 0; i < eq->total_abilities; ++i) {
|
for(auto i = 0; i < eq->total_abilities; ++i) {
|
||||||
eq->abilities[i].skill_id = inapp->ReadUInt32();
|
eq->abilities[i].skill_id = inapp->ReadUInt32();
|
||||||
eq->abilities[i].base_value = inapp->ReadUInt32();
|
eq->abilities[i].base1 = inapp->ReadUInt32();
|
||||||
eq->abilities[i].limit_value = inapp->ReadUInt32();
|
eq->abilities[i].base2 = inapp->ReadUInt32();
|
||||||
eq->abilities[i].slot = inapp->ReadUInt32();
|
eq->abilities[i].slot = inapp->ReadUInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ E(OP_ItemVerifyReply)
|
|||||||
E(OP_LeadershipExpUpdate)
|
E(OP_LeadershipExpUpdate)
|
||||||
E(OP_LogServer)
|
E(OP_LogServer)
|
||||||
E(OP_LootItem)
|
E(OP_LootItem)
|
||||||
|
E(OP_ManaChange)
|
||||||
E(OP_MercenaryDataResponse)
|
E(OP_MercenaryDataResponse)
|
||||||
E(OP_MercenaryDataUpdate)
|
E(OP_MercenaryDataUpdate)
|
||||||
E(OP_MoveItem)
|
E(OP_MoveItem)
|
||||||
|
|||||||
@@ -450,8 +450,8 @@ struct NewZone_Struct {
|
|||||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||||
/*0872*/ uint32 scriptIDSomething3;
|
/*0872*/ uint32 scriptIDSomething3;
|
||||||
/*0876*/ uint32 SuspendBuffs;
|
/*0876*/ uint32 SuspendBuffs;
|
||||||
/*0880*/ uint32 LavaDamage; //seen 50
|
/*0880*/ uint32 unknown880; //seen 50
|
||||||
/*0884*/ uint32 MinLavaDamage; //seen 10
|
/*0884*/ uint32 unknown884; //seen 10
|
||||||
/*0888*/ uint8 unknown888; //seen 1
|
/*0888*/ uint8 unknown888; //seen 1
|
||||||
/*0889*/ uint8 unknown889; //seen 0 (POK) or 1 (rujj)
|
/*0889*/ uint8 unknown889; //seen 0 (POK) or 1 (rujj)
|
||||||
/*0890*/ uint8 unknown890; //seen 1
|
/*0890*/ uint8 unknown890; //seen 1
|
||||||
@@ -3748,8 +3748,8 @@ struct UseAA_Struct {
|
|||||||
|
|
||||||
struct AA_Ability {
|
struct AA_Ability {
|
||||||
/*00*/ uint32 skill_id;
|
/*00*/ uint32 skill_id;
|
||||||
/*04*/ uint32 base_value;
|
/*04*/ uint32 base1;
|
||||||
/*08*/ uint32 limit_value;
|
/*08*/ uint32 base2;
|
||||||
/*12*/ uint32 slot;
|
/*12*/ uint32 slot;
|
||||||
/*16*/
|
/*16*/
|
||||||
};
|
};
|
||||||
|
|||||||
+18
-4
@@ -966,6 +966,20 @@ namespace SoF
|
|||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENCODE(OP_ManaChange)
|
||||||
|
{
|
||||||
|
ENCODE_LENGTH_EXACT(ManaChange_Struct);
|
||||||
|
SETUP_DIRECT_ENCODE(ManaChange_Struct, structs::ManaChange_Struct);
|
||||||
|
|
||||||
|
OUT(new_mana);
|
||||||
|
OUT(stamina);
|
||||||
|
OUT(spell_id);
|
||||||
|
OUT(keepcasting);
|
||||||
|
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
|
||||||
|
|
||||||
|
FINISH_ENCODE();
|
||||||
|
}
|
||||||
|
|
||||||
ENCODE(OP_MemorizeSpell)
|
ENCODE(OP_MemorizeSpell)
|
||||||
{
|
{
|
||||||
ENCODE_LENGTH_EXACT(MemorizeSpell_Struct);
|
ENCODE_LENGTH_EXACT(MemorizeSpell_Struct);
|
||||||
@@ -1052,8 +1066,8 @@ namespace SoF
|
|||||||
/*fill in some unknowns with observed values, hopefully it will help */
|
/*fill in some unknowns with observed values, hopefully it will help */
|
||||||
eq->unknown796 = -1;
|
eq->unknown796 = -1;
|
||||||
eq->unknown840 = 600;
|
eq->unknown840 = 600;
|
||||||
OUT(LavaDamage);
|
eq->unknown876 = 50;
|
||||||
OUT(MinLavaDamage);
|
eq->unknown880 = 10;
|
||||||
eq->unknown884 = 1;
|
eq->unknown884 = 1;
|
||||||
eq->unknown885 = 0;
|
eq->unknown885 = 0;
|
||||||
eq->unknown886 = 1;
|
eq->unknown886 = 1;
|
||||||
@@ -1531,8 +1545,8 @@ namespace SoF
|
|||||||
|
|
||||||
for(auto i = 0; i < eq->total_abilities; ++i) {
|
for(auto i = 0; i < eq->total_abilities; ++i) {
|
||||||
eq->abilities[i].skill_id = inapp->ReadUInt32();
|
eq->abilities[i].skill_id = inapp->ReadUInt32();
|
||||||
eq->abilities[i].base_value = inapp->ReadUInt32();
|
eq->abilities[i].base1 = inapp->ReadUInt32();
|
||||||
eq->abilities[i].limit_value = inapp->ReadUInt32();
|
eq->abilities[i].base2 = inapp->ReadUInt32();
|
||||||
eq->abilities[i].slot = inapp->ReadUInt32();
|
eq->abilities[i].slot = inapp->ReadUInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ E(OP_ItemVerifyReply)
|
|||||||
E(OP_LeadershipExpUpdate)
|
E(OP_LeadershipExpUpdate)
|
||||||
E(OP_LogServer)
|
E(OP_LogServer)
|
||||||
E(OP_LootItem)
|
E(OP_LootItem)
|
||||||
|
E(OP_ManaChange)
|
||||||
E(OP_MemorizeSpell)
|
E(OP_MemorizeSpell)
|
||||||
E(OP_MoveItem)
|
E(OP_MoveItem)
|
||||||
E(OP_NewSpawn)
|
E(OP_NewSpawn)
|
||||||
|
|||||||
@@ -454,8 +454,8 @@ struct NewZone_Struct {
|
|||||||
/*0864*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
/*0864*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||||
/*0868*/ uint32 scriptIDSomething3;
|
/*0868*/ uint32 scriptIDSomething3;
|
||||||
/*0872*/ uint32 SuspendBuffs;
|
/*0872*/ uint32 SuspendBuffs;
|
||||||
/*0876*/ uint32 LavaDamage; //seen 50
|
/*0876*/ uint32 unknown876; //seen 50
|
||||||
/*0880*/ uint32 MinLavaDamage; //seen 10
|
/*0880*/ uint32 unknown880; //seen 10
|
||||||
/*0884*/ uint8 unknown884; //seen 1
|
/*0884*/ uint8 unknown884; //seen 1
|
||||||
/*0885*/ uint8 unknown885; //seen 0 (POK) or 1 (rujj)
|
/*0885*/ uint8 unknown885; //seen 0 (POK) or 1 (rujj)
|
||||||
/*0886*/ uint8 unknown886; //seen 1
|
/*0886*/ uint8 unknown886; //seen 1
|
||||||
@@ -3673,8 +3673,8 @@ struct UseAA_Struct {
|
|||||||
|
|
||||||
struct AA_Ability {
|
struct AA_Ability {
|
||||||
/*00*/ uint32 skill_id;
|
/*00*/ uint32 skill_id;
|
||||||
/*04*/ uint32 base_value;
|
/*04*/ uint32 base1;
|
||||||
/*08*/ uint32 limit_value;
|
/*08*/ uint32 base2;
|
||||||
/*12*/ uint32 slot;
|
/*12*/ uint32 slot;
|
||||||
/*16*/
|
/*16*/
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -932,19 +932,6 @@ namespace Titanium
|
|||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
ENCODE(OP_ManaChange)
|
|
||||||
{
|
|
||||||
ENCODE_LENGTH_EXACT(ManaChange_Struct);
|
|
||||||
SETUP_DIRECT_ENCODE(ManaChange_Struct, structs::ManaChange_Struct);
|
|
||||||
|
|
||||||
OUT(new_mana);
|
|
||||||
OUT(stamina);
|
|
||||||
OUT(spell_id);
|
|
||||||
OUT(keepcasting);
|
|
||||||
|
|
||||||
FINISH_ENCODE();
|
|
||||||
}
|
|
||||||
|
|
||||||
ENCODE(OP_MemorizeSpell)
|
ENCODE(OP_MemorizeSpell)
|
||||||
{
|
{
|
||||||
ENCODE_LENGTH_EXACT(MemorizeSpell_Struct);
|
ENCODE_LENGTH_EXACT(MemorizeSpell_Struct);
|
||||||
@@ -1351,8 +1338,8 @@ namespace Titanium
|
|||||||
|
|
||||||
for(auto i = 0; i < eq->total_abilities; ++i) {
|
for(auto i = 0; i < eq->total_abilities; ++i) {
|
||||||
eq->abilities[i].skill_id = inapp->ReadUInt32();
|
eq->abilities[i].skill_id = inapp->ReadUInt32();
|
||||||
eq->abilities[i].base_value = inapp->ReadUInt32();
|
eq->abilities[i].base1 = inapp->ReadUInt32();
|
||||||
eq->abilities[i].limit_value = inapp->ReadUInt32();
|
eq->abilities[i].base2 = inapp->ReadUInt32();
|
||||||
eq->abilities[i].slot = inapp->ReadUInt32();
|
eq->abilities[i].slot = inapp->ReadUInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ E(OP_ItemPacket)
|
|||||||
E(OP_LeadershipExpUpdate)
|
E(OP_LeadershipExpUpdate)
|
||||||
E(OP_LFGuild)
|
E(OP_LFGuild)
|
||||||
E(OP_LootItem)
|
E(OP_LootItem)
|
||||||
E(OP_ManaChange)
|
|
||||||
E(OP_MemorizeSpell)
|
E(OP_MemorizeSpell)
|
||||||
E(OP_MoveItem)
|
E(OP_MoveItem)
|
||||||
E(OP_OnLevelMessage)
|
E(OP_OnLevelMessage)
|
||||||
|
|||||||
@@ -3180,8 +3180,8 @@ struct UseAA_Struct {
|
|||||||
|
|
||||||
struct AA_Ability {
|
struct AA_Ability {
|
||||||
/*00*/ uint32 skill_id;
|
/*00*/ uint32 skill_id;
|
||||||
/*04*/ uint32 base_value;
|
/*04*/ uint32 base1;
|
||||||
/*08*/ uint32 limit_value;
|
/*08*/ uint32 base2;
|
||||||
/*12*/ uint32 slot;
|
/*12*/ uint32 slot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+18
-4
@@ -1390,6 +1390,20 @@ namespace UF
|
|||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENCODE(OP_ManaChange)
|
||||||
|
{
|
||||||
|
ENCODE_LENGTH_EXACT(ManaChange_Struct);
|
||||||
|
SETUP_DIRECT_ENCODE(ManaChange_Struct, structs::ManaChange_Struct);
|
||||||
|
|
||||||
|
OUT(new_mana);
|
||||||
|
OUT(stamina);
|
||||||
|
OUT(spell_id);
|
||||||
|
OUT(keepcasting);
|
||||||
|
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
|
||||||
|
|
||||||
|
FINISH_ENCODE();
|
||||||
|
}
|
||||||
|
|
||||||
ENCODE(OP_MercenaryDataResponse)
|
ENCODE(OP_MercenaryDataResponse)
|
||||||
{
|
{
|
||||||
//consume the packet
|
//consume the packet
|
||||||
@@ -1600,8 +1614,8 @@ namespace UF
|
|||||||
/*fill in some unknowns with observed values, hopefully it will help */
|
/*fill in some unknowns with observed values, hopefully it will help */
|
||||||
eq->unknown800 = -1;
|
eq->unknown800 = -1;
|
||||||
eq->unknown844 = 600;
|
eq->unknown844 = 600;
|
||||||
OUT(LavaDamage);
|
eq->unknown880 = 50;
|
||||||
OUT(MinLavaDamage);
|
eq->unknown884 = 10;
|
||||||
eq->unknown888 = 1;
|
eq->unknown888 = 1;
|
||||||
eq->unknown889 = 0;
|
eq->unknown889 = 0;
|
||||||
eq->unknown890 = 1;
|
eq->unknown890 = 1;
|
||||||
@@ -2125,8 +2139,8 @@ namespace UF
|
|||||||
|
|
||||||
for(auto i = 0; i < eq->total_abilities; ++i) {
|
for(auto i = 0; i < eq->total_abilities; ++i) {
|
||||||
eq->abilities[i].skill_id = inapp->ReadUInt32();
|
eq->abilities[i].skill_id = inapp->ReadUInt32();
|
||||||
eq->abilities[i].base_value = inapp->ReadUInt32();
|
eq->abilities[i].base1 = inapp->ReadUInt32();
|
||||||
eq->abilities[i].limit_value = inapp->ReadUInt32();
|
eq->abilities[i].base2 = inapp->ReadUInt32();
|
||||||
eq->abilities[i].slot = inapp->ReadUInt32();
|
eq->abilities[i].slot = inapp->ReadUInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ E(OP_ItemVerifyReply)
|
|||||||
E(OP_LeadershipExpUpdate)
|
E(OP_LeadershipExpUpdate)
|
||||||
E(OP_LogServer)
|
E(OP_LogServer)
|
||||||
E(OP_LootItem)
|
E(OP_LootItem)
|
||||||
|
E(OP_ManaChange)
|
||||||
E(OP_MercenaryDataResponse)
|
E(OP_MercenaryDataResponse)
|
||||||
E(OP_MercenaryDataUpdate)
|
E(OP_MercenaryDataUpdate)
|
||||||
E(OP_MoveItem)
|
E(OP_MoveItem)
|
||||||
|
|||||||
@@ -450,8 +450,8 @@ struct NewZone_Struct {
|
|||||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||||
/*0872*/ uint32 scriptIDSomething3;
|
/*0872*/ uint32 scriptIDSomething3;
|
||||||
/*0876*/ uint32 SuspendBuffs;
|
/*0876*/ uint32 SuspendBuffs;
|
||||||
/*0880*/ uint32 LavaDamage; //seen 50
|
/*0880*/ uint32 unknown880; //seen 50
|
||||||
/*0884*/ uint32 MinLavaDamage; //seen 10
|
/*0884*/ uint32 unknown884; //seen 10
|
||||||
/*0888*/ uint8 unknown888; //seen 1
|
/*0888*/ uint8 unknown888; //seen 1
|
||||||
/*0889*/ uint8 unknown889; //seen 0 (POK) or 1 (rujj)
|
/*0889*/ uint8 unknown889; //seen 0 (POK) or 1 (rujj)
|
||||||
/*0890*/ uint8 unknown890; //seen 1
|
/*0890*/ uint8 unknown890; //seen 1
|
||||||
@@ -3803,8 +3803,8 @@ struct UseAA_Struct {
|
|||||||
|
|
||||||
struct AA_Ability {
|
struct AA_Ability {
|
||||||
/*00*/ uint32 skill_id;
|
/*00*/ uint32 skill_id;
|
||||||
/*04*/ uint32 base_value;
|
/*04*/ uint32 base1;
|
||||||
/*08*/ uint32 limit_value;
|
/*08*/ uint32 base2;
|
||||||
/*12*/ uint32 slot;
|
/*12*/ uint32 slot;
|
||||||
/*16*/
|
/*16*/
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ enum : int { //values for pTimerType
|
|||||||
pTimerLinkedSpellReuseStart = 28,
|
pTimerLinkedSpellReuseStart = 28,
|
||||||
pTimerLinkedSpellReuseEnd = 48,
|
pTimerLinkedSpellReuseEnd = 48,
|
||||||
|
|
||||||
pTimerShieldAbility = 86,
|
|
||||||
|
|
||||||
pTimerLayHands = 87, //these IDs are used by client too
|
pTimerLayHands = 87, //these IDs are used by client too
|
||||||
pTimerHarmTouch = 89, //so dont change them
|
pTimerHarmTouch = 89, //so dont change them
|
||||||
|
|
||||||
|
|||||||
@@ -2232,15 +2232,3 @@ bool PlayerAppearance::IsValidWoad(uint16 race_id, uint8 gender_id, uint8 woad_v
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* GetGenderName(uint32 gender_id) {
|
|
||||||
const char* gender_name = "Unknown";
|
|
||||||
if (gender_id == MALE) {
|
|
||||||
gender_name = "Male";
|
|
||||||
} else if (gender_id == FEMALE) {
|
|
||||||
gender_name = "Female";
|
|
||||||
} else if (gender_id == NEUTER) {
|
|
||||||
gender_name = "Neuter";
|
|
||||||
}
|
|
||||||
return gender_name;
|
|
||||||
}
|
|
||||||
@@ -851,7 +851,6 @@
|
|||||||
|
|
||||||
const char* GetRaceIDName(uint16 race_id);
|
const char* GetRaceIDName(uint16 race_id);
|
||||||
const char* GetPlayerRaceName(uint32 player_race_value);
|
const char* GetPlayerRaceName(uint32 player_race_value);
|
||||||
const char* GetGenderName(uint32 gender_id);
|
|
||||||
|
|
||||||
uint32 GetPlayerRaceValue(uint16 race_id);
|
uint32 GetPlayerRaceValue(uint16 race_id);
|
||||||
uint32 GetPlayerRaceBit(uint16 race_id);
|
uint32 GetPlayerRaceBit(uint16 race_id);
|
||||||
@@ -1603,14 +1602,6 @@ namespace PlayerAppearance
|
|||||||
#define RACE_FALLEN_KNIGHT_722 722
|
#define RACE_FALLEN_KNIGHT_722 722
|
||||||
#define RACE_SERVANT_OF_SHADOW_723 723
|
#define RACE_SERVANT_OF_SHADOW_723 723
|
||||||
#define RACE_LUCLIN_724 724
|
#define RACE_LUCLIN_724 724
|
||||||
#define RACE_XARIC_725 725
|
|
||||||
#define RACE_DERVISH_726 726
|
|
||||||
#define RACE_DERVISH_727 727
|
|
||||||
#define RACE_LUCLIN_728 728
|
|
||||||
#define RACE_LUCLIN_729 729
|
|
||||||
#define RACE_ORB_730 730
|
|
||||||
#define RACE_LUCLIN_731 731
|
|
||||||
#define RACE_PEGASUS_732 732
|
|
||||||
#define RACE_INTERACTIVE_OBJECT_2250 2250
|
#define RACE_INTERACTIVE_OBJECT_2250 2250
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+7
-39
@@ -1,5 +1,5 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2021 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,24 +25,10 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#ifdef USE_SFMT19937
|
/* This uses mt19937 seeded with the std::random_device
|
||||||
// only GCC supports, so lets turn it off
|
* The idea is to have this be included as a member of another class
|
||||||
#ifndef __GNUC__
|
* so mocking out for testing is easier
|
||||||
#undef USE_SFMT19937
|
* If you need to reseed random.Reseed()
|
||||||
#endif
|
|
||||||
#ifdef __clang__
|
|
||||||
#undef USE_SFMT19937
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_ADDITIVE_LFIB_PRNG
|
|
||||||
#include "additive_lagged_fibonacci_engine.h"
|
|
||||||
#elif defined(USE_SFMT19937)
|
|
||||||
#include <ext/random>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This uses mt19937 (or other compatible engine) seeded with the std::random_device. The idea is to have this be
|
|
||||||
* included as a member of another class so mocking out for testing is easier If you need to reseed random.Reseed()
|
|
||||||
* Eventually this should be derived from an abstract base class
|
* Eventually this should be derived from an abstract base class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -54,12 +40,7 @@ namespace EQ {
|
|||||||
{
|
{
|
||||||
if (low > high)
|
if (low > high)
|
||||||
std::swap(low, high);
|
std::swap(low, high);
|
||||||
// EQ uses biased int distribution, so I guess we can support it :P
|
|
||||||
#ifdef BIASED_INT_DIST
|
|
||||||
return low + m_gen() % (high - low + 1);
|
|
||||||
#else
|
|
||||||
return int_dist(m_gen, int_param_t(low, high)); // [low, high]
|
return int_dist(m_gen, int_param_t(low, high)); // [low, high]
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AKA old MakeRandomFloat
|
// AKA old MakeRandomFloat
|
||||||
@@ -117,24 +98,11 @@ namespace EQ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef BIASED_INT_DIST
|
|
||||||
typedef std::uniform_int_distribution<int>::param_type int_param_t;
|
typedef std::uniform_int_distribution<int>::param_type int_param_t;
|
||||||
std::uniform_int_distribution<int> int_dist;
|
|
||||||
#endif
|
|
||||||
typedef std::uniform_real_distribution<double>::param_type real_param_t;
|
typedef std::uniform_real_distribution<double>::param_type real_param_t;
|
||||||
|
std::mt19937 m_gen;
|
||||||
|
std::uniform_int_distribution<int> int_dist;
|
||||||
std::uniform_real_distribution<double> real_dist;
|
std::uniform_real_distribution<double> real_dist;
|
||||||
// define USE_CUSTOM_PRNG_ENGINE to any supported random engine like:
|
|
||||||
// #define USE_CUSTOM_PRNG_ENGINE std::default_random_engine
|
|
||||||
#ifdef USE_ADDITIVE_LFIB_PRNG
|
|
||||||
EQRand
|
|
||||||
#elif defined(USE_SFMT19937)
|
|
||||||
__gnu_cxx::sfmt19937
|
|
||||||
#elif defined(USE_CUSTOM_PRNG_ENGINE)
|
|
||||||
USE_CUSTOM_PRNG_ENGINE
|
|
||||||
#else
|
|
||||||
std::mt19937
|
|
||||||
#endif
|
|
||||||
m_gen;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public:
|
|||||||
entry.accid = 0;
|
entry.accid = 0;
|
||||||
entry.ip = "";
|
entry.ip = "";
|
||||||
entry.count = 1;
|
entry.count = 1;
|
||||||
entry.lastused = "";
|
entry.lastused = current_timestamp();
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public:
|
|||||||
entry.zone_in_time = 1800;
|
entry.zone_in_time = 1800;
|
||||||
entry.win_points = 0;
|
entry.win_points = 0;
|
||||||
entry.lose_points = 0;
|
entry.lose_points = 0;
|
||||||
entry.theme = LDoNThemes::GUK;
|
entry.theme = 1;
|
||||||
entry.zone_in_zone_id = 0;
|
entry.zone_in_zone_id = 0;
|
||||||
entry.zone_in_x = 0;
|
entry.zone_in_x = 0;
|
||||||
entry.zone_in_y = 0;
|
entry.zone_in_y = 0;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class BaseBaseDataRepository {
|
|||||||
public:
|
public:
|
||||||
struct BaseData {
|
struct BaseData {
|
||||||
int level;
|
int level;
|
||||||
int class_;
|
int class;
|
||||||
float hp;
|
float hp;
|
||||||
float mana;
|
float mana;
|
||||||
float end;
|
float end;
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"level",
|
"level",
|
||||||
"`class`",
|
"class",
|
||||||
"hp",
|
"hp",
|
||||||
"mana",
|
"mana",
|
||||||
"end",
|
"end",
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
BaseData entry{};
|
BaseData entry{};
|
||||||
|
|
||||||
entry.level = 0;
|
entry.level = 0;
|
||||||
entry.class_ = 0;
|
entry.class = 0;
|
||||||
entry.hp = 0;
|
entry.hp = 0;
|
||||||
entry.mana = 0;
|
entry.mana = 0;
|
||||||
entry.end = 0;
|
entry.end = 0;
|
||||||
@@ -129,7 +129,7 @@ public:
|
|||||||
BaseData entry{};
|
BaseData entry{};
|
||||||
|
|
||||||
entry.level = atoi(row[0]);
|
entry.level = atoi(row[0]);
|
||||||
entry.class_ = atoi(row[1]);
|
entry.class = atoi(row[1]);
|
||||||
entry.hp = static_cast<float>(atof(row[2]));
|
entry.hp = static_cast<float>(atof(row[2]));
|
||||||
entry.mana = static_cast<float>(atof(row[3]));
|
entry.mana = static_cast<float>(atof(row[3]));
|
||||||
entry.end = static_cast<float>(atof(row[4]));
|
entry.end = static_cast<float>(atof(row[4]));
|
||||||
@@ -172,7 +172,7 @@ public:
|
|||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
update_values.push_back(columns[0] + " = " + std::to_string(base_data_entry.level));
|
update_values.push_back(columns[0] + " = " + std::to_string(base_data_entry.level));
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(base_data_entry.class_));
|
update_values.push_back(columns[1] + " = " + std::to_string(base_data_entry.class));
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(base_data_entry.hp));
|
update_values.push_back(columns[2] + " = " + std::to_string(base_data_entry.hp));
|
||||||
update_values.push_back(columns[3] + " = " + std::to_string(base_data_entry.mana));
|
update_values.push_back(columns[3] + " = " + std::to_string(base_data_entry.mana));
|
||||||
update_values.push_back(columns[4] + " = " + std::to_string(base_data_entry.end));
|
update_values.push_back(columns[4] + " = " + std::to_string(base_data_entry.end));
|
||||||
@@ -203,7 +203,7 @@ public:
|
|||||||
std::vector<std::string> insert_values;
|
std::vector<std::string> insert_values;
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(base_data_entry.level));
|
insert_values.push_back(std::to_string(base_data_entry.level));
|
||||||
insert_values.push_back(std::to_string(base_data_entry.class_));
|
insert_values.push_back(std::to_string(base_data_entry.class));
|
||||||
insert_values.push_back(std::to_string(base_data_entry.hp));
|
insert_values.push_back(std::to_string(base_data_entry.hp));
|
||||||
insert_values.push_back(std::to_string(base_data_entry.mana));
|
insert_values.push_back(std::to_string(base_data_entry.mana));
|
||||||
insert_values.push_back(std::to_string(base_data_entry.end));
|
insert_values.push_back(std::to_string(base_data_entry.end));
|
||||||
@@ -242,7 +242,7 @@ public:
|
|||||||
std::vector<std::string> insert_values;
|
std::vector<std::string> insert_values;
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(base_data_entry.level));
|
insert_values.push_back(std::to_string(base_data_entry.level));
|
||||||
insert_values.push_back(std::to_string(base_data_entry.class_));
|
insert_values.push_back(std::to_string(base_data_entry.class));
|
||||||
insert_values.push_back(std::to_string(base_data_entry.hp));
|
insert_values.push_back(std::to_string(base_data_entry.hp));
|
||||||
insert_values.push_back(std::to_string(base_data_entry.mana));
|
insert_values.push_back(std::to_string(base_data_entry.mana));
|
||||||
insert_values.push_back(std::to_string(base_data_entry.end));
|
insert_values.push_back(std::to_string(base_data_entry.end));
|
||||||
@@ -285,7 +285,7 @@ public:
|
|||||||
BaseData entry{};
|
BaseData entry{};
|
||||||
|
|
||||||
entry.level = atoi(row[0]);
|
entry.level = atoi(row[0]);
|
||||||
entry.class_ = atoi(row[1]);
|
entry.class = atoi(row[1]);
|
||||||
entry.hp = static_cast<float>(atof(row[2]));
|
entry.hp = static_cast<float>(atof(row[2]));
|
||||||
entry.mana = static_cast<float>(atof(row[3]));
|
entry.mana = static_cast<float>(atof(row[3]));
|
||||||
entry.end = static_cast<float>(atof(row[4]));
|
entry.end = static_cast<float>(atof(row[4]));
|
||||||
@@ -319,7 +319,7 @@ public:
|
|||||||
BaseData entry{};
|
BaseData entry{};
|
||||||
|
|
||||||
entry.level = atoi(row[0]);
|
entry.level = atoi(row[0]);
|
||||||
entry.class_ = atoi(row[1]);
|
entry.class = atoi(row[1]);
|
||||||
entry.hp = static_cast<float>(atof(row[2]));
|
entry.hp = static_cast<float>(atof(row[2]));
|
||||||
entry.mana = static_cast<float>(atof(row[3]));
|
entry.mana = static_cast<float>(atof(row[3]));
|
||||||
entry.end = static_cast<float>(atof(row[4]));
|
entry.end = static_cast<float>(atof(row[4]));
|
||||||
|
|||||||
@@ -154,9 +154,9 @@ public:
|
|||||||
entry._unknown_value = 0;
|
entry._unknown_value = 0;
|
||||||
entry.bug_report = "";
|
entry.bug_report = "";
|
||||||
entry.system_info = "";
|
entry.system_info = "";
|
||||||
entry.report_datetime = "";
|
entry.report_datetime = current_timestamp();
|
||||||
entry.bug_status = 0;
|
entry.bug_status = 0;
|
||||||
entry.last_review = "";
|
entry.last_review = current_timestamp();
|
||||||
entry.last_reviewer = "None";
|
entry.last_reviewer = "None";
|
||||||
entry.reviewer_notes = "";
|
entry.reviewer_notes = "";
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
struct CharCreateCombinations {
|
struct CharCreateCombinations {
|
||||||
int allocation_id;
|
int allocation_id;
|
||||||
int race;
|
int race;
|
||||||
int class_;
|
int class;
|
||||||
int deity;
|
int deity;
|
||||||
int start_zone;
|
int start_zone;
|
||||||
int expansions_req;
|
int expansions_req;
|
||||||
@@ -36,7 +36,7 @@ public:
|
|||||||
return {
|
return {
|
||||||
"allocation_id",
|
"allocation_id",
|
||||||
"race",
|
"race",
|
||||||
"`class`",
|
"class",
|
||||||
"deity",
|
"deity",
|
||||||
"start_zone",
|
"start_zone",
|
||||||
"expansions_req",
|
"expansions_req",
|
||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
|
|
||||||
entry.allocation_id = 0;
|
entry.allocation_id = 0;
|
||||||
entry.race = 0;
|
entry.race = 0;
|
||||||
entry.class_ = 0;
|
entry.class = 0;
|
||||||
entry.deity = 0;
|
entry.deity = 0;
|
||||||
entry.start_zone = 0;
|
entry.start_zone = 0;
|
||||||
entry.expansions_req = 0;
|
entry.expansions_req = 0;
|
||||||
@@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
entry.allocation_id = atoi(row[0]);
|
entry.allocation_id = atoi(row[0]);
|
||||||
entry.race = atoi(row[1]);
|
entry.race = atoi(row[1]);
|
||||||
entry.class_ = atoi(row[2]);
|
entry.class = atoi(row[2]);
|
||||||
entry.deity = atoi(row[3]);
|
entry.deity = atoi(row[3]);
|
||||||
entry.start_zone = atoi(row[4]);
|
entry.start_zone = atoi(row[4]);
|
||||||
entry.expansions_req = atoi(row[5]);
|
entry.expansions_req = atoi(row[5]);
|
||||||
@@ -157,7 +157,7 @@ public:
|
|||||||
|
|
||||||
update_values.push_back(columns[0] + " = " + std::to_string(char_create_combinations_entry.allocation_id));
|
update_values.push_back(columns[0] + " = " + std::to_string(char_create_combinations_entry.allocation_id));
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(char_create_combinations_entry.race));
|
update_values.push_back(columns[1] + " = " + std::to_string(char_create_combinations_entry.race));
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(char_create_combinations_entry.class_));
|
update_values.push_back(columns[2] + " = " + std::to_string(char_create_combinations_entry.class));
|
||||||
update_values.push_back(columns[3] + " = " + std::to_string(char_create_combinations_entry.deity));
|
update_values.push_back(columns[3] + " = " + std::to_string(char_create_combinations_entry.deity));
|
||||||
update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone));
|
update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone));
|
||||||
update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req));
|
update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req));
|
||||||
@@ -184,7 +184,7 @@ public:
|
|||||||
|
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.class_));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.class));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
|
||||||
@@ -219,7 +219,7 @@ public:
|
|||||||
|
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.class_));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.class));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
|
||||||
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
|
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
|
||||||
@@ -258,7 +258,7 @@ public:
|
|||||||
|
|
||||||
entry.allocation_id = atoi(row[0]);
|
entry.allocation_id = atoi(row[0]);
|
||||||
entry.race = atoi(row[1]);
|
entry.race = atoi(row[1]);
|
||||||
entry.class_ = atoi(row[2]);
|
entry.class = atoi(row[2]);
|
||||||
entry.deity = atoi(row[3]);
|
entry.deity = atoi(row[3]);
|
||||||
entry.start_zone = atoi(row[4]);
|
entry.start_zone = atoi(row[4]);
|
||||||
entry.expansions_req = atoi(row[5]);
|
entry.expansions_req = atoi(row[5]);
|
||||||
@@ -288,7 +288,7 @@ public:
|
|||||||
|
|
||||||
entry.allocation_id = atoi(row[0]);
|
entry.allocation_id = atoi(row[0]);
|
||||||
entry.race = atoi(row[1]);
|
entry.race = atoi(row[1]);
|
||||||
entry.class_ = atoi(row[2]);
|
entry.class = atoi(row[2]);
|
||||||
entry.deity = atoi(row[3]);
|
entry.deity = atoi(row[3]);
|
||||||
entry.start_zone = atoi(row[4]);
|
entry.start_zone = atoi(row[4]);
|
||||||
entry.expansions_req = atoi(row[5]);
|
entry.expansions_req = atoi(row[5]);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
int level;
|
int level;
|
||||||
int race;
|
int race;
|
||||||
int gender;
|
int gender;
|
||||||
int class_;
|
int class;
|
||||||
int deity;
|
int deity;
|
||||||
int texture;
|
int texture;
|
||||||
int helm_texture;
|
int helm_texture;
|
||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
"level",
|
"level",
|
||||||
"race",
|
"race",
|
||||||
"gender",
|
"gender",
|
||||||
"`class`",
|
"class",
|
||||||
"deity",
|
"deity",
|
||||||
"texture",
|
"texture",
|
||||||
"helm_texture",
|
"helm_texture",
|
||||||
@@ -177,7 +177,7 @@ public:
|
|||||||
entry.level = 0;
|
entry.level = 0;
|
||||||
entry.race = 0;
|
entry.race = 0;
|
||||||
entry.gender = 0;
|
entry.gender = 0;
|
||||||
entry.class_ = 0;
|
entry.class = 0;
|
||||||
entry.deity = 0;
|
entry.deity = 0;
|
||||||
entry.texture = 0;
|
entry.texture = 0;
|
||||||
entry.helm_texture = 0;
|
entry.helm_texture = 0;
|
||||||
@@ -259,7 +259,7 @@ public:
|
|||||||
entry.level = atoi(row[17]);
|
entry.level = atoi(row[17]);
|
||||||
entry.race = atoi(row[18]);
|
entry.race = atoi(row[18]);
|
||||||
entry.gender = atoi(row[19]);
|
entry.gender = atoi(row[19]);
|
||||||
entry.class_ = atoi(row[20]);
|
entry.class = atoi(row[20]);
|
||||||
entry.deity = atoi(row[21]);
|
entry.deity = atoi(row[21]);
|
||||||
entry.texture = atoi(row[22]);
|
entry.texture = atoi(row[22]);
|
||||||
entry.helm_texture = atoi(row[23]);
|
entry.helm_texture = atoi(row[23]);
|
||||||
@@ -338,7 +338,7 @@ public:
|
|||||||
update_values.push_back(columns[17] + " = " + std::to_string(character_corpses_entry.level));
|
update_values.push_back(columns[17] + " = " + std::to_string(character_corpses_entry.level));
|
||||||
update_values.push_back(columns[18] + " = " + std::to_string(character_corpses_entry.race));
|
update_values.push_back(columns[18] + " = " + std::to_string(character_corpses_entry.race));
|
||||||
update_values.push_back(columns[19] + " = " + std::to_string(character_corpses_entry.gender));
|
update_values.push_back(columns[19] + " = " + std::to_string(character_corpses_entry.gender));
|
||||||
update_values.push_back(columns[20] + " = " + std::to_string(character_corpses_entry.class_));
|
update_values.push_back(columns[20] + " = " + std::to_string(character_corpses_entry.class));
|
||||||
update_values.push_back(columns[21] + " = " + std::to_string(character_corpses_entry.deity));
|
update_values.push_back(columns[21] + " = " + std::to_string(character_corpses_entry.deity));
|
||||||
update_values.push_back(columns[22] + " = " + std::to_string(character_corpses_entry.texture));
|
update_values.push_back(columns[22] + " = " + std::to_string(character_corpses_entry.texture));
|
||||||
update_values.push_back(columns[23] + " = " + std::to_string(character_corpses_entry.helm_texture));
|
update_values.push_back(columns[23] + " = " + std::to_string(character_corpses_entry.helm_texture));
|
||||||
@@ -406,7 +406,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(character_corpses_entry.level));
|
insert_values.push_back(std::to_string(character_corpses_entry.level));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.race));
|
insert_values.push_back(std::to_string(character_corpses_entry.race));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.gender));
|
insert_values.push_back(std::to_string(character_corpses_entry.gender));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.class_));
|
insert_values.push_back(std::to_string(character_corpses_entry.class));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.deity));
|
insert_values.push_back(std::to_string(character_corpses_entry.deity));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.texture));
|
insert_values.push_back(std::to_string(character_corpses_entry.texture));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
|
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
|
||||||
@@ -482,7 +482,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(character_corpses_entry.level));
|
insert_values.push_back(std::to_string(character_corpses_entry.level));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.race));
|
insert_values.push_back(std::to_string(character_corpses_entry.race));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.gender));
|
insert_values.push_back(std::to_string(character_corpses_entry.gender));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.class_));
|
insert_values.push_back(std::to_string(character_corpses_entry.class));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.deity));
|
insert_values.push_back(std::to_string(character_corpses_entry.deity));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.texture));
|
insert_values.push_back(std::to_string(character_corpses_entry.texture));
|
||||||
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
|
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
|
||||||
@@ -562,7 +562,7 @@ public:
|
|||||||
entry.level = atoi(row[17]);
|
entry.level = atoi(row[17]);
|
||||||
entry.race = atoi(row[18]);
|
entry.race = atoi(row[18]);
|
||||||
entry.gender = atoi(row[19]);
|
entry.gender = atoi(row[19]);
|
||||||
entry.class_ = atoi(row[20]);
|
entry.class = atoi(row[20]);
|
||||||
entry.deity = atoi(row[21]);
|
entry.deity = atoi(row[21]);
|
||||||
entry.texture = atoi(row[22]);
|
entry.texture = atoi(row[22]);
|
||||||
entry.helm_texture = atoi(row[23]);
|
entry.helm_texture = atoi(row[23]);
|
||||||
@@ -633,7 +633,7 @@ public:
|
|||||||
entry.level = atoi(row[17]);
|
entry.level = atoi(row[17]);
|
||||||
entry.race = atoi(row[18]);
|
entry.race = atoi(row[18]);
|
||||||
entry.gender = atoi(row[19]);
|
entry.gender = atoi(row[19]);
|
||||||
entry.class_ = atoi(row[20]);
|
entry.class = atoi(row[20]);
|
||||||
entry.deity = atoi(row[21]);
|
entry.deity = atoi(row[21]);
|
||||||
entry.texture = atoi(row[22]);
|
entry.texture = atoi(row[22]);
|
||||||
entry.helm_texture = atoi(row[23]);
|
entry.helm_texture = atoi(row[23]);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
float heading;
|
float heading;
|
||||||
int gender;
|
int gender;
|
||||||
int race;
|
int race;
|
||||||
int class_;
|
int class;
|
||||||
int level;
|
int level;
|
||||||
int deity;
|
int deity;
|
||||||
int birthday;
|
int birthday;
|
||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
int sta;
|
int sta;
|
||||||
int cha;
|
int cha;
|
||||||
int dex;
|
int dex;
|
||||||
int int_;
|
int int;
|
||||||
int agi;
|
int agi;
|
||||||
int wis;
|
int wis;
|
||||||
int zone_change_count;
|
int zone_change_count;
|
||||||
@@ -144,7 +144,7 @@ public:
|
|||||||
"heading",
|
"heading",
|
||||||
"gender",
|
"gender",
|
||||||
"race",
|
"race",
|
||||||
"`class`",
|
"class",
|
||||||
"level",
|
"level",
|
||||||
"deity",
|
"deity",
|
||||||
"birthday",
|
"birthday",
|
||||||
@@ -184,7 +184,7 @@ public:
|
|||||||
"sta",
|
"sta",
|
||||||
"cha",
|
"cha",
|
||||||
"dex",
|
"dex",
|
||||||
"`int`",
|
"int",
|
||||||
"agi",
|
"agi",
|
||||||
"wis",
|
"wis",
|
||||||
"zone_change_count",
|
"zone_change_count",
|
||||||
@@ -281,7 +281,7 @@ public:
|
|||||||
entry.heading = 0;
|
entry.heading = 0;
|
||||||
entry.gender = 0;
|
entry.gender = 0;
|
||||||
entry.race = 0;
|
entry.race = 0;
|
||||||
entry.class_ = 0;
|
entry.class = 0;
|
||||||
entry.level = 0;
|
entry.level = 0;
|
||||||
entry.deity = 0;
|
entry.deity = 0;
|
||||||
entry.birthday = 0;
|
entry.birthday = 0;
|
||||||
@@ -321,7 +321,7 @@ public:
|
|||||||
entry.sta = 0;
|
entry.sta = 0;
|
||||||
entry.cha = 0;
|
entry.cha = 0;
|
||||||
entry.dex = 0;
|
entry.dex = 0;
|
||||||
entry.int_ = 0;
|
entry.int = 0;
|
||||||
entry.agi = 0;
|
entry.agi = 0;
|
||||||
entry.wis = 0;
|
entry.wis = 0;
|
||||||
entry.zone_change_count = 0;
|
entry.zone_change_count = 0;
|
||||||
@@ -368,7 +368,7 @@ public:
|
|||||||
entry.aa_points_spent_old = 0;
|
entry.aa_points_spent_old = 0;
|
||||||
entry.aa_points_old = 0;
|
entry.aa_points_old = 0;
|
||||||
entry.e_last_invsnapshot = 0;
|
entry.e_last_invsnapshot = 0;
|
||||||
entry.deleted_at = "";
|
entry.deleted_at = 0;
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -418,7 +418,7 @@ public:
|
|||||||
entry.heading = static_cast<float>(atof(row[11]));
|
entry.heading = static_cast<float>(atof(row[11]));
|
||||||
entry.gender = atoi(row[12]);
|
entry.gender = atoi(row[12]);
|
||||||
entry.race = atoi(row[13]);
|
entry.race = atoi(row[13]);
|
||||||
entry.class_ = atoi(row[14]);
|
entry.class = atoi(row[14]);
|
||||||
entry.level = atoi(row[15]);
|
entry.level = atoi(row[15]);
|
||||||
entry.deity = atoi(row[16]);
|
entry.deity = atoi(row[16]);
|
||||||
entry.birthday = atoi(row[17]);
|
entry.birthday = atoi(row[17]);
|
||||||
@@ -458,7 +458,7 @@ public:
|
|||||||
entry.sta = atoi(row[51]);
|
entry.sta = atoi(row[51]);
|
||||||
entry.cha = atoi(row[52]);
|
entry.cha = atoi(row[52]);
|
||||||
entry.dex = atoi(row[53]);
|
entry.dex = atoi(row[53]);
|
||||||
entry.int_ = atoi(row[54]);
|
entry.int = atoi(row[54]);
|
||||||
entry.agi = atoi(row[55]);
|
entry.agi = atoi(row[55]);
|
||||||
entry.wis = atoi(row[56]);
|
entry.wis = atoi(row[56]);
|
||||||
entry.zone_change_count = atoi(row[57]);
|
entry.zone_change_count = atoi(row[57]);
|
||||||
@@ -552,7 +552,7 @@ public:
|
|||||||
update_values.push_back(columns[11] + " = " + std::to_string(character_data_entry.heading));
|
update_values.push_back(columns[11] + " = " + std::to_string(character_data_entry.heading));
|
||||||
update_values.push_back(columns[12] + " = " + std::to_string(character_data_entry.gender));
|
update_values.push_back(columns[12] + " = " + std::to_string(character_data_entry.gender));
|
||||||
update_values.push_back(columns[13] + " = " + std::to_string(character_data_entry.race));
|
update_values.push_back(columns[13] + " = " + std::to_string(character_data_entry.race));
|
||||||
update_values.push_back(columns[14] + " = " + std::to_string(character_data_entry.class_));
|
update_values.push_back(columns[14] + " = " + std::to_string(character_data_entry.class));
|
||||||
update_values.push_back(columns[15] + " = " + std::to_string(character_data_entry.level));
|
update_values.push_back(columns[15] + " = " + std::to_string(character_data_entry.level));
|
||||||
update_values.push_back(columns[16] + " = " + std::to_string(character_data_entry.deity));
|
update_values.push_back(columns[16] + " = " + std::to_string(character_data_entry.deity));
|
||||||
update_values.push_back(columns[17] + " = " + std::to_string(character_data_entry.birthday));
|
update_values.push_back(columns[17] + " = " + std::to_string(character_data_entry.birthday));
|
||||||
@@ -592,7 +592,7 @@ public:
|
|||||||
update_values.push_back(columns[51] + " = " + std::to_string(character_data_entry.sta));
|
update_values.push_back(columns[51] + " = " + std::to_string(character_data_entry.sta));
|
||||||
update_values.push_back(columns[52] + " = " + std::to_string(character_data_entry.cha));
|
update_values.push_back(columns[52] + " = " + std::to_string(character_data_entry.cha));
|
||||||
update_values.push_back(columns[53] + " = " + std::to_string(character_data_entry.dex));
|
update_values.push_back(columns[53] + " = " + std::to_string(character_data_entry.dex));
|
||||||
update_values.push_back(columns[54] + " = " + std::to_string(character_data_entry.int_));
|
update_values.push_back(columns[54] + " = " + std::to_string(character_data_entry.int));
|
||||||
update_values.push_back(columns[55] + " = " + std::to_string(character_data_entry.agi));
|
update_values.push_back(columns[55] + " = " + std::to_string(character_data_entry.agi));
|
||||||
update_values.push_back(columns[56] + " = " + std::to_string(character_data_entry.wis));
|
update_values.push_back(columns[56] + " = " + std::to_string(character_data_entry.wis));
|
||||||
update_values.push_back(columns[57] + " = " + std::to_string(character_data_entry.zone_change_count));
|
update_values.push_back(columns[57] + " = " + std::to_string(character_data_entry.zone_change_count));
|
||||||
@@ -675,7 +675,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(character_data_entry.heading));
|
insert_values.push_back(std::to_string(character_data_entry.heading));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.gender));
|
insert_values.push_back(std::to_string(character_data_entry.gender));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.race));
|
insert_values.push_back(std::to_string(character_data_entry.race));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.class_));
|
insert_values.push_back(std::to_string(character_data_entry.class));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.level));
|
insert_values.push_back(std::to_string(character_data_entry.level));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.deity));
|
insert_values.push_back(std::to_string(character_data_entry.deity));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.birthday));
|
insert_values.push_back(std::to_string(character_data_entry.birthday));
|
||||||
@@ -715,7 +715,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(character_data_entry.sta));
|
insert_values.push_back(std::to_string(character_data_entry.sta));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.cha));
|
insert_values.push_back(std::to_string(character_data_entry.cha));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.dex));
|
insert_values.push_back(std::to_string(character_data_entry.dex));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.int_));
|
insert_values.push_back(std::to_string(character_data_entry.int));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.agi));
|
insert_values.push_back(std::to_string(character_data_entry.agi));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.wis));
|
insert_values.push_back(std::to_string(character_data_entry.wis));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.zone_change_count));
|
insert_values.push_back(std::to_string(character_data_entry.zone_change_count));
|
||||||
@@ -806,7 +806,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(character_data_entry.heading));
|
insert_values.push_back(std::to_string(character_data_entry.heading));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.gender));
|
insert_values.push_back(std::to_string(character_data_entry.gender));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.race));
|
insert_values.push_back(std::to_string(character_data_entry.race));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.class_));
|
insert_values.push_back(std::to_string(character_data_entry.class));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.level));
|
insert_values.push_back(std::to_string(character_data_entry.level));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.deity));
|
insert_values.push_back(std::to_string(character_data_entry.deity));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.birthday));
|
insert_values.push_back(std::to_string(character_data_entry.birthday));
|
||||||
@@ -846,7 +846,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(character_data_entry.sta));
|
insert_values.push_back(std::to_string(character_data_entry.sta));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.cha));
|
insert_values.push_back(std::to_string(character_data_entry.cha));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.dex));
|
insert_values.push_back(std::to_string(character_data_entry.dex));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.int_));
|
insert_values.push_back(std::to_string(character_data_entry.int));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.agi));
|
insert_values.push_back(std::to_string(character_data_entry.agi));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.wis));
|
insert_values.push_back(std::to_string(character_data_entry.wis));
|
||||||
insert_values.push_back(std::to_string(character_data_entry.zone_change_count));
|
insert_values.push_back(std::to_string(character_data_entry.zone_change_count));
|
||||||
@@ -941,7 +941,7 @@ public:
|
|||||||
entry.heading = static_cast<float>(atof(row[11]));
|
entry.heading = static_cast<float>(atof(row[11]));
|
||||||
entry.gender = atoi(row[12]);
|
entry.gender = atoi(row[12]);
|
||||||
entry.race = atoi(row[13]);
|
entry.race = atoi(row[13]);
|
||||||
entry.class_ = atoi(row[14]);
|
entry.class = atoi(row[14]);
|
||||||
entry.level = atoi(row[15]);
|
entry.level = atoi(row[15]);
|
||||||
entry.deity = atoi(row[16]);
|
entry.deity = atoi(row[16]);
|
||||||
entry.birthday = atoi(row[17]);
|
entry.birthday = atoi(row[17]);
|
||||||
@@ -981,7 +981,7 @@ public:
|
|||||||
entry.sta = atoi(row[51]);
|
entry.sta = atoi(row[51]);
|
||||||
entry.cha = atoi(row[52]);
|
entry.cha = atoi(row[52]);
|
||||||
entry.dex = atoi(row[53]);
|
entry.dex = atoi(row[53]);
|
||||||
entry.int_ = atoi(row[54]);
|
entry.int = atoi(row[54]);
|
||||||
entry.agi = atoi(row[55]);
|
entry.agi = atoi(row[55]);
|
||||||
entry.wis = atoi(row[56]);
|
entry.wis = atoi(row[56]);
|
||||||
entry.zone_change_count = atoi(row[57]);
|
entry.zone_change_count = atoi(row[57]);
|
||||||
@@ -1067,7 +1067,7 @@ public:
|
|||||||
entry.heading = static_cast<float>(atof(row[11]));
|
entry.heading = static_cast<float>(atof(row[11]));
|
||||||
entry.gender = atoi(row[12]);
|
entry.gender = atoi(row[12]);
|
||||||
entry.race = atoi(row[13]);
|
entry.race = atoi(row[13]);
|
||||||
entry.class_ = atoi(row[14]);
|
entry.class = atoi(row[14]);
|
||||||
entry.level = atoi(row[15]);
|
entry.level = atoi(row[15]);
|
||||||
entry.deity = atoi(row[16]);
|
entry.deity = atoi(row[16]);
|
||||||
entry.birthday = atoi(row[17]);
|
entry.birthday = atoi(row[17]);
|
||||||
@@ -1107,7 +1107,7 @@ public:
|
|||||||
entry.sta = atoi(row[51]);
|
entry.sta = atoi(row[51]);
|
||||||
entry.cha = atoi(row[52]);
|
entry.cha = atoi(row[52]);
|
||||||
entry.dex = atoi(row[53]);
|
entry.dex = atoi(row[53]);
|
||||||
entry.int_ = atoi(row[54]);
|
entry.int = atoi(row[54]);
|
||||||
entry.agi = atoi(row[55]);
|
entry.agi = atoi(row[55]);
|
||||||
entry.wis = atoi(row[56]);
|
entry.wis = atoi(row[56]);
|
||||||
entry.zone_change_count = atoi(row[57]);
|
entry.zone_change_count = atoi(row[57]);
|
||||||
|
|||||||
@@ -1,355 +0,0 @@
|
|||||||
/**
|
|
||||||
* DO NOT MODIFY THIS FILE
|
|
||||||
*
|
|
||||||
* This repository was automatically generated and is NOT to be modified directly.
|
|
||||||
* Any repository modifications are meant to be made to the repository extending the base.
|
|
||||||
* Any modifications to base repositories are to be made by the generator only
|
|
||||||
*
|
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
|
||||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_CHARACTER_INSTANCE_SAFERETURNS_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_CHARACTER_INSTANCE_SAFERETURNS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../string_util.h"
|
|
||||||
|
|
||||||
class BaseCharacterInstanceSafereturnsRepository {
|
|
||||||
public:
|
|
||||||
struct CharacterInstanceSafereturns {
|
|
||||||
int id;
|
|
||||||
int character_id;
|
|
||||||
int instance_zone_id;
|
|
||||||
int instance_id;
|
|
||||||
int safe_zone_id;
|
|
||||||
float safe_x;
|
|
||||||
float safe_y;
|
|
||||||
float safe_z;
|
|
||||||
float safe_heading;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"character_id",
|
|
||||||
"instance_zone_id",
|
|
||||||
"instance_id",
|
|
||||||
"safe_zone_id",
|
|
||||||
"safe_x",
|
|
||||||
"safe_y",
|
|
||||||
"safe_z",
|
|
||||||
"safe_heading",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", Columns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TableName()
|
|
||||||
{
|
|
||||||
return std::string("character_instance_safereturns");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
ColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterInstanceSafereturns NewEntity()
|
|
||||||
{
|
|
||||||
CharacterInstanceSafereturns entry{};
|
|
||||||
|
|
||||||
entry.id = 0;
|
|
||||||
entry.character_id = 0;
|
|
||||||
entry.instance_zone_id = 0;
|
|
||||||
entry.instance_id = 0;
|
|
||||||
entry.safe_zone_id = 0;
|
|
||||||
entry.safe_x = 0;
|
|
||||||
entry.safe_y = 0;
|
|
||||||
entry.safe_z = 0;
|
|
||||||
entry.safe_heading = 0;
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterInstanceSafereturns GetCharacterInstanceSafereturnsEntry(
|
|
||||||
const std::vector<CharacterInstanceSafereturns> &character_instance_safereturnss,
|
|
||||||
int character_instance_safereturns_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &character_instance_safereturns : character_instance_safereturnss) {
|
|
||||||
if (character_instance_safereturns.id == character_instance_safereturns_id) {
|
|
||||||
return character_instance_safereturns;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterInstanceSafereturns FindOne(
|
|
||||||
Database& db,
|
|
||||||
int character_instance_safereturns_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE id = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
character_instance_safereturns_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
CharacterInstanceSafereturns entry{};
|
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
|
||||||
entry.character_id = atoi(row[1]);
|
|
||||||
entry.instance_zone_id = atoi(row[2]);
|
|
||||||
entry.instance_id = atoi(row[3]);
|
|
||||||
entry.safe_zone_id = atoi(row[4]);
|
|
||||||
entry.safe_x = static_cast<float>(atof(row[5]));
|
|
||||||
entry.safe_y = static_cast<float>(atof(row[6]));
|
|
||||||
entry.safe_z = static_cast<float>(atof(row[7]));
|
|
||||||
entry.safe_heading = static_cast<float>(atof(row[8]));
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int character_instance_safereturns_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
character_instance_safereturns_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
CharacterInstanceSafereturns character_instance_safereturns_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> update_values;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(character_instance_safereturns_entry.character_id));
|
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(character_instance_safereturns_entry.instance_zone_id));
|
|
||||||
update_values.push_back(columns[3] + " = " + std::to_string(character_instance_safereturns_entry.instance_id));
|
|
||||||
update_values.push_back(columns[4] + " = " + std::to_string(character_instance_safereturns_entry.safe_zone_id));
|
|
||||||
update_values.push_back(columns[5] + " = " + std::to_string(character_instance_safereturns_entry.safe_x));
|
|
||||||
update_values.push_back(columns[6] + " = " + std::to_string(character_instance_safereturns_entry.safe_y));
|
|
||||||
update_values.push_back(columns[7] + " = " + std::to_string(character_instance_safereturns_entry.safe_z));
|
|
||||||
update_values.push_back(columns[8] + " = " + std::to_string(character_instance_safereturns_entry.safe_heading));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"UPDATE {} SET {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
implode(", ", update_values),
|
|
||||||
PrimaryKey(),
|
|
||||||
character_instance_safereturns_entry.id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterInstanceSafereturns InsertOne(
|
|
||||||
Database& db,
|
|
||||||
CharacterInstanceSafereturns character_instance_safereturns_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.character_id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.instance_zone_id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.instance_id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_zone_id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_x));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_y));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_z));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_heading));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_values)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.Success()) {
|
|
||||||
character_instance_safereturns_entry.id = results.LastInsertedID();
|
|
||||||
return character_instance_safereturns_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
character_instance_safereturns_entry = NewEntity();
|
|
||||||
|
|
||||||
return character_instance_safereturns_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int InsertMany(
|
|
||||||
Database& db,
|
|
||||||
std::vector<CharacterInstanceSafereturns> character_instance_safereturns_entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &character_instance_safereturns_entry: character_instance_safereturns_entries) {
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.character_id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.instance_zone_id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.instance_id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_zone_id));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_x));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_y));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_z));
|
|
||||||
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_heading));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CharacterInstanceSafereturns> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<CharacterInstanceSafereturns> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CharacterInstanceSafereturns entry{};
|
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
|
||||||
entry.character_id = atoi(row[1]);
|
|
||||||
entry.instance_zone_id = atoi(row[2]);
|
|
||||||
entry.instance_id = atoi(row[3]);
|
|
||||||
entry.safe_zone_id = atoi(row[4]);
|
|
||||||
entry.safe_x = static_cast<float>(atof(row[5]));
|
|
||||||
entry.safe_y = static_cast<float>(atof(row[6]));
|
|
||||||
entry.safe_z = static_cast<float>(atof(row[7]));
|
|
||||||
entry.safe_heading = static_cast<float>(atof(row[8]));
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CharacterInstanceSafereturns> GetWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
std::vector<CharacterInstanceSafereturns> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {}",
|
|
||||||
BaseSelect(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CharacterInstanceSafereturns entry{};
|
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
|
||||||
entry.character_id = atoi(row[1]);
|
|
||||||
entry.instance_zone_id = atoi(row[2]);
|
|
||||||
entry.instance_id = atoi(row[3]);
|
|
||||||
entry.safe_zone_id = atoi(row[4]);
|
|
||||||
entry.safe_x = static_cast<float>(atof(row[5]));
|
|
||||||
entry.safe_y = static_cast<float>(atof(row[6]));
|
|
||||||
entry.safe_z = static_cast<float>(atof(row[7]));
|
|
||||||
entry.safe_heading = static_cast<float>(atof(row[8]));
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {}",
|
|
||||||
TableName(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Truncate(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"TRUNCATE TABLE {}",
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_BASE_CHARACTER_INSTANCE_SAFERETURNS_REPOSITORY_H
|
|
||||||
@@ -1,336 +0,0 @@
|
|||||||
/**
|
|
||||||
* DO NOT MODIFY THIS FILE
|
|
||||||
*
|
|
||||||
* This repository was automatically generated and is NOT to be modified directly.
|
|
||||||
* Any repository modifications are meant to be made to the repository extending the base.
|
|
||||||
* Any modifications to base repositories are to be made by the generator only
|
|
||||||
*
|
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
|
||||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_CHARACTER_TASK_TIMERS_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_CHARACTER_TASK_TIMERS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../string_util.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BaseCharacterTaskTimersRepository {
|
|
||||||
public:
|
|
||||||
struct CharacterTaskTimers {
|
|
||||||
int id;
|
|
||||||
int character_id;
|
|
||||||
int task_id;
|
|
||||||
int timer_type;
|
|
||||||
time_t expire_time;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"character_id",
|
|
||||||
"task_id",
|
|
||||||
"timer_type",
|
|
||||||
"expire_time",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"character_id",
|
|
||||||
"task_id",
|
|
||||||
"timer_type",
|
|
||||||
"UNIX_TIMESTAMP(expire_time)",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", Columns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string SelectColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", SelectColumns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TableName()
|
|
||||||
{
|
|
||||||
return std::string("character_task_timers");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterTaskTimers NewEntity()
|
|
||||||
{
|
|
||||||
CharacterTaskTimers entry{};
|
|
||||||
|
|
||||||
entry.id = 0;
|
|
||||||
entry.character_id = 0;
|
|
||||||
entry.task_id = 0;
|
|
||||||
entry.timer_type = 0;
|
|
||||||
entry.expire_time = std::time(nullptr);
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterTaskTimers GetCharacterTaskTimersEntry(
|
|
||||||
const std::vector<CharacterTaskTimers> &character_task_timerss,
|
|
||||||
int character_task_timers_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &character_task_timers : character_task_timerss) {
|
|
||||||
if (character_task_timers.id == character_task_timers_id) {
|
|
||||||
return character_task_timers;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterTaskTimers FindOne(
|
|
||||||
Database& db,
|
|
||||||
int character_task_timers_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE id = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
character_task_timers_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
CharacterTaskTimers entry{};
|
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
|
||||||
entry.character_id = atoi(row[1]);
|
|
||||||
entry.task_id = atoi(row[2]);
|
|
||||||
entry.timer_type = atoi(row[3]);
|
|
||||||
entry.expire_time = strtoll(row[4], nullptr, 10);
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int character_task_timers_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
character_task_timers_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
CharacterTaskTimers character_task_timers_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> update_values;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(character_task_timers_entry.character_id));
|
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(character_task_timers_entry.task_id));
|
|
||||||
update_values.push_back(columns[3] + " = " + std::to_string(character_task_timers_entry.timer_type));
|
|
||||||
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"UPDATE {} SET {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
implode(", ", update_values),
|
|
||||||
PrimaryKey(),
|
|
||||||
character_task_timers_entry.id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterTaskTimers InsertOne(
|
|
||||||
Database& db,
|
|
||||||
CharacterTaskTimers character_task_timers_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(character_task_timers_entry.id));
|
|
||||||
insert_values.push_back(std::to_string(character_task_timers_entry.character_id));
|
|
||||||
insert_values.push_back(std::to_string(character_task_timers_entry.task_id));
|
|
||||||
insert_values.push_back(std::to_string(character_task_timers_entry.timer_type));
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_values)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.Success()) {
|
|
||||||
character_task_timers_entry.id = results.LastInsertedID();
|
|
||||||
return character_task_timers_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
character_task_timers_entry = NewEntity();
|
|
||||||
|
|
||||||
return character_task_timers_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int InsertMany(
|
|
||||||
Database& db,
|
|
||||||
std::vector<CharacterTaskTimers> character_task_timers_entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &character_task_timers_entry: character_task_timers_entries) {
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(character_task_timers_entry.id));
|
|
||||||
insert_values.push_back(std::to_string(character_task_timers_entry.character_id));
|
|
||||||
insert_values.push_back(std::to_string(character_task_timers_entry.task_id));
|
|
||||||
insert_values.push_back(std::to_string(character_task_timers_entry.timer_type));
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CharacterTaskTimers> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<CharacterTaskTimers> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CharacterTaskTimers entry{};
|
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
|
||||||
entry.character_id = atoi(row[1]);
|
|
||||||
entry.task_id = atoi(row[2]);
|
|
||||||
entry.timer_type = atoi(row[3]);
|
|
||||||
entry.expire_time = strtoll(row[4], nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CharacterTaskTimers> GetWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
std::vector<CharacterTaskTimers> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {}",
|
|
||||||
BaseSelect(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CharacterTaskTimers entry{};
|
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
|
||||||
entry.character_id = atoi(row[1]);
|
|
||||||
entry.task_id = atoi(row[2]);
|
|
||||||
entry.timer_type = atoi(row[3]);
|
|
||||||
entry.expire_time = strtoll(row[4], nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {}",
|
|
||||||
TableName(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Truncate(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"TRUNCATE TABLE {}",
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_BASE_CHARACTER_TASK_TIMERS_REPOSITORY_H
|
|
||||||
@@ -1,337 +0,0 @@
|
|||||||
/**
|
|
||||||
* DO NOT MODIFY THIS FILE
|
|
||||||
*
|
|
||||||
* This repository was automatically generated and is NOT to be modified directly.
|
|
||||||
* Any repository modifications are meant to be made to the repository extending the base.
|
|
||||||
* Any modifications to base repositories are to be made by the generator only
|
|
||||||
*
|
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
|
||||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_COMPLETED_SHARED_TASK_ACTIVITY_STATE_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_COMPLETED_SHARED_TASK_ACTIVITY_STATE_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../string_util.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BaseCompletedSharedTaskActivityStateRepository {
|
|
||||||
public:
|
|
||||||
struct CompletedSharedTaskActivityState {
|
|
||||||
int64 shared_task_id;
|
|
||||||
int activity_id;
|
|
||||||
int done_count;
|
|
||||||
time_t updated_time;
|
|
||||||
time_t completed_time;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("shared_task_id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"shared_task_id",
|
|
||||||
"activity_id",
|
|
||||||
"done_count",
|
|
||||||
"updated_time",
|
|
||||||
"completed_time",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"shared_task_id",
|
|
||||||
"activity_id",
|
|
||||||
"done_count",
|
|
||||||
"UNIX_TIMESTAMP(updated_time)",
|
|
||||||
"UNIX_TIMESTAMP(completed_time)",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", Columns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string SelectColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", SelectColumns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TableName()
|
|
||||||
{
|
|
||||||
return std::string("completed_shared_task_activity_state");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTaskActivityState NewEntity()
|
|
||||||
{
|
|
||||||
CompletedSharedTaskActivityState entry{};
|
|
||||||
|
|
||||||
entry.shared_task_id = 0;
|
|
||||||
entry.activity_id = 0;
|
|
||||||
entry.done_count = 0;
|
|
||||||
entry.updated_time = 0;
|
|
||||||
entry.completed_time = 0;
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTaskActivityState GetCompletedSharedTaskActivityStateEntry(
|
|
||||||
const std::vector<CompletedSharedTaskActivityState> &completed_shared_task_activity_states,
|
|
||||||
int completed_shared_task_activity_state_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &completed_shared_task_activity_state : completed_shared_task_activity_states) {
|
|
||||||
if (completed_shared_task_activity_state.shared_task_id == completed_shared_task_activity_state_id) {
|
|
||||||
return completed_shared_task_activity_state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTaskActivityState FindOne(
|
|
||||||
Database& db,
|
|
||||||
int completed_shared_task_activity_state_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE id = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
completed_shared_task_activity_state_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
CompletedSharedTaskActivityState entry{};
|
|
||||||
|
|
||||||
entry.shared_task_id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.activity_id = atoi(row[1]);
|
|
||||||
entry.done_count = atoi(row[2]);
|
|
||||||
entry.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
|
||||||
entry.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int completed_shared_task_activity_state_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
completed_shared_task_activity_state_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
CompletedSharedTaskActivityState completed_shared_task_activity_state_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> update_values;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
update_values.push_back(columns[0] + " = " + std::to_string(completed_shared_task_activity_state_entry.shared_task_id));
|
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(completed_shared_task_activity_state_entry.activity_id));
|
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(completed_shared_task_activity_state_entry.done_count));
|
|
||||||
update_values.push_back(columns[3] + " = FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.updated_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.updated_time) : "null") + ")");
|
|
||||||
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.completed_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.completed_time) : "null") + ")");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"UPDATE {} SET {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
implode(", ", update_values),
|
|
||||||
PrimaryKey(),
|
|
||||||
completed_shared_task_activity_state_entry.shared_task_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTaskActivityState InsertOne(
|
|
||||||
Database& db,
|
|
||||||
CompletedSharedTaskActivityState completed_shared_task_activity_state_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.shared_task_id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.activity_id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.done_count));
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.updated_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.updated_time) : "null") + ")");
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.completed_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.completed_time) : "null") + ")");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_values)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.Success()) {
|
|
||||||
completed_shared_task_activity_state_entry.shared_task_id = results.LastInsertedID();
|
|
||||||
return completed_shared_task_activity_state_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
completed_shared_task_activity_state_entry = NewEntity();
|
|
||||||
|
|
||||||
return completed_shared_task_activity_state_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int InsertMany(
|
|
||||||
Database& db,
|
|
||||||
std::vector<CompletedSharedTaskActivityState> completed_shared_task_activity_state_entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &completed_shared_task_activity_state_entry: completed_shared_task_activity_state_entries) {
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.shared_task_id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.activity_id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.done_count));
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.updated_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.updated_time) : "null") + ")");
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.completed_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.completed_time) : "null") + ")");
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CompletedSharedTaskActivityState> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<CompletedSharedTaskActivityState> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CompletedSharedTaskActivityState entry{};
|
|
||||||
|
|
||||||
entry.shared_task_id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.activity_id = atoi(row[1]);
|
|
||||||
entry.done_count = atoi(row[2]);
|
|
||||||
entry.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
|
||||||
entry.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CompletedSharedTaskActivityState> GetWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
std::vector<CompletedSharedTaskActivityState> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {}",
|
|
||||||
BaseSelect(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CompletedSharedTaskActivityState entry{};
|
|
||||||
|
|
||||||
entry.shared_task_id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.activity_id = atoi(row[1]);
|
|
||||||
entry.done_count = atoi(row[2]);
|
|
||||||
entry.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
|
||||||
entry.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {}",
|
|
||||||
TableName(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Truncate(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"TRUNCATE TABLE {}",
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_BASE_COMPLETED_SHARED_TASK_ACTIVITY_STATE_REPOSITORY_H
|
|
||||||
@@ -1,317 +0,0 @@
|
|||||||
/**
|
|
||||||
* DO NOT MODIFY THIS FILE
|
|
||||||
*
|
|
||||||
* This repository was automatically generated and is NOT to be modified directly.
|
|
||||||
* Any repository modifications are meant to be made to the repository extending the base.
|
|
||||||
* Any modifications to base repositories are to be made by the generator only
|
|
||||||
*
|
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
|
||||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_COMPLETED_SHARED_TASK_MEMBERS_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_COMPLETED_SHARED_TASK_MEMBERS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../string_util.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BaseCompletedSharedTaskMembersRepository {
|
|
||||||
public:
|
|
||||||
struct CompletedSharedTaskMembers {
|
|
||||||
int64 shared_task_id;
|
|
||||||
int64 character_id;
|
|
||||||
int is_leader;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("shared_task_id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"shared_task_id",
|
|
||||||
"character_id",
|
|
||||||
"is_leader",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"shared_task_id",
|
|
||||||
"character_id",
|
|
||||||
"is_leader",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", Columns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string SelectColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", SelectColumns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TableName()
|
|
||||||
{
|
|
||||||
return std::string("completed_shared_task_members");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTaskMembers NewEntity()
|
|
||||||
{
|
|
||||||
CompletedSharedTaskMembers entry{};
|
|
||||||
|
|
||||||
entry.shared_task_id = 0;
|
|
||||||
entry.character_id = 0;
|
|
||||||
entry.is_leader = 0;
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTaskMembers GetCompletedSharedTaskMembersEntry(
|
|
||||||
const std::vector<CompletedSharedTaskMembers> &completed_shared_task_memberss,
|
|
||||||
int completed_shared_task_members_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &completed_shared_task_members : completed_shared_task_memberss) {
|
|
||||||
if (completed_shared_task_members.shared_task_id == completed_shared_task_members_id) {
|
|
||||||
return completed_shared_task_members;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTaskMembers FindOne(
|
|
||||||
Database& db,
|
|
||||||
int completed_shared_task_members_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE id = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
completed_shared_task_members_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
CompletedSharedTaskMembers entry{};
|
|
||||||
|
|
||||||
entry.shared_task_id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.character_id = strtoll(row[1], nullptr, 10);
|
|
||||||
entry.is_leader = atoi(row[2]);
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int completed_shared_task_members_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
completed_shared_task_members_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
CompletedSharedTaskMembers completed_shared_task_members_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> update_values;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
update_values.push_back(columns[0] + " = " + std::to_string(completed_shared_task_members_entry.shared_task_id));
|
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(completed_shared_task_members_entry.character_id));
|
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(completed_shared_task_members_entry.is_leader));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"UPDATE {} SET {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
implode(", ", update_values),
|
|
||||||
PrimaryKey(),
|
|
||||||
completed_shared_task_members_entry.shared_task_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTaskMembers InsertOne(
|
|
||||||
Database& db,
|
|
||||||
CompletedSharedTaskMembers completed_shared_task_members_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_members_entry.shared_task_id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_members_entry.character_id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_members_entry.is_leader));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_values)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.Success()) {
|
|
||||||
completed_shared_task_members_entry.shared_task_id = results.LastInsertedID();
|
|
||||||
return completed_shared_task_members_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
completed_shared_task_members_entry = NewEntity();
|
|
||||||
|
|
||||||
return completed_shared_task_members_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int InsertMany(
|
|
||||||
Database& db,
|
|
||||||
std::vector<CompletedSharedTaskMembers> completed_shared_task_members_entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &completed_shared_task_members_entry: completed_shared_task_members_entries) {
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_members_entry.shared_task_id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_members_entry.character_id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_task_members_entry.is_leader));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CompletedSharedTaskMembers> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<CompletedSharedTaskMembers> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CompletedSharedTaskMembers entry{};
|
|
||||||
|
|
||||||
entry.shared_task_id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.character_id = strtoll(row[1], nullptr, 10);
|
|
||||||
entry.is_leader = atoi(row[2]);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CompletedSharedTaskMembers> GetWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
std::vector<CompletedSharedTaskMembers> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {}",
|
|
||||||
BaseSelect(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CompletedSharedTaskMembers entry{};
|
|
||||||
|
|
||||||
entry.shared_task_id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.character_id = strtoll(row[1], nullptr, 10);
|
|
||||||
entry.is_leader = atoi(row[2]);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {}",
|
|
||||||
TableName(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Truncate(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"TRUNCATE TABLE {}",
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_BASE_COMPLETED_SHARED_TASK_MEMBERS_REPOSITORY_H
|
|
||||||
@@ -1,347 +0,0 @@
|
|||||||
/**
|
|
||||||
* DO NOT MODIFY THIS FILE
|
|
||||||
*
|
|
||||||
* This repository was automatically generated and is NOT to be modified directly.
|
|
||||||
* Any repository modifications are meant to be made to the repository extending the base.
|
|
||||||
* Any modifications to base repositories are to be made by the generator only
|
|
||||||
*
|
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
|
||||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_COMPLETED_SHARED_TASKS_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_COMPLETED_SHARED_TASKS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../string_util.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BaseCompletedSharedTasksRepository {
|
|
||||||
public:
|
|
||||||
struct CompletedSharedTasks {
|
|
||||||
int64 id;
|
|
||||||
int task_id;
|
|
||||||
time_t accepted_time;
|
|
||||||
time_t expire_time;
|
|
||||||
time_t completion_time;
|
|
||||||
int is_locked;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"task_id",
|
|
||||||
"accepted_time",
|
|
||||||
"expire_time",
|
|
||||||
"completion_time",
|
|
||||||
"is_locked",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"task_id",
|
|
||||||
"UNIX_TIMESTAMP(accepted_time)",
|
|
||||||
"UNIX_TIMESTAMP(expire_time)",
|
|
||||||
"UNIX_TIMESTAMP(completion_time)",
|
|
||||||
"is_locked",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", Columns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string SelectColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(implode(", ", SelectColumns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TableName()
|
|
||||||
{
|
|
||||||
return std::string("completed_shared_tasks");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTasks NewEntity()
|
|
||||||
{
|
|
||||||
CompletedSharedTasks entry{};
|
|
||||||
|
|
||||||
entry.id = 0;
|
|
||||||
entry.task_id = 0;
|
|
||||||
entry.accepted_time = 0;
|
|
||||||
entry.expire_time = 0;
|
|
||||||
entry.completion_time = 0;
|
|
||||||
entry.is_locked = 0;
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTasks GetCompletedSharedTasksEntry(
|
|
||||||
const std::vector<CompletedSharedTasks> &completed_shared_taskss,
|
|
||||||
int completed_shared_tasks_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &completed_shared_tasks : completed_shared_taskss) {
|
|
||||||
if (completed_shared_tasks.id == completed_shared_tasks_id) {
|
|
||||||
return completed_shared_tasks;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTasks FindOne(
|
|
||||||
Database& db,
|
|
||||||
int completed_shared_tasks_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE id = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
completed_shared_tasks_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
CompletedSharedTasks entry{};
|
|
||||||
|
|
||||||
entry.id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.task_id = atoi(row[1]);
|
|
||||||
entry.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
|
|
||||||
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
|
||||||
entry.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
|
||||||
entry.is_locked = atoi(row[5]);
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int completed_shared_tasks_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
completed_shared_tasks_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
CompletedSharedTasks completed_shared_tasks_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> update_values;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
update_values.push_back(columns[0] + " = " + std::to_string(completed_shared_tasks_entry.id));
|
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(completed_shared_tasks_entry.task_id));
|
|
||||||
update_values.push_back(columns[2] + " = FROM_UNIXTIME(" + (completed_shared_tasks_entry.accepted_time > 0 ? std::to_string(completed_shared_tasks_entry.accepted_time) : "null") + ")");
|
|
||||||
update_values.push_back(columns[3] + " = FROM_UNIXTIME(" + (completed_shared_tasks_entry.expire_time > 0 ? std::to_string(completed_shared_tasks_entry.expire_time) : "null") + ")");
|
|
||||||
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + (completed_shared_tasks_entry.completion_time > 0 ? std::to_string(completed_shared_tasks_entry.completion_time) : "null") + ")");
|
|
||||||
update_values.push_back(columns[5] + " = " + std::to_string(completed_shared_tasks_entry.is_locked));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"UPDATE {} SET {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
implode(", ", update_values),
|
|
||||||
PrimaryKey(),
|
|
||||||
completed_shared_tasks_entry.id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CompletedSharedTasks InsertOne(
|
|
||||||
Database& db,
|
|
||||||
CompletedSharedTasks completed_shared_tasks_entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_tasks_entry.id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_tasks_entry.task_id));
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.accepted_time > 0 ? std::to_string(completed_shared_tasks_entry.accepted_time) : "null") + ")");
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.expire_time > 0 ? std::to_string(completed_shared_tasks_entry.expire_time) : "null") + ")");
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.completion_time > 0 ? std::to_string(completed_shared_tasks_entry.completion_time) : "null") + ")");
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_tasks_entry.is_locked));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_values)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.Success()) {
|
|
||||||
completed_shared_tasks_entry.id = results.LastInsertedID();
|
|
||||||
return completed_shared_tasks_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
completed_shared_tasks_entry = NewEntity();
|
|
||||||
|
|
||||||
return completed_shared_tasks_entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int InsertMany(
|
|
||||||
Database& db,
|
|
||||||
std::vector<CompletedSharedTasks> completed_shared_tasks_entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &completed_shared_tasks_entry: completed_shared_tasks_entries) {
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_tasks_entry.id));
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_tasks_entry.task_id));
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.accepted_time > 0 ? std::to_string(completed_shared_tasks_entry.accepted_time) : "null") + ")");
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.expire_time > 0 ? std::to_string(completed_shared_tasks_entry.expire_time) : "null") + ")");
|
|
||||||
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.completion_time > 0 ? std::to_string(completed_shared_tasks_entry.completion_time) : "null") + ")");
|
|
||||||
insert_values.push_back(std::to_string(completed_shared_tasks_entry.is_locked));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> insert_values;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseInsert(),
|
|
||||||
implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CompletedSharedTasks> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<CompletedSharedTasks> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CompletedSharedTasks entry{};
|
|
||||||
|
|
||||||
entry.id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.task_id = atoi(row[1]);
|
|
||||||
entry.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
|
|
||||||
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
|
||||||
entry.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
|
||||||
entry.is_locked = atoi(row[5]);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CompletedSharedTasks> GetWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
std::vector<CompletedSharedTasks> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {}",
|
|
||||||
BaseSelect(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CompletedSharedTasks entry{};
|
|
||||||
|
|
||||||
entry.id = strtoll(row[0], nullptr, 10);
|
|
||||||
entry.task_id = atoi(row[1]);
|
|
||||||
entry.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
|
|
||||||
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
|
||||||
entry.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
|
||||||
entry.is_locked = atoi(row[5]);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteWhere(Database& db, std::string where_filter)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {}",
|
|
||||||
TableName(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Truncate(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"TRUNCATE TABLE {}",
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_BASE_COMPLETED_SHARED_TASKS_REPOSITORY_H
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
class BaseDataBucketsRepository {
|
class BaseDataBucketsRepository {
|
||||||
public:
|
public:
|
||||||
struct DataBuckets {
|
struct DataBuckets {
|
||||||
int64 id;
|
int id;
|
||||||
std::string key;
|
std::string key;
|
||||||
std::string value;
|
std::string value;
|
||||||
int expires;
|
int expires;
|
||||||
@@ -110,7 +110,7 @@ public:
|
|||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
DataBuckets entry{};
|
DataBuckets entry{};
|
||||||
|
|
||||||
entry.id = strtoll(row[0], NULL, 10);
|
entry.id = atoi(row[0]);
|
||||||
entry.key = row[1] ? row[1] : "";
|
entry.key = row[1] ? row[1] : "";
|
||||||
entry.value = row[2] ? row[2] : "";
|
entry.value = row[2] ? row[2] : "";
|
||||||
entry.expires = atoi(row[3]);
|
entry.expires = atoi(row[3]);
|
||||||
@@ -241,7 +241,7 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
DataBuckets entry{};
|
DataBuckets entry{};
|
||||||
|
|
||||||
entry.id = strtoll(row[0], NULL, 10);
|
entry.id = atoi(row[0]);
|
||||||
entry.key = row[1] ? row[1] : "";
|
entry.key = row[1] ? row[1] : "";
|
||||||
entry.value = row[2] ? row[2] : "";
|
entry.value = row[2] ? row[2] : "";
|
||||||
entry.expires = atoi(row[3]);
|
entry.expires = atoi(row[3]);
|
||||||
@@ -269,7 +269,7 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
DataBuckets entry{};
|
DataBuckets entry{};
|
||||||
|
|
||||||
entry.id = strtoll(row[0], NULL, 10);
|
entry.id = atoi(row[0]);
|
||||||
entry.key = row[1] ? row[1] : "";
|
entry.key = row[1] ? row[1] : "";
|
||||||
entry.value = row[2] ? row[2] : "";
|
entry.value = row[2] ? row[2] : "";
|
||||||
entry.expires = atoi(row[3]);
|
entry.expires = atoi(row[3]);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public:
|
|||||||
int max_expansion;
|
int max_expansion;
|
||||||
std::string content_flags;
|
std::string content_flags;
|
||||||
std::string content_flags_disabled;
|
std::string content_flags_disabled;
|
||||||
|
int is_instance_door;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -98,6 +99,7 @@ public:
|
|||||||
"max_expansion",
|
"max_expansion",
|
||||||
"content_flags",
|
"content_flags",
|
||||||
"content_flags_disabled",
|
"content_flags_disabled",
|
||||||
|
"is_instance_door",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +170,7 @@ public:
|
|||||||
entry.max_expansion = 0;
|
entry.max_expansion = 0;
|
||||||
entry.content_flags = "";
|
entry.content_flags = "";
|
||||||
entry.content_flags_disabled = "";
|
entry.content_flags_disabled = "";
|
||||||
|
entry.is_instance_door = 0;
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -238,6 +241,7 @@ public:
|
|||||||
entry.max_expansion = atoi(row[32]);
|
entry.max_expansion = atoi(row[32]);
|
||||||
entry.content_flags = row[33] ? row[33] : "";
|
entry.content_flags = row[33] ? row[33] : "";
|
||||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||||
|
entry.is_instance_door = atoi(row[35]);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -305,6 +309,7 @@ public:
|
|||||||
update_values.push_back(columns[32] + " = " + std::to_string(doors_entry.max_expansion));
|
update_values.push_back(columns[32] + " = " + std::to_string(doors_entry.max_expansion));
|
||||||
update_values.push_back(columns[33] + " = '" + EscapeString(doors_entry.content_flags) + "'");
|
update_values.push_back(columns[33] + " = '" + EscapeString(doors_entry.content_flags) + "'");
|
||||||
update_values.push_back(columns[34] + " = '" + EscapeString(doors_entry.content_flags_disabled) + "'");
|
update_values.push_back(columns[34] + " = '" + EscapeString(doors_entry.content_flags_disabled) + "'");
|
||||||
|
update_values.push_back(columns[35] + " = " + std::to_string(doors_entry.is_instance_door));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -361,6 +366,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(doors_entry.max_expansion));
|
insert_values.push_back(std::to_string(doors_entry.max_expansion));
|
||||||
insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'");
|
insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'");
|
||||||
insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'");
|
insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'");
|
||||||
|
insert_values.push_back(std::to_string(doors_entry.is_instance_door));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -425,6 +431,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(doors_entry.max_expansion));
|
insert_values.push_back(std::to_string(doors_entry.max_expansion));
|
||||||
insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'");
|
insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'");
|
||||||
insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'");
|
insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'");
|
||||||
|
insert_values.push_back(std::to_string(doors_entry.is_instance_door));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||||
}
|
}
|
||||||
@@ -493,6 +500,7 @@ public:
|
|||||||
entry.max_expansion = atoi(row[32]);
|
entry.max_expansion = atoi(row[32]);
|
||||||
entry.content_flags = row[33] ? row[33] : "";
|
entry.content_flags = row[33] ? row[33] : "";
|
||||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||||
|
entry.is_instance_door = atoi(row[35]);
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
all_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
@@ -552,6 +560,7 @@ public:
|
|||||||
entry.max_expansion = atoi(row[32]);
|
entry.max_expansion = atoi(row[32]);
|
||||||
entry.content_flags = row[33] ? row[33] : "";
|
entry.content_flags = row[33] ? row[33] : "";
|
||||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||||
|
entry.is_instance_door = atoi(row[35]);
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
all_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public:
|
|||||||
int id;
|
int id;
|
||||||
int dynamic_zone_id;
|
int dynamic_zone_id;
|
||||||
int character_id;
|
int character_id;
|
||||||
|
int is_current_member;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -34,6 +35,7 @@ public:
|
|||||||
"id",
|
"id",
|
||||||
"dynamic_zone_id",
|
"dynamic_zone_id",
|
||||||
"character_id",
|
"character_id",
|
||||||
|
"is_current_member",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +74,7 @@ public:
|
|||||||
entry.id = 0;
|
entry.id = 0;
|
||||||
entry.dynamic_zone_id = 0;
|
entry.dynamic_zone_id = 0;
|
||||||
entry.character_id = 0;
|
entry.character_id = 0;
|
||||||
|
entry.is_current_member = 1;
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -110,6 +113,7 @@ public:
|
|||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.dynamic_zone_id = atoi(row[1]);
|
entry.dynamic_zone_id = atoi(row[1]);
|
||||||
entry.character_id = atoi(row[2]);
|
entry.character_id = atoi(row[2]);
|
||||||
|
entry.is_current_member = atoi(row[3]);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -145,6 +149,7 @@ public:
|
|||||||
|
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
update_values.push_back(columns[1] + " = " + std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(dynamic_zone_members_entry.character_id));
|
update_values.push_back(columns[2] + " = " + std::to_string(dynamic_zone_members_entry.character_id));
|
||||||
|
update_values.push_back(columns[3] + " = " + std::to_string(dynamic_zone_members_entry.is_current_member));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -169,6 +174,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
|
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
|
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
|
||||||
|
insert_values.push_back(std::to_string(dynamic_zone_members_entry.is_current_member));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -201,6 +207,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
|
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
|
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
|
||||||
|
insert_values.push_back(std::to_string(dynamic_zone_members_entry.is_current_member));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||||
}
|
}
|
||||||
@@ -237,6 +244,7 @@ public:
|
|||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.dynamic_zone_id = atoi(row[1]);
|
entry.dynamic_zone_id = atoi(row[1]);
|
||||||
entry.character_id = atoi(row[2]);
|
entry.character_id = atoi(row[2]);
|
||||||
|
entry.is_current_member = atoi(row[3]);
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
all_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
@@ -264,6 +272,7 @@ public:
|
|||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.dynamic_zone_id = atoi(row[1]);
|
entry.dynamic_zone_id = atoi(row[1]);
|
||||||
entry.character_id = atoi(row[2]);
|
entry.character_id = atoi(row[2]);
|
||||||
|
entry.is_current_member = atoi(row[3]);
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
all_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,6 @@ public:
|
|||||||
int id;
|
int id;
|
||||||
int instance_id;
|
int instance_id;
|
||||||
int type;
|
int type;
|
||||||
std::string uuid;
|
|
||||||
std::string name;
|
|
||||||
int leader_id;
|
|
||||||
int min_players;
|
|
||||||
int max_players;
|
|
||||||
int compass_zone_id;
|
int compass_zone_id;
|
||||||
float compass_x;
|
float compass_x;
|
||||||
float compass_y;
|
float compass_y;
|
||||||
@@ -53,11 +48,6 @@ public:
|
|||||||
"id",
|
"id",
|
||||||
"instance_id",
|
"instance_id",
|
||||||
"type",
|
"type",
|
||||||
"uuid",
|
|
||||||
"name",
|
|
||||||
"leader_id",
|
|
||||||
"min_players",
|
|
||||||
"max_players",
|
|
||||||
"compass_zone_id",
|
"compass_zone_id",
|
||||||
"compass_x",
|
"compass_x",
|
||||||
"compass_y",
|
"compass_y",
|
||||||
@@ -110,11 +100,6 @@ public:
|
|||||||
entry.id = 0;
|
entry.id = 0;
|
||||||
entry.instance_id = 0;
|
entry.instance_id = 0;
|
||||||
entry.type = 0;
|
entry.type = 0;
|
||||||
entry.uuid = "";
|
|
||||||
entry.name = "";
|
|
||||||
entry.leader_id = 0;
|
|
||||||
entry.min_players = 0;
|
|
||||||
entry.max_players = 0;
|
|
||||||
entry.compass_zone_id = 0;
|
entry.compass_zone_id = 0;
|
||||||
entry.compass_x = 0;
|
entry.compass_x = 0;
|
||||||
entry.compass_y = 0;
|
entry.compass_y = 0;
|
||||||
@@ -167,25 +152,20 @@ public:
|
|||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.instance_id = atoi(row[1]);
|
entry.instance_id = atoi(row[1]);
|
||||||
entry.type = atoi(row[2]);
|
entry.type = atoi(row[2]);
|
||||||
entry.uuid = row[3] ? row[3] : "";
|
entry.compass_zone_id = atoi(row[3]);
|
||||||
entry.name = row[4] ? row[4] : "";
|
entry.compass_x = static_cast<float>(atof(row[4]));
|
||||||
entry.leader_id = atoi(row[5]);
|
entry.compass_y = static_cast<float>(atof(row[5]));
|
||||||
entry.min_players = atoi(row[6]);
|
entry.compass_z = static_cast<float>(atof(row[6]));
|
||||||
entry.max_players = atoi(row[7]);
|
entry.safe_return_zone_id = atoi(row[7]);
|
||||||
entry.compass_zone_id = atoi(row[8]);
|
entry.safe_return_x = static_cast<float>(atof(row[8]));
|
||||||
entry.compass_x = static_cast<float>(atof(row[9]));
|
entry.safe_return_y = static_cast<float>(atof(row[9]));
|
||||||
entry.compass_y = static_cast<float>(atof(row[10]));
|
entry.safe_return_z = static_cast<float>(atof(row[10]));
|
||||||
entry.compass_z = static_cast<float>(atof(row[11]));
|
entry.safe_return_heading = static_cast<float>(atof(row[11]));
|
||||||
entry.safe_return_zone_id = atoi(row[12]);
|
entry.zone_in_x = static_cast<float>(atof(row[12]));
|
||||||
entry.safe_return_x = static_cast<float>(atof(row[13]));
|
entry.zone_in_y = static_cast<float>(atof(row[13]));
|
||||||
entry.safe_return_y = static_cast<float>(atof(row[14]));
|
entry.zone_in_z = static_cast<float>(atof(row[14]));
|
||||||
entry.safe_return_z = static_cast<float>(atof(row[15]));
|
entry.zone_in_heading = static_cast<float>(atof(row[15]));
|
||||||
entry.safe_return_heading = static_cast<float>(atof(row[16]));
|
entry.has_zone_in = atoi(row[16]);
|
||||||
entry.zone_in_x = static_cast<float>(atof(row[17]));
|
|
||||||
entry.zone_in_y = static_cast<float>(atof(row[18]));
|
|
||||||
entry.zone_in_z = static_cast<float>(atof(row[19]));
|
|
||||||
entry.zone_in_heading = static_cast<float>(atof(row[20]));
|
|
||||||
entry.has_zone_in = atoi(row[21]);
|
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -221,25 +201,20 @@ public:
|
|||||||
|
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(dynamic_zones_entry.instance_id));
|
update_values.push_back(columns[1] + " = " + std::to_string(dynamic_zones_entry.instance_id));
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(dynamic_zones_entry.type));
|
update_values.push_back(columns[2] + " = " + std::to_string(dynamic_zones_entry.type));
|
||||||
update_values.push_back(columns[3] + " = '" + EscapeString(dynamic_zones_entry.uuid) + "'");
|
update_values.push_back(columns[3] + " = " + std::to_string(dynamic_zones_entry.compass_zone_id));
|
||||||
update_values.push_back(columns[4] + " = '" + EscapeString(dynamic_zones_entry.name) + "'");
|
update_values.push_back(columns[4] + " = " + std::to_string(dynamic_zones_entry.compass_x));
|
||||||
update_values.push_back(columns[5] + " = " + std::to_string(dynamic_zones_entry.leader_id));
|
update_values.push_back(columns[5] + " = " + std::to_string(dynamic_zones_entry.compass_y));
|
||||||
update_values.push_back(columns[6] + " = " + std::to_string(dynamic_zones_entry.min_players));
|
update_values.push_back(columns[6] + " = " + std::to_string(dynamic_zones_entry.compass_z));
|
||||||
update_values.push_back(columns[7] + " = " + std::to_string(dynamic_zones_entry.max_players));
|
update_values.push_back(columns[7] + " = " + std::to_string(dynamic_zones_entry.safe_return_zone_id));
|
||||||
update_values.push_back(columns[8] + " = " + std::to_string(dynamic_zones_entry.compass_zone_id));
|
update_values.push_back(columns[8] + " = " + std::to_string(dynamic_zones_entry.safe_return_x));
|
||||||
update_values.push_back(columns[9] + " = " + std::to_string(dynamic_zones_entry.compass_x));
|
update_values.push_back(columns[9] + " = " + std::to_string(dynamic_zones_entry.safe_return_y));
|
||||||
update_values.push_back(columns[10] + " = " + std::to_string(dynamic_zones_entry.compass_y));
|
update_values.push_back(columns[10] + " = " + std::to_string(dynamic_zones_entry.safe_return_z));
|
||||||
update_values.push_back(columns[11] + " = " + std::to_string(dynamic_zones_entry.compass_z));
|
update_values.push_back(columns[11] + " = " + std::to_string(dynamic_zones_entry.safe_return_heading));
|
||||||
update_values.push_back(columns[12] + " = " + std::to_string(dynamic_zones_entry.safe_return_zone_id));
|
update_values.push_back(columns[12] + " = " + std::to_string(dynamic_zones_entry.zone_in_x));
|
||||||
update_values.push_back(columns[13] + " = " + std::to_string(dynamic_zones_entry.safe_return_x));
|
update_values.push_back(columns[13] + " = " + std::to_string(dynamic_zones_entry.zone_in_y));
|
||||||
update_values.push_back(columns[14] + " = " + std::to_string(dynamic_zones_entry.safe_return_y));
|
update_values.push_back(columns[14] + " = " + std::to_string(dynamic_zones_entry.zone_in_z));
|
||||||
update_values.push_back(columns[15] + " = " + std::to_string(dynamic_zones_entry.safe_return_z));
|
update_values.push_back(columns[15] + " = " + std::to_string(dynamic_zones_entry.zone_in_heading));
|
||||||
update_values.push_back(columns[16] + " = " + std::to_string(dynamic_zones_entry.safe_return_heading));
|
update_values.push_back(columns[16] + " = " + std::to_string(dynamic_zones_entry.has_zone_in));
|
||||||
update_values.push_back(columns[17] + " = " + std::to_string(dynamic_zones_entry.zone_in_x));
|
|
||||||
update_values.push_back(columns[18] + " = " + std::to_string(dynamic_zones_entry.zone_in_y));
|
|
||||||
update_values.push_back(columns[19] + " = " + std::to_string(dynamic_zones_entry.zone_in_z));
|
|
||||||
update_values.push_back(columns[20] + " = " + std::to_string(dynamic_zones_entry.zone_in_heading));
|
|
||||||
update_values.push_back(columns[21] + " = " + std::to_string(dynamic_zones_entry.has_zone_in));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -264,11 +239,6 @@ public:
|
|||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.id));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.instance_id));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.instance_id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.type));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.type));
|
||||||
insert_values.push_back("'" + EscapeString(dynamic_zones_entry.uuid) + "'");
|
|
||||||
insert_values.push_back("'" + EscapeString(dynamic_zones_entry.name) + "'");
|
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.leader_id));
|
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.min_players));
|
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.max_players));
|
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_zone_id));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_zone_id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_x));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_x));
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_y));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_y));
|
||||||
@@ -315,11 +285,6 @@ public:
|
|||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.id));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.instance_id));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.instance_id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.type));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.type));
|
||||||
insert_values.push_back("'" + EscapeString(dynamic_zones_entry.uuid) + "'");
|
|
||||||
insert_values.push_back("'" + EscapeString(dynamic_zones_entry.name) + "'");
|
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.leader_id));
|
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.min_players));
|
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.max_players));
|
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_zone_id));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_zone_id));
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_x));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_x));
|
||||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_y));
|
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_y));
|
||||||
@@ -370,25 +335,20 @@ public:
|
|||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.instance_id = atoi(row[1]);
|
entry.instance_id = atoi(row[1]);
|
||||||
entry.type = atoi(row[2]);
|
entry.type = atoi(row[2]);
|
||||||
entry.uuid = row[3] ? row[3] : "";
|
entry.compass_zone_id = atoi(row[3]);
|
||||||
entry.name = row[4] ? row[4] : "";
|
entry.compass_x = static_cast<float>(atof(row[4]));
|
||||||
entry.leader_id = atoi(row[5]);
|
entry.compass_y = static_cast<float>(atof(row[5]));
|
||||||
entry.min_players = atoi(row[6]);
|
entry.compass_z = static_cast<float>(atof(row[6]));
|
||||||
entry.max_players = atoi(row[7]);
|
entry.safe_return_zone_id = atoi(row[7]);
|
||||||
entry.compass_zone_id = atoi(row[8]);
|
entry.safe_return_x = static_cast<float>(atof(row[8]));
|
||||||
entry.compass_x = static_cast<float>(atof(row[9]));
|
entry.safe_return_y = static_cast<float>(atof(row[9]));
|
||||||
entry.compass_y = static_cast<float>(atof(row[10]));
|
entry.safe_return_z = static_cast<float>(atof(row[10]));
|
||||||
entry.compass_z = static_cast<float>(atof(row[11]));
|
entry.safe_return_heading = static_cast<float>(atof(row[11]));
|
||||||
entry.safe_return_zone_id = atoi(row[12]);
|
entry.zone_in_x = static_cast<float>(atof(row[12]));
|
||||||
entry.safe_return_x = static_cast<float>(atof(row[13]));
|
entry.zone_in_y = static_cast<float>(atof(row[13]));
|
||||||
entry.safe_return_y = static_cast<float>(atof(row[14]));
|
entry.zone_in_z = static_cast<float>(atof(row[14]));
|
||||||
entry.safe_return_z = static_cast<float>(atof(row[15]));
|
entry.zone_in_heading = static_cast<float>(atof(row[15]));
|
||||||
entry.safe_return_heading = static_cast<float>(atof(row[16]));
|
entry.has_zone_in = atoi(row[16]);
|
||||||
entry.zone_in_x = static_cast<float>(atof(row[17]));
|
|
||||||
entry.zone_in_y = static_cast<float>(atof(row[18]));
|
|
||||||
entry.zone_in_z = static_cast<float>(atof(row[19]));
|
|
||||||
entry.zone_in_heading = static_cast<float>(atof(row[20]));
|
|
||||||
entry.has_zone_in = atoi(row[21]);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
all_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
@@ -416,25 +376,20 @@ public:
|
|||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.instance_id = atoi(row[1]);
|
entry.instance_id = atoi(row[1]);
|
||||||
entry.type = atoi(row[2]);
|
entry.type = atoi(row[2]);
|
||||||
entry.uuid = row[3] ? row[3] : "";
|
entry.compass_zone_id = atoi(row[3]);
|
||||||
entry.name = row[4] ? row[4] : "";
|
entry.compass_x = static_cast<float>(atof(row[4]));
|
||||||
entry.leader_id = atoi(row[5]);
|
entry.compass_y = static_cast<float>(atof(row[5]));
|
||||||
entry.min_players = atoi(row[6]);
|
entry.compass_z = static_cast<float>(atof(row[6]));
|
||||||
entry.max_players = atoi(row[7]);
|
entry.safe_return_zone_id = atoi(row[7]);
|
||||||
entry.compass_zone_id = atoi(row[8]);
|
entry.safe_return_x = static_cast<float>(atof(row[8]));
|
||||||
entry.compass_x = static_cast<float>(atof(row[9]));
|
entry.safe_return_y = static_cast<float>(atof(row[9]));
|
||||||
entry.compass_y = static_cast<float>(atof(row[10]));
|
entry.safe_return_z = static_cast<float>(atof(row[10]));
|
||||||
entry.compass_z = static_cast<float>(atof(row[11]));
|
entry.safe_return_heading = static_cast<float>(atof(row[11]));
|
||||||
entry.safe_return_zone_id = atoi(row[12]);
|
entry.zone_in_x = static_cast<float>(atof(row[12]));
|
||||||
entry.safe_return_x = static_cast<float>(atof(row[13]));
|
entry.zone_in_y = static_cast<float>(atof(row[13]));
|
||||||
entry.safe_return_y = static_cast<float>(atof(row[14]));
|
entry.zone_in_z = static_cast<float>(atof(row[14]));
|
||||||
entry.safe_return_z = static_cast<float>(atof(row[15]));
|
entry.zone_in_heading = static_cast<float>(atof(row[15]));
|
||||||
entry.safe_return_heading = static_cast<float>(atof(row[16]));
|
entry.has_zone_in = atoi(row[16]);
|
||||||
entry.zone_in_x = static_cast<float>(atof(row[17]));
|
|
||||||
entry.zone_in_y = static_cast<float>(atof(row[18]));
|
|
||||||
entry.zone_in_z = static_cast<float>(atof(row[19]));
|
|
||||||
entry.zone_in_heading = static_cast<float>(atof(row[20]));
|
|
||||||
entry.has_zone_in = atoi(row[21]);
|
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
all_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public:
|
|||||||
entry.status = 0;
|
entry.status = 0;
|
||||||
entry.charname = "";
|
entry.charname = "";
|
||||||
entry.target = "None";
|
entry.target = "None";
|
||||||
entry.time = "";
|
entry.time = current_timestamp();
|
||||||
entry.descriptiontype = "";
|
entry.descriptiontype = "";
|
||||||
entry.description = "";
|
entry.description = "";
|
||||||
entry.event_nid = 0;
|
entry.event_nid = 0;
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ class BaseExpeditionsRepository {
|
|||||||
public:
|
public:
|
||||||
struct Expeditions {
|
struct Expeditions {
|
||||||
int id;
|
int id;
|
||||||
|
std::string uuid;
|
||||||
int dynamic_zone_id;
|
int dynamic_zone_id;
|
||||||
|
std::string expedition_name;
|
||||||
|
int leader_id;
|
||||||
|
int min_players;
|
||||||
|
int max_players;
|
||||||
int add_replay_on_join;
|
int add_replay_on_join;
|
||||||
int is_locked;
|
int is_locked;
|
||||||
};
|
};
|
||||||
@@ -33,7 +38,12 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
|
"uuid",
|
||||||
"dynamic_zone_id",
|
"dynamic_zone_id",
|
||||||
|
"expedition_name",
|
||||||
|
"leader_id",
|
||||||
|
"min_players",
|
||||||
|
"max_players",
|
||||||
"add_replay_on_join",
|
"add_replay_on_join",
|
||||||
"is_locked",
|
"is_locked",
|
||||||
};
|
};
|
||||||
@@ -72,7 +82,12 @@ public:
|
|||||||
Expeditions entry{};
|
Expeditions entry{};
|
||||||
|
|
||||||
entry.id = 0;
|
entry.id = 0;
|
||||||
|
entry.uuid = "";
|
||||||
entry.dynamic_zone_id = 0;
|
entry.dynamic_zone_id = 0;
|
||||||
|
entry.expedition_name = "";
|
||||||
|
entry.leader_id = 0;
|
||||||
|
entry.min_players = 0;
|
||||||
|
entry.max_players = 0;
|
||||||
entry.add_replay_on_join = 1;
|
entry.add_replay_on_join = 1;
|
||||||
entry.is_locked = 0;
|
entry.is_locked = 0;
|
||||||
|
|
||||||
@@ -111,9 +126,14 @@ public:
|
|||||||
Expeditions entry{};
|
Expeditions entry{};
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.dynamic_zone_id = atoi(row[1]);
|
entry.uuid = row[1] ? row[1] : "";
|
||||||
entry.add_replay_on_join = atoi(row[2]);
|
entry.dynamic_zone_id = atoi(row[2]);
|
||||||
entry.is_locked = atoi(row[3]);
|
entry.expedition_name = row[3] ? row[3] : "";
|
||||||
|
entry.leader_id = atoi(row[4]);
|
||||||
|
entry.min_players = atoi(row[5]);
|
||||||
|
entry.max_players = atoi(row[6]);
|
||||||
|
entry.add_replay_on_join = atoi(row[7]);
|
||||||
|
entry.is_locked = atoi(row[8]);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -147,9 +167,14 @@ public:
|
|||||||
|
|
||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
update_values.push_back(columns[1] + " = " + std::to_string(expeditions_entry.dynamic_zone_id));
|
update_values.push_back(columns[1] + " = '" + EscapeString(expeditions_entry.uuid) + "'");
|
||||||
update_values.push_back(columns[2] + " = " + std::to_string(expeditions_entry.add_replay_on_join));
|
update_values.push_back(columns[2] + " = " + std::to_string(expeditions_entry.dynamic_zone_id));
|
||||||
update_values.push_back(columns[3] + " = " + std::to_string(expeditions_entry.is_locked));
|
update_values.push_back(columns[3] + " = '" + EscapeString(expeditions_entry.expedition_name) + "'");
|
||||||
|
update_values.push_back(columns[4] + " = " + std::to_string(expeditions_entry.leader_id));
|
||||||
|
update_values.push_back(columns[5] + " = " + std::to_string(expeditions_entry.min_players));
|
||||||
|
update_values.push_back(columns[6] + " = " + std::to_string(expeditions_entry.max_players));
|
||||||
|
update_values.push_back(columns[7] + " = " + std::to_string(expeditions_entry.add_replay_on_join));
|
||||||
|
update_values.push_back(columns[8] + " = " + std::to_string(expeditions_entry.is_locked));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -172,7 +197,12 @@ public:
|
|||||||
std::vector<std::string> insert_values;
|
std::vector<std::string> insert_values;
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(expeditions_entry.id));
|
insert_values.push_back(std::to_string(expeditions_entry.id));
|
||||||
|
insert_values.push_back("'" + EscapeString(expeditions_entry.uuid) + "'");
|
||||||
insert_values.push_back(std::to_string(expeditions_entry.dynamic_zone_id));
|
insert_values.push_back(std::to_string(expeditions_entry.dynamic_zone_id));
|
||||||
|
insert_values.push_back("'" + EscapeString(expeditions_entry.expedition_name) + "'");
|
||||||
|
insert_values.push_back(std::to_string(expeditions_entry.leader_id));
|
||||||
|
insert_values.push_back(std::to_string(expeditions_entry.min_players));
|
||||||
|
insert_values.push_back(std::to_string(expeditions_entry.max_players));
|
||||||
insert_values.push_back(std::to_string(expeditions_entry.add_replay_on_join));
|
insert_values.push_back(std::to_string(expeditions_entry.add_replay_on_join));
|
||||||
insert_values.push_back(std::to_string(expeditions_entry.is_locked));
|
insert_values.push_back(std::to_string(expeditions_entry.is_locked));
|
||||||
|
|
||||||
@@ -205,7 +235,12 @@ public:
|
|||||||
std::vector<std::string> insert_values;
|
std::vector<std::string> insert_values;
|
||||||
|
|
||||||
insert_values.push_back(std::to_string(expeditions_entry.id));
|
insert_values.push_back(std::to_string(expeditions_entry.id));
|
||||||
|
insert_values.push_back("'" + EscapeString(expeditions_entry.uuid) + "'");
|
||||||
insert_values.push_back(std::to_string(expeditions_entry.dynamic_zone_id));
|
insert_values.push_back(std::to_string(expeditions_entry.dynamic_zone_id));
|
||||||
|
insert_values.push_back("'" + EscapeString(expeditions_entry.expedition_name) + "'");
|
||||||
|
insert_values.push_back(std::to_string(expeditions_entry.leader_id));
|
||||||
|
insert_values.push_back(std::to_string(expeditions_entry.min_players));
|
||||||
|
insert_values.push_back(std::to_string(expeditions_entry.max_players));
|
||||||
insert_values.push_back(std::to_string(expeditions_entry.add_replay_on_join));
|
insert_values.push_back(std::to_string(expeditions_entry.add_replay_on_join));
|
||||||
insert_values.push_back(std::to_string(expeditions_entry.is_locked));
|
insert_values.push_back(std::to_string(expeditions_entry.is_locked));
|
||||||
|
|
||||||
@@ -242,9 +277,14 @@ public:
|
|||||||
Expeditions entry{};
|
Expeditions entry{};
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.dynamic_zone_id = atoi(row[1]);
|
entry.uuid = row[1] ? row[1] : "";
|
||||||
entry.add_replay_on_join = atoi(row[2]);
|
entry.dynamic_zone_id = atoi(row[2]);
|
||||||
entry.is_locked = atoi(row[3]);
|
entry.expedition_name = row[3] ? row[3] : "";
|
||||||
|
entry.leader_id = atoi(row[4]);
|
||||||
|
entry.min_players = atoi(row[5]);
|
||||||
|
entry.max_players = atoi(row[6]);
|
||||||
|
entry.add_replay_on_join = atoi(row[7]);
|
||||||
|
entry.is_locked = atoi(row[8]);
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
all_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
@@ -270,9 +310,14 @@ public:
|
|||||||
Expeditions entry{};
|
Expeditions entry{};
|
||||||
|
|
||||||
entry.id = atoi(row[0]);
|
entry.id = atoi(row[0]);
|
||||||
entry.dynamic_zone_id = atoi(row[1]);
|
entry.uuid = row[1] ? row[1] : "";
|
||||||
entry.add_replay_on_join = atoi(row[2]);
|
entry.dynamic_zone_id = atoi(row[2]);
|
||||||
entry.is_locked = atoi(row[3]);
|
entry.expedition_name = row[3] ? row[3] : "";
|
||||||
|
entry.leader_id = atoi(row[4]);
|
||||||
|
entry.min_players = atoi(row[5]);
|
||||||
|
entry.max_players = atoi(row[6]);
|
||||||
|
entry.add_replay_on_join = atoi(row[7]);
|
||||||
|
entry.is_locked = atoi(row[8]);
|
||||||
|
|
||||||
all_entries.push_back(entry);
|
all_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
int rare;
|
int rare;
|
||||||
int raid;
|
int raid;
|
||||||
std::string race;
|
std::string race;
|
||||||
std::string class_;
|
std::string class;
|
||||||
std::string bodytype;
|
std::string bodytype;
|
||||||
std::string zone;
|
std::string zone;
|
||||||
int hot_zone;
|
int hot_zone;
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
"rare",
|
"rare",
|
||||||
"raid",
|
"raid",
|
||||||
"race",
|
"race",
|
||||||
"`class`",
|
"class",
|
||||||
"bodytype",
|
"bodytype",
|
||||||
"zone",
|
"zone",
|
||||||
"hot_zone",
|
"hot_zone",
|
||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
entry.rare = 0;
|
entry.rare = 0;
|
||||||
entry.raid = 0;
|
entry.raid = 0;
|
||||||
entry.race = "";
|
entry.race = "";
|
||||||
entry.class_ = "";
|
entry.class = "";
|
||||||
entry.bodytype = "";
|
entry.bodytype = "";
|
||||||
entry.zone = "";
|
entry.zone = "";
|
||||||
entry.hot_zone = 0;
|
entry.hot_zone = 0;
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
entry.rare = atoi(row[6]);
|
entry.rare = atoi(row[6]);
|
||||||
entry.raid = atoi(row[7]);
|
entry.raid = atoi(row[7]);
|
||||||
entry.race = row[8] ? row[8] : "";
|
entry.race = row[8] ? row[8] : "";
|
||||||
entry.class_ = row[9] ? row[9] : "";
|
entry.class = row[9] ? row[9] : "";
|
||||||
entry.bodytype = row[10] ? row[10] : "";
|
entry.bodytype = row[10] ? row[10] : "";
|
||||||
entry.zone = row[11] ? row[11] : "";
|
entry.zone = row[11] ? row[11] : "";
|
||||||
entry.hot_zone = atoi(row[12]);
|
entry.hot_zone = atoi(row[12]);
|
||||||
@@ -207,7 +207,7 @@ public:
|
|||||||
update_values.push_back(columns[6] + " = " + std::to_string(global_loot_entry.rare));
|
update_values.push_back(columns[6] + " = " + std::to_string(global_loot_entry.rare));
|
||||||
update_values.push_back(columns[7] + " = " + std::to_string(global_loot_entry.raid));
|
update_values.push_back(columns[7] + " = " + std::to_string(global_loot_entry.raid));
|
||||||
update_values.push_back(columns[8] + " = '" + EscapeString(global_loot_entry.race) + "'");
|
update_values.push_back(columns[8] + " = '" + EscapeString(global_loot_entry.race) + "'");
|
||||||
update_values.push_back(columns[9] + " = '" + EscapeString(global_loot_entry.class_) + "'");
|
update_values.push_back(columns[9] + " = '" + EscapeString(global_loot_entry.class) + "'");
|
||||||
update_values.push_back(columns[10] + " = '" + EscapeString(global_loot_entry.bodytype) + "'");
|
update_values.push_back(columns[10] + " = '" + EscapeString(global_loot_entry.bodytype) + "'");
|
||||||
update_values.push_back(columns[11] + " = '" + EscapeString(global_loot_entry.zone) + "'");
|
update_values.push_back(columns[11] + " = '" + EscapeString(global_loot_entry.zone) + "'");
|
||||||
update_values.push_back(columns[12] + " = " + std::to_string(global_loot_entry.hot_zone));
|
update_values.push_back(columns[12] + " = " + std::to_string(global_loot_entry.hot_zone));
|
||||||
@@ -245,7 +245,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(global_loot_entry.rare));
|
insert_values.push_back(std::to_string(global_loot_entry.rare));
|
||||||
insert_values.push_back(std::to_string(global_loot_entry.raid));
|
insert_values.push_back(std::to_string(global_loot_entry.raid));
|
||||||
insert_values.push_back("'" + EscapeString(global_loot_entry.race) + "'");
|
insert_values.push_back("'" + EscapeString(global_loot_entry.race) + "'");
|
||||||
insert_values.push_back("'" + EscapeString(global_loot_entry.class_) + "'");
|
insert_values.push_back("'" + EscapeString(global_loot_entry.class) + "'");
|
||||||
insert_values.push_back("'" + EscapeString(global_loot_entry.bodytype) + "'");
|
insert_values.push_back("'" + EscapeString(global_loot_entry.bodytype) + "'");
|
||||||
insert_values.push_back("'" + EscapeString(global_loot_entry.zone) + "'");
|
insert_values.push_back("'" + EscapeString(global_loot_entry.zone) + "'");
|
||||||
insert_values.push_back(std::to_string(global_loot_entry.hot_zone));
|
insert_values.push_back(std::to_string(global_loot_entry.hot_zone));
|
||||||
@@ -291,7 +291,7 @@ public:
|
|||||||
insert_values.push_back(std::to_string(global_loot_entry.rare));
|
insert_values.push_back(std::to_string(global_loot_entry.rare));
|
||||||
insert_values.push_back(std::to_string(global_loot_entry.raid));
|
insert_values.push_back(std::to_string(global_loot_entry.raid));
|
||||||
insert_values.push_back("'" + EscapeString(global_loot_entry.race) + "'");
|
insert_values.push_back("'" + EscapeString(global_loot_entry.race) + "'");
|
||||||
insert_values.push_back("'" + EscapeString(global_loot_entry.class_) + "'");
|
insert_values.push_back("'" + EscapeString(global_loot_entry.class) + "'");
|
||||||
insert_values.push_back("'" + EscapeString(global_loot_entry.bodytype) + "'");
|
insert_values.push_back("'" + EscapeString(global_loot_entry.bodytype) + "'");
|
||||||
insert_values.push_back("'" + EscapeString(global_loot_entry.zone) + "'");
|
insert_values.push_back("'" + EscapeString(global_loot_entry.zone) + "'");
|
||||||
insert_values.push_back(std::to_string(global_loot_entry.hot_zone));
|
insert_values.push_back(std::to_string(global_loot_entry.hot_zone));
|
||||||
@@ -341,7 +341,7 @@ public:
|
|||||||
entry.rare = atoi(row[6]);
|
entry.rare = atoi(row[6]);
|
||||||
entry.raid = atoi(row[7]);
|
entry.raid = atoi(row[7]);
|
||||||
entry.race = row[8] ? row[8] : "";
|
entry.race = row[8] ? row[8] : "";
|
||||||
entry.class_ = row[9] ? row[9] : "";
|
entry.class = row[9] ? row[9] : "";
|
||||||
entry.bodytype = row[10] ? row[10] : "";
|
entry.bodytype = row[10] ? row[10] : "";
|
||||||
entry.zone = row[11] ? row[11] : "";
|
entry.zone = row[11] ? row[11] : "";
|
||||||
entry.hot_zone = atoi(row[12]);
|
entry.hot_zone = atoi(row[12]);
|
||||||
@@ -382,7 +382,7 @@ public:
|
|||||||
entry.rare = atoi(row[6]);
|
entry.rare = atoi(row[6]);
|
||||||
entry.raid = atoi(row[7]);
|
entry.raid = atoi(row[7]);
|
||||||
entry.race = row[8] ? row[8] : "";
|
entry.race = row[8] ? row[8] : "";
|
||||||
entry.class_ = row[9] ? row[9] : "";
|
entry.class = row[9] ? row[9] : "";
|
||||||
entry.bodytype = row[10] ? row[10] : "";
|
entry.bodytype = row[10] ? row[10] : "";
|
||||||
entry.zone = row[11] ? row[11] : "";
|
entry.zone = row[11] ? row[11] : "";
|
||||||
entry.hot_zone = atoi(row[12]);
|
entry.hot_zone = atoi(row[12]);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
entry.name = "";
|
entry.name = "";
|
||||||
entry.hacked = "";
|
entry.hacked = "";
|
||||||
entry.zone = "";
|
entry.zone = "";
|
||||||
entry.date = "";
|
entry.date = current_timestamp();
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -717,7 +717,7 @@ public:
|
|||||||
entry.itemclass = 0;
|
entry.itemclass = 0;
|
||||||
entry.itemtype = 0;
|
entry.itemtype = 0;
|
||||||
entry.ldonprice = 0;
|
entry.ldonprice = 0;
|
||||||
entry.ldontheme = LDoNThemes::Unused;
|
entry.ldontheme = 0;
|
||||||
entry.ldonsold = 0;
|
entry.ldonsold = 0;
|
||||||
entry.light = 0;
|
entry.light = 0;
|
||||||
entry.lore = "";
|
entry.lore = "";
|
||||||
@@ -797,8 +797,8 @@ public:
|
|||||||
entry.scrolllevel2 = 0;
|
entry.scrolllevel2 = 0;
|
||||||
entry.scrolllevel = 0;
|
entry.scrolllevel = 0;
|
||||||
entry.UNK157 = 0;
|
entry.UNK157 = 0;
|
||||||
entry.serialized = "";
|
entry.serialized = 0;
|
||||||
entry.verified = "";
|
entry.verified = 0;
|
||||||
entry.serialization = "";
|
entry.serialization = "";
|
||||||
entry.source = "";
|
entry.source = "";
|
||||||
entry.UNK033 = 0;
|
entry.UNK033 = 0;
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ public:
|
|||||||
entry.account_email = "";
|
entry.account_email = "";
|
||||||
entry.source_loginserver = "";
|
entry.source_loginserver = "";
|
||||||
entry.last_ip_address = "";
|
entry.last_ip_address = "";
|
||||||
entry.last_login_date = "";
|
entry.last_login_date = 0;
|
||||||
entry.created_at = "";
|
entry.created_at = 0;
|
||||||
entry.updated_at = "";
|
entry.updated_at = current_timestamp();
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ public:
|
|||||||
entry.token = "";
|
entry.token = "";
|
||||||
entry.can_write = 0;
|
entry.can_write = 0;
|
||||||
entry.can_read = 0;
|
entry.can_read = 0;
|
||||||
entry.created_at = "";
|
entry.created_at = 0;
|
||||||
entry.updated_at = "";
|
entry.updated_at = current_timestamp();
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
entry.first_name = "";
|
entry.first_name = "";
|
||||||
entry.last_name = "";
|
entry.last_name = "";
|
||||||
entry.email = "";
|
entry.email = "";
|
||||||
entry.registration_date = "";
|
entry.registration_date = 0;
|
||||||
entry.registration_ip_address = "";
|
entry.registration_ip_address = "";
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
entry.short_name = "";
|
entry.short_name = "";
|
||||||
entry.tag_description = "";
|
entry.tag_description = "";
|
||||||
entry.login_server_list_type_id = 0;
|
entry.login_server_list_type_id = 0;
|
||||||
entry.last_login_date = "";
|
entry.last_login_date = 0;
|
||||||
entry.last_ip_address = "";
|
entry.last_ip_address = "";
|
||||||
entry.login_server_admin_id = 0;
|
entry.login_server_admin_id = 0;
|
||||||
entry.is_server_trusted = 0;
|
entry.is_server_trusted = 0;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user