mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
fix: check for purchased program before enough money (#839)
This commit is contained in:
parent
f4cd4b3362
commit
e22527e7b7
@ -450,16 +450,16 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Player.money < item.price) {
|
||||
helpers.log(ctx, () => `Not enough money to purchase '${item.program}'. Need ${formatMoney(item.price)}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Player.hasProgram(item.program)) {
|
||||
helpers.log(ctx, () => `You already have the '${item.program}' program`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Player.money < item.price) {
|
||||
helpers.log(ctx, () => `Not enough money to purchase '${item.program}'. Need ${formatMoney(item.price)}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player.getHomeComputer().pushProgram(item.program);
|
||||
// Cancel if the program is in progress of writing
|
||||
if (isCreateProgramWork(Player.currentWork) && Player.currentWork.programName === item.program) {
|
||||
|
Loading…
Reference in New Issue
Block a user