mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-31 10:22:32 +00:00
[Fix] Clamp Item Ldon Sell Back Rates. (#2592)
* [Fix] Clamp ldonsellbackrates to prevent abuse. * Change cast to uint32 * Fix issues with Clamp not functioning correctly. * Fix missed clamp * change price is unsigned int to prevent potential overflow * Formatting * Formatting fix * Update client_packet.cpp * Update client_packet.cpp Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com>
This commit is contained in:
parent
1d302f512e
commit
639f8e184a
@ -2211,7 +2211,14 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 06/11/2016 This formula matches RoF2 client side calculation.
|
// 06/11/2016 This formula matches RoF2 client side calculation.
|
||||||
int32 price = (item->LDoNPrice + 1) * item->LDoNSellBackRate / 100;
|
uint32 price = EQ::Clamp(
|
||||||
|
price,
|
||||||
|
EQ::ClampUpper(
|
||||||
|
(item->LDoNPrice + 1) * item->LDoNSellBackRate / 100,
|
||||||
|
item->LDoNPrice
|
||||||
|
),
|
||||||
|
item->LDoNPrice
|
||||||
|
);
|
||||||
|
|
||||||
if (price == 0)
|
if (price == 0)
|
||||||
{
|
{
|
||||||
@ -2696,7 +2703,14 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
if (item->ID == inst->GetItem()->ID) {
|
if (item->ID == inst->GetItem()->ID) {
|
||||||
// 06/11/2016 This formula matches RoF2 client side calculation.
|
// 06/11/2016 This formula matches RoF2 client side calculation.
|
||||||
cost = (ml.alt_currency_cost + 1) * item->LDoNSellBackRate / 100;
|
cost = EQ::Clamp(
|
||||||
|
cost,
|
||||||
|
EQ::ClampUpper(
|
||||||
|
static_cast<uint32>((ml.alt_currency_cost + 1) * item->LDoNSellBackRate / 100),
|
||||||
|
static_cast<uint32>(ml.alt_currency_cost)
|
||||||
|
),
|
||||||
|
static_cast<uint32>(ml.alt_currency_cost)
|
||||||
|
);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2801,7 +2815,14 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
if (item->ID == inst->GetItem()->ID) {
|
if (item->ID == inst->GetItem()->ID) {
|
||||||
// 06/11/2016 This formula matches RoF2 client side calculation.
|
// 06/11/2016 This formula matches RoF2 client side calculation.
|
||||||
cost = (ml.alt_currency_cost + 1) * item->LDoNSellBackRate / 100;
|
cost = EQ::Clamp(
|
||||||
|
cost,
|
||||||
|
EQ::ClampUpper(
|
||||||
|
static_cast<uint32>((ml.alt_currency_cost + 1) * item->LDoNSellBackRate / 100),
|
||||||
|
static_cast<uint32>(ml.alt_currency_cost)
|
||||||
|
),
|
||||||
|
static_cast<uint32>(ml.alt_currency_cost)
|
||||||
|
);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user