[Fix] Parcel Delivery Updates (#4688)

* Fix two parcel bugs

Fix two Parcel Bugs

- If a player was at their parcel limit and perform a bazaar purchase via parcel delivery, their money would be lost
- If a container with items was delivered via parcel, the parcel under certain inventory conditions could be delivered into an incorrect slot resulting in the container being lost.

* Incorrect field used for BagSize vs ItemSize.  Silly mistake.

* Remove duplicate check and reorder stacking check

* Fix edge case when Parcel Window remains open and Bazaar purchases are made.

* Repair
- bazaar purchase of items with charges reverting to 1 charge in error
- bazaar visual error with selling price. Was caused by the parcel fee not being properly reflected in the client
- corrected a type mismatch with parcel fee uint32 vs uin64
- corrected a few TraderPurchase and TraderSell event data points by splitting quantity and charges

* Formatting

* Use pre-existing AddMoney and TakeMoney and remove unnecessary routines

* Updates after rebase
This commit is contained in:
Mitch Freeman
2025-02-15 20:27:09 -04:00
committed by GitHub
parent c09fad5a75
commit ab4e1191ef
8 changed files with 210 additions and 277 deletions
+17 -15
View File
@@ -4002,21 +4002,23 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
TraderRepository::UpdateActiveTransaction(database, in->id, false);
auto item = trader_pc->FindTraderItemBySerialNumber(item_sn);
if (player_event_logs.IsEventEnabled(PlayerEvent::TRADER_SELL)) {
auto buy_item = trader_pc->FindTraderItemBySerialNumber(item_sn);
auto e = PlayerEvent::TraderSellEvent{
.item_id = in->trader_buy_struct.item_id,
.augment_1_id = buy_item->GetAugmentItemID(0),
.augment_2_id = buy_item->GetAugmentItemID(1),
.augment_3_id = buy_item->GetAugmentItemID(2),
.augment_4_id = buy_item->GetAugmentItemID(3),
.augment_5_id = buy_item->GetAugmentItemID(4),
.augment_6_id = buy_item->GetAugmentItemID(5),
auto e = PlayerEvent::TraderSellEvent{
.item_id = item ? item->GetID() : 0,
.augment_1_id = item->GetAugmentItemID(0),
.augment_2_id = item->GetAugmentItemID(1),
.augment_3_id = item->GetAugmentItemID(2),
.augment_4_id = item->GetAugmentItemID(3),
.augment_5_id = item->GetAugmentItemID(4),
.augment_6_id = item->GetAugmentItemID(5),
.item_name = in->trader_buy_struct.item_name,
.buyer_id = in->buyer_id,
.buyer_name = in->trader_buy_struct.buyer_name,
.price = in->trader_buy_struct.price,
.charges = in->trader_buy_struct.quantity,
.quantity = in->trader_buy_struct.quantity,
.charges = item ? item->IsStackable() ? 1 : item->GetCharges() : 0,
.total_cost = (in->trader_buy_struct.price * in->trader_buy_struct.quantity),
.player_money_balance = trader_pc->GetCarriedMoney(),
};
@@ -4121,7 +4123,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
sell_line.seller_quantity,
sell_line.item_name,
buyer->GetCleanName());
buyer->AddMoneyToPPWithOverflow(total_cost, true);
buyer->AddMoneyToPP(total_cost, true);
buyer->RemoveItem(sell_line.item_id, sell_line.seller_quantity);
buyer->Message(
@@ -4220,7 +4222,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
if (inst->IsStackable()) {
if (!buyer->PutItemInInventoryWithStacking(inst.get())) {
buyer->Message(Chat::Red, "Error putting item in your inventory.");
buyer->AddMoneyToPPWithOverflow(total_cost, true);
buyer->AddMoneyToPP(total_cost, true);
in->action = Barter_FailedTransaction;
in->sub_action = Barter_FailedBuyerChecks;
worldserver.SendPacket(pack);
@@ -4232,7 +4234,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
inst->SetCharges(1);
if (!buyer->PutItemInInventoryWithStacking(inst.get())) {
buyer->Message(Chat::Red, "Error putting item in your inventory.");
buyer->AddMoneyToPPWithOverflow(total_cost, true);
buyer->AddMoneyToPP(total_cost, true);
in->action = Barter_FailedTransaction;
in->sub_action = Barter_FailedBuyerChecks;
worldserver.SendPacket(pack);
@@ -4241,7 +4243,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
}
}
if (!buyer->TakeMoneyFromPPWithOverFlow(total_cost, false)) {
if (!buyer->TakeMoneyFromPP(total_cost, false)) {
in->action = Barter_FailedTransaction;
in->sub_action = Barter_FailedBuyerChecks;
worldserver.SendPacket(pack);
@@ -4306,7 +4308,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
uint64 total_cost = (uint64) sell_line.item_cost * (uint64) sell_line.seller_quantity;
seller->RemoveItem(in->buy_item_id, in->seller_quantity);
seller->AddMoneyToPPWithOverflow(total_cost, false);
seller->AddMoneyToPP(total_cost, false);
seller->SendBarterBuyerClientMessage(
sell_line,
Barter_SellerTransactionComplete,