[Player Events] Don't Write Empty Data (#4912)

* [Player Events] Don't Write Empty Data

* Revert "[Player Events] Don't Write Empty Data"

This reverts commit f64a824b33c467697cdd377261745add889db206.

* Update player_events.h

* Augs
This commit is contained in:
Chris Miles 2025-06-24 19:14:51 -05:00 committed by GitHub
parent 2e760d6397
commit c3f2708f1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 550 additions and 117 deletions

View File

@ -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",

View File

@ -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)
);
}
};
}

View File

@ -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;