mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Fix trade exploit
Using the Max Sale button it was possible to "invert" the buying/selling state.
This commit is contained in:
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…
x
Reference in New Issue
Block a user