Fixed an issue where clients would sell x1000 stacks of items where the price overflows data sizes, the code will now make sure not to sell too many items that go over this data size

This commit is contained in:
Akkadius 2017-02-19 21:12:18 -06:00
parent 08c2f73e37
commit f0f5c41c30

View File

@ -12440,14 +12440,33 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
return;
}
int cost_quantity = mp->quantity;
uint32 cost_quantity = mp->quantity;
if (inst->IsCharged())
int cost_quantity = 1;
uint32 cost_quantity = 1;
uint32 i;
if (RuleB(Merchant, UsePriceMod)) {
for (i = 0; i < cost_quantity; i++) {
price = (uint32)((item->Price * i)*(RuleR(Merchant, BuyCostMod))*Client::CalcPriceMod(vendor, true) + 0.5); // need to round up, because client does it automatically when displaying price
if (price > 4000000000) {
cost_quantity = i;
mp->quantity = i;
break;
}
}
}
else {
for (i = 0; i < cost_quantity; i++) {
price = (uint32)((item->Price * i)*(RuleR(Merchant, BuyCostMod)) + 0.5); // need to round up, because client does it automatically when displaying price
if (price > 4000000000) {
cost_quantity = i;
mp->quantity = i;
break;
}
}
}
if (RuleB(Merchant, UsePriceMod))
price = (int)((item->Price*cost_quantity)*(RuleR(Merchant, BuyCostMod))*Client::CalcPriceMod(vendor, true) + 0.5); // need to round up, because client does it automatically when displaying price
else
price = (int)((item->Price*cost_quantity)*(RuleR(Merchant, BuyCostMod)) + 0.5);
AddMoneyToPP(price, false);
if (inst->IsStackable() || inst->IsCharged())