mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
Merge branch 'master' into akkadius/logsys-global-to-singleton
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
+81
-7
@@ -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<std::string, DataBucketsRepository::DataBuckets> 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;
|
||||
|
||||
@@ -708,6 +708,20 @@ const std::string Database::GetNPCNameByID(uint32 npc_id)
|
||||
return e.id ? e.name : std::string();
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename OutputIterator>
|
||||
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);
|
||||
|
||||
@@ -33,6 +33,13 @@ public:
|
||||
DatabaseUpdate *SetContentDatabase(Database *db);
|
||||
DatabaseUpdate *SetSkipBackup(bool skip);
|
||||
bool HasPendingUpdates();
|
||||
|
||||
static DatabaseUpdate* Instance()
|
||||
{
|
||||
static DatabaseUpdate instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_skip_backup = false;
|
||||
Database *m_database;
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <string>
|
||||
#include "../types.h"
|
||||
#include "../http/httplib.h"
|
||||
#include "../repositories/player_event_logs_repository.h"
|
||||
#include "../events/player_events.h"
|
||||
|
||||
|
||||
@@ -13,6 +13,12 @@ public:
|
||||
void QueueWebhookMessage(uint32 webhook_id, const std::string& message);
|
||||
void ProcessMessageQueue();
|
||||
void QueuePlayerEventMessage(const PlayerEvent::PlayerEventContainer& e);
|
||||
|
||||
static DiscordManager* Instance()
|
||||
{
|
||||
static DiscordManager instance;
|
||||
return &instance;
|
||||
}
|
||||
private:
|
||||
std::mutex webhook_queue_lock{};
|
||||
std::map<uint32, std::vector<std::string>> webhook_message_queue{};
|
||||
|
||||
@@ -436,11 +436,11 @@ void EQEmuConfig::CheckUcsConfigConversion()
|
||||
LogInfo("Migrating old [eqemu_config] UCS configuration to new configuration");
|
||||
|
||||
std::string config_file_path = std::filesystem::path{
|
||||
path.GetServerPath() + "/eqemu_config.json"
|
||||
PathManager::Instance()->GetServerPath() + "/eqemu_config.json"
|
||||
}.string();
|
||||
|
||||
std::string config_file_bak_path = std::filesystem::path{
|
||||
path.GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
||||
PathManager::Instance()->GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
||||
}.string();
|
||||
|
||||
// copy eqemu_config.json to eqemu_config.json.bak
|
||||
|
||||
@@ -191,7 +191,7 @@ class EQEmuConfig
|
||||
|
||||
std::string file = fmt::format(
|
||||
"{}/{}",
|
||||
(file_path.empty() ? path.GetServerPath() : file_path),
|
||||
(file_path.empty() ? PathManager::Instance()->GetServerPath() : file_path),
|
||||
EQEmuConfig::ConfigFile
|
||||
);
|
||||
|
||||
|
||||
@@ -537,9 +537,9 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
||||
{
|
||||
EQEmuLogSys::CloseFileLogs();
|
||||
|
||||
if (!File::Exists(path.GetLogPath())) {
|
||||
LogInfo("Logs directory not found, creating [{}]", path.GetLogPath());
|
||||
File::Makedir(path.GetLogPath());
|
||||
if (!File::Exists(PathManager::Instance()->GetLogPath())) {
|
||||
LogInfo("Logs directory not found, creating [{}]", PathManager::Instance()->GetLogPath());
|
||||
File::Makedir(PathManager::Instance()->GetLogPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<PlayerEvent::EventType>(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<PlayerEventLogSettingsRepository::PlayerEventLogSettings> &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
|
||||
|
||||
@@ -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<PlayerEventLogSettingsRepository::PlayerEventLogSettings>& settings);
|
||||
|
||||
static std::string GetDiscordPayloadFromEvent(const PlayerEvent::PlayerEventContainer &e);
|
||||
|
||||
|
||||
+547
-114
@@ -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<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(account_id),
|
||||
@@ -185,8 +193,8 @@ namespace PlayerEvent {
|
||||
PlayerEventLogsRepository::PlayerEventLogs player_event_log;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(player_event),
|
||||
@@ -200,8 +208,8 @@ namespace PlayerEvent {
|
||||
std::string noop; // noop, gets discard upstream
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(noop)
|
||||
@@ -224,8 +232,38 @@ namespace PlayerEvent {
|
||||
bool attuned;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
void load(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -284,8 +322,37 @@ namespace PlayerEvent {
|
||||
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
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<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(platinum),
|
||||
@@ -342,8 +409,8 @@ namespace PlayerEvent {
|
||||
std::vector<TradeItemEntry> character_2_give_items;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(character_1_id),
|
||||
@@ -363,8 +430,8 @@ namespace PlayerEvent {
|
||||
std::string target;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(message),
|
||||
@@ -386,8 +453,8 @@ namespace PlayerEvent {
|
||||
int32 to_instance_version;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(from_zone_long_name),
|
||||
@@ -408,8 +475,8 @@ namespace PlayerEvent {
|
||||
uint32 aa_gained;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(CEREAL_NVP(aa_gained));
|
||||
}
|
||||
@@ -422,8 +489,8 @@ namespace PlayerEvent {
|
||||
int32 aa_next_id;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
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<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
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<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
void load(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -501,9 +618,41 @@ namespace PlayerEvent {
|
||||
bool attuned;
|
||||
std::string reason;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
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<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(from_level),
|
||||
@@ -544,8 +694,8 @@ namespace PlayerEvent {
|
||||
int levels_lost;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(from_level),
|
||||
@@ -569,8 +719,41 @@ namespace PlayerEvent {
|
||||
std::string corpse_name;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
void load(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -601,8 +784,8 @@ namespace PlayerEvent {
|
||||
uint64 player_currency_balance;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(npc_id),
|
||||
@@ -632,8 +815,8 @@ namespace PlayerEvent {
|
||||
uint64 player_currency_balance;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(npc_id),
|
||||
@@ -657,8 +840,8 @@ namespace PlayerEvent {
|
||||
std::string against_who;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(skill_id),
|
||||
@@ -676,8 +859,8 @@ namespace PlayerEvent {
|
||||
std::string task_name;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(npc_id),
|
||||
@@ -695,8 +878,8 @@ namespace PlayerEvent {
|
||||
uint32 done_count;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(task_id),
|
||||
@@ -714,8 +897,8 @@ namespace PlayerEvent {
|
||||
uint32 done_count;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(task_id),
|
||||
@@ -731,8 +914,8 @@ namespace PlayerEvent {
|
||||
std::string item_name;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -746,8 +929,8 @@ namespace PlayerEvent {
|
||||
std::string target;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(message),
|
||||
@@ -762,8 +945,8 @@ namespace PlayerEvent {
|
||||
uint32 spell_id;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(resurrecter_name),
|
||||
@@ -780,8 +963,8 @@ namespace PlayerEvent {
|
||||
uint32 tradeskill_id;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(recipe_id),
|
||||
@@ -805,8 +988,38 @@ namespace PlayerEvent {
|
||||
uint32 charges;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
void load(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -833,8 +1046,8 @@ namespace PlayerEvent {
|
||||
std::string skill_name;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(killer_id),
|
||||
@@ -856,8 +1069,8 @@ namespace PlayerEvent {
|
||||
uint64 player_money_balance;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(copper),
|
||||
@@ -886,10 +1099,44 @@ namespace PlayerEvent {
|
||||
uint64 total_cost;
|
||||
uint64 player_money_balance;
|
||||
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
void load(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -928,10 +1175,43 @@ namespace PlayerEvent {
|
||||
uint64 total_cost;
|
||||
uint64 player_money_balance;
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
void load(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -958,8 +1238,8 @@ namespace PlayerEvent {
|
||||
std::string item_name;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -978,8 +1258,8 @@ namespace PlayerEvent {
|
||||
bool attuned;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -1000,8 +1280,8 @@ namespace PlayerEvent {
|
||||
uint32 platinum;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(copper),
|
||||
@@ -1022,8 +1302,8 @@ namespace PlayerEvent {
|
||||
bool is_quest_handin;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(npc_id),
|
||||
@@ -1041,8 +1321,8 @@ namespace PlayerEvent {
|
||||
std::string message;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(message)
|
||||
@@ -1058,8 +1338,8 @@ namespace PlayerEvent {
|
||||
uint64 total_heal_per_second_taken;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(npc_id),
|
||||
@@ -1083,9 +1363,36 @@ namespace PlayerEvent {
|
||||
bool attuned;
|
||||
uint32 guild_favor;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
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<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(plat),
|
||||
@@ -1127,9 +1436,38 @@ namespace PlayerEvent {
|
||||
std::string from_player_name;
|
||||
uint32 sent_date;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
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<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
void load(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -1195,9 +1564,40 @@ namespace PlayerEvent {
|
||||
std::string from_name;
|
||||
std::string note;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
void load(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
@@ -1226,8 +1626,8 @@ namespace PlayerEvent {
|
||||
std::string seller_name;
|
||||
uint64 total_cost;
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(status),
|
||||
@@ -1251,8 +1651,8 @@ namespace PlayerEvent {
|
||||
double progression;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(status),
|
||||
@@ -1273,8 +1673,8 @@ namespace PlayerEvent {
|
||||
uint32 type;
|
||||
std::string message;
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(to),
|
||||
@@ -1300,9 +1700,41 @@ namespace PlayerEvent {
|
||||
uint32 quantity;
|
||||
uint32 permission;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar)
|
||||
{
|
||||
if constexpr (Archive::is_saving::value) {
|
||||
save(ar);
|
||||
}
|
||||
else {
|
||||
load(ar);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
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 <class Archive>
|
||||
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)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace EQ {
|
||||
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
|
||||
}
|
||||
#else
|
||||
std::string final_name = fmt::format("{}/{}.lock", path.GetSharedMemoryPath(), name);
|
||||
std::string final_name = fmt::format("{}/{}.lock", PathManager::Instance()->GetSharedMemoryPath(), name);
|
||||
|
||||
#ifdef __DARWIN
|
||||
#if __DARWIN_C_LEVEL < 200809L
|
||||
|
||||
@@ -1799,7 +1799,7 @@ std::vector<std::string> 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;
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace RoF
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
@@ -117,7 +117,7 @@ namespace RoF
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace RoF2
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
@@ -123,7 +123,7 @@ namespace RoF2
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
|
||||
+13
-13
@@ -72,7 +72,7 @@ namespace SoD
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
opcodes = new RegularOpcodeManager();
|
||||
@@ -113,7 +113,7 @@ namespace SoD
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
@@ -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) {
|
||||
|
||||
+13
-13
@@ -71,7 +71,7 @@ namespace SoF
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
opcodes = new RegularOpcodeManager();
|
||||
@@ -110,7 +110,7 @@ namespace SoF
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
@@ -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) {
|
||||
|
||||
+14
-14
@@ -73,7 +73,7 @@ namespace Titanium
|
||||
auto Config = EQEmuConfig::get();
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
opcodes = new RegularOpcodeManager();
|
||||
@@ -114,7 +114,7 @@ namespace Titanium
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
@@ -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;
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace UF
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
opcodes = new RegularOpcodeManager();
|
||||
@@ -117,7 +117,7 @@ namespace UF
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
void PathManager::LoadPaths()
|
||||
void PathManager::Init()
|
||||
{
|
||||
m_server_path = File::FindEqemuConfigPath();
|
||||
|
||||
|
||||
@@ -7,7 +7,13 @@
|
||||
|
||||
class PathManager {
|
||||
public:
|
||||
void LoadPaths();
|
||||
void Init();
|
||||
|
||||
static PathManager *Instance()
|
||||
{
|
||||
static PathManager instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::string &GetLogPath() const;
|
||||
[[nodiscard]] const std::string &GetLuaModsPath() const;
|
||||
@@ -38,6 +44,4 @@ private:
|
||||
std::string m_shared_memory_path;
|
||||
};
|
||||
|
||||
extern PathManager path;
|
||||
|
||||
#endif //EQEMU_PATH_MANAGER_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"
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include "process.h"
|
||||
#include <fmt/format.h>
|
||||
|
||||
std::string Process::execute(const std::string &cmd)
|
||||
{
|
||||
|
||||
@@ -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<int>::param_type int_param_t;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
#include <cereal/cereal.hpp>
|
||||
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<class Archive>
|
||||
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()
|
||||
|
||||
@@ -167,6 +167,30 @@ public:
|
||||
|
||||
return zone_player_counts;
|
||||
}
|
||||
|
||||
static std::vector<uint32_t> GetCharacterIDsByAccountID(
|
||||
Database& db,
|
||||
uint32_t account_id
|
||||
)
|
||||
{
|
||||
std::vector<uint32_t> 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<uint32_t>(std::stoul(row[0])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return character_ids;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_CHARACTER_DATA_REPOSITORY_H
|
||||
|
||||
@@ -43,6 +43,47 @@ public:
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
template<typename T1, typename T2, typename T3, typename T4>
|
||||
static std::vector<std::string> join_tuple(
|
||||
const std::string &glue,
|
||||
const std::pair<char, char> &encapsulation,
|
||||
const std::vector<std::tuple<T1, T2, T3, T4>> &src
|
||||
)
|
||||
{
|
||||
if (src.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<std::string> output;
|
||||
|
||||
for (const std::tuple<T1, T2, T3, T4> &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<std::string> GetRuleNames(Database &db, int rule_set_id)
|
||||
{
|
||||
@@ -87,12 +128,28 @@ public:
|
||||
return v;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static std::string
|
||||
ImplodePair(const std::string &glue, const std::pair<char, char> &encapsulation, const std::vector<T> &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<std::string>& v)
|
||||
{
|
||||
const auto query = fmt::format(
|
||||
"DELETE FROM {} WHERE rule_name IN ({})",
|
||||
TableName(),
|
||||
Strings::ImplodePair(",", std::pair<char, char>('\'', '\''), v)
|
||||
ImplodePair(",", std::pair<char, char>('\'', '\''), 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<char, char>('(', ')'),
|
||||
join_tuple(",", std::pair<char, char>('\'', '\''), v)
|
||||
|
||||
+3
-1
@@ -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
|
||||
|
||||
+53
-5
@@ -974,7 +974,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
const auto Config = EQEmuConfig::get();
|
||||
EQ::IPCMutex mutex("items");
|
||||
mutex.Lock();
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("items"));
|
||||
std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("items"));
|
||||
items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(static_cast<uint8*>(items_mmf->Get()), items_mmf->Size());
|
||||
mutex.Unlock();
|
||||
@@ -1544,12 +1544,60 @@ bool SharedDatabase::GetCommandSettings(std::map<std::string, std::pair<uint8, s
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
inline std::vector<std::string> join_pair(
|
||||
const std::string &glue,
|
||||
const std::pair<char, char> &encapsulation,
|
||||
const std::vector<std::pair<T1, T2>> &src
|
||||
)
|
||||
{
|
||||
if (src.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<std::string> output;
|
||||
|
||||
for (const std::pair<T1, T2> &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<typename T>
|
||||
inline std::string
|
||||
ImplodePair(const std::string &glue, const std::pair<char, char> &encapsulation, const std::vector<T> &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<std::pair<std::string, uint8>> &injected)
|
||||
{
|
||||
if (injected.size()) {
|
||||
const std::string query = fmt::format(
|
||||
"REPLACE INTO `command_settings`(`command`, `access`) VALUES {}",
|
||||
Strings::ImplodePair(
|
||||
ImplodePair(
|
||||
",",
|
||||
std::pair<char, char>('(', ')'),
|
||||
join_pair(",", std::pair<char, char>('\'', '\''), injected)
|
||||
@@ -1576,7 +1624,7 @@ bool SharedDatabase::UpdateOrphanedCommandSettings(const std::vector<std::string
|
||||
if (orphaned.size()) {
|
||||
std::string query = fmt::format(
|
||||
"DELETE FROM `command_settings` WHERE `command` IN ({})",
|
||||
Strings::ImplodePair(",", std::pair<char, char>('\'', '\''), orphaned)
|
||||
ImplodePair(",", std::pair<char, char>('\'', '\''), orphaned)
|
||||
);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
@@ -1586,7 +1634,7 @@ bool SharedDatabase::UpdateOrphanedCommandSettings(const std::vector<std::string
|
||||
|
||||
query = fmt::format(
|
||||
"DELETE FROM `command_subsettings` WHERE `parent_command` IN ({})",
|
||||
Strings::ImplodePair(",", std::pair<char, char>('\'', '\''), orphaned)
|
||||
ImplodePair(",", std::pair<char, char>('\'', '\''), orphaned)
|
||||
);
|
||||
|
||||
auto results_two = QueryDatabase(query);
|
||||
@@ -1665,7 +1713,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
|
||||
EQ::IPCMutex mutex("spells");
|
||||
mutex.Lock();
|
||||
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("spells"));
|
||||
std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("spells"));
|
||||
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
LogInfo("Loading [{}]", file_name);
|
||||
*records = *static_cast<uint32*>(spells_mmf->Get());
|
||||
|
||||
+6
-2
@@ -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<uint64, SkillCapsRepository::SkillCaps> m_skill_caps = {};
|
||||
};
|
||||
|
||||
extern SkillCaps skill_caps;
|
||||
|
||||
|
||||
#endif //CODE_SKILL_CAPS_H
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
*/
|
||||
|
||||
#include "strings.h"
|
||||
#include <cereal/external/rapidjson/document.h>
|
||||
#include <fmt/format.h>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
@@ -41,6 +42,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <random>
|
||||
#include <string>
|
||||
@@ -49,6 +51,12 @@
|
||||
#include "strings_legacy.cpp" // legacy c functions
|
||||
#include "strings_misc.cpp" // anything non "Strings" scoped
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <ctype.h>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#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)
|
||||
{
|
||||
|
||||
+3
-193
@@ -36,53 +36,19 @@
|
||||
#define _STRINGUTIL_H_
|
||||
|
||||
#include <charconv>
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <string_view>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdarg>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <cereal/external/rapidjson/document.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
// this doesn't appear to affect linux-based systems..need feedback for _WIN64
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#ifdef _WIN32
|
||||
#include <ctype.h>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace detail {
|
||||
// template magic to check if std::from_chars floating point functions exist
|
||||
template <typename T, typename = void>
|
||||
struct has_from_chars_float : std::false_type { };
|
||||
|
||||
// basically it "uses" this template if they do exist because reasons
|
||||
template <typename T>
|
||||
struct has_from_chars_float < T,
|
||||
std::void_t<decltype(std::from_chars(std::declval<const char *>(), std::declval<const char *>(),
|
||||
std::declval<T &>()))>> : 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<std::string> 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<typename T>
|
||||
static std::string
|
||||
ImplodePair(const std::string &glue, const std::pair<char, char> &encapsulation, const std::vector<T> &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 <typename T>
|
||||
std::enable_if_t<std::is_floating_point_v<T> && detail::has_from_chars_float<T>::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 <typename T>
|
||||
std::enable_if_t<std::is_integral_v<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 <typename T>
|
||||
std::enable_if_t<std::is_floating_point_v<T> && !detail::has_from_chars_float<T>::value && std::is_same_v<T, float>, 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 <typename T>
|
||||
std::enable_if_t<std::is_floating_point_v<T> && !detail::has_from_chars_float<T>::value && std::is_same_v<T, double>, 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<fmt/format.h> be included in whatever code file the invocation is made from (no header files)
|
||||
template<typename T1, typename T2>
|
||||
std::vector<std::string> join_pair(
|
||||
const std::string &glue,
|
||||
const std::pair<char, char> &encapsulation,
|
||||
const std::vector<std::pair<T1, T2>> &src
|
||||
)
|
||||
{
|
||||
if (src.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<std::string> output;
|
||||
|
||||
for (const std::pair<T1, T2> &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<fmt/format.h> be included in whatever code file the invocation is made from (no header files)
|
||||
template<typename T1, typename T2, typename T3, typename T4>
|
||||
std::vector<std::string> join_tuple(
|
||||
const std::string &glue,
|
||||
const std::pair<char, char> &encapsulation,
|
||||
const std::vector<std::tuple<T1, T2, T3, T4>> &src
|
||||
)
|
||||
{
|
||||
if (src.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<std::string> output;
|
||||
|
||||
for (const std::tuple<T1, T2, T3, T4> &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<std::string> GetBadWords();
|
||||
@@ -310,18 +134,4 @@ std::string FormatName(const std::string &char_name);
|
||||
bool IsAllowedWorldServerCharacterList(char c);
|
||||
void SanitizeWorldServerName(char *name);
|
||||
|
||||
template<typename InputIterator, typename OutputIterator>
|
||||
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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+13
-10
@@ -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<ZoneRepository::Zone> 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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user