[Fix] Add price change check to the Bazaar Search Window purchase mechanics (#4632)

This commit is contained in:
Mitch Freeman
2025-02-01 16:30:07 -04:00
committed by GitHub
parent 29701d0ea7
commit 0a20100d12
6 changed files with 37 additions and 3 deletions
+4 -1
View File
@@ -1106,6 +1106,7 @@ void Client::TraderStartTrader(const EQApplicationPacket *app)
trader_item.item_id = inst->GetID();
trader_item.item_sn = in->serial_number[i];
trader_item.slot_id = i;
trader_item.listing_date = time(nullptr);
if (inst->IsAugmented()) {
auto augs = inst->GetAugmentIDs();
trader_item.aug_slot_1 = augs.at(0);
@@ -1812,6 +1813,7 @@ void Client::DoBazaarSearch(BazaarSearchCriteria_Struct search_criteria)
return;
}
SetTraderTransactionDate();
std::stringstream ss{};
cereal::BinaryOutputArchive ar(ss);
ar(results);
@@ -2798,6 +2800,7 @@ void Client::TraderPriceUpdate(const EQApplicationPacket *app)
trader_item.item_cost = tpus->NewPrice;
trader_item.item_id = newgis->items[i];
trader_item.item_sn = newgis->serial_number[i];
trader_item.listing_date = time(nullptr);
if (item_detail->IsAugmented()) {
auto augs = item_detail->GetAugmentIDs();
trader_item.aug_slot_1 = augs.at(0);
@@ -3072,7 +3075,7 @@ void Client::BuyTraderItemOutsideBazaar(TraderBuy_Struct *tbs, const EQApplicati
{
auto in = (TraderBuy_Struct *) app->pBuffer;
auto trader_item = TraderRepository::GetItemBySerialNumber(database, tbs->serial_number, tbs->trader_id);
if (!trader_item.id) {
if (!trader_item.id || GetTraderTransactionDate() < trader_item.listing_date) {
LogTrading("Attempt to purchase an item outside of the Bazaar trader_id <red>[{}] item serial_number "
"<red>[{}] The Traders data was outdated.",
tbs->trader_id,