_internal.classes.focus.train.TrainingFocusable - vladzaharia/bitburner GitHub Wiki

Class: TrainingFocusable

_internal/classes/focus/train.TrainingFocusable

Focusable managing training stats for faction requirements.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new TrainingFocusable(ns, priority?)

Creates a focuser that manages training stats.

Parameters

Name Type Default value Description
ns NS undefined The Netscript object.
priority number 100 Priority this focuser should run at, defaults to 100.

Overrides

BaseFocusable.constructor

Defined in

_internal/classes/focus/train.ts:29

Properties

_currentTraining

Private _currentTraining: undefined | Workouts | Courses

Current training or course being done.

Defined in

_internal/classes/focus/train.ts:20


_factionManager

Private _factionManager: FactionManager

Manager of factions

Defined in

_internal/classes/focus/train.ts:17


_ns

Protected _ns: NS

The Netscript object.

Inherited from

BaseFocusable._ns

Defined in

_internal/classes/focus/_base.ts:21


name

name: string

The name of the focusable.

Inherited from

BaseFocusable.name

Defined in

_internal/classes/focus/_base.ts:18

Methods

_checkCombatStats

Private _checkCombatStats(combat): boolean

Check combat stats against player.

Parameters

Name Type Description
combat number Combat requirement to check against.

Returns

boolean

True if player meets requirement with all stats, false otherwise.

Defined in

_internal/classes/focus/train.ts:180


_focus

Protected _focus(): boolean

Either train at the Powerhouse Gym, or study hacking at Rothman University.

Returns

boolean

True if the focus was successful, false otherwise.

Overrides

BaseFocusable._focus

Defined in

_internal/classes/focus/train.ts:68


_getCombatFactions

Private _getCombatFactions(): Faction[]

Get factions needing a higher combat stat.

Returns

Faction[]

All factions which have combat requirement higher than current stats, sorted by requirement.

Defined in

_internal/classes/focus/train.ts:141


_getHackingFactions

Private _getHackingFactions(): Faction[]

Get factions needing a higher hacking stat.

Returns

Faction[]

All factions which have hacking requirement higher than current stats, sorted by requirement.

Defined in

_internal/classes/focus/train.ts:160


_learn

Private _learn(course, university?): boolean

Take a course at a university.

Parameters

Name Type Default value Description
course Courses undefined The course to take.
university string "Rothman University" University to take course at.

Returns

boolean

True if was successful taking course.

Defined in

_internal/classes/focus/train.ts:126


_train

Private _train(workout, gym?): boolean

Train a combat stat at a gym.

Parameters

Name Type Default value Description
workout Workouts undefined The stat to train.
gym string "Powerhouse Gym" Gym to train at.

Returns

boolean

True if was successful training.

Defined in

_internal/classes/focus/train.ts:112


canFocus

canFocus(): boolean

Check if we need to train to meet faction requirements.

Returns

boolean

True if there's a faction which requires more combat or hacking experience.

Overrides

BaseFocusable.canFocus

Defined in

_internal/classes/focus/train.ts:56


focus

focus(): number

Executes a focus action, returning a predefined sleep time.

Returns

number

_sleepTime if successful, -1 otherwise.

Inherited from

BaseFocusable.focus

Defined in

_internal/classes/focus/_base.ts:76


getCheckInterval

getCheckInterval(): number

Gets how often to check for task completion, defaults to this._checkInterval.

Returns

number

How often to check for task completion.

Inherited from

BaseFocusable.getCheckInterval

Defined in

_internal/classes/focus/_base.ts:118


getDetailText

getDetailText(): string

Returns value from preset field.

Returns

string

Value of this._detailField if set, "" otherwise

Inherited from

BaseFocusable.getDetailText

Defined in

_internal/classes/focus/_base.ts:137


getFocusTime

getFocusTime(): number

Get time needed for task, defaults to this._sleepTime.

Returns

number

The time to sleep before running the manager again.

Inherited from

BaseFocusable.getFocusTime

Defined in

_internal/classes/focus/_base.ts:109


getPriority

getPriority(): number

Returns priority 5 if multipliers make working within reach, default otherwise.

Returns

number

Priority for task.

Overrides

BaseFocusable.getPriority

Defined in

_internal/classes/focus/train.ts:40


shouldContinueRunning

shouldContinueRunning(): boolean

Checks if the player is still working.

virtual Can be overridden, but run super.shouldContinueRunning if you do.

Returns

boolean

True if user is still working, false otherwise.

Inherited from

BaseFocusable.shouldContinueRunning

Defined in

_internal/classes/focus/_base.ts:128


shouldRunInBackground

shouldRunInBackground(): boolean

Checks if the action should run in the background, defaults to if priority is > 50.

Returns

boolean

True if this can run in the background, False if it needs to be in the foreground.

Inherited from

BaseFocusable.shouldRunInBackground

Defined in

_internal/classes/focus/_base.ts:95

⚠️ **GitHub.com Fallback** ⚠️