_internal.classes.focus.crime.CrimeFocusable - vladzaharia/bitburner GitHub Wiki

Class: CrimeFocusable

_internal/classes/focus/crime.CrimeFocusable

Focusable managing crime.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new CrimeFocusable(ns, priority?)

Creates a focuser that manages crime work.

Parameters

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

Overrides

BaseFocusable.constructor

Defined in

_internal/classes/focus/crime.ts:37

Properties

_crimeTime

Private _crimeTime: undefined | number

Time to sleep, set when executing a task.

Defined in

_internal/classes/focus/crime.ts:25


_currentCrime

Private _currentCrime: undefined | Crimes

Current crime being worked.

Defined in

_internal/classes/focus/crime.ts:28


_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

_focus

Protected _focus(): boolean

Commit a crime.

Returns

boolean

True if crime was successful, false otherwise.

Overrides

BaseFocusable._focus

Defined in

_internal/classes/focus/crime.ts:55


_needToKill

Private _needToKill(): boolean

Check if we need to kill someone.

Returns

boolean

True if we still need to kill for a faction invitation.

Defined in

_internal/classes/focus/crime.ts:111


_needToLoseKarma

Private _needToLoseKarma(): boolean

Check if we need to lose karma.

Returns

boolean

True if we still need to lose karma for a faction invitation.

Defined in

_internal/classes/focus/crime.ts:125


_shouldExecute

Private _shouldExecute(crime): boolean

Check if we should commit a crime.

Parameters

Name Type Description
crime Crimes The crime to check if we should commit.

Returns

boolean

True if there's a good chance to succeed, false otherwise.

Defined in

_internal/classes/focus/crime.ts:100


canFocus

canFocus(): boolean

Check if we need to commit a crime to meet faction requirements.

Returns

boolean

True if we need to kill or lose karma.

Overrides

BaseFocusable.canFocus

Defined in

_internal/classes/focus/crime.ts:46


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

Returns the focus time of the current crime.

Returns

number

Time needed to focus, 0 if not commiting a crime.

Overrides

BaseFocusable.getFocusTime

Defined in

_internal/classes/focus/crime.ts:90


getPriority

getPriority(): number

Gets the current priority of the focusable action.

Returns

number

Current priority, with 0 being the highest.

Inherited from

BaseFocusable.getPriority

Defined in

_internal/classes/focus/_base.ts:60


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

Crimes can never run in the background, returns false always.

Returns

boolean

Always false.

Overrides

BaseFocusable.shouldRunInBackground

Defined in

_internal/classes/focus/crime.ts:81

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