diff --git a/doc/source/netscript/netscriptjs.rst b/doc/source/netscript/netscriptjs.rst index d9f31281e..316aa1906 100644 --- a/doc/source/netscript/netscriptjs.rst +++ b/doc/source/netscript/netscriptjs.rst @@ -151,7 +151,7 @@ You may have noticed that every new ns2 file will contains the following comment * @param {NS} ns **/ -This command is used to help the text editor autocomplete functions in the Netscript API. You can enabling it by pressing ctrl+space after `ns.` +This comment is used to help the text editor autocomplete functions in the Netscript API. You can enabling it by pressing ctrl+space after `ns.` .. image:: autocomplete.png diff --git a/doc/source/netscript/netscriptmisc.rst b/doc/source/netscript/netscriptmisc.rst index 5d1cd9629..ddbee4088 100644 --- a/doc/source/netscript/netscriptmisc.rst +++ b/doc/source/netscript/netscriptmisc.rst @@ -34,7 +34,7 @@ Let's assume Port 1 starts out empty (no data inside). We'll represent the port Now assume we ran the following simple script:: for (i = 0; i < 10; ++i) { - write(1, i); //Writes the value of i to port 1 + writePort(1, i); //Writes the value of i to port 1 } After this script executes, our script will contain every number from 0 through 9, as so:: @@ -44,7 +44,7 @@ After this script executes, our script will contain every number from 0 through Then, assume we run the following script:: for (i = 0; i < 3; ++i) { - print(read(1)); //Reads a value from port 1 and then prints it + print(readPort(1)); //Reads a value from port 1 and then prints it } This script above will read the first three values from port 1 and then print them to the script's log. The log will end up looking like:: @@ -69,7 +69,7 @@ The :js:func:`getPortHandle` Netscript function can be used to get a handle to a This handle allows you to access several new port-related functions and the port's underlying data structure, which is just a JavaScript array. The functions are: -.. js:method:: NetscriptPort.write(data) +.. js:method:: NetscriptPort.writePort(data) :param data: Data to write to the port :returns: If the port is full, the item that is removed from the port is returned. @@ -77,7 +77,7 @@ port's underlying data structure, which is just a JavaScript array. The function Writes `data` to the port. Works the same as the Netscript function `write`. -.. js:method:: NetscriptPort.tryWrite(data) +.. js:method:: NetscriptPort.tryWritePort(data) :param data: Data to try to write to the port :returns: True if the data is successfully written to the port, and false otherwise. @@ -85,7 +85,7 @@ port's underlying data structure, which is just a JavaScript array. The function Attempts to write `data` to the Netscript port. If the port is full, the data will not be written. Otherwise, the data will be written normally. -.. js::method:: NetscriptPort.read() +.. js::method:: NetscriptPort.readPort() :returns: The data read from the port. If the port is empty, "NULL PORT DATA" is returned diff --git a/src/Casino/Blackjack.tsx b/src/Casino/Blackjack.tsx index c6c9a5b7a..834138f37 100644 --- a/src/Casino/Blackjack.tsx +++ b/src/Casino/Blackjack.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { IPlayer } from "../PersonObjects/IPlayer"; import { Money } from "../ui/React/Money"; -import { Game } from "./Game"; +import { Game, reachedLimit } from "./Game"; import { Deck } from "./CardDeck/Deck"; import { Hand } from "./CardDeck/Hand"; import { InputAdornment } from "@mui/material"; @@ -70,7 +70,7 @@ export class Blackjack extends Game { }; startGame = (): void => { - if (!this.canStartGame()) { + if (!this.canStartGame() || reachedLimit(this.props.p)) { return; } @@ -217,11 +217,18 @@ export class Blackjack extends Game { }; finishGame = (result: Result): void => { - const gains = result === Result.DealerWon ? 0 : // We took away the bet at the start, don't need to take more - result === Result.Tie ? this.state.bet : // We took away the bet at the start, give it back - result === Result.PlayerWon ? 2 * this.state.bet : // Give back their bet plus their winnings - result === Result.PlayerWonByBlackjack ? 2.5 * this.state.bet : // Blackjack pays out 1.5x bet! - (() => { throw new Error(`Unexpected result: ${result}`); })(); // This can't happen, right? + const gains = + result === Result.DealerWon + ? 0 // We took away the bet at the start, don't need to take more + : result === Result.Tie + ? this.state.bet // We took away the bet at the start, give it back + : result === Result.PlayerWon + ? 2 * this.state.bet // Give back their bet plus their winnings + : result === Result.PlayerWonByBlackjack + ? 2.5 * this.state.bet // Blackjack pays out 1.5x bet! + : (() => { + throw new Error(`Unexpected result: ${result}`); + })(); // This can't happen, right? this.win(this.props.p, gains); this.setState({ gameInProgress: false, @@ -345,7 +352,7 @@ export class Blackjack extends Game { )} {/* Main game part. Displays both if the game is in progress OR if there's a result so you can see - * the cards that led to that result. */} + * the cards that led to that result. */} {(gameInProgress || result !== Result.Pending) && ( <> @@ -355,10 +362,12 @@ export class Blackjack extends Game { ))} - Count: { - playerHandValues.map((value, i) => {value}) - .reduce((prev, curr) => [prev, ' or ', curr]) - } + + Count:{" "} + {playerHandValues + .map((value, i) => {value}) + .reduce((prev, curr) => [prev, " or ", curr])} + @@ -374,10 +383,12 @@ export class Blackjack extends Game { {!gameInProgress && ( <> - Count: { - dealerHandValues.map((value, i) => {value}) - .reduce((prev, curr) => [prev, ' or ', curr]) - } + + Count:{" "} + {dealerHandValues + .map((value, i) => {value}) + .reduce((prev, curr) => [prev, " or ", curr])} + )} diff --git a/src/Terminal/commands/nano.ts b/src/Terminal/commands/nano.ts index d1ffd3cff..85665424b 100644 --- a/src/Terminal/commands/nano.ts +++ b/src/Terminal/commands/nano.ts @@ -47,9 +47,7 @@ export async function main(ns) { router.toScriptEditor(filepath, txt.text); } } else { - terminal.error( - "Invalid file. Only scripts (.script, .ns, .js), text files (.txt), or .fconf can be edited with nano", - ); + terminal.error("Invalid file. Only scripts (.script, .ns, .js), or text files (.txt) can be edited with nano"); return; } } catch (e) { diff --git a/src/ui/React/ThemeEditorModal.tsx b/src/ui/React/ThemeEditorModal.tsx index d4b847b54..4937a5c23 100644 --- a/src/ui/React/ThemeEditorModal.tsx +++ b/src/ui/React/ThemeEditorModal.tsx @@ -112,7 +112,6 @@ export function ThemeEditorModal(props: IProps): React.ReactElement {
- Warning: Editing the theme is very slow.