mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +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
1 changed files with 5 additions and 2 deletions
|
@ -302,6 +302,9 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Is the player buying?
|
||||||
|
bool buying = (mCurrentMerchantOffer < 0);
|
||||||
|
|
||||||
if(mCurrentBalance > mCurrentMerchantOffer)
|
if(mCurrentBalance > mCurrentMerchantOffer)
|
||||||
{
|
{
|
||||||
//if npc is a creature: reject (no haggle)
|
//if npc is a creature: reject (no haggle)
|
||||||
|
@ -315,7 +318,7 @@ namespace MWGui
|
||||||
int a = abs(mCurrentMerchantOffer);
|
int a = abs(mCurrentMerchantOffer);
|
||||||
int b = abs(mCurrentBalance);
|
int b = abs(mCurrentBalance);
|
||||||
int d = 0;
|
int d = 0;
|
||||||
if (mCurrentBalance<0)
|
if (buying)
|
||||||
d = int(100 * (a - b) / a);
|
d = int(100 * (a - b) / a);
|
||||||
else
|
else
|
||||||
d = int(100 * (b - a) / a);
|
d = int(100 * (b - a) / a);
|
||||||
|
@ -336,7 +339,7 @@ namespace MWGui
|
||||||
float pcTerm = (clampedDisposition - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm();
|
float pcTerm = (clampedDisposition - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm();
|
||||||
float npcTerm = (d1 + e1 + f1) * sellerStats.getFatigueTerm();
|
float npcTerm = (d1 + e1 + f1) * sellerStats.getFatigueTerm();
|
||||||
float x = gmst.find("fBargainOfferMulti")->getFloat() * d + gmst.find("fBargainOfferBase")->getFloat();
|
float x = gmst.find("fBargainOfferMulti")->getFloat() * d + gmst.find("fBargainOfferBase")->getFloat();
|
||||||
if (mCurrentBalance<0)
|
if (buying)
|
||||||
x += abs(int(pcTerm - npcTerm));
|
x += abs(int(pcTerm - npcTerm));
|
||||||
else
|
else
|
||||||
x += abs(int(npcTerm - pcTerm));
|
x += abs(int(npcTerm - pcTerm));
|
||||||
|
|
Loading…
Reference in a new issue