mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 10:13:52 +01:00
Remove async from buyCoffee and throwParty
This commit is contained in:
parent
ffaa38d086
commit
04efd899a0
@ -333,12 +333,14 @@ export function UpgradeOfficeSize(corp: ICorporation, office: OfficeSpace, size:
|
|||||||
corp.funds = corp.funds - cost;
|
corp.funds = corp.funds - cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BuyCoffee(corp: ICorporation, office: OfficeSpace): void {
|
export function BuyCoffee(corp: ICorporation, office: OfficeSpace): boolean {
|
||||||
const cost = 500e3 * office.employees.length;
|
const cost = 500e3 * office.employees.length;
|
||||||
if (corp.funds < cost) { return; }
|
if (corp.funds < cost) { return false; }
|
||||||
|
|
||||||
if (!office.setCoffee()) { return; }
|
if (!office.setCoffee()) { return false; }
|
||||||
corp.funds -= cost;
|
corp.funds -= cost;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ThrowParty(corp: ICorporation, office: OfficeSpace, costPerEmployee: number): number {
|
export function ThrowParty(corp: ICorporation, office: OfficeSpace, costPerEmployee: number): number {
|
||||||
|
@ -769,7 +769,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
|||||||
},
|
},
|
||||||
throwParty:
|
throwParty:
|
||||||
(ctx: NetscriptContext) =>
|
(ctx: NetscriptContext) =>
|
||||||
async (_divisionName: unknown, _cityName: unknown, _costPerEmployee: unknown): Promise<number> => {
|
(_divisionName: unknown, _cityName: unknown, _costPerEmployee: unknown): number => {
|
||||||
checkAccess(ctx, 8);
|
checkAccess(ctx, 8);
|
||||||
const divisionName = ctx.helper.string("divisionName", _divisionName);
|
const divisionName = ctx.helper.string("divisionName", _divisionName);
|
||||||
const cityName = ctx.helper.city("cityName", _cityName);
|
const cityName = ctx.helper.city("cityName", _cityName);
|
||||||
@ -782,14 +782,11 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
|||||||
const corporation = getCorporation();
|
const corporation = getCorporation();
|
||||||
const office = getOffice(divisionName, cityName);
|
const office = getOffice(divisionName, cityName);
|
||||||
|
|
||||||
return netscriptDelay(0, workerScript).then(function () {
|
return ThrowParty(corporation, office, costPerEmployee)
|
||||||
return Promise.resolve(ThrowParty(corporation, office, costPerEmployee));
|
|
||||||
});
|
|
||||||
//return ThrowParty(corporation, office, costPerEmployee)
|
|
||||||
},
|
},
|
||||||
buyCoffee:
|
buyCoffee:
|
||||||
(ctx: NetscriptContext) =>
|
(ctx: NetscriptContext) =>
|
||||||
async (_divisionName: unknown, _cityName: unknown): Promise<void> => {
|
(_divisionName: unknown, _cityName: unknown): boolean => {
|
||||||
checkAccess(ctx, 8);
|
checkAccess(ctx, 8);
|
||||||
const divisionName = ctx.helper.string("divisionName", _divisionName);
|
const divisionName = ctx.helper.string("divisionName", _divisionName);
|
||||||
const cityName = ctx.helper.city("cityName", _cityName);
|
const cityName = ctx.helper.city("cityName", _cityName);
|
||||||
@ -797,10 +794,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
|||||||
const corporation = getCorporation();
|
const corporation = getCorporation();
|
||||||
const office = getOffice(divisionName, cityName);
|
const office = getOffice(divisionName, cityName);
|
||||||
|
|
||||||
return netscriptDelay(0, workerScript).then(function () {
|
return BuyCoffee(corporation, office);
|
||||||
return Promise.resolve(BuyCoffee(corporation, office));
|
|
||||||
});
|
|
||||||
//BuyCoffee(corporation, getOffice(divisionName, cityName);
|
|
||||||
},
|
},
|
||||||
hireAdVert:
|
hireAdVert:
|
||||||
(ctx: NetscriptContext) =>
|
(ctx: NetscriptContext) =>
|
||||||
|
8
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
8
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -6639,16 +6639,16 @@ export interface OfficeAPI {
|
|||||||
* @param divisionName - Name of the division
|
* @param divisionName - Name of the division
|
||||||
* @param cityName - Name of the city
|
* @param cityName - Name of the city
|
||||||
* @param costPerEmployee - Amount to spend per employee.
|
* @param costPerEmployee - Amount to spend per employee.
|
||||||
* @returns Amount of happiness increased.
|
* @returns Multiplier for happiness and morale, or zero on failure
|
||||||
*/
|
*/
|
||||||
throwParty(divisionName: string, cityName: string, costPerEmployee: number): Promise<number>;
|
throwParty(divisionName: string, cityName: string, costPerEmployee: number): number;
|
||||||
/**
|
/**
|
||||||
* Buy coffee for your employees
|
* Buy coffee for your employees
|
||||||
* @param divisionName - Name of the division
|
* @param divisionName - Name of the division
|
||||||
* @param cityName - Name of the city
|
* @param cityName - Name of the city
|
||||||
* @returns A promise that is fulfilled when the coffee is served.
|
* @returns true if buying coffee was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
buyCoffee(divisionName: string, cityName: string): Promise<void>;
|
buyCoffee(divisionName: string, cityName: string): boolean;
|
||||||
/**
|
/**
|
||||||
* Hire AdVert.
|
* Hire AdVert.
|
||||||
* @param divisionName - Name of the division
|
* @param divisionName - Name of the division
|
||||||
|
Loading…
Reference in New Issue
Block a user