mirror of
https://github.com/EQEmu/Server.git
synced 2026-12-03 14:22:17 +00:00
[Bug Fix] Never pay more for a sale than the merchant charges for it (#5137)
This commit is contained in:
1 parent
2de1c08d63
commit
1a859afbf7
1 file changed
+15
@@ -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
|
||||
|
||||
Reference in new issue
Block a user