[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
@@ -0,0 +1,17 @@
-- Drop all qs_ tables
DROP TABLE IF EXISTS
qs_merchant_transaction_record,
qs_merchant_transaction_record_entries,
qs_player_aa_rate_hourly,
qs_player_delete_record,
qs_player_delete_record_entries,
qs_player_events,
qs_player_handin_record,
qs_player_handin_record_entries,
qs_player_move_record,
qs_player_move_record_entries,
qs_player_npc_kill_record,
qs_player_npc_kill_record_entries,
qs_player_speech,
qs_player_trade_record,
qs_player_trade_record_entries;
@@ -0,0 +1,94 @@
-- ================================
-- Conversion of Merchant Transactions
-- ================================
INSERT INTO player_event_merchant_sell (
npc_id, merchant_name, merchant_type, item_id, item_name, charges, cost, alternate_currency_id,
player_money_balance, player_currency_balance, created_at
)
SELECT
r.merchant_id, NULL AS merchant_name, NULL AS merchant_type, e.item_id, NULL AS item_name, e.charges, r.merchant_cp AS cost, NULL AS alternate_currency_id,
r.char_cp AS player_money_balance, NULL AS player_currency_balance, r.time AS created_at
FROM qs_merchant_transaction_record AS r
JOIN qs_merchant_transaction_record_entries AS e
ON r.transaction_id = e.event_id;
-- ================================
-- Conversion of Player Trades
-- ================================
INSERT INTO player_event_trade (
char1_id, char2_id, char1_copper, char1_silver, char1_gold, char1_platinum,
char2_copper, char2_silver, char2_gold, char2_platinum, created_at
)
SELECT
char1_id, char2_id, char1_cp, char1_sp, char1_gp, char1_pp,
char2_cp, char2_sp, char2_gp, char2_pp, time AS created_at
FROM qs_player_trade_record;
INSERT INTO player_event_trade_entries (
player_event_trade_id, char_id, slot, item_id, charges, augment_1_id, augment_2_id, augment_3_id,
augment_4_id, augment_5_id, augment_6_id, in_bag, created_at
)
SELECT
event_id, from_id AS char_id, from_slot AS slot, item_id, charges, aug_1 AS augment_1_id, aug_2 AS augment_2_id, aug_3 AS augment_3_id,
aug_4 AS augment_4_id, aug_5 AS augment_5_id, NULL AS augment_6_id, 0 AS in_bag, NULL AS created_at
FROM qs_player_trade_record_entries;
-- ================================
-- Conversion of NPC Hand-ins
-- ================================
INSERT INTO player_event_npc_handin (
npc_id, npc_name, handin_copper, handin_silver, handin_gold, handin_platinum,
return_copper, return_silver, return_gold, return_platinum, is_quest_handin, created_at
)
SELECT
npc_id, NULL AS npc_name, char_cp AS handin_copper, char_sp AS handin_silver, char_gp AS handin_gold, char_pp AS handin_platinum,
npc_cp AS return_copper, npc_sp AS return_silver, npc_gp AS return_gold, npc_pp AS return_platinum,
0 AS is_quest_handin, time AS created_at
FROM qs_player_handin_record;
INSERT INTO player_event_npc_handin_entries (
player_event_npc_handin_id, type, item_id, charges, evolve_level, evolve_amount,
augment_1_id, augment_2_id, augment_3_id, augment_4_id, augment_5_id, augment_6_id, created_at
)
SELECT
event_id, NULL AS type, item_id, charges, 0 AS evolve_level, 0 AS evolve_amount,
aug_1 AS augment_1_id, aug_2 AS augment_2_id, aug_3 AS augment_3_id, aug_4 AS augment_4_id, aug_5 AS augment_5_id, 0 AS augment_6_id, NULL AS created_at
FROM qs_player_handin_record_entries;
-- ================================
-- Conversion of NPC Kill Records
-- ================================
INSERT INTO player_event_killed_npc (
npc_id, npc_name, combat_time_seconds, total_damage_per_second_taken, total_heal_per_second_taken, created_at
)
SELECT
npc_id, NULL AS npc_name, NULL AS combat_time_seconds, NULL AS total_damage_per_second_taken, NULL AS total_heal_per_second_taken, time AS created_at
FROM qs_player_npc_kill_record;
INSERT INTO player_event_killed_named_npc (
npc_id, npc_name, combat_time_seconds, total_damage_per_second_taken, total_heal_per_second_taken, created_at
)
SELECT
npc_id, NULL AS npc_name, NULL AS combat_time_seconds, NULL AS total_damage_per_second_taken, NULL AS total_heal_per_second_taken, time AS created_at
FROM qs_player_npc_kill_record WHERE type = 1; -- Example condition for named NPCs
-- ================================
-- Conversion of Player Speech
-- ================================
INSERT INTO player_event_speech (
from_char_id, to_char_id, guild_id, type, min_status, message, created_at
)
SELECT
`from` AS from_char_id, `to` AS to_char_id, guilddbid AS guild_id, type, minstatus AS min_status, message,
timerecorded AS created_at
FROM qs_player_speech;
-- ================================
-- Conversion of AA Purchases
-- ================================
INSERT INTO player_event_aa_purchase (
aa_ability_id, cost, previous_id, next_id, created_at
)
SELECT
NULL AS aa_ability_id, NULL AS cost, NULL AS previous_id, NULL AS next_id, NULL AS created_at
FROM qs_player_aa_rate_hourly; -- Adjust as necessary for the source table and logic
-22
View File
@@ -1,22 +0,0 @@
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `qs_player_npc_kill_record`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_npc_kill_record`;
CREATE TABLE `qs_player_npc_kill_record` (
`fight_id` int(11) NOT NULL AUTO_INCREMENT,
`npc_id` int(11) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`zone_id` int(11) DEFAULT NULL,
`time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`fight_id`)
) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_player_npc_kill_record_entries`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_npc_kill_record_entries`;
CREATE TABLE `qs_player_npc_kill_record_entries` (
`event_id` int(11) DEFAULT '0',
`char_id` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-41
View File
@@ -1,41 +0,0 @@
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `qs_player_npc_kill_record`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_trade_record`;
CREATE TABLE `qs_player_trade_record` (
`trade_id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`char1_id` int(11) DEFAULT '0',
`char1_pp` int(11) DEFAULT '0',
`char1_gp` int(11) DEFAULT '0',
`char1_sp` int(11) DEFAULT '0',
`char1_cp` int(11) DEFAULT '0',
`char1_items` mediumint(7) DEFAULT '0',
`char2_id` int(11) DEFAULT '0',
`char2_pp` int(11) DEFAULT '0',
`char2_gp` int(11) DEFAULT '0',
`char2_sp` int(11) DEFAULT '0',
`char2_cp` int(11) DEFAULT '0',
`char2_items` mediumint(7) DEFAULT '0',
PRIMARY KEY (`trade_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_player_npc_kill_record_entries`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_trade_record_entries`;
CREATE TABLE `qs_player_trade_record_entries` (
`event_id` int(11) DEFAULT '0',
`from_id` int(11) DEFAULT '0',
`from_slot` mediumint(7) DEFAULT '0',
`to_id` int(11) DEFAULT '0',
`to_slot` mediumint(7) DEFAULT '0',
`item_id` int(11) DEFAULT '0',
`charges` mediumint(7) DEFAULT '0',
`aug_1` int(11) DEFAULT '0',
`aug_2` int(11) DEFAULT '0',
`aug_3` int(11) DEFAULT '0',
`aug_4` int(11) DEFAULT '0',
`aug_5` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-141
View File
@@ -1,141 +0,0 @@
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `qs_merchant_transaction_record`
-- ----------------------------
DROP TABLE IF EXISTS `qs_merchant_transaction_record`;
CREATE TABLE `qs_merchant_transaction_record` (
`transaction_id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`zone_id` int(11) DEFAULT '0',
`merchant_id` int(11) DEFAULT '0',
`merchant_pp` int(11) DEFAULT '0',
`merchant_gp` int(11) DEFAULT '0',
`merchant_sp` int(11) DEFAULT '0',
`merchant_cp` int(11) DEFAULT '0',
`merchant_items` mediumint(7) DEFAULT '0',
`char_id` int(11) DEFAULT '0',
`char_pp` int(11) DEFAULT '0',
`char_gp` int(11) DEFAULT '0',
`char_sp` int(11) DEFAULT '0',
`char_cp` int(11) DEFAULT '0',
`char_items` mediumint(7) DEFAULT '0',
PRIMARY KEY (`transaction_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_merchant_transaction_record_entries`
-- ----------------------------
DROP TABLE IF EXISTS `qs_merchant_transaction_record_entries`;
CREATE TABLE `qs_merchant_transaction_record_entries` (
`event_id` int(11) DEFAULT '0',
`char_slot` mediumint(7) DEFAULT '0',
`item_id` int(11) DEFAULT '0',
`charges` mediumint(7) DEFAULT '0',
`aug_1` int(11) DEFAULT '0',
`aug_2` int(11) DEFAULT '0',
`aug_3` int(11) DEFAULT '0',
`aug_4` int(11) DEFAULT '0',
`aug_5` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_player_delete_record`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_delete_record`;
CREATE TABLE `qs_player_delete_record` (
`delete_id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`char_id` int(11) DEFAULT '0',
`stack_size` mediumint(7) DEFAULT '0',
`char_items` mediumint(7) DEFAULT '0',
PRIMARY KEY (`delete_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_player_delete_record_entries`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_delete_record_entries`;
CREATE TABLE `qs_player_delete_record_entries` (
`event_id` int(11) DEFAULT '0',
`char_slot` mediumint(7) DEFAULT '0',
`item_id` int(11) DEFAULT '0',
`charges` mediumint(7) DEFAULT '0',
`aug_1` int(11) DEFAULT '0',
`aug_2` int(11) DEFAULT '0',
`aug_3` int(11) DEFAULT '0',
`aug_4` int(11) DEFAULT '0',
`aug_5` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_player_handin_record`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_handin_record`;
CREATE TABLE `qs_player_handin_record` (
`handin_id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`quest_id` int(11) DEFAULT '0',
`char_id` int(11) DEFAULT '0',
`char_pp` int(11) DEFAULT '0',
`char_gp` int(11) DEFAULT '0',
`char_sp` int(11) DEFAULT '0',
`char_cp` int(11) DEFAULT '0',
`char_items` mediumint(7) DEFAULT '0',
`npc_id` int(11) DEFAULT '0',
`npc_pp` int(11) DEFAULT '0',
`npc_gp` int(11) DEFAULT '0',
`npc_sp` int(11) DEFAULT '0',
`npc_cp` int(11) DEFAULT '0',
`npc_items` mediumint(7) DEFAULT '0',
PRIMARY KEY (`handin_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_player_handin_record_entries`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_handin_record_entries`;
CREATE TABLE `qs_player_handin_record_entries` (
`event_id` int(11) DEFAULT '0',
`action_type` char(6) Default 'action',
`char_slot` mediumint(7) DEFAULT '0',
`item_id` int(11) DEFAULT '0',
`charges` mediumint(7) DEFAULT '0',
`aug_1` int(11) DEFAULT '0',
`aug_2` int(11) DEFAULT '0',
`aug_3` int(11) DEFAULT '0',
`aug_4` int(11) DEFAULT '0',
`aug_5` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_player_move_record`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_move_record`;
CREATE TABLE `qs_player_move_record` (
`move_id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`char_id` int(11) DEFAULT '0',
`from_slot` mediumint(7) DEFAULT '0',
`to_slot` mediumint(7) DEFAULT '0',
`stack_size` mediumint(7) DEFAULT '0',
`char_items` mediumint(7) DEFAULT '0',
`postaction` tinyint(1) DEFAULT '0',
PRIMARY KEY (`move_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `qs_player_move_record_entries`
-- ----------------------------
DROP TABLE IF EXISTS `qs_player_move_record_entries`;
CREATE TABLE `qs_player_move_record_entries` (
`event_id` int(11) DEFAULT '0',
`from_slot` mediumint(7) DEFAULT '0',
`to_slot` mediumint(7) DEFAULT '0',
`item_id` int(11) DEFAULT '0',
`charges` mediumint(7) DEFAULT '0',
`aug_1` int(11) DEFAULT '0',
`aug_2` int(11) DEFAULT '0',
`aug_3` int(11) DEFAULT '0',
`aug_4` int(11) DEFAULT '0',
`aug_5` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;