[Quest API] (Performance) Check merchant events exist before export and execute (#2893)

* [Quest API] Optionally parse merchant events

- Optionally parse these events instead of always doing so.

* Cleanup
This commit is contained in:
Alex King 2023-02-13 00:33:32 -05:00 committed by GitHub
parent 3474c00e7a
commit 21e42714eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2596,6 +2596,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app)
QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, CharacterID(), event_desc);
}
if (parse->PlayerHasQuestSub(EVENT_ALT_CURRENCY_MERCHANT_BUY)) {
const auto& export_string = fmt::format(
"{} {} {} {} {}",
alt_cur_id,
@ -2604,7 +2605,9 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app)
item->ID,
cost
);
parse->EventPlayer(EVENT_ALT_CURRENCY_MERCHANT_BUY, this, export_string, 0);
}
uint64 current_balance = AddAlternateCurrencyValue(alt_cur_id, -((int32) cost));
int16 charges = 1;
@ -2787,6 +2790,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, CharacterID(), event_desc);
}
if (parse->PlayerHasQuestSub(EVENT_ALT_CURRENCY_MERCHANT_SELL)) {
const auto& export_string = fmt::format(
"{} {} {} {} {}",
alt_cur_id,
@ -2795,7 +2799,9 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
item->ID,
cost
);
parse->EventPlayer(EVENT_ALT_CURRENCY_MERCHANT_SELL, this, export_string, 0);
}
FastQueuePacket(&outapp);
uint64 new_balance = AddAlternateCurrencyValue(alt_cur_id, cost);
@ -13576,6 +13582,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
}
// end QS code
if (parse->PlayerHasQuestSub(EVENT_MERCHANT_BUY)) {
const auto& export_string = fmt::format(
"{} {} {} {} {}",
tmp->GetNPCTypeID(),
@ -13584,7 +13591,9 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
mpo->quantity,
mpo->price
);
parse->EventPlayer(EVENT_MERCHANT_BUY, this, export_string, 0);
}
if (player_event_logs.IsEventEnabled(PlayerEvent::MERCHANT_PURCHASE)) {
auto e = PlayerEvent::MerchantPurchaseEvent{
@ -13772,6 +13781,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
}
// end QS code
if (parse->PlayerHasQuestSub(EVENT_MERCHANT_SELL)) {
const auto& export_string = fmt::format(
"{} {} {} {} {}",
vendor->GetNPCTypeID(),
@ -13780,7 +13790,9 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
mp->quantity,
price
);
parse->EventPlayer(EVENT_MERCHANT_SELL, this, export_string, 0);
}
if (player_event_logs.IsEventEnabled(PlayerEvent::MERCHANT_SELL)) {
auto e = PlayerEvent::MerchantSellEvent{