Fix trade exploit

Using the Max Sale button it was possible to "invert" the buying/selling state.
deque
scrawl 11 years ago
parent 865486604f
commit 0f1b39bca4

@ -302,6 +302,9 @@ namespace MWGui
}
}
// Is the player buying?
bool buying = (mCurrentMerchantOffer < 0);
if(mCurrentBalance > mCurrentMerchantOffer)
{
//if npc is a creature: reject (no haggle)
@ -315,7 +318,7 @@ namespace MWGui
int a = abs(mCurrentMerchantOffer);
int b = abs(mCurrentBalance);
int d = 0;
if (mCurrentBalance<0)
if (buying)
d = int(100 * (a - b) / a);
else
d = int(100 * (b - a) / a);
@ -336,7 +339,7 @@ namespace MWGui
float pcTerm = (clampedDisposition - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm();
float npcTerm = (d1 + e1 + f1) * sellerStats.getFatigueTerm();
float x = gmst.find("fBargainOfferMulti")->getFloat() * d + gmst.find("fBargainOfferBase")->getFloat();
if (mCurrentBalance<0)
if (buying)
x += abs(int(pcTerm - npcTerm));
else
x += abs(int(npcTerm - pcTerm));

Loading…
Cancel
Save