mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 14:13:48 +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;
|
||||
}
|
||||
|
||||
export function BuyCoffee(corp: ICorporation, office: OfficeSpace): void {
|
||||
export function BuyCoffee(corp: ICorporation, office: OfficeSpace): boolean {
|
||||
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;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function ThrowParty(corp: ICorporation, office: OfficeSpace, costPerEmployee: number): number {
|
||||
|
@ -769,7 +769,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
},
|
||||
throwParty:
|
||||
(ctx: NetscriptContext) =>
|
||||
async (_divisionName: unknown, _cityName: unknown, _costPerEmployee: unknown): Promise<number> => {
|
||||
(_divisionName: unknown, _cityName: unknown, _costPerEmployee: unknown): number => {
|
||||
checkAccess(ctx, 8);
|
||||
const divisionName = ctx.helper.string("divisionName", _divisionName);
|
||||
const cityName = ctx.helper.city("cityName", _cityName);
|
||||
@ -782,14 +782,11 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
const corporation = getCorporation();
|
||||
const office = getOffice(divisionName, cityName);
|
||||
|
||||
return netscriptDelay(0, workerScript).then(function () {
|
||||
return Promise.resolve(ThrowParty(corporation, office, costPerEmployee));
|
||||
});
|
||||
//return ThrowParty(corporation, office, costPerEmployee)
|
||||
return ThrowParty(corporation, office, costPerEmployee)
|
||||
},
|
||||
buyCoffee:
|
||||
(ctx: NetscriptContext) =>
|
||||
async (_divisionName: unknown, _cityName: unknown): Promise<void> => {
|
||||
(_divisionName: unknown, _cityName: unknown): boolean => {
|
||||
checkAccess(ctx, 8);
|
||||
const divisionName = ctx.helper.string("divisionName", _divisionName);
|
||||
const cityName = ctx.helper.city("cityName", _cityName);
|
||||
@ -797,10 +794,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
const corporation = getCorporation();
|
||||
const office = getOffice(divisionName, cityName);
|
||||
|
||||
return netscriptDelay(0, workerScript).then(function () {
|
||||
return Promise.resolve(BuyCoffee(corporation, office));
|
||||
});
|
||||
//BuyCoffee(corporation, getOffice(divisionName, cityName);
|
||||
return BuyCoffee(corporation, office);
|
||||
},
|
||||
hireAdVert:
|
||||
(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 cityName - Name of the city
|
||||
* @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
|
||||
* @param divisionName - Name of the division
|
||||
* @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.
|
||||
* @param divisionName - Name of the division
|
||||
|
Loading…
Reference in New Issue
Block a user