mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 14:12:27 +01:00
Fixed issue with faction reputation donation bug calculating invalid rep gain
This commit is contained in:
parent
33f1e0cb3c
commit
3dd2975c61
2
dist/engine.bundle.js
vendored
2
dist/engine.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -45,9 +45,9 @@ export class DonateOption extends React.Component<IProps, IState> {
|
|||||||
this.handleChange = this.handleChange.bind(this);
|
this.handleChange = this.handleChange.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns rep gain for the current donation amount
|
// Returns rep gain for a given donation amount
|
||||||
calculateRepGain(): number {
|
calculateRepGain(amt: number): number {
|
||||||
return this.state.donateAmt / CONSTANTS.DonateMoneyToRepDivisor * this.props.p.faction_rep_mult;
|
return amt / CONSTANTS.DonateMoneyToRepDivisor * this.props.p.faction_rep_mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
donate(): void {
|
donate(): void {
|
||||||
@ -59,7 +59,7 @@ export class DonateOption extends React.Component<IProps, IState> {
|
|||||||
dialogBoxCreate(`You cannot afford to donate this much money!`);
|
dialogBoxCreate(`You cannot afford to donate this much money!`);
|
||||||
} else {
|
} else {
|
||||||
this.props.p.loseMoney(amt);
|
this.props.p.loseMoney(amt);
|
||||||
const repGain = this.calculateRepGain();
|
const repGain = this.calculateRepGain(amt);
|
||||||
this.props.faction.playerReputation += repGain;
|
this.props.faction.playerReputation += repGain;
|
||||||
dialogBoxCreate(`You just donated ${numeralWrapper.formatMoney(amt)} to ${fac.name} to gain ` +
|
dialogBoxCreate(`You just donated ${numeralWrapper.formatMoney(amt)} to ${fac.name} to gain ` +
|
||||||
`${numeralWrapper.format(repGain, "0,0.000")} reputation`);
|
`${numeralWrapper.format(repGain, "0,0.000")} reputation`);
|
||||||
@ -76,11 +76,11 @@ export class DonateOption extends React.Component<IProps, IState> {
|
|||||||
statusTxt: "Invalid donate amount entered!",
|
statusTxt: "Invalid donate amount entered!",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const repGain = this.calculateRepGain();
|
const repGain = this.calculateRepGain(amt);
|
||||||
this.setState({
|
this.setState({
|
||||||
donateAmt: amt,
|
donateAmt: amt,
|
||||||
statusTxt: `This donation will result in ${numeralWrapper.format(repGain, "0,0.000")} reputation gain`,
|
statusTxt: `This donation will result in ${numeralWrapper.format(repGain, "0,0.000")} reputation gain`,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user