diff --git a/README.md b/README.md
index 1a2ae2b3a..033fcccab 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
-EverQuest Emulator (EQEmu) - A Fan-Made Project Honoring the Legendary MMORPG
+EQEmulator - A Fan-Made Project Honoring a Legendary MMORPG
@@ -26,19 +26,19 @@
***
-EQEmulator is a passion-driven, open source server emulator project dedicated to preserving and celebrating the groundbreaking world of EverQuest, the massively multiplayer online role-playing game originally developed by Verant Interactive and Sony Online Entertainment (now Daybreak Game Company).
+EQEmulator is a passion-driven, open source server emulator project dedicated to preserving and celebrating the legacy of a groundbreaking classic MMORPG.
-For over two decades and continuing, EQEmulator has served as a fan tribute, providing tools and technology that allow players to explore, customize, and experience EverQuest’s iconic gameplay in new ways. This project exists solely out of deep admiration for the original developers, artists, designers, and visionaries who created one of the most influential online worlds of all time.
+For over two decades and continuing, EQEmulator has served as a fan tribute, providing tools and technology that allow players to explore, customize, and experience the legendary game's iconic gameplay in new ways. This project exists solely out of deep admiration for the original developers, artists, designers, and visionaries who created one of the most influential online worlds of all time.
-We do not claim ownership of EverQuest or its assets. All credit and respect belong to the original creators and Daybreak Game Company, whose work continues to inspire generations of players and developers alike.
+We do not claim ownership of the original game or its assets. All credit and respect belong to the original creators and Daybreak Game Company, whose work continues to inspire generations of players and developers alike.
-EQEmulator has for over 20 years and always will be a fan-based, non-commercial open-source effort made by players, for players—preserving the legacy of EverQuest while empowering community-driven creativity, learning and joy that the game and its creators has so strongly inspired in us all.
+EQEmulator has for over 20 years and always will be a fan-based, non-commercial open-source effort made by players, for players—preserving the legacy of the game while empowering community-driven creativity, learning and joy that the game and its creators has so strongly inspired in us all.
***
@@ -47,7 +47,7 @@ EQEmulator has for over 20 years and always will be a fan-based, non-com
Technical Overview & Reverse Engineering Effort
-EQEmulator represents over two decades of collaborative reverse engineering, rebuilding the EverQuest server from the ground up without access to the original source code. This effort was achieved entirely through community-driven analysis, network protocol decoding, and in-game behavioral research.
+EQEmulator represents over two decades of collaborative reverse engineering, building the server from the ground up without access to the original source code. This effort was achieved entirely through community-driven analysis, network protocol decoding, and in-game behavioral research.
💡 How We Did It
@@ -104,10 +104,10 @@ Every system, packet, opcode, and game mechanic has been reconstructed through c
🚀 Why It Matters
-🧬 EQEmulator stands as a technical preservation project, ensuring that the magic of classic and custom EverQuest servers lives on for future generations of players, tinkerers, and game designers.
+
🧬 EQEmulator stands as a technical preservation project, ensuring that the magic of classic and custom servers lives on for future generations of players, tinkerers, and game designers.
-> We humbly acknowledge and thank the original developers at **Verant Interactive** and **Sony Online Entertainment (now Daybreak Game Company)** for creating one of the most influential online experiences in gaming history.
+> We humbly acknowledge and thank the original developers for creating one of the most influential online experiences in gaming history.
🧑💻🖥️ Supported Clients
@@ -148,4 +148,3 @@ If you want to set up your own EQEmulator server, please refer to the current [s
-
diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp
index faad88103..c75645f88 100644
--- a/client_files/export/main.cpp
+++ b/client_files/export/main.cpp
@@ -40,7 +40,6 @@
EQEmuLogSys LogSys;
WorldContentService content_service;
-ZoneStore zone_store;
PlayerEventLogs player_event_logs;
EvolvingItemsManager evolving_items_manager;
diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp
index 286f76572..36bcdedf2 100644
--- a/client_files/import/main.cpp
+++ b/client_files/import/main.cpp
@@ -34,7 +34,6 @@
EQEmuLogSys LogSys;
WorldContentService content_service;
-ZoneStore zone_store;
PlayerEventLogs player_event_logs;
EvolvingItemsManager evolving_items_manager;
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 0350cb6d4..787cd299c 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -842,7 +842,7 @@ IF (UNIX)
ENDIF (UNIX)
IF (WIN32 AND EQEMU_BUILD_PCH)
- TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h)
+ TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h)
ENDIF ()
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
diff --git a/common/content/world_content_service.cpp b/common/content/world_content_service.cpp
index 7d23c9d13..b54dd7032 100644
--- a/common/content/world_content_service.cpp
+++ b/common/content/world_content_service.cpp
@@ -185,7 +185,7 @@ void WorldContentService::ReloadContentFlags()
SetContentFlags(set_content_flags);
LoadStaticGlobalZoneInstances();
- zone_store.LoadZones(*m_content_database);
+ ZoneStore::Instance()->LoadZones(*m_content_database);
}
Database *WorldContentService::GetDatabase() const
@@ -291,7 +291,7 @@ WorldContentService *WorldContentService::LoadStaticGlobalZoneInstances()
// instance_list table entry for lavastorm has version = 1, is_global = 1, never_expires = 1
WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id, uint32 instance_id)
{
- for (const auto &z: zone_store.GetZones()) {
+ for (const auto &z: ZoneStore::Instance()->GetZones()) {
for (auto &i: m_zone_static_instances) {
if (
z.zoneidnumber == zone_id &&
diff --git a/common/data_bucket.cpp b/common/data_bucket.cpp
index d0ad01b7e..166100549 100644
--- a/common/data_bucket.cpp
+++ b/common/data_bucket.cpp
@@ -19,6 +19,37 @@ extern WorldDatabase database;
#error "You must define either ZONE or WORLD"
#endif
+// Key: compound cache key (e.g., account_id|character_id|zone_id|instance_id|top_key|full_key)
+// Value: resolved DataBuckets with extracted nested value
+static std::unordered_map g_nested_bucket_cache;
+
+static std::string MakeNestedCacheKey(const DataBucketKey &k, const std::string &full_key) {
+ return fmt::format(
+ "account_id:{}|character_id:{}|npc_id:{}|bot_id:{}|zone_id:{}|instance_id:{}|top_key:{}|full_key:{}",
+ k.account_id, k.character_id, k.npc_id, k.bot_id, k.zone_id, k.instance_id,
+ Strings::Split(full_key, NESTED_KEY_DELIMITER).front(),
+ full_key
+ );
+}
+
+static std::string MakeNestedCacheKeyPrefix(const DataBucketKey &k, const std::string &top_key) {
+ return fmt::format(
+ "account_id:{}|character_id:{}|npc_id:{}|bot_id:{}|zone_id:{}|instance_id:{}|top_key:{}|",
+ k.account_id, k.character_id, k.npc_id, k.bot_id, k.zone_id, k.instance_id, top_key
+ );
+}
+
+static void InvalidateNestedCacheForKey(const DataBucketKey &k, const std::string &top_key) {
+ std::string prefix = MakeNestedCacheKeyPrefix(k, top_key);
+ for (auto it = g_nested_bucket_cache.begin(); it != g_nested_bucket_cache.end(); ) {
+ if (it->first.find(prefix) == 0) {
+ it = g_nested_bucket_cache.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
void DataBucket::SetData(const std::string &bucket_key, const std::string &bucket_value, std::string expires_time)
{
auto k = DataBucketKey{
@@ -136,6 +167,15 @@ void DataBucket::SetData(const DataBucketKey &k_)
// Serialize JSON back to string
b.value = json_value.dump();
b.key_ = top_key; // Use the top-level key
+
+ if (CanCache(k_)) {
+ InvalidateNestedCacheForKey(k_, top_key);
+ std::string nested_cache_key = MakeNestedCacheKey(k_, k_.key);
+ auto extracted = ExtractNestedValue(b, k_.key);
+ if (extracted.id > 0) {
+ g_nested_bucket_cache[nested_cache_key] = extracted;
+ }
+ }
}
if (bucket_id) {
@@ -251,12 +291,27 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
LogDataBuckets("Returning key [{}] value [{}] from cache", e.key_, e.value);
if (is_nested_key && !k_.key.empty()) {
- return ExtractNestedValue(e, k_.key);
+ std::string nested_cache_key = MakeNestedCacheKey(k_, k.key);
+
+ auto it = g_nested_bucket_cache.find(nested_cache_key);
+ if (it != g_nested_bucket_cache.end()) {
+ LogDataBucketsDetail("Nested cache hit for key [{}]", nested_cache_key);
+ return it->second;
+ }
+
+ auto extracted = ExtractNestedValue(e, k_.key);
+ if (extracted.id > 0) {
+ g_nested_bucket_cache[nested_cache_key] = extracted;
+ }
+ return extracted;
}
return e;
}
}
+
+ // if we can cache its assumed we didn't load this into the cache so we should not return a miss
+ return DataBucketsRepository::NewEntity(); // Not found in cache
}
// Fetch the value from the database
@@ -315,23 +370,42 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
}
// Add the value to the cache if it doesn't exist
+ // If cacheable and not found in cache, short-circuit and assume it doesn't exist
if (can_cache) {
- bool has_cache = false;
+ bool found_in_cache = false;
for (const auto &e : g_data_bucket_cache) {
- if (e.id == bucket.id) {
- has_cache = true;
+ if (CheckBucketMatch(e, k)) {
+ found_in_cache = true;
break;
}
}
- if (!has_cache) {
- g_data_bucket_cache.emplace_back(bucket);
+ if (!found_in_cache) {
+ LogDataBuckets("Cache miss for key [{}] - skipping DB due to CanCache", k.key);
+ return DataBucketsRepository::NewEntity();
}
}
// Handle nested key extraction
if (is_nested_key && !k_.key.empty()) {
- return ExtractNestedValue(bucket, k_.key);
+ if (CanCache(k_)) {
+ std::string nested_cache_key = MakeNestedCacheKey(k_, k.key);
+
+ auto it = g_nested_bucket_cache.find(nested_cache_key);
+ if (it != g_nested_bucket_cache.end()) {
+ LogDataBucketsDetail("Nested cache hit for key [{}]", nested_cache_key);
+ return it->second;
+ }
+
+ auto extracted = ExtractNestedValue(bucket, k_.key);
+ if (extracted.id > 0) {
+ g_nested_bucket_cache[nested_cache_key] = extracted;
+ }
+ return extracted;
+ } else {
+ // Not cacheable, just extract and return
+ return ExtractNestedValue(bucket, k_.key);
+ }
}
return bucket;
diff --git a/common/database.cpp b/common/database.cpp
index c79ae0117..099b796ad 100644
--- a/common/database.cpp
+++ b/common/database.cpp
@@ -708,6 +708,20 @@ const std::string Database::GetNPCNameByID(uint32 npc_id)
return e.id ? e.name : std::string();
}
+template
+inline auto CleanMobName(InputIterator first, InputIterator last, OutputIterator result)
+{
+ for (; first != last; ++first) {
+ if (*first == '_') {
+ *result = ' ';
+ }
+ else if (isalpha(*first) || *first == '`') {
+ *result = *first;
+ }
+ }
+ return result;
+}
+
const std::string Database::GetCleanNPCNameByID(uint32 npc_id)
{
const auto& e = NpcTypesRepository::FindOne(*this, npc_id);
diff --git a/common/database/database_update_manifest.cpp b/common/database/database_update_manifest.cpp
index 1b2f7bc61..5a3a8f683 100644
--- a/common/database/database_update_manifest.cpp
+++ b/common/database/database_update_manifest.cpp
@@ -7109,6 +7109,18 @@ ALTER TABLE `npc_types`
ALTER TABLE `character_data`
CHANGE COLUMN `firstlogon` `ingame` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`,
ADD COLUMN `first_login` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`;
+)",
+ .content_schema_update = false
+ },
+ ManifestEntry{
+ .version = 9324,
+ .description = "2025_06_11_player_event_logs_table.sql",
+ .check = "SHOW CREATE TABLE `player_event_logs`",
+ .condition = "missing",
+ .match = "COMPRESS",
+ .sql = R"(
+ALTER TABLE player_event_logs ROW_FORMAT=COMPRESSED;
+CREATE INDEX idx_event_type_char_id ON player_event_logs (event_type_id, character_id);
)",
.content_schema_update = false
},
diff --git a/common/events/player_event_discord_formatter.cpp b/common/events/player_event_discord_formatter.cpp
index e3e4e5c27..5b068f507 100644
--- a/common/events/player_event_discord_formatter.cpp
+++ b/common/events/player_event_discord_formatter.cpp
@@ -716,7 +716,7 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
);
for (int i = 0; i < h.augment_ids.size(); i++) {
- if (!Strings::EqualFold(h.augment_names[i], "None")) {
+ if (!h.augment_names[i].empty()) {
const uint8 slot_id = (i + 1);
handin_items_info += fmt::format(
"Augment {}: {} ({})\n",
@@ -741,7 +741,7 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
);
for (int i = 0; i < r.augment_ids.size(); i++) {
- if (!Strings::EqualFold(r.augment_names[i], "None")) {
+ if (!r.augment_names[i].empty()) {
const uint8 slot_id = (i + 1);
return_items_info += fmt::format(
"Augment {}: {} ({})\n",
diff --git a/common/events/player_event_logs.cpp b/common/events/player_event_logs.cpp
index 41be9f7d1..f39242901 100644
--- a/common/events/player_event_logs.cpp
+++ b/common/events/player_event_logs.cpp
@@ -195,10 +195,12 @@ void PlayerEventLogs::ProcessBatchQueue()
};
// Helper to assign ETL table ID
- auto AssignEtlId = [&](
- PlayerEventLogsRepository::PlayerEventLogs &r,
- PlayerEvent::EventType type
- ) {
+
+ auto AssignEtlId = [&](
+ PlayerEventLogsRepository::PlayerEventLogs& r,
+ PlayerEvent::EventType type
+ )
+ {
if (m_etl_settings.contains(type)) {
r.etl_table_id = m_etl_settings.at(type).next_id++;
}
@@ -406,7 +408,6 @@ void PlayerEventLogs::ProcessBatchQueue()
auto it = event_processors.find(static_cast(r.event_type_id));
if (it != event_processors.end()) {
it->second(r); // Call the appropriate lambda
- r.event_data = "{}"; // Clear event data
}
else {
LogPlayerEventsDetail("Non-Implemented ETL routing [{}]", r.event_type_id);
@@ -535,6 +536,20 @@ std::string PlayerEventLogs::GetDiscordWebhookUrlFromEventType(int32_t event_typ
return "";
}
+void PlayerEventLogs::LoadPlayerEventSettingsFromQS(
+ const std::vector &settings
+)
+{
+ for (const auto &e : settings) {
+ if (e.id >= PlayerEvent::MAX || e.id < 0) {
+ continue;
+ }
+ m_settings[e.id] = e;
+ }
+
+ LogInfo("Applied [{}] player event log settings from QS", settings.size());
+}
+
// GM_COMMAND | [x] Implemented Formatter
// ZONING | [x] Implemented Formatter
// AA_GAIN | [x] Implemented Formatter
diff --git a/common/events/player_event_logs.h b/common/events/player_event_logs.h
index 8a9ccb202..cbc455666 100644
--- a/common/events/player_event_logs.h
+++ b/common/events/player_event_logs.h
@@ -73,9 +73,11 @@ public:
return BuildPlayerEventPacket(c);
}
- [[nodiscard]] const PlayerEventLogSettingsRepository::PlayerEventLogSettings *GetSettings() const;
- bool IsEventDiscordEnabled(int32_t event_type_id);
- std::string GetDiscordWebhookUrlFromEventType(int32_t event_type_id);
+ [[nodiscard]] const PlayerEventLogSettingsRepository::PlayerEventLogSettings * GetSettings() const;
+ bool IsEventDiscordEnabled(int32_t event_type_id);
+ std::string GetDiscordWebhookUrlFromEventType(int32_t event_type_id);
+
+ void LoadPlayerEventSettingsFromQS(const std::vector& settings);
static std::string GetDiscordPayloadFromEvent(const PlayerEvent::PlayerEventContainer &e);
diff --git a/common/events/player_events.h b/common/events/player_events.h
index 78b9fc10d..b2a485621 100644
--- a/common/events/player_events.h
+++ b/common/events/player_events.h
@@ -7,8 +7,16 @@
#include "../rulesys.h"
#include "../repositories/player_event_logs_repository.h"
-namespace PlayerEvent {
+#define CEREAL_NVP_IF_NONZERO(ar, name) \
+if ((name) != 0) ar(cereal::make_nvp(#name, name))
+#define CEREAL_NVP_IF_NOT_EMPTY(ar, name) \
+if (!(name).empty()) ar(cereal::make_nvp(#name, name))
+
+#define CEREAL_NVP_IF_TRUE(ar, name) \
+if ((name)) ar(cereal::make_nvp(#name, name))
+
+namespace PlayerEvent {
enum EventType {
GM_COMMAND = 1,
ZONING,
@@ -26,10 +34,10 @@ namespace PlayerEvent {
LOOT_ITEM,
MERCHANT_PURCHASE,
MERCHANT_SELL,
- GROUP_JOIN, // unimplemented
+ GROUP_JOIN, // unimplemented
GROUP_LEAVE, // unimplemented
- RAID_JOIN, // unimplemented
- RAID_LEAVE, // unimplemented
+ RAID_JOIN, // unimplemented
+ RAID_LEAVE, // unimplemented
GROUNDSPAWN_PICKUP,
NPC_HANDIN,
SKILL_UP,
@@ -45,12 +53,12 @@ namespace PlayerEvent {
COMBINE_SUCCESS,
DROPPED_ITEM,
SPLIT_MONEY,
- DZ_JOIN, // unimplemented
+ DZ_JOIN, // unimplemented
DZ_LEAVE, // unimplemented
TRADER_PURCHASE,
TRADER_SELL,
BANDOLIER_CREATE, // unimplemented
- BANDOLIER_SWAP, // unimplemented
+ BANDOLIER_SWAP, // unimplemented
DISCOVER_ITEM,
POSSIBLE_HACK,
KILLED_NPC,
@@ -76,7 +84,7 @@ namespace PlayerEvent {
// If event is unimplemented just tag (Unimplemented) in the name
// Events don't get saved to the database if unimplemented or deprecated
// Events tagged as deprecated will get automatically removed
- static const char *EventName[EventType::MAX] = {
+ static const char* EventName[EventType::MAX] = {
"None",
"GM Command",
"Zoning",
@@ -156,8 +164,8 @@ namespace PlayerEvent {
float heading;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(account_id),
@@ -185,8 +193,8 @@ namespace PlayerEvent {
PlayerEventLogsRepository::PlayerEventLogs player_event_log;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(player_event),
@@ -200,8 +208,8 @@ namespace PlayerEvent {
std::string noop; // noop, gets discard upstream
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(noop)
@@ -224,8 +232,38 @@ namespace PlayerEvent {
bool attuned;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(
+ CEREAL_NVP(item_id),
+ CEREAL_NVP(item_name),
+ CEREAL_NVP(to_slot),
+ CEREAL_NVP(charges)
+ );
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+ CEREAL_NVP_IF_TRUE(ar, attuned);
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -284,8 +322,37 @@ namespace PlayerEvent {
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void save(Archive& ar) const
+ {
+ ar(
+ CEREAL_NVP(slot),
+ CEREAL_NVP(item_id)
+ );
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NOT_EMPTY(ar, augment_1_name);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NOT_EMPTY(ar, augment_2_name);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NOT_EMPTY(ar, augment_3_name);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NOT_EMPTY(ar, augment_4_name);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NOT_EMPTY(ar, augment_5_name);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+ CEREAL_NVP_IF_NOT_EMPTY(ar, augment_6_name);
+
+ ar(
+ CEREAL_NVP(item_name),
+ CEREAL_NVP(charges)
+ );
+
+ CEREAL_NVP_IF_TRUE(ar, in_bag);
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(slot),
@@ -295,7 +362,7 @@ namespace PlayerEvent {
CEREAL_NVP(augment_2_id),
CEREAL_NVP(augment_2_name),
CEREAL_NVP(augment_3_id),
- CEREAL_NVP(augment_1_name),
+ CEREAL_NVP(augment_3_name),
CEREAL_NVP(augment_4_id),
CEREAL_NVP(augment_4_name),
CEREAL_NVP(augment_5_id),
@@ -319,8 +386,8 @@ namespace PlayerEvent {
int32 copper;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(platinum),
@@ -342,8 +409,8 @@ namespace PlayerEvent {
std::vector character_2_give_items;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(character_1_id),
@@ -363,8 +430,8 @@ namespace PlayerEvent {
std::string target;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(message),
@@ -386,8 +453,8 @@ namespace PlayerEvent {
int32 to_instance_version;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(from_zone_long_name),
@@ -408,8 +475,8 @@ namespace PlayerEvent {
uint32 aa_gained;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(CEREAL_NVP(aa_gained));
}
@@ -422,8 +489,8 @@ namespace PlayerEvent {
int32 aa_next_id;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(aa_id),
@@ -444,9 +511,34 @@ namespace PlayerEvent {
uint32 augment_6_id;
std::string item_name;
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(CEREAL_NVP(item_name));
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -471,9 +563,34 @@ namespace PlayerEvent {
uint32 augment_6_id;
std::string item_name;
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(CEREAL_NVP(item_name));
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -501,9 +618,41 @@ namespace PlayerEvent {
bool attuned;
std::string reason;
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(
+ CEREAL_NVP(item_id),
+ CEREAL_NVP(item_name),
+ CEREAL_NVP(charges)
+ );
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(
+ CEREAL_NVP(attuned),
+ CEREAL_NVP(reason)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -521,14 +670,15 @@ namespace PlayerEvent {
}
};
+
struct LevelGainedEvent {
uint32 from_level;
uint8 to_level;
int levels_gained;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(from_level),
@@ -544,8 +694,8 @@ namespace PlayerEvent {
int levels_lost;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(from_level),
@@ -569,8 +719,41 @@ namespace PlayerEvent {
std::string corpse_name;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(
+ CEREAL_NVP(item_id),
+ CEREAL_NVP(item_name),
+ CEREAL_NVP(charges)
+ );
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(
+ CEREAL_NVP(npc_id),
+ CEREAL_NVP(corpse_name)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -601,8 +784,8 @@ namespace PlayerEvent {
uint64 player_currency_balance;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(npc_id),
@@ -632,8 +815,8 @@ namespace PlayerEvent {
uint64 player_currency_balance;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(npc_id),
@@ -657,8 +840,8 @@ namespace PlayerEvent {
std::string against_who;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(skill_id),
@@ -676,8 +859,8 @@ namespace PlayerEvent {
std::string task_name;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(npc_id),
@@ -695,8 +878,8 @@ namespace PlayerEvent {
uint32 done_count;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(task_id),
@@ -714,8 +897,8 @@ namespace PlayerEvent {
uint32 done_count;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(task_id),
@@ -731,8 +914,8 @@ namespace PlayerEvent {
std::string item_name;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -746,8 +929,8 @@ namespace PlayerEvent {
std::string target;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(message),
@@ -762,8 +945,8 @@ namespace PlayerEvent {
uint32 spell_id;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(resurrecter_name),
@@ -780,8 +963,8 @@ namespace PlayerEvent {
uint32 tradeskill_id;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(recipe_id),
@@ -805,8 +988,38 @@ namespace PlayerEvent {
uint32 charges;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(
+ CEREAL_NVP(item_name),
+ CEREAL_NVP(slot_id),
+ CEREAL_NVP(charges)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -833,8 +1046,8 @@ namespace PlayerEvent {
std::string skill_name;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(killer_id),
@@ -856,8 +1069,8 @@ namespace PlayerEvent {
uint64 player_money_balance;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(copper),
@@ -886,10 +1099,44 @@ namespace PlayerEvent {
uint64 total_cost;
uint64 player_money_balance;
-
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(
+ CEREAL_NVP(item_name),
+ CEREAL_NVP(trader_id),
+ CEREAL_NVP(trader_name),
+ CEREAL_NVP(price),
+ CEREAL_NVP(quantity),
+ CEREAL_NVP(charges),
+ CEREAL_NVP(total_cost),
+ CEREAL_NVP(player_money_balance)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -928,10 +1175,43 @@ namespace PlayerEvent {
uint64 total_cost;
uint64 player_money_balance;
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(
+ CEREAL_NVP(item_name),
+ CEREAL_NVP(buyer_id),
+ CEREAL_NVP(buyer_name),
+ CEREAL_NVP(price),
+ CEREAL_NVP(quantity),
+ CEREAL_NVP(charges),
+ CEREAL_NVP(total_cost),
+ CEREAL_NVP(player_money_balance)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -958,8 +1238,8 @@ namespace PlayerEvent {
std::string item_name;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -978,8 +1258,8 @@ namespace PlayerEvent {
bool attuned;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -1000,8 +1280,8 @@ namespace PlayerEvent {
uint32 platinum;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(copper),
@@ -1022,8 +1302,8 @@ namespace PlayerEvent {
bool is_quest_handin;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(npc_id),
@@ -1041,8 +1321,8 @@ namespace PlayerEvent {
std::string message;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(message)
@@ -1058,8 +1338,8 @@ namespace PlayerEvent {
uint64 total_heal_per_second_taken;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(npc_id),
@@ -1083,9 +1363,36 @@ namespace PlayerEvent {
bool attuned;
uint32 guild_favor;
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+ CEREAL_NVP_IF_NONZERO(ar, charges);
+ CEREAL_NVP_IF_TRUE(ar, attuned);
+
+ ar(CEREAL_NVP(guild_favor));
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -1095,6 +1402,8 @@ namespace PlayerEvent {
CEREAL_NVP(augment_4_id),
CEREAL_NVP(augment_5_id),
CEREAL_NVP(augment_6_id),
+ CEREAL_NVP(charges),
+ CEREAL_NVP(attuned),
CEREAL_NVP(guild_favor)
);
}
@@ -1105,8 +1414,8 @@ namespace PlayerEvent {
uint32 guild_favor;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(plat),
@@ -1127,9 +1436,38 @@ namespace PlayerEvent {
std::string from_player_name;
uint32 sent_date;
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(
+ CEREAL_NVP(quantity),
+ CEREAL_NVP(from_player_name),
+ CEREAL_NVP(sent_date)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -1160,9 +1498,40 @@ namespace PlayerEvent {
std::string to_player_name;
uint32 sent_date;
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+ CEREAL_NVP_IF_NONZERO(ar, charges);
+
+ ar(
+ CEREAL_NVP(quantity),
+ CEREAL_NVP(from_player_name),
+ CEREAL_NVP(to_player_name),
+ CEREAL_NVP(sent_date)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -1195,9 +1564,40 @@ namespace PlayerEvent {
std::string from_name;
std::string note;
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(CEREAL_NVP(item_id));
+
+ CEREAL_NVP_IF_NONZERO(ar, augment_1_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_2_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_3_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_4_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_5_id);
+ CEREAL_NVP_IF_NONZERO(ar, augment_6_id);
+
+ ar(
+ CEREAL_NVP(quantity),
+ CEREAL_NVP(char_id),
+ CEREAL_NVP(from_name),
+ CEREAL_NVP(note),
+ CEREAL_NVP(sent_date)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(item_id),
@@ -1226,8 +1626,8 @@ namespace PlayerEvent {
std::string seller_name;
uint64 total_cost;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(status),
@@ -1251,8 +1651,8 @@ namespace PlayerEvent {
double progression;
// cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(status),
@@ -1273,8 +1673,8 @@ namespace PlayerEvent {
uint32 type;
std::string message;
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
{
ar(
CEREAL_NVP(to),
@@ -1300,9 +1700,41 @@ namespace PlayerEvent {
uint32 quantity;
uint32 permission;
- // cereal
- template
- void serialize(Archive &ar)
+ template
+ void serialize(Archive& ar)
+ {
+ if constexpr (Archive::is_saving::value) {
+ save(ar);
+ }
+ else {
+ load(ar);
+ }
+ }
+
+ template
+ void save(Archive& ar) const
+ {
+ ar(
+ CEREAL_NVP(char_id),
+ CEREAL_NVP(guild_id),
+ CEREAL_NVP(item_id)
+ );
+
+ CEREAL_NVP_IF_NONZERO(ar, aug_slot_one);
+ CEREAL_NVP_IF_NONZERO(ar, aug_slot_two);
+ CEREAL_NVP_IF_NONZERO(ar, aug_slot_three);
+ CEREAL_NVP_IF_NONZERO(ar, aug_slot_four);
+ CEREAL_NVP_IF_NONZERO(ar, aug_slot_five);
+ CEREAL_NVP_IF_NONZERO(ar, aug_slot_six);
+
+ ar(
+ CEREAL_NVP(quantity),
+ CEREAL_NVP(permission)
+ );
+ }
+
+ template
+ void load(Archive& ar)
{
ar(
CEREAL_NVP(char_id),
@@ -1314,8 +1746,9 @@ namespace PlayerEvent {
CEREAL_NVP(aug_slot_four),
CEREAL_NVP(aug_slot_five),
CEREAL_NVP(aug_slot_six),
- CEREAL_NVP(quantity)
- );
+ CEREAL_NVP(quantity),
+ CEREAL_NVP(permission)
+ );
}
};
}
diff --git a/common/item_instance.cpp b/common/item_instance.cpp
index c25ea09d2..b2d619b5a 100644
--- a/common/item_instance.cpp
+++ b/common/item_instance.cpp
@@ -1799,7 +1799,7 @@ std::vector EQ::ItemInstance::GetAugmentNames() const
for (uint8 slot_id = invaug::SOCKET_BEGIN; slot_id <= invaug::SOCKET_END; slot_id++) {
const auto augment = GetAugment(slot_id);
- augment_names.push_back(augment ? augment->GetItem()->Name : "None");
+ augment_names.push_back(augment ? augment->GetItem()->Name : "");
}
return augment_names;
diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp
index b7eb890e7..72a3a3c48 100644
--- a/common/patches/sod.cpp
+++ b/common/patches/sod.cpp
@@ -3966,12 +3966,12 @@ namespace SoD
SoDSlot = serverSlot - 2;
}
- else if (serverSlot <= EQ::invbag::GENERAL_BAGS_8_END && serverSlot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
- SoDSlot = serverSlot + 11;
+ else if (serverSlot <= EQ::invbag::GENERAL_BAGS_END && serverSlot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
+ SoDSlot = serverSlot - (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((serverSlot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));;
}
else if (serverSlot <= EQ::invbag::CURSOR_BAG_END && serverSlot >= EQ::invbag::CURSOR_BAG_BEGIN) {
- SoDSlot = serverSlot - 9;
+ SoDSlot = serverSlot - (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (serverSlot <= EQ::invslot::TRIBUTE_END && serverSlot >= EQ::invslot::TRIBUTE_BEGIN) {
@@ -3991,7 +3991,7 @@ namespace SoD
}
else if (serverSlot <= EQ::invbag::BANK_BAGS_END && serverSlot >= EQ::invbag::BANK_BAGS_BEGIN) {
- SoDSlot = serverSlot + 1;
+ SoDSlot = serverSlot - (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((serverSlot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));;
}
else if (serverSlot <= EQ::invslot::SHARED_BANK_END && serverSlot >= EQ::invslot::SHARED_BANK_BEGIN) {
@@ -3999,7 +3999,7 @@ namespace SoD
}
else if (serverSlot <= EQ::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQ::invbag::SHARED_BANK_BAGS_BEGIN) {
- SoDSlot = serverSlot + 1;
+ SoDSlot = serverSlot - (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((serverSlot - EQ::invbag::SHARED_BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (serverSlot <= EQ::invslot::TRADE_END && serverSlot >= EQ::invslot::TRADE_BEGIN) {
@@ -4007,7 +4007,7 @@ namespace SoD
}
else if (serverSlot <= EQ::invbag::TRADE_BAGS_END && serverSlot >= EQ::invbag::TRADE_BAGS_BEGIN) {
- SoDSlot = serverSlot;
+ SoDSlot = serverSlot - (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((serverSlot - EQ::invbag::TRADE_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (serverSlot <= EQ::invslot::WORLD_END && serverSlot >= EQ::invslot::WORLD_BEGIN) {
@@ -4049,11 +4049,11 @@ namespace SoD
}
else if (sod_slot <= invbag::GENERAL_BAGS_END && sod_slot >= invbag::GENERAL_BAGS_BEGIN) {
- server_slot = sod_slot - 11;
+ server_slot = sod_slot + (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sod_slot - invbag::GENERAL_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (sod_slot <= invbag::CURSOR_BAG_END && sod_slot >= invbag::CURSOR_BAG_BEGIN) {
- server_slot = sod_slot + 9;
+ server_slot = sod_slot + (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (sod_slot <= invslot::TRIBUTE_END && sod_slot >= invslot::TRIBUTE_BEGIN) {
@@ -4073,7 +4073,7 @@ namespace SoD
}
else if (sod_slot <= invbag::BANK_BAGS_END && sod_slot >= invbag::BANK_BAGS_BEGIN) {
- server_slot = sod_slot - 1;
+ server_slot = sod_slot + (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sod_slot - invbag::BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (sod_slot <= invslot::SHARED_BANK_END && sod_slot >= invslot::SHARED_BANK_BEGIN) {
@@ -4081,7 +4081,7 @@ namespace SoD
}
else if (sod_slot <= invbag::SHARED_BANK_BAGS_END && sod_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
- server_slot = sod_slot - 1;
+ server_slot = sod_slot + (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sod_slot - invbag::SHARED_BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (sod_slot <= invslot::TRADE_END && sod_slot >= invslot::TRADE_BEGIN) {
@@ -4089,7 +4089,7 @@ namespace SoD
}
else if (sod_slot <= invbag::TRADE_BAGS_END && sod_slot >= invbag::TRADE_BAGS_BEGIN) {
- server_slot = sod_slot;
+ server_slot = sod_slot + (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sod_slot - invbag::TRADE_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (sod_slot <= invslot::WORLD_END && sod_slot >= invslot::WORLD_BEGIN) {
diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp
index 0b31cb2f2..444b33b35 100644
--- a/common/patches/sof.cpp
+++ b/common/patches/sof.cpp
@@ -3355,12 +3355,12 @@ namespace SoF
sof_slot = server_slot - 2;
}
- else if (server_slot <= EQ::invbag::GENERAL_BAGS_8_END && server_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
- sof_slot = server_slot + 11;
+ else if (server_slot <= EQ::invbag::GENERAL_BAGS_END && server_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
+ sof_slot = server_slot - (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));;
}
else if (server_slot <= EQ::invbag::CURSOR_BAG_END && server_slot >= EQ::invbag::CURSOR_BAG_BEGIN) {
- sof_slot = server_slot - 9;
+ sof_slot = server_slot - (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (server_slot <= EQ::invslot::TRIBUTE_END && server_slot >= EQ::invslot::TRIBUTE_BEGIN) {
@@ -3380,7 +3380,7 @@ namespace SoF
}
else if (server_slot <= EQ::invbag::BANK_BAGS_END && server_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
- sof_slot = server_slot + 1;
+ sof_slot = server_slot - (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::SHARED_BANK_END && server_slot >= EQ::invslot::SHARED_BANK_BEGIN) {
@@ -3388,7 +3388,7 @@ namespace SoF
}
else if (server_slot <= EQ::invbag::SHARED_BANK_BAGS_END && server_slot >= EQ::invbag::SHARED_BANK_BAGS_BEGIN) {
- sof_slot = server_slot + 1;
+ sof_slot = server_slot - (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::SHARED_BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::TRADE_END && server_slot >= EQ::invslot::TRADE_BEGIN) {
@@ -3396,7 +3396,7 @@ namespace SoF
}
else if (server_slot <= EQ::invbag::TRADE_BAGS_END && server_slot >= EQ::invbag::TRADE_BAGS_BEGIN) {
- sof_slot = server_slot;
+ sof_slot = server_slot - (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::TRADE_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::WORLD_END && server_slot >= EQ::invslot::WORLD_BEGIN) {
@@ -3442,11 +3442,11 @@ namespace SoF
}
else if (sof_slot <= invbag::GENERAL_BAGS_END && sof_slot >= invbag::GENERAL_BAGS_BEGIN) {
- server_slot = sof_slot - 11;
+ server_slot = sof_slot + (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sof_slot - invbag::GENERAL_BAGS_BEGIN) / invbag::SLOT_COUNT));;
}
else if (sof_slot <= invbag::CURSOR_BAG_END && sof_slot >= invbag::CURSOR_BAG_BEGIN) {
- server_slot = sof_slot + 9;
+ server_slot = sof_slot + (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (sof_slot <= invslot::TRIBUTE_END && sof_slot >= invslot::TRIBUTE_BEGIN) {
@@ -3466,7 +3466,7 @@ namespace SoF
}
else if (sof_slot <= invbag::BANK_BAGS_END && sof_slot >= invbag::BANK_BAGS_BEGIN) {
- server_slot = sof_slot - 1;
+ server_slot = sof_slot + (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sof_slot - invbag::BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));;
}
else if (sof_slot <= invslot::SHARED_BANK_END && sof_slot >= invslot::SHARED_BANK_BEGIN) {
@@ -3474,7 +3474,7 @@ namespace SoF
}
else if (sof_slot <= invbag::SHARED_BANK_BAGS_END && sof_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
- server_slot = sof_slot - 1;
+ server_slot = sof_slot + (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sof_slot - invbag::SHARED_BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));;
}
else if (sof_slot <= invslot::TRADE_END && sof_slot >= invslot::TRADE_BEGIN) {
@@ -3482,7 +3482,7 @@ namespace SoF
}
else if (sof_slot <= invbag::TRADE_BAGS_END && sof_slot >= invbag::TRADE_BAGS_BEGIN) {
- server_slot = sof_slot;
+ server_slot = sof_slot + (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sof_slot - invbag::TRADE_BAGS_BEGIN) / invbag::SLOT_COUNT));;
}
else if (sof_slot <= invslot::WORLD_END && sof_slot >= invslot::WORLD_BEGIN) {
diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp
index 9c8a1df07..19d93addb 100644
--- a/common/patches/titanium.cpp
+++ b/common/patches/titanium.cpp
@@ -3596,12 +3596,12 @@ namespace Titanium
else if (server_slot == (EQ::invslot::POSSESSIONS_COUNT + EQ::invslot::slotAmmo)) {
titanium_slot = server_slot - 4;
}
- else if (server_slot <= EQ::invbag::GENERAL_BAGS_8_END &&
+ else if (server_slot <= EQ::invbag::GENERAL_BAGS_END &&
server_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
- titanium_slot = server_slot;
+ titanium_slot = server_slot - (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invbag::CURSOR_BAG_END && server_slot >= EQ::invbag::CURSOR_BAG_BEGIN) {
- titanium_slot = server_slot - 20;
+ titanium_slot = server_slot - (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (server_slot <= EQ::invslot::TRIBUTE_END && server_slot >= EQ::invslot::TRIBUTE_BEGIN) {
titanium_slot = server_slot;
@@ -3616,21 +3616,21 @@ namespace Titanium
else if (server_slot <= EQ::invslot::BANK_END && server_slot >= EQ::invslot::BANK_BEGIN) {
titanium_slot = server_slot;
}
- else if (server_slot <= EQ::invbag::BANK_BAGS_16_END && server_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
- titanium_slot = server_slot;
+ else if (server_slot <= EQ::invbag::BANK_BAGS_END && server_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
+ titanium_slot = server_slot - (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::SHARED_BANK_END && server_slot >= EQ::invslot::SHARED_BANK_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQ::invbag::SHARED_BANK_BAGS_END &&
server_slot >= EQ::invbag::SHARED_BANK_BAGS_BEGIN) {
- titanium_slot = server_slot;
+ titanium_slot = server_slot - (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::SHARED_BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::TRADE_END && server_slot >= EQ::invslot::TRADE_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQ::invbag::TRADE_BAGS_END && server_slot >= EQ::invbag::TRADE_BAGS_BEGIN) {
- titanium_slot = server_slot;
+ titanium_slot = server_slot - (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::TRADE_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::WORLD_END && server_slot >= EQ::invslot::WORLD_BEGIN) {
titanium_slot = server_slot;
@@ -3687,10 +3687,10 @@ namespace Titanium
server_slot = titanium_slot + 4;
}
else if (titanium_slot <= invbag::GENERAL_BAGS_END && titanium_slot >= invbag::GENERAL_BAGS_BEGIN) {
- server_slot = titanium_slot;
+ server_slot = titanium_slot + (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((titanium_slot - invbag::GENERAL_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (titanium_slot <= invbag::CURSOR_BAG_END && titanium_slot >= invbag::CURSOR_BAG_BEGIN) {
- server_slot = titanium_slot + 20;
+ server_slot = titanium_slot + (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (titanium_slot <= invslot::TRIBUTE_END && titanium_slot >= invslot::TRIBUTE_BEGIN) {
server_slot = titanium_slot;
@@ -3705,19 +3705,19 @@ namespace Titanium
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::BANK_BAGS_END && titanium_slot >= invbag::BANK_BAGS_BEGIN) {
- server_slot = titanium_slot;
+ server_slot = titanium_slot + (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((titanium_slot - invbag::BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (titanium_slot <= invslot::SHARED_BANK_END && titanium_slot >= invslot::SHARED_BANK_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::SHARED_BANK_BAGS_END && titanium_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
- server_slot = titanium_slot;
+ server_slot = titanium_slot + (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((titanium_slot - invbag::SHARED_BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (titanium_slot <= invslot::TRADE_END && titanium_slot >= invslot::TRADE_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::TRADE_BAGS_END && titanium_slot >= invbag::TRADE_BAGS_BEGIN) {
- server_slot = titanium_slot;
+ server_slot = titanium_slot + (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((titanium_slot - invbag::TRADE_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (titanium_slot <= invslot::WORLD_END && titanium_slot >= invslot::WORLD_BEGIN) {
server_slot = titanium_slot;
diff --git a/common/pch/app-pch.h b/common/pch/app-pch.h
new file mode 100644
index 000000000..aa2244f13
--- /dev/null
+++ b/common/pch/app-pch.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "../types.h"
+#include "../database.h"
+#include "../strings.h"
+#include "../eqemu_logsys.h"
+#include "../eqemu_logsys_log_aliases.h"
+#include "../features.h"
+#include "../global_define.h"
diff --git a/common/pch/pch.h b/common/pch/std-pch.h
similarity index 100%
rename from common/pch/pch.h
rename to common/pch/std-pch.h
diff --git a/common/process/process.cpp b/common/process/process.cpp
index badb0fe11..56bbeff2b 100644
--- a/common/process/process.cpp
+++ b/common/process/process.cpp
@@ -1,6 +1,7 @@
#include
#include
#include "process.h"
+#include
std::string Process::execute(const std::string &cmd)
{
diff --git a/common/random.h b/common/random.h
index 6d351121f..73b14369e 100644
--- a/common/random.h
+++ b/common/random.h
@@ -116,6 +116,12 @@ namespace EQ {
Reseed();
}
+ static Random* Instance()
+ {
+ static Random instance;
+ return &instance;
+ }
+
private:
#ifndef BIASED_INT_DIST
typedef std::uniform_int_distribution::param_type int_param_t;
diff --git a/common/repositories/base/base_player_event_log_settings_repository.h b/common/repositories/base/base_player_event_log_settings_repository.h
index 4a2457576..94a53b981 100644
--- a/common/repositories/base/base_player_event_log_settings_repository.h
+++ b/common/repositories/base/base_player_event_log_settings_repository.h
@@ -15,7 +15,7 @@
#include "../../database.h"
#include "../../strings.h"
#include
-
+#include
class BasePlayerEventLogSettingsRepository {
public:
struct PlayerEventLogSettings {
@@ -25,6 +25,20 @@ public:
int32_t retention_days;
int32_t discord_webhook_id;
uint8_t etl_enabled;
+
+ // cereal
+ template
+ void serialize(Archive &ar)
+ {
+ ar(
+ CEREAL_NVP(id),
+ CEREAL_NVP(event_name),
+ CEREAL_NVP(event_enabled),
+ CEREAL_NVP(retention_days),
+ CEREAL_NVP(discord_webhook_id),
+ CEREAL_NVP(etl_enabled)
+ );
+ }
};
static std::string PrimaryKey()
diff --git a/common/repositories/character_data_repository.h b/common/repositories/character_data_repository.h
index 74f884cf3..d95ac2fda 100644
--- a/common/repositories/character_data_repository.h
+++ b/common/repositories/character_data_repository.h
@@ -167,6 +167,30 @@ public:
return zone_player_counts;
}
+
+ static std::vector GetCharacterIDsByAccountID(
+ Database& db,
+ uint32_t account_id
+ )
+ {
+ std::vector character_ids;
+
+ auto query = fmt::format(
+ "SELECT id FROM character_data WHERE account_id = {} AND deleted_at IS NULL",
+ account_id
+ );
+
+ auto results = db.QueryDatabase(query);
+ if (results.Success()) {
+ for (auto row : results) {
+ if (row[0]) {
+ character_ids.push_back(static_cast(std::stoul(row[0])));
+ }
+ }
+ }
+
+ return character_ids;
+ }
};
#endif //EQEMU_CHARACTER_DATA_REPOSITORY_H
diff --git a/common/repositories/rule_values_repository.h b/common/repositories/rule_values_repository.h
index 072175d5f..d7eb1530e 100644
--- a/common/repositories/rule_values_repository.h
+++ b/common/repositories/rule_values_repository.h
@@ -43,6 +43,47 @@ public:
* method and encapsulate filters there
*/
+ template
+ static std::vector join_tuple(
+ const std::string &glue,
+ const std::pair &encapsulation,
+ const std::vector> &src
+ )
+ {
+ if (src.empty()) {
+ return {};
+ }
+
+ std::vector output;
+
+ for (const std::tuple &src_iter: src) {
+
+ output.emplace_back(
+
+ fmt::format(
+ "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
+ encapsulation.first,
+ std::get<0>(src_iter),
+ encapsulation.second,
+ glue,
+ encapsulation.first,
+ std::get<1>(src_iter),
+ encapsulation.second,
+ glue,
+ encapsulation.first,
+ std::get<2>(src_iter),
+ encapsulation.second,
+ glue,
+ encapsulation.first,
+ std::get<3>(src_iter),
+ encapsulation.second
+ )
+ );
+ }
+
+ return output;
+ }
+
// Custom extended repository methods here
static std::vector GetRuleNames(Database &db, int rule_set_id)
{
@@ -87,12 +128,28 @@ public:
return v;
}
+ template
+ static std::string
+ ImplodePair(const std::string &glue, const std::pair &encapsulation, const std::vector &src)
+ {
+ if (src.empty()) {
+ return {};
+ }
+ std::ostringstream oss;
+ for (const T &src_iter: src) {
+ oss << encapsulation.first << src_iter << encapsulation.second << glue;
+ }
+ std::string output(oss.str());
+ output.resize(output.size() - glue.size());
+ return output;
+ }
+
static bool DeleteOrphanedRules(Database& db, std::vector& v)
{
const auto query = fmt::format(
"DELETE FROM {} WHERE rule_name IN ({})",
TableName(),
- Strings::ImplodePair(",", std::pair('\'', '\''), v)
+ ImplodePair(",", std::pair('\'', '\''), v)
);
return db.QueryDatabase(query).Success();
@@ -103,7 +160,7 @@ public:
const auto query = fmt::format(
"REPLACE INTO {} (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES {}",
TableName(),
- Strings::ImplodePair(
+ ImplodePair(
",",
std::pair('(', ')'),
join_tuple(",", std::pair('\'', '\''), v)
diff --git a/common/servertalk.h b/common/servertalk.h
index 3680ac76d..9985c875c 100644
--- a/common/servertalk.h
+++ b/common/servertalk.h
@@ -273,8 +273,9 @@
#define ServerOP_WWTaskUpdate 0x4758
// player events
-#define ServerOP_QSSendQuery 0x5000
+#define ServerOP_QSSendQuery 0x5000
#define ServerOP_PlayerEvent 0x5100
+#define ServerOP_SendPlayerEventSettings 0x5101
enum {
CZUpdateType_Character,
@@ -1778,6 +1779,7 @@ struct BazaarPurchaseMessaging_Struct {
uint32 id;
};
+
#pragma pack()
#endif
diff --git a/common/shareddb.cpp b/common/shareddb.cpp
index 8fe9d61bf..d143dfbfd 100644
--- a/common/shareddb.cpp
+++ b/common/shareddb.cpp
@@ -1544,12 +1544,60 @@ bool SharedDatabase::GetCommandSettings(std::map
+inline std::vector join_pair(
+ const std::string &glue,
+ const std::pair &encapsulation,
+ const std::vector> &src
+)
+{
+ if (src.empty()) {
+ return {};
+ }
+
+ std::vector output;
+
+ for (const std::pair &src_iter: src) {
+ output.emplace_back(
+
+ fmt::format(
+ "{}{}{}{}{}{}{}",
+ encapsulation.first,
+ src_iter.first,
+ encapsulation.second,
+ glue,
+ encapsulation.first,
+ src_iter.second,
+ encapsulation.second
+ )
+ );
+ }
+
+ return output;
+}
+
+template
+inline std::string
+ImplodePair(const std::string &glue, const std::pair &encapsulation, const std::vector &src)
+{
+ if (src.empty()) {
+ return {};
+ }
+ std::ostringstream oss;
+ for (const T &src_iter: src) {
+ oss << encapsulation.first << src_iter << encapsulation.second << glue;
+ }
+ std::string output(oss.str());
+ output.resize(output.size() - glue.size());
+ return output;
+}
+
bool SharedDatabase::UpdateInjectedCommandSettings(const std::vector> &injected)
{
if (injected.size()) {
const std::string query = fmt::format(
"REPLACE INTO `command_settings`(`command`, `access`) VALUES {}",
- Strings::ImplodePair(
+ ImplodePair(
",",
std::pair('(', ')'),
join_pair(",", std::pair('\'', '\''), injected)
@@ -1576,7 +1624,7 @@ bool SharedDatabase::UpdateOrphanedCommandSettings(const std::vector('\'', '\''), orphaned)
+ ImplodePair(",", std::pair('\'', '\''), orphaned)
);
auto results = QueryDatabase(query);
@@ -1586,7 +1634,7 @@ bool SharedDatabase::UpdateOrphanedCommandSettings(const std::vector('\'', '\''), orphaned)
+ ImplodePair(",", std::pair('\'', '\''), orphaned)
);
auto results_two = QueryDatabase(query);
diff --git a/common/skill_caps.h b/common/skill_caps.h
index 9630ed7d7..6566a1104 100644
--- a/common/skill_caps.h
+++ b/common/skill_caps.h
@@ -16,12 +16,16 @@ public:
static int32_t GetSkillCapMaxLevel(uint8 class_id, EQ::skills::SkillType skill_id);
SkillCaps *SetContentDatabase(Database *db);
+
+ static SkillCaps* Instance()
+ {
+ static SkillCaps instance;
+ return &instance;
+ }
private:
Database *m_content_database{};
std::map m_skill_caps = {};
};
-extern SkillCaps skill_caps;
-
#endif //CODE_SKILL_CAPS_H
diff --git a/common/strings.cpp b/common/strings.cpp
index 58261388f..52990aa85 100644
--- a/common/strings.cpp
+++ b/common/strings.cpp
@@ -34,6 +34,7 @@
*/
#include "strings.h"
+#include
#include
#include
#include
@@ -41,6 +42,7 @@
#include
#include
#include
+#include
#include
#include
@@ -49,6 +51,12 @@
#include "strings_legacy.cpp" // legacy c functions
#include "strings_misc.cpp" // anything non "Strings" scoped
+#ifdef _WINDOWS
+#include
+#include
+#include
+#endif
+
std::string Strings::Random(size_t length)
{
static auto &chrs = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -701,6 +709,18 @@ std::string &Strings::Trim(std::string &str, const std::string &chars)
return LTrim(RTrim(str, chars), chars);
}
+const std::string NUM_TO_ENGLISH_X[] = {
+ "", "One ", "Two ", "Three ", "Four ",
+ "Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
+ "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ",
+ "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen "
+};
+
+const std::string NUM_TO_ENGLISH_Y[] = {
+ "", "", "Twenty ", "Thirty ", "Forty ",
+ "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety "
+};
+
// Function to convert single digit or two digit number into words
std::string Strings::ConvertToDigit(int n, const std::string& suffix)
{
diff --git a/common/strings.h b/common/strings.h
index 5338949b5..8ae8fee25 100644
--- a/common/strings.h
+++ b/common/strings.h
@@ -36,53 +36,19 @@
#define _STRINGUTIL_H_
#include
-#include
-#include
+#include
#include
+#include
#include
#include
-#include
#include
-#include
-#include
-
-#ifndef _WIN32
-// this doesn't appear to affect linux-based systems..need feedback for _WIN64
-
-#endif
-
-#ifdef _WINDOWS
+#ifdef _WIN32
#include
-#include
-#include
#endif
#include "types.h"
-namespace detail {
- // template magic to check if std::from_chars floating point functions exist
- template
- struct has_from_chars_float : std::false_type { };
-
- // basically it "uses" this template if they do exist because reasons
- template
- struct has_from_chars_float < T,
- std::void_t(), std::declval(),
- std::declval()))>> : std::true_type { };
-}; // namespace detail
-
-namespace EQ {
-// lame -- older GCC's didn't define this, clang's libc++ however does, even though they lack FP support
-#if defined(__GNUC__) && (__GNUC__ < 11) && !defined(__clang__)
- enum class chars_format {
- scientific = 1, fixed = 2, hex = 4, general = fixed | scientific
- };
-#else
- using chars_format = std::chars_format;
-#endif
-}; // namespace EQ
-
class Strings {
public:
static bool Contains(std::vector container, const std::string& element);
@@ -133,61 +99,6 @@ public:
static bool BeginsWith(const std::string& subject, const std::string& search);
static bool EndsWith(const std::string& subject, const std::string& search);
static std::string ZoneTime(const uint8 hours, const uint8 minutes);
-
- template
- static std::string
- ImplodePair(const std::string &glue, const std::pair &encapsulation, const std::vector &src)
- {
- if (src.empty()) {
- return {};
- }
- std::ostringstream oss;
- for (const T &src_iter: src) {
- oss << encapsulation.first << src_iter << encapsulation.second << glue;
- }
- std::string output(oss.str());
- output.resize(output.size() - glue.size());
- return output;
- }
-
- // basic string_view overloads that just use std stuff since they work!
- template
- std::enable_if_t && detail::has_from_chars_float::value, std::from_chars_result>
- static from_chars(std::string_view str, T& value, EQ::chars_format fmt = EQ::chars_format::general)
- {
- return std::from_chars(str.data(), str.data() + str.size(), value, fmt);
- }
-
- template
- std::enable_if_t, std::from_chars_result>
- static from_chars(std::string_view str, T& value, int base = 10)
- {
- return std::from_chars(str.data(), str.data() + str.size(), value, base);
- }
-
- // fallback versions of floating point in case they're not implemented
- // TODO: add error handling ...
- // This does have to allocate since from_chars doesn't need a null terminated string and neither does string_view
- template
- std::enable_if_t && !detail::has_from_chars_float::value && std::is_same_v, std::from_chars_result>
- static from_chars(std::string_view str, T& value, EQ::chars_format fmt = EQ::chars_format::general)
- {
- std::from_chars_result res{};
- std::string tmp_str(str.data(), str.size());
- value = strtof(tmp_str.data(), nullptr);
- return res;
- }
-
- template
- std::enable_if_t && !detail::has_from_chars_float::value && std::is_same_v, std::from_chars_result>
- static from_chars(std::string_view str, T& value, EQ::chars_format fmt = EQ::chars_format::general)
- {
- std::from_chars_result res{};
- std::string tmp_str(str.data(), str.size());
- value = strtod(tmp_str.data(), nullptr);
- return res;
- }
-
static std::string Slugify(const std::string &input, const std::string &separator = "-");
static bool IsValidJson(const std::string& json);
};
@@ -199,93 +110,6 @@ const std::string vStringFormat(const char *format, va_list args);
// Used for grid nodes, as NPC names remove numerals.
// But general purpose
-const std::string NUM_TO_ENGLISH_X[] = {
- "", "One ", "Two ", "Three ", "Four ",
- "Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
- "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ",
- "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen "
-};
-
-const std::string NUM_TO_ENGLISH_Y[] = {
- "", "", "Twenty ", "Thirty ", "Forty ",
- "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety "
-};
-
-// _WIN32 builds require that #include be included in whatever code file the invocation is made from (no header files)
-template
-std::vector join_pair(
- const std::string &glue,
- const std::pair &encapsulation,
- const std::vector> &src
-)
-{
- if (src.empty()) {
- return {};
- }
-
- std::vector output;
-
- for (const std::pair &src_iter: src) {
- output.emplace_back(
-
- fmt::format(
- "{}{}{}{}{}{}{}",
- encapsulation.first,
- src_iter.first,
- encapsulation.second,
- glue,
- encapsulation.first,
- src_iter.second,
- encapsulation.second
- )
- );
- }
-
- return output;
-}
-
-// _WIN32 builds require that #include be included in whatever code file the invocation is made from (no header files)
-template
-std::vector join_tuple(
- const std::string &glue,
- const std::pair &encapsulation,
- const std::vector> &src
-)
-{
- if (src.empty()) {
- return {};
- }
-
- std::vector output;
-
- for (const std::tuple &src_iter: src) {
-
- output.emplace_back(
-
- fmt::format(
- "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
- encapsulation.first,
- std::get<0>(src_iter),
- encapsulation.second,
- glue,
- encapsulation.first,
- std::get<1>(src_iter),
- encapsulation.second,
- glue,
- encapsulation.first,
- std::get<2>(src_iter),
- encapsulation.second,
- glue,
- encapsulation.first,
- std::get<3>(src_iter),
- encapsulation.second
- )
- );
- }
-
- return output;
-}
-
// misc functions
std::string SanitizeWorldServerName(std::string server_long_name);
std::vector GetBadWords();
@@ -310,18 +134,4 @@ std::string FormatName(const std::string &char_name);
bool IsAllowedWorldServerCharacterList(char c);
void SanitizeWorldServerName(char *name);
-template
-auto CleanMobName(InputIterator first, InputIterator last, OutputIterator result)
-{
- for (; first != last; ++first) {
- if (*first == '_') {
- *result = ' ';
- }
- else if (isalpha(*first) || *first == '`') {
- *result = *first;
- }
- }
- return result;
-}
-
#endif
diff --git a/common/version.h b/common/version.h
index 5a2c1bdff..9e0614f12 100644
--- a/common/version.h
+++ b/common/version.h
@@ -42,7 +42,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
-#define CURRENT_BINARY_DATABASE_VERSION 9323
+#define CURRENT_BINARY_DATABASE_VERSION 9324
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
#define CUSTOM_BINARY_DATABASE_VERSION 0
diff --git a/common/zone_store.h b/common/zone_store.h
index d8ee7233d..4a6940f4d 100644
--- a/common/zone_store.h
+++ b/common/zone_store.h
@@ -104,36 +104,39 @@ public:
uint8 GetZoneIdleWhenEmpty(uint32 zone_id, int version = 0);
uint32 GetZoneSecondsBeforeIdle(uint32 zone_id, int version = 0);
+ static ZoneStore* Instance()
+ {
+ static ZoneStore instance;
+ return &instance;
+ }
private:
std::vector m_zones;
};
-extern ZoneStore zone_store;
-
/**
* Global helpers
*/
-inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); }
-inline uint32 ZoneID(const std::string& zone_name) { return zone_store.GetZoneID(zone_name); }
+inline uint32 ZoneID(const char *in_zone_name) { return ZoneStore::Instance()->GetZoneID(in_zone_name); }
+inline uint32 ZoneID(const std::string& zone_name) { return ZoneStore::Instance()->GetZoneID(zone_name); }
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
{
- return zone_store.GetZoneName(
+ return ZoneStore::Instance()->GetZoneName(
zone_id,
error_unknown
);
}
inline const char *ZoneLongName(uint32 zone_id, bool error_unknown = false)
{
- return zone_store.GetZoneLongName(
+ return ZoneStore::Instance()->GetZoneLongName(
zone_id,
error_unknown
);
}
-inline ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0) { return zone_store.GetZone(zone_id, version); };
-inline ZoneRepository::Zone *GetZone(const char *in_zone_name) { return zone_store.GetZone(in_zone_name); };
+inline ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0) { return ZoneStore::Instance()->GetZone(zone_id, version); };
+inline ZoneRepository::Zone *GetZone(const char *in_zone_name) { return ZoneStore::Instance()->GetZone(in_zone_name); };
inline ZoneRepository::Zone *GetZone(const char *in_zone_name, int version = 0)
{
- return zone_store.GetZone(
+ return ZoneStore::Instance()->GetZone(
ZoneID(
in_zone_name
), version
@@ -141,7 +144,7 @@ inline ZoneRepository::Zone *GetZone(const char *in_zone_name, int version = 0)
};
inline ZoneRepository::Zone *GetZoneVersionWithFallback(uint32 zone_id, int version = 0)
{
- return zone_store.GetZoneWithFallback(
+ return ZoneStore::Instance()->GetZoneWithFallback(
zone_id,
version
);
diff --git a/loginserver/main.cpp b/loginserver/main.cpp
index f1dc3ab09..e1499dace 100644
--- a/loginserver/main.cpp
+++ b/loginserver/main.cpp
@@ -26,7 +26,6 @@ EQEmuLogSys LogSys;
bool run_server = true;
Database database;
PlayerEventLogs player_event_logs;
-ZoneStore zone_store;
void CatchSignal(int sig_num)
{
diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp
index 290c22836..0334949b4 100644
--- a/queryserv/queryserv.cpp
+++ b/queryserv/queryserv.cpp
@@ -30,7 +30,6 @@ std::string WorldShortName;
const queryservconfig *Config;
WorldServer *worldserver = 0;
EQEmuLogSys LogSys;
-ZoneStore zone_store;
PlayerEventLogs player_event_logs;
ZSList zs_list;
uint32 numzones = 0;
diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp
index 948ab931e..e2270c57c 100644
--- a/queryserv/worldserver.cpp
+++ b/queryserv/worldserver.cpp
@@ -21,10 +21,13 @@
#include
#include
+#include "zonelist.h"
+
extern WorldServer worldserver;
extern const queryservconfig *Config;
extern QSDatabase qs_database;
extern LFGuildManager lfguildmanager;
+extern ZSList zs_list;
WorldServer::WorldServer()
{
@@ -78,6 +81,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
if (o->type == ServerReload::Type::Logs) {
LogSys.LoadLogDatabaseSettings();
player_event_logs.ReloadSettings();
+ zs_list.SendPlayerEventLogSettings();
}
break;
diff --git a/queryserv/zonelist.cpp b/queryserv/zonelist.cpp
index d06cfefe8..16ad65371 100644
--- a/queryserv/zonelist.cpp
+++ b/queryserv/zonelist.cpp
@@ -5,6 +5,8 @@
void ZSList::Add(ZoneServer* zoneserver) {
zone_server_list.emplace_back(std::unique_ptr(zoneserver));
zoneserver->SetIsZoneConnected(true);
+
+ zoneserver->SendPlayerEventLogSettings();
}
void ZSList::Remove(const std::string &uuid)
@@ -18,3 +20,10 @@ void ZSList::Remove(const std::string &uuid)
iter++;
}
}
+
+void ZSList::SendPlayerEventLogSettings()
+{
+ for (auto &zs : zone_server_list) {
+ zs->SendPlayerEventLogSettings();
+ }
+}
diff --git a/queryserv/zonelist.h b/queryserv/zonelist.h
index c63d1c211..3fc41676d 100644
--- a/queryserv/zonelist.h
+++ b/queryserv/zonelist.h
@@ -12,9 +12,10 @@ class ZoneServer;
class ZSList {
public:
- std::list> &GetZsList() { return zone_server_list; }
- void Add(ZoneServer *zoneserver);
- void Remove(const std::string &uuid);
+ std::list>& GetZsList() { return zone_server_list; }
+ void Add(ZoneServer* zoneserver);
+ void Remove(const std::string& uuid);
+ void SendPlayerEventLogSettings();
private:
std::list> zone_server_list;
diff --git a/queryserv/zoneserver.cpp b/queryserv/zoneserver.cpp
index f6727fcff..dfa71f66b 100644
--- a/queryserv/zoneserver.cpp
+++ b/queryserv/zoneserver.cpp
@@ -44,3 +44,27 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
}
}
}
+
+void ZoneServer::SendPlayerEventLogSettings()
+{
+ EQ::Net::DynamicPacket dyn_pack;
+ std::vector settings(
+ player_event_logs.GetSettings(),
+ player_event_logs.GetSettings() + PlayerEvent::EventType::MAX
+ );
+
+ dyn_pack.PutSerialize(0, settings);
+
+ auto packet_size = sizeof(ServerSendPlayerEvent_Struct) + dyn_pack.Length();
+
+ auto pack = std::make_unique(
+ ServerOP_SendPlayerEventSettings,
+ static_cast(packet_size)
+ );
+
+ auto* buf = reinterpret_cast(pack->pBuffer);
+ buf->cereal_size = static_cast(dyn_pack.Length());
+ memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
+
+ SendPacket(pack.release());
+}
diff --git a/queryserv/zoneserver.h b/queryserv/zoneserver.h
index db36bd4ff..f4a4b08e6 100644
--- a/queryserv/zoneserver.h
+++ b/queryserv/zoneserver.h
@@ -16,11 +16,12 @@ class ZoneServer : public WorldTCPConnection {
public:
ZoneServer(std::shared_ptr in_connection, EQ::Net::ConsoleServer *in_console);
~ZoneServer();
- void SendPacket(ServerPacket *pack) { m_connection->SendPacket(pack); }
- void SetIsZoneConnected(bool in) { m_is_zone_connected = in; }
- bool GetIsZoneConnected() { return m_is_zone_connected; }
- void HandleMessage(uint16 opcode, const EQ::Net::Packet &p);
+ void SendPacket(ServerPacket *pack) { m_connection->SendPacket(pack); }
+ void SetIsZoneConnected(bool in) { m_is_zone_connected = in; }
+ bool GetIsZoneConnected() { return m_is_zone_connected; }
+ void HandleMessage(uint16 opcode, const EQ::Net::Packet &p);
std::string GetUUID() const { return m_connection->GetUUID(); }
+ void SendPlayerEventLogSettings();
private:
std::shared_ptr m_connection{};
diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp
index 03d44a03f..0935e5d99 100644
--- a/shared_memory/main.cpp
+++ b/shared_memory/main.cpp
@@ -37,7 +37,6 @@
EQEmuLogSys LogSys;
WorldContentService content_service;
-ZoneStore zone_store;
PlayerEventLogs player_event_logs;
EvolvingItemsManager evolving_items_manager;
diff --git a/tests/string_util_test.h b/tests/string_util_test.h
index af88a5a03..37bd539f7 100644
--- a/tests/string_util_test.h
+++ b/tests/string_util_test.h
@@ -30,7 +30,6 @@ public:
TEST_ADD(StringUtilTest::EscapeStringTest);
TEST_ADD(StringUtilTest::SearchDeliminatedStringTest);
TEST_ADD(StringUtilTest::SplitStringTest);
- TEST_ADD(StringUtilTest::FromCharsTest);
TEST_ADD(StringUtilTest::TestIsFloat);
TEST_ADD(StringUtilTest::TestIsNumber);
}
@@ -108,21 +107,6 @@ public:
TEST_ASSERT(v[2] == "789");
}
- void FromCharsTest() {
- char int_chars[] = "123";
- int int_value = 0;
-
- char float_chars[] = "3.14";
- float float_value = 0.0f;
-
- Strings::from_chars(int_chars, int_value);
- TEST_ASSERT(int_value == 123);
-
- Strings::from_chars(float_chars, float_value);
- TEST_ASSERT(float_value == 3.14f);
-
- }
-
void TestIsFloat() {
TEST_ASSERT_EQUALS(Strings::IsFloat("0.23424523"), true);
TEST_ASSERT_EQUALS(Strings::IsFloat("12312312313.23424523"), true);
diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp
index c4666a257..68e3fbd12 100644
--- a/ucs/ucs.cpp
+++ b/ucs/ucs.cpp
@@ -47,7 +47,6 @@ Clientlist *g_Clientlist;
EQEmuLogSys LogSys;
UCSDatabase database;
WorldServer *worldserver = nullptr;
-ZoneStore zone_store;
PlayerEventLogs player_event_logs;
const ucsconfig *Config;
diff --git a/utils/scripts/generators/repository-generator.pl b/utils/scripts/generators/repository-generator.pl
index 6cb6a137c..3def50506 100644
--- a/utils/scripts/generators/repository-generator.pl
+++ b/utils/scripts/generators/repository-generator.pl
@@ -114,7 +114,8 @@ if ($requested_table_to_generate ne "all") {
my @cereal_enabled_tables = (
"data_buckets",
- "player_event_logs"
+ "player_event_logs",
+ "player_event_log_settings"
);
my $generated_base_repository_files = "";
diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt
index 0eed74b9b..1963c83ae 100644
--- a/world/CMakeLists.txt
+++ b/world/CMakeLists.txt
@@ -77,7 +77,7 @@ ADD_EXECUTABLE(world ${world_sources} ${world_headers})
INSTALL(TARGETS world RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
IF (WIN32 AND EQEMU_BUILD_PCH)
- TARGET_PRECOMPILE_HEADERS(world PRIVATE ../common/pch/pch.h)
+ TARGET_PRECOMPILE_HEADERS(world PRIVATE ../common/pch/std-pch.h)
ENDIF ()
ADD_DEFINITIONS(-DWORLD)
diff --git a/world/adventure.cpp b/world/adventure.cpp
index ae923b3be..3abd5aa61 100644
--- a/world/adventure.cpp
+++ b/world/adventure.cpp
@@ -18,7 +18,6 @@
extern ZSList zoneserver_list;
extern ClientList client_list;
extern AdventureManager adventure_manager;
-extern EQ::Random emu_random;
Adventure::Adventure(AdventureTemplate *t)
{
@@ -368,8 +367,8 @@ void Adventure::MoveCorpsesToGraveyard()
glm::vec4 position;
- float x = GetTemplate()->graveyard_x + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
- float y = GetTemplate()->graveyard_y + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
+ float x = GetTemplate()->graveyard_x + EQ::Random::Instance()->Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
+ float y = GetTemplate()->graveyard_y + EQ::Random::Instance()->Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float z = GetTemplate()->graveyard_z;
position.x = x;
diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp
index 3d8442e53..bebcc369c 100644
--- a/world/adventure_manager.cpp
+++ b/world/adventure_manager.cpp
@@ -16,7 +16,6 @@
extern ZSList zoneserver_list;
extern ClientList client_list;
-extern EQ::Random emu_random;
AdventureManager::AdventureManager()
{
@@ -324,7 +323,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
if(eligible_adventures.size() > 0)
{
ea_iter = eligible_adventures.begin();
- int c_index = emu_random.Int(0, (eligible_adventures.size()-1));
+ int c_index = EQ::Random::Instance()->Int(0, (eligible_adventures.size()-1));
for(int i = 0; i < c_index; ++i)
{
++ea_iter;
diff --git a/world/client.cpp b/world/client.cpp
index 243d9f203..b281c9080 100644
--- a/world/client.cpp
+++ b/world/client.cpp
@@ -36,6 +36,7 @@
#include "../common/shareddb.h"
#include "../common/opcodemgr.h"
#include "../common/data_verification.h"
+#include "../common/data_bucket.h"
#include "client.h"
#include "worlddb.h"
@@ -91,7 +92,6 @@ std::vector character_create_race_class_combos;
extern ZSList zoneserver_list;
extern LoginServerList loginserverlist;
extern ClientList client_list;
-extern EQ::Random emu_random;
extern uint32 numclients;
extern volatile bool RunLoops;
extern volatile bool UCSServerAvailable_;
@@ -135,6 +135,8 @@ Client::Client(EQStreamInterface* ieqs)
}
Client::~Client() {
+ ClearDataBucketsCache();
+
if (RunLoops && cle && zone_id == 0)
cle->SetOnline(CLE_Status::Offline);
@@ -477,6 +479,8 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
LogClientLogin("Checking authentication id [{}]", id);
if ((cle = client_list.CheckAuth(id, password))) {
+ LoadDataBucketsCache();
+
LogClientLogin("Checking authentication id [{}] passed", id);
if (!is_player_zoning) {
// Track who is in and who is out of the game
@@ -984,7 +988,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
safe_delete(outapp);
// set mailkey - used for duration of character session
- int mail_key = emu_random.Int(1, INT_MAX);
+ int mail_key = EQ::Random::Instance()->Int(1, INT_MAX);
database.SetMailKey(charid, GetIP(), mail_key);
if (UCSServerAvailable_) {
@@ -2171,7 +2175,7 @@ void Client::SetClassStartingSkills(PlayerProfile_Struct *pp)
i == EQ::skills::SkillAlcoholTolerance || i == EQ::skills::SkillBindWound)
continue;
- pp->skills[i] = skill_caps.GetSkillCap(pp->class_, (EQ::skills::SkillType)i, 1).cap;
+ pp->skills[i] = SkillCaps::Instance()->GetSkillCap(pp->class_, (EQ::skills::SkillType)i, 1).cap;
}
}
@@ -2369,7 +2373,7 @@ bool Client::StoreCharacter(
return false;
}
- const std::string& zone_name = zone_store.GetZoneName(p_player_profile_struct->zone_id, true);
+ const std::string& zone_name = ZoneStore::Instance()->GetZoneName(p_player_profile_struct->zone_id, true);
if (Strings::EqualFold(zone_name, "UNKNOWN")) {
p_player_profile_struct->zone_id = Zones::QEYNOS;
}
@@ -2518,3 +2522,19 @@ void Client::SendUnsupportedClientPacket(const std::string& message)
QueuePacket(&packet);
}
+
+void Client::LoadDataBucketsCache()
+{
+ DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Account, {GetAccountID()});
+ const auto ids = CharacterDataRepository::GetCharacterIDsByAccountID(database, GetAccountID());
+ DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Client, ids);
+}
+
+void Client::ClearDataBucketsCache()
+{
+ DataBucket::DeleteFromCache(GetAccountID(), DataBucketLoadType::Account);
+ auto ids = CharacterDataRepository::GetCharacterIDsByAccountID(database, GetAccountID());
+ for (const auto& id : ids) {
+ DataBucket::DeleteFromCache(id, DataBucketLoadType::Client);
+ }
+}
diff --git a/world/client.h b/world/client.h
index e88f8a94e..5890cfcf0 100644
--- a/world/client.h
+++ b/world/client.h
@@ -121,6 +121,9 @@ private:
bool CanTradeFVNoDropItem();
void RecordPossibleHack(const std::string& message);
void SendUnsupportedClientPacket(const std::string& message);
+
+ void LoadDataBucketsCache();
+ void ClearDataBucketsCache();
};
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
diff --git a/world/console.cpp b/world/console.cpp
index 2fcc878bf..599bb8125 100644
--- a/world/console.cpp
+++ b/world/console.cpp
@@ -1219,7 +1219,7 @@ void ConsoleCrossZoneMove(
const auto& zone_short_name = !Strings::IsNumber(args[2]) ? args[2] : "";
const uint16 instance_id = Strings::IsNumber(args[2]) ? static_cast