[Player Event Logs] Migrate and Deprecate QS Legacy Logging (#4542)

* First pass of player_event_loot_items

* Second pass of player_event_loot_items

* Third pass of player_event_loot_items

* Example without RecordDetailEvent template

* Cleanup the removal of the template

* Fourth Pass

Add retention for etl tables
Rename tables/fields to etl nomenclature
Combine database work to one atomic load

* Reposition to reduce db tasks

* Refactor etl processing for easier additions

* Add merchant purchase event
testing passed though appears that the event itself has a few bugs.  Will fix them in another commit

* Fix PlayerEventMerchantPurchase in client_packet.cpp

* WIP - Handin

* Handin Event added

* Cleanup

* All a rentention period of 0 days which deletes all current records.

* Updates

Cleanup and refactor a few items.

* Cleanup and Formatting

Cleanup and Formatting

* Add etl for
Playerevent::Trade
PlayerEvent::Speech (new event to mirror functionality of qs_speech

* Add etl for
Playerevent::KilledNPC, KilledNamedNPC and KilledRaidNPC

* Add etl for Playerevent::AA_purchase

Add etl for Playerevent::AA_purchase

* Cleanup before PR

* Review comment updates.

* Add world cli etl:settings to output a json on all player event details.

* Add reserve for all etl_queues
Correct a failed test case for improper next id for etl tables when table is first created.

* Potential solution for a dedicated database connection for player events.

* Simple thread for player_events.  Likely there is a better way to do this.

* Add zone to qs communications for recordplayerevents

First pass of enabling zone to qs direct transport to allow for PlayerEvents to bypass world.

* Cleanup a linux compile issue

* Add augments to LOOT ITEM and DESTROY ITEM

* Add augments to ITEMCREATION, FORAGESUCCESS, FISHSUCCESS, DESTROYITEM, LOOTITEM, DROPPEDITEM, TRADERPURCHASE, TRADERSELL, GUILDTRIBUTEDONATE and cleaned up the naming convention of augments

* Formatting fixes

* Swap out GetNextTableId

* Statically load counter

* Add counter.clear() since the counter is static

* Upload optional QS conversion scripts

* Remove all qs_tables and code referencing them

* Update database.cpp

* Simplify ProcessBatchQueue

* Simplify PorcessBatchQueue

* Simplify event truncation

* Build event truncation to bulk query by retention groups

* Post rebase

* Update player_events.h

* Fix build

* Update npc.cpp

* First pass of direct zone to qs sending for player events

* Remove keepalive logic

* Fix event ordering

* Cleanup

* Update player_event_logs.cpp

* Wipe event data after ETL processed

* Split up database connections, hot reload logs for QS

* Load rules from database vs qs_database

* Update player_event_logs.cpp

* Hot toggle queryserv connect

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Mitch Freeman
2025-02-05 04:02:16 -04:00
committed by GitHub
parent 21d27a1122
commit 8f4f8368df
99 changed files with 8156 additions and 2451 deletions
+89 -108
View File
@@ -1247,28 +1247,21 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
}
}
/* Logs Player Chat */
if (RuleB(QueryServ, PlayerLogChat)) {
auto pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct) + strlen(message) + 1);
Server_Speech_Struct* sem = (Server_Speech_Struct*) pack->pBuffer;
if (player_event_logs.IsEventEnabled(PlayerEvent::EventType::SPEECH)) {
PlayerEvent::PlayerSpeech e{};
std::string msg = message;
if (!msg.empty() && msg.at(0) != '#' && msg.at(0) != '^') {
e.message = message;
e.min_status = Admin();
e.type = chan_num;
e.to = targetname;
e.from = GetCleanName();
if (chan_num == ChatChannel_Guild) {
e.guild_id = GuildID();
}
if(chan_num == ChatChannel_Guild)
sem->guilddbid = GuildID();
else
sem->guilddbid = 0;
strcpy(sem->message, message);
sem->minstatus = Admin();
sem->type = chan_num;
if(targetname != 0)
strcpy(sem->to, targetname);
if(GetName() != 0)
strcpy(sem->from, GetName());
if(worldserver.Connected())
worldserver.SendPacket(pack);
safe_delete(pack);
RecordPlayerEventLog(PlayerEvent::SPEECH, e);
}
}
// Garble the message based on drunkness
@@ -7218,15 +7211,6 @@ int Client::AddAlternateCurrencyValue(uint32 currency_id, int amount, bool is_sc
return 0;
}
/* Added via Quest, rest of the logging methods may be done inline due to information available in that area of the code */
if (is_scripted) {
/* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */
if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)){
std::string event_desc = StringFormat("Added via Quest :: Cursor to Item :: alt_currency_id:%i amount:%i in zoneid:%i instid:%i", currency_id, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, CharacterID(), event_desc);
}
}
if (!amount) {
return 0;
}
@@ -12557,23 +12541,22 @@ void Client::PlayerTradeEventLog(Trade *t, Trade *t2)
if (inst) {
t_entries.emplace_back(
PlayerEvent::TradeItemEntry{
.slot = i,
.item_id = inst->GetItem()->ID,
.item_name = inst->GetItem()->Name,
.charges = static_cast<uint16>(inst->GetCharges()),
.aug_1_item_id = inst->GetAugmentItemID(0),
.aug_1_item_name = inst->GetAugment(0) ? inst->GetAugment(0)->GetItem()->Name : "",
.aug_2_item_id = inst->GetAugmentItemID(1),
.aug_2_item_name = inst->GetAugment(1) ? inst->GetAugment(1)->GetItem()->Name : "",
.aug_3_item_id = inst->GetAugmentItemID(2),
.aug_3_item_name = inst->GetAugment(2) ? inst->GetAugment(2)->GetItem()->Name : "",
.aug_4_item_id = inst->GetAugmentItemID(3),
.aug_4_item_name = inst->GetAugment(3) ? inst->GetAugment(3)->GetItem()->Name : "",
.aug_5_item_id = inst->GetAugmentItemID(4),
.aug_5_item_name = inst->GetAugment(4) ? inst->GetAugment(4)->GetItem()->Name : "",
.aug_6_item_id = inst->GetAugmentItemID(5),
.aug_6_item_name = inst->GetAugment(5) ? inst->GetAugment(5)->GetItem()->Name : "",
.in_bag = false,
.slot = i,
.item_id = inst->GetItem()->ID,
.augment_1_id = inst->GetAugmentItemID(0),
.augment_1_name = inst->GetAugment(0) ? inst->GetAugment(0)->GetItem()->Name : "",
.augment_2_id = inst->GetAugmentItemID(1),
.augment_2_name = inst->GetAugment(1) ? inst->GetAugment(1)->GetItem()->Name : "",
.augment_3_id = inst->GetAugmentItemID(2),
.augment_3_name = inst->GetAugment(2) ? inst->GetAugment(2)->GetItem()->Name : "",
.augment_4_id = inst->GetAugmentItemID(3),
.augment_4_name = inst->GetAugment(3) ? inst->GetAugment(3)->GetItem()->Name : "",
.augment_5_id = inst->GetAugmentItemID(4),
.augment_5_name = inst->GetAugment(4) ? inst->GetAugment(4)->GetItem()->Name : "",
.augment_6_id = inst->GetAugmentItemID(5),
.augment_6_name = inst->GetAugment(5) ? inst->GetAugment(5)->GetItem()->Name : "",.item_name = inst->GetItem()->Name,
.charges = static_cast<uint16>(inst->GetCharges()),
.in_bag = false,
}
);
@@ -12581,27 +12564,26 @@ void Client::PlayerTradeEventLog(Trade *t, Trade *t2)
for (uint8 j = EQ::invbag::SLOT_BEGIN; j <= EQ::invbag::SLOT_END; j++) {
inst = trader->GetInv().GetItem(i, j);
if (inst) {
t_entries.emplace_back(
PlayerEvent::TradeItemEntry{
.slot = j,
.item_id = inst->GetItem()->ID,
.item_name = inst->GetItem()->Name,
.charges = static_cast<uint16>(inst->GetCharges()),
.aug_1_item_id = inst->GetAugmentItemID(0),
.aug_1_item_name = inst->GetAugment(0) ? inst->GetAugment(0)->GetItem()->Name : "",
.aug_2_item_id = inst->GetAugmentItemID(1),
.aug_2_item_name = inst->GetAugment(1) ? inst->GetAugment(1)->GetItem()->Name : "",
.aug_3_item_id = inst->GetAugmentItemID(2),
.aug_3_item_name = inst->GetAugment(2) ? inst->GetAugment(2)->GetItem()->Name : "",
.aug_4_item_id = inst->GetAugmentItemID(3),
.aug_4_item_name = inst->GetAugment(3) ? inst->GetAugment(3)->GetItem()->Name : "",
.aug_5_item_id = inst->GetAugmentItemID(4),
.aug_5_item_name = inst->GetAugment(4) ? inst->GetAugment(4)->GetItem()->Name : "",
.aug_6_item_id = inst->GetAugmentItemID(5),
.aug_6_item_name = inst->GetAugment(5) ? inst->GetAugment(5)->GetItem()->Name : "",
.in_bag = true,
}
);
t_entries.emplace_back(PlayerEvent::TradeItemEntry{
.slot = j,
.item_id = inst->GetItem()->ID,
.augment_1_id = inst->GetAugmentItemID(0),
.augment_1_name = inst->GetAugment(0) ? inst->GetAugment(0)->GetItem()->Name : "",
.augment_2_id = inst->GetAugmentItemID(1),
.augment_2_name = inst->GetAugment(1) ? inst->GetAugment(1)->GetItem()->Name : "",
.augment_3_id = inst->GetAugmentItemID(2),
.augment_3_name = inst->GetAugment(2) ? inst->GetAugment(2)->GetItem()->Name : "",
.augment_4_id = inst->GetAugmentItemID(3),
.augment_4_name = inst->GetAugment(3) ? inst->GetAugment(3)->GetItem()->Name : "",
.augment_5_id = inst->GetAugmentItemID(4),
.augment_5_name = inst->GetAugment(4) ? inst->GetAugment(4)->GetItem()->Name : "",
.augment_6_id = inst->GetAugmentItemID(5),
.augment_6_name = inst->GetAugment(5) ? inst->GetAugment(5)->GetItem()->Name : "",
.item_name = inst->GetItem()->Name,
.charges = static_cast<uint16>(inst->GetCharges()),
.in_bag = true,
}
);
}
}
}
@@ -12615,52 +12597,50 @@ void Client::PlayerTradeEventLog(Trade *t, Trade *t2)
for (uint16 i = EQ::invslot::TRADE_BEGIN; i <= EQ::invslot::TRADE_END; i++) {
const EQ::ItemInstance *inst = trader2->GetInv().GetItem(i);
if (inst) {
t2_entries.emplace_back(
PlayerEvent::TradeItemEntry{
.slot = i,
.item_id = inst->GetItem()->ID,
.item_name = inst->GetItem()->Name,
.charges = static_cast<uint16>(inst->GetCharges()),
.aug_1_item_id = inst->GetAugmentItemID(0),
.aug_1_item_name = inst->GetAugment(0) ? inst->GetAugment(0)->GetItem()->Name : "",
.aug_2_item_id = inst->GetAugmentItemID(1),
.aug_2_item_name = inst->GetAugment(1) ? inst->GetAugment(1)->GetItem()->Name : "",
.aug_3_item_id = inst->GetAugmentItemID(2),
.aug_3_item_name = inst->GetAugment(2) ? inst->GetAugment(2)->GetItem()->Name : "",
.aug_4_item_id = inst->GetAugmentItemID(3),
.aug_4_item_name = inst->GetAugment(3) ? inst->GetAugment(3)->GetItem()->Name : "",
.aug_5_item_id = inst->GetAugmentItemID(4),
.aug_5_item_name = inst->GetAugment(4) ? inst->GetAugment(4)->GetItem()->Name : "",
.aug_6_item_id = inst->GetAugmentItemID(5),
.aug_6_item_name = inst->GetAugment(5) ? inst->GetAugment(5)->GetItem()->Name : "",
.in_bag = false,
}
t2_entries.emplace_back(PlayerEvent::TradeItemEntry{
.slot = i,
.item_id = inst->GetItem()->ID,
.augment_1_id = inst->GetAugmentItemID(0),
.augment_1_name = inst->GetAugment(0) ? inst->GetAugment(0)->GetItem()->Name : "",
.augment_2_id = inst->GetAugmentItemID(1),
.augment_2_name = inst->GetAugment(1) ? inst->GetAugment(1)->GetItem()->Name : "",
.augment_3_id = inst->GetAugmentItemID(2),
.augment_3_name = inst->GetAugment(2) ? inst->GetAugment(2)->GetItem()->Name : "",
.augment_4_id = inst->GetAugmentItemID(3),
.augment_4_name = inst->GetAugment(3) ? inst->GetAugment(3)->GetItem()->Name : "",
.augment_5_id = inst->GetAugmentItemID(4),
.augment_5_name = inst->GetAugment(4) ? inst->GetAugment(4)->GetItem()->Name : "",
.augment_6_id = inst->GetAugmentItemID(5),
.augment_6_name = inst->GetAugment(5) ? inst->GetAugment(5)->GetItem()->Name : "",
.item_name = inst->GetItem()->Name,
.charges = static_cast<uint16>(inst->GetCharges()),
.in_bag = false,
}
);
if (inst->IsClassBag()) {
for (uint8 j = EQ::invbag::SLOT_BEGIN; j <= EQ::invbag::SLOT_END; j++) {
inst = trader2->GetInv().GetItem(i, j);
if (inst) {
t2_entries.emplace_back(
PlayerEvent::TradeItemEntry{
.slot = j,
.item_id = inst->GetItem()->ID,
.item_name = inst->GetItem()->Name,
.charges = static_cast<uint16>(inst->GetCharges()),
.aug_1_item_id = inst->GetAugmentItemID(0),
.aug_1_item_name = inst->GetAugment(0) ? inst->GetAugment(0)->GetItem()->Name : "",
.aug_2_item_id = inst->GetAugmentItemID(1),
.aug_2_item_name = inst->GetAugment(1) ? inst->GetAugment(1)->GetItem()->Name : "",
.aug_3_item_id = inst->GetAugmentItemID(2),
.aug_3_item_name = inst->GetAugment(2) ? inst->GetAugment(2)->GetItem()->Name : "",
.aug_4_item_id = inst->GetAugmentItemID(3),
.aug_4_item_name = inst->GetAugment(3) ? inst->GetAugment(3)->GetItem()->Name : "",
.aug_5_item_id = inst->GetAugmentItemID(4),
.aug_5_item_name = inst->GetAugment(4) ? inst->GetAugment(4)->GetItem()->Name : "",
.aug_6_item_id = inst->GetAugmentItemID(5),
.aug_6_item_name = inst->GetAugment(5) ? inst->GetAugment(5)->GetItem()->Name : "",
.in_bag = true,
}
t2_entries.emplace_back(PlayerEvent::TradeItemEntry{
.slot = j,
.item_id = inst->GetItem()->ID,
.augment_1_id = inst->GetAugmentItemID(0),
.augment_1_name = inst->GetAugment(0) ? inst->GetAugment(0)->GetItem()->Name : "",
.augment_2_id = inst->GetAugmentItemID(1),
.augment_2_name = inst->GetAugment(1) ? inst->GetAugment(1)->GetItem()->Name : "",
.augment_3_id = inst->GetAugmentItemID(2),
.augment_3_name = inst->GetAugment(2) ? inst->GetAugment(2)->GetItem()->Name : "",
.augment_4_id = inst->GetAugmentItemID(3),
.augment_4_name = inst->GetAugment(3) ? inst->GetAugment(3)->GetItem()->Name : "",
.augment_5_id = inst->GetAugmentItemID(4),
.augment_5_name = inst->GetAugment(4) ? inst->GetAugment(4)->GetItem()->Name : "",
.augment_6_id = inst->GetAugmentItemID(5),
.augment_6_name = inst->GetAugment(5) ? inst->GetAugment(5)->GetItem()->Name : "",
.item_name = inst->GetItem()->Name,
.charges = static_cast<uint16>(inst->GetCharges()),
.in_bag = true,
}
);
}
}
@@ -12681,6 +12661,7 @@ void Client::PlayerTradeEventLog(Trade *t, Trade *t2)
};
RecordPlayerEventLogWithClient(trader, PlayerEvent::TRADE, e);
//Not sure the usefulness of sending the same data twice??
RecordPlayerEventLogWithClient(trader2, PlayerEvent::TRADE, e);
}