mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 08:42:53 +02:00
Updated WorkerScript-related code for the workerScripts array->map change
This commit is contained in:
@@ -12,7 +12,7 @@ import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
|
||||
type IProps = {
|
||||
p: IPlayer;
|
||||
workerScripts: WorkerScript[];
|
||||
workerScripts: Map<number, WorkerScript>;
|
||||
}
|
||||
|
||||
export class ActiveScriptsRoot extends React.Component<IProps> {
|
||||
|
||||
@@ -11,14 +11,14 @@ import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
|
||||
type IProps = {
|
||||
p: IPlayer;
|
||||
workerScripts: WorkerScript[];
|
||||
workerScripts: Map<number, WorkerScript>;
|
||||
}
|
||||
|
||||
export function ScriptProduction(props: IProps): React.ReactElement {
|
||||
const prodRateSinceLastAug = props.p.scriptProdSinceLastAug / (props.p.playtimeSinceLastAug / 1000);
|
||||
|
||||
let onlineProduction = 0;
|
||||
for (const ws of props.workerScripts) {
|
||||
for (const ws of props.workerScripts.values()) {
|
||||
onlineProduction += (ws.scriptRef.onlineMoneyMade / ws.scriptRef.onlineRunningTime);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function ScriptProduction(props: IProps): React.ReactElement {
|
||||
<span id="active-scripts-total-prod-aug-total" className="money-gold">
|
||||
{numeralWrapper.formatMoney(props.p.scriptProdSinceLastAug)}
|
||||
</span>
|
||||
|
||||
|
||||
(<span className="money-gold">
|
||||
<span id="active-scripts-total-prod-aug-avg" className="money-gold">
|
||||
{numeralWrapper.formatMoney(prodRateSinceLastAug)}
|
||||
|
||||
@@ -22,7 +22,7 @@ interface IServerToScriptsMap {
|
||||
}
|
||||
|
||||
type IProps = {
|
||||
workerScripts: WorkerScript[];
|
||||
workerScripts: Map<number, WorkerScript>;
|
||||
};
|
||||
|
||||
type IState = {
|
||||
@@ -61,7 +61,7 @@ export class ServerAccordions extends React.Component<IProps, IState> {
|
||||
updateServerToScriptsMap(): void {
|
||||
const map: IServerToScriptsMap = {};
|
||||
|
||||
for (const ws of this.props.workerScripts) {
|
||||
for (const ws of this.props.workerScripts.values()) {
|
||||
const server = getServer(ws.serverIp);
|
||||
if (server == null) {
|
||||
console.warn(`WorkerScript has invalid IP address: ${ws.serverIp}`);
|
||||
|
||||
Reference in New Issue
Block a user