[Bug Fix] Never pay more for a sale than the merchant charges for it (#5137)
Build / Linux (push) Canceled after 0s
Build / Windows (push) Canceled after 0s

This commit is contained in:
straps-eq authored and GitHub committed 2026-12-01 19:22:23 -08:00
1 parent 2de1c08d63
commit 1a859afbf7
1 file changed
+15
+15
View File
@@ -14449,6 +14449,21 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
}
}
// paying more than the merchant charges for the same quantity would be a money loop
uint64 buy_unit_price = (item->Price * item->SellRate);
if (!RuleB(Merchant, UseClassicPriceMod)) {
buy_unit_price *= RuleR(Merchant, SellCostMod);
}
if (RuleB(Merchant, UsePriceMod)) {
buy_unit_price *= Client::CalcPriceMod(vendor, false);
}
const uint64 buy_back_cap = buy_unit_price * cost_quantity;
if (price > buy_back_cap) {
price = static_cast<uint32>(buy_back_cap);
}
AddMoneyToPP(price);
// Update merchant stock and refresh client