diff --git a/doc/source/basicgameplay/codingcontracts.rst b/doc/source/basicgameplay/codingcontracts.rst index 596f6033f..715b2fb31 100644 --- a/doc/source/basicgameplay/codingcontracts.rst +++ b/doc/source/basicgameplay/codingcontracts.rst @@ -306,3 +306,67 @@ The list contains the name of (i.e. the value returned by | | | Input: [3, [[0, 1], [0, 2], [1, 2]]] | | | | Output: [] | +-----------------------------------------+------------------------------------------------------------------------------------------+ +| Compression I: RLE Compression | | Run-length encoding (RLE) is a data compression technique which encodes data as a | +| | | series of runs of a repeated single character. Runs are encoded as a length, followed | +| | | by the character itself. Lengths are encoded as a single ASCII digit; runs of 10 | +| | | characters or more are encoded by splitting them into multiple runs. | +| | | | +| | | You are given a string as input. Encode it using run-length encoding with the minimum | +| | | possible output length. | +| | | | +| | | Examples: | +| | | aaaaabccc -> 5a1b3c | +| | | aAaAaA -> 1a1A1a1A1a1A | +| | | 111112333 -> 511233 | +| | | zzzzzzzzzzzzzzzzzzz -> 9z9z1z (or 9z8z2z, etc.) | ++-----------------------------------------+------------------------------------------------------------------------------------------+ +| Compression II: LZ Decompression | | Lempel-Ziv (LZ) compression is a data compression technique which encodes data using | +| | | references to earlier parts of the data. In this variant of LZ, data is encoded in two | +| | | types of chunk. Each chunk begins with a length L, encoded as a single ASCII digit | +| | | from 1 - 9, followed by the chunk data, which is either: | +| | | | +| | | 1. Exactly L characters, which are to be copied directly into the uncompressed data. | +| | | 2. A reference to an earlier part of the uncompressed data. To do this, the length | +| | | is followed by a second ASCII digit X: each of the L output characters is a copy | +| | | of the character X places before it in the uncompressed data. | +| | | | +| | | For both chunk types, a length of 0 instead means the chunk ends immediately, and the | +| | | next character is the start of a new chunk. The two chunk types alternate, starting | +| | | with type 1, and the final chunk may be of either type. | +| | | | +| | | You are given an LZ-encoded string. Decode it and output the original string. | +| | | | +| | | Example: decoding '5aaabc340533bca' chunk-by-chunk | +| | | 5aaabc -> aaabc | +| | | 5aaabc34 -> aaabcaab | +| | | 5aaabc340 -> aaabcaab | +| | | 5aaabc34053 -> aaabcaabaabaa | +| | | 5aaabc340533bca -> aaabcaabaabaabca | ++-----------------------------------------+------------------------------------------------------------------------------------------+ +| Compression III: LZ Compression | | Lempel-Ziv (LZ) compression is a data compression technique which encodes data using | +| | | references to earlier parts of the data. In this variant of LZ, data is encoded in two | +| | | types of chunk. Each chunk begins with a length L, encoded as a single ASCII digit | +| | | from 1 - 9, followed by the chunk data, which is either: | +| | | | +| | | 1. Exactly L characters, which are to be copied directly into the uncompressed data. | +| | | 2. A reference to an earlier part of the uncompressed data. To do this, the length | +| | | is followed by a second ASCII digit X: each of the L output characters is a copy | +| | | of the character X places before it in the uncompressed data. | +| | | | +| | | For both chunk types, a length of 0 instead means the chunk ends immediately, and the | +| | | next character is the start of a new chunk. The two chunk types alternate, starting | +| | | with type 1, and the final chunk may be of either type. | +| | | | +| | | You are given a string as input. Encode it using Lempel-Ziv encoding with the minimum | +| | | possible output length. | +| | | | +| | | Examples (some have other possible encodings of minimal length): | +| | | abracadabra -> 7abracad47 | +| | | mississippi -> 4miss433ppi | +| | | aAAaAAaAaAA -> 3aAA53035 | +| | | 2718281828 -> 627182844 | +| | | abcdefghijk -> 9abcdefghi02jk | +| | | aaaaaaaaaaa -> 1a911a | +| | | aaaaaaaaaaaa -> 1a912aa | +| | | aaaaaaaaaaaaa -> 1a91031 | ++-----------------------------------------+------------------------------------------------------------------------------------------+ diff --git a/src/PersonObjects/Sleeve/Sleeve.ts b/src/PersonObjects/Sleeve/Sleeve.ts index 74295b062..ffeb03dad 100644 --- a/src/PersonObjects/Sleeve/Sleeve.ts +++ b/src/PersonObjects/Sleeve/Sleeve.ts @@ -519,6 +519,14 @@ export class Sleeve extends Person { break; } + // If the player has a gang with the faction the sleeve is working + // for, we need to reset the sleeve's task + if (p.gang) { + if (fac.name === p.gang.facName) { + this.resetTaskStatus(); + } + } + fac.playerReputation += this.getRepGain(p) * cyclesUsed; break; } diff --git a/src/PersonObjects/Sleeve/ui/TaskSelector.tsx b/src/PersonObjects/Sleeve/ui/TaskSelector.tsx index 8d3295076..d7876c77b 100644 --- a/src/PersonObjects/Sleeve/ui/TaskSelector.tsx +++ b/src/PersonObjects/Sleeve/ui/TaskSelector.tsx @@ -110,6 +110,8 @@ const tasks: { first: factions, second: (s1: string) => { const faction = Factions[s1]; + if (!faction) return ["------"]; + const facInfo = faction.getInfo(); const options: string[] = []; if (facInfo.offerHackingWork) { @@ -260,7 +262,7 @@ export function TaskSelector(props: IProps): React.ReactElement { const detailsF = tasks[n]; if (detailsF === undefined) throw new Error(`No function for task '${s0}'`); const details = detailsF(props.player, props.sleeve); - const details2 = details.second(details.first[0]); + const details2 = details.second(details.first[0]) ?? ["------"]; setS2(details2[0]); setS1(details.first[0]); setS0(n); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 6801bea07..e98b03557 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -2198,7 +2198,7 @@ export interface Singularity { * RAM cost: 5 GB * 16/4/1 * * - * This function will automatically install your Augmentations, resetting the game as usual. + * This function will automatically install your Augmentations, resetting the game as usual. If you do not own uninstalled Augmentations then the game will not reset. * * @param cbScript - This is a script that will automatically be run after Augmentations are installed (after the reset). This script will be run with no arguments and 1 thread. It must be located on your home computer. */