mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 22:22:26 +01:00
Fix focus arg for sing functions
This commit is contained in:
parent
89fd54698b
commit
2d38ce8f72
@ -35,7 +35,9 @@ export function GymLocation(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
function train(stat: string): void {
|
function train(stat: string): void {
|
||||||
const loc = props.loc;
|
const loc = props.loc;
|
||||||
props.p.startClass(props.router, calculateCost(), loc.expMult, stat);
|
props.p.startClass(calculateCost(), loc.expMult, stat);
|
||||||
|
props.p.startFocusing();
|
||||||
|
props.router.toWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
function trainStrength(): void {
|
function trainStrength(): void {
|
||||||
|
@ -34,7 +34,9 @@ export function UniversityLocation(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
function take(stat: string): void {
|
function take(stat: string): void {
|
||||||
const loc = props.loc;
|
const loc = props.loc;
|
||||||
player.startClass(router, calculateCost(), loc.expMult, stat);
|
player.startClass(calculateCost(), loc.expMult, stat);
|
||||||
|
player.startFocusing();
|
||||||
|
router.toWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
function study(): void {
|
function study(): void {
|
||||||
|
@ -343,7 +343,7 @@ export function NetscriptSingularity(
|
|||||||
workerScript.log("universityCourse", () => `Invalid class name: ${className}.`);
|
workerScript.log("universityCourse", () => `Invalid class name: ${className}.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.startClass(Router, costMult, expMult, task);
|
player.startClass(costMult, expMult, task);
|
||||||
if (focus) {
|
if (focus) {
|
||||||
player.startFocusing();
|
player.startFocusing();
|
||||||
Router.toWork();
|
Router.toWork();
|
||||||
@ -433,19 +433,19 @@ export function NetscriptSingularity(
|
|||||||
switch (stat.toLowerCase()) {
|
switch (stat.toLowerCase()) {
|
||||||
case "strength".toLowerCase():
|
case "strength".toLowerCase():
|
||||||
case "str".toLowerCase():
|
case "str".toLowerCase():
|
||||||
player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymStrength);
|
player.startClass(costMult, expMult, CONSTANTS.ClassGymStrength);
|
||||||
break;
|
break;
|
||||||
case "defense".toLowerCase():
|
case "defense".toLowerCase():
|
||||||
case "def".toLowerCase():
|
case "def".toLowerCase():
|
||||||
player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDefense);
|
player.startClass(costMult, expMult, CONSTANTS.ClassGymDefense);
|
||||||
break;
|
break;
|
||||||
case "dexterity".toLowerCase():
|
case "dexterity".toLowerCase():
|
||||||
case "dex".toLowerCase():
|
case "dex".toLowerCase():
|
||||||
player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDexterity);
|
player.startClass(costMult, expMult, CONSTANTS.ClassGymDexterity);
|
||||||
break;
|
break;
|
||||||
case "agility".toLowerCase():
|
case "agility".toLowerCase():
|
||||||
case "agi".toLowerCase():
|
case "agi".toLowerCase():
|
||||||
player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymAgility);
|
player.startClass(costMult, expMult, CONSTANTS.ClassGymAgility);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
workerScript.log("gymWorkout", () => `Invalid stat: ${stat}.`);
|
workerScript.log("gymWorkout", () => `Invalid stat: ${stat}.`);
|
||||||
@ -1271,7 +1271,7 @@ export function NetscriptSingularity(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.startCreateProgramWork(Router, p.name, create.time, create.level);
|
player.startCreateProgramWork(p.name, create.time, create.level);
|
||||||
if (focus) {
|
if (focus) {
|
||||||
player.startFocusing();
|
player.startFocusing();
|
||||||
Router.toWork();
|
Router.toWork();
|
||||||
|
@ -215,7 +215,7 @@ export interface IPlayer {
|
|||||||
singularityStopWork(): string;
|
singularityStopWork(): string;
|
||||||
startBladeburner(p: any): void;
|
startBladeburner(p: any): void;
|
||||||
startFactionWork(faction: Faction): void;
|
startFactionWork(faction: Faction): void;
|
||||||
startClass(router: IRouter, costMult: number, expMult: number, className: string): void;
|
startClass(costMult: number, expMult: number, className: string): void;
|
||||||
startCorporation(corpName: string, additionalShares?: number): void;
|
startCorporation(corpName: string, additionalShares?: number): void;
|
||||||
startCrime(
|
startCrime(
|
||||||
router: IRouter,
|
router: IRouter,
|
||||||
@ -247,7 +247,7 @@ export interface IPlayer {
|
|||||||
quitJob(company: string): void;
|
quitJob(company: string): void;
|
||||||
hasJob(): boolean;
|
hasJob(): boolean;
|
||||||
createHacknetServer(): HacknetServer;
|
createHacknetServer(): HacknetServer;
|
||||||
startCreateProgramWork(router: IRouter, programName: string, time: number, reqLevel: number): void;
|
startCreateProgramWork(programName: string, time: number, reqLevel: number): void;
|
||||||
queueAugmentation(augmentationName: string): void;
|
queueAugmentation(augmentationName: string): void;
|
||||||
receiveInvite(factionName: string): void;
|
receiveInvite(factionName: string): void;
|
||||||
updateSkillLevels(): void;
|
updateSkillLevels(): void;
|
||||||
|
@ -220,7 +220,7 @@ export class PlayerObject implements IPlayer {
|
|||||||
singularityStopWork: () => string;
|
singularityStopWork: () => string;
|
||||||
startBladeburner: (p: any) => void;
|
startBladeburner: (p: any) => void;
|
||||||
startFactionWork: (faction: Faction) => void;
|
startFactionWork: (faction: Faction) => void;
|
||||||
startClass: (router: IRouter, costMult: number, expMult: number, className: string) => void;
|
startClass: (costMult: number, expMult: number, className: string) => void;
|
||||||
startCorporation: (corpName: string, additionalShares?: number) => void;
|
startCorporation: (corpName: string, additionalShares?: number) => void;
|
||||||
startCrime: (
|
startCrime: (
|
||||||
router: IRouter,
|
router: IRouter,
|
||||||
@ -253,7 +253,7 @@ export class PlayerObject implements IPlayer {
|
|||||||
hasJob: () => boolean;
|
hasJob: () => boolean;
|
||||||
process: (router: IRouter, numCycles?: number) => void;
|
process: (router: IRouter, numCycles?: number) => void;
|
||||||
createHacknetServer: () => HacknetServer;
|
createHacknetServer: () => HacknetServer;
|
||||||
startCreateProgramWork: (router: IRouter, programName: string, time: number, reqLevel: number) => void;
|
startCreateProgramWork: (programName: string, time: number, reqLevel: number) => void;
|
||||||
queueAugmentation: (augmentationName: string) => void;
|
queueAugmentation: (augmentationName: string) => void;
|
||||||
receiveInvite: (factionName: string) => void;
|
receiveInvite: (factionName: string) => void;
|
||||||
updateSkillLevels: () => void;
|
updateSkillLevels: () => void;
|
||||||
|
@ -1253,14 +1253,12 @@ export function getWorkRepGain(this: IPlayer): number {
|
|||||||
/* Creating a Program */
|
/* Creating a Program */
|
||||||
export function startCreateProgramWork(
|
export function startCreateProgramWork(
|
||||||
this: IPlayer,
|
this: IPlayer,
|
||||||
router: IRouter,
|
|
||||||
programName: string,
|
programName: string,
|
||||||
time: number,
|
time: number,
|
||||||
reqLevel: number,
|
reqLevel: number,
|
||||||
): void {
|
): void {
|
||||||
this.resetWorkStatus();
|
this.resetWorkStatus();
|
||||||
this.isWorking = true;
|
this.isWorking = true;
|
||||||
this.focus = true;
|
|
||||||
this.workType = CONSTANTS.WorkTypeCreateProgram;
|
this.workType = CONSTANTS.WorkTypeCreateProgram;
|
||||||
|
|
||||||
//Time needed to complete work affected by hacking skill (linearly based on
|
//Time needed to complete work affected by hacking skill (linearly based on
|
||||||
@ -1289,7 +1287,6 @@ export function startCreateProgramWork(
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.createProgramName = programName;
|
this.createProgramName = programName;
|
||||||
router.toWork();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createProgramWork(this: IPlayer, numCycles: number): boolean {
|
export function createProgramWork(this: IPlayer, numCycles: number): boolean {
|
||||||
@ -1337,10 +1334,9 @@ export function finishCreateProgramWork(this: IPlayer, cancelled: boolean): stri
|
|||||||
return "You've finished creating " + programName + "! The new program can be found on your home computer.";
|
return "You've finished creating " + programName + "! The new program can be found on your home computer.";
|
||||||
}
|
}
|
||||||
/* Studying/Taking Classes */
|
/* Studying/Taking Classes */
|
||||||
export function startClass(this: IPlayer, router: IRouter, costMult: number, expMult: number, className: string): void {
|
export function startClass(this: IPlayer, costMult: number, expMult: number, className: string): void {
|
||||||
this.resetWorkStatus();
|
this.resetWorkStatus();
|
||||||
this.isWorking = true;
|
this.isWorking = true;
|
||||||
this.focus = true;
|
|
||||||
this.workType = CONSTANTS.WorkTypeStudyClass;
|
this.workType = CONSTANTS.WorkTypeStudyClass;
|
||||||
this.workCostMult = costMult;
|
this.workCostMult = costMult;
|
||||||
this.workExpMult = expMult;
|
this.workExpMult = expMult;
|
||||||
@ -1353,7 +1349,6 @@ export function startClass(this: IPlayer, router: IRouter, costMult: number, exp
|
|||||||
this.workDexExpGainRate = earnings.workDexExpGainRate;
|
this.workDexExpGainRate = earnings.workDexExpGainRate;
|
||||||
this.workAgiExpGainRate = earnings.workAgiExpGainRate;
|
this.workAgiExpGainRate = earnings.workAgiExpGainRate;
|
||||||
this.workChaExpGainRate = earnings.workChaExpGainRate;
|
this.workChaExpGainRate = earnings.workChaExpGainRate;
|
||||||
router.toWork();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function takeClass(this: IPlayer, numCycles: number): boolean {
|
export function takeClass(this: IPlayer, numCycles: number): boolean {
|
||||||
|
@ -50,7 +50,9 @@ export function ProgramsRoot(): React.ReactElement {
|
|||||||
sx={{ my: 1 }}
|
sx={{ my: 1 }}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
if (!event.isTrusted) return;
|
if (!event.isTrusted) return;
|
||||||
player.startCreateProgramWork(router, program.name, create.time, create.level);
|
player.startCreateProgramWork(program.name, create.time, create.level);
|
||||||
|
player.startFocusing();
|
||||||
|
router.toWork();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{program.name}
|
{program.name}
|
||||||
|
Loading…
Reference in New Issue
Block a user