Merge branch 'danielyxie:dev' into sleeve

This commit is contained in:
Mughur 2022-08-28 10:47:49 +03:00 committed by GitHub
commit ce5d777f59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 32 deletions

6
dist/main.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

14
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -39,6 +39,9 @@ export class Crime {
// Name of crime // Name of crime
name = ""; name = "";
// Name of crime as it appears on work screen: "You are attempting..."
workName = "";
// Milliseconds it takes to attempt the crime // Milliseconds it takes to attempt the crime
time = 0; time = 0;
@ -64,6 +67,7 @@ export class Crime {
constructor( constructor(
name = "", name = "",
workName = "",
type: CrimeType, type: CrimeType,
time = 0, time = 0,
money = 0, money = 0,
@ -72,6 +76,7 @@ export class Crime {
params: IConstructorParams = {}, params: IConstructorParams = {},
) { ) {
this.name = name; this.name = name;
this.workName = workName;
this.type = type; this.type = type;
this.time = time; this.time = time;
this.money = money; this.money = money;

@ -6,7 +6,7 @@ import { IMap } from "../types";
import { CrimeType } from "../utils/WorkType"; import { CrimeType } from "../utils/WorkType";
export const Crimes: IMap<Crime> = { export const Crimes: IMap<Crime> = {
Shoplift: new Crime("Shoplift", CrimeType.SHOPLIFT, 2e3, 15e3, 1 / 20, 0.1, { Shoplift: new Crime("Shoplift", "to shoplift", CrimeType.SHOPLIFT, 2e3, 15e3, 1 / 20, 0.1, {
dexterity_success_weight: 1, dexterity_success_weight: 1,
agility_success_weight: 1, agility_success_weight: 1,
@ -14,7 +14,7 @@ export const Crimes: IMap<Crime> = {
agility_exp: 2, agility_exp: 2,
}), }),
RobStore: new Crime("Rob Store", CrimeType.ROB_STORE, 60e3, 400e3, 1 / 5, 0.5, { RobStore: new Crime("Rob Store", "to rob a store", CrimeType.ROB_STORE, 60e3, 400e3, 1 / 5, 0.5, {
hacking_exp: 30, hacking_exp: 30,
dexterity_exp: 45, dexterity_exp: 45,
agility_exp: 45, agility_exp: 45,
@ -26,7 +26,7 @@ export const Crimes: IMap<Crime> = {
intelligence_exp: 7.5 * CONSTANTS.IntelligenceCrimeBaseExpGain, intelligence_exp: 7.5 * CONSTANTS.IntelligenceCrimeBaseExpGain,
}), }),
Mug: new Crime("Mug", CrimeType.MUG, 4e3, 36e3, 1 / 5, 0.25, { Mug: new Crime("Mug", "to mug", CrimeType.MUG, 4e3, 36e3, 1 / 5, 0.25, {
strength_exp: 3, strength_exp: 3,
defense_exp: 3, defense_exp: 3,
dexterity_exp: 3, dexterity_exp: 3,
@ -38,7 +38,7 @@ export const Crimes: IMap<Crime> = {
agility_success_weight: 0.5, agility_success_weight: 0.5,
}), }),
Larceny: new Crime("Larceny", CrimeType.LARCENY, 90e3, 800e3, 1 / 3, 1.5, { Larceny: new Crime("Larceny", "larceny", CrimeType.LARCENY, 90e3, 800e3, 1 / 3, 1.5, {
hacking_exp: 45, hacking_exp: 45,
dexterity_exp: 60, dexterity_exp: 60,
agility_exp: 60, agility_exp: 60,
@ -50,7 +50,7 @@ export const Crimes: IMap<Crime> = {
intelligence_exp: 15 * CONSTANTS.IntelligenceCrimeBaseExpGain, intelligence_exp: 15 * CONSTANTS.IntelligenceCrimeBaseExpGain,
}), }),
DealDrugs: new Crime("Deal Drugs", CrimeType.DRUGS, 10e3, 120e3, 1, 0.5, { DealDrugs: new Crime("Deal Drugs", "to deal drugs", CrimeType.DRUGS, 10e3, 120e3, 1, 0.5, {
dexterity_exp: 5, dexterity_exp: 5,
agility_exp: 5, agility_exp: 5,
charisma_exp: 10, charisma_exp: 10,
@ -60,7 +60,7 @@ export const Crimes: IMap<Crime> = {
agility_success_weight: 1, agility_success_weight: 1,
}), }),
BondForgery: new Crime("Bond Forgery", CrimeType.BOND_FORGERY, 300e3, 4.5e6, 1 / 2, 0.1, { BondForgery: new Crime("Bond Forgery", "to forge bonds", CrimeType.BOND_FORGERY, 300e3, 4.5e6, 1 / 2, 0.1, {
hacking_exp: 100, hacking_exp: 100,
dexterity_exp: 150, dexterity_exp: 150,
charisma_exp: 15, charisma_exp: 15,
@ -71,7 +71,7 @@ export const Crimes: IMap<Crime> = {
intelligence_exp: 60 * CONSTANTS.IntelligenceCrimeBaseExpGain, intelligence_exp: 60 * CONSTANTS.IntelligenceCrimeBaseExpGain,
}), }),
TraffickArms: new Crime("Traffick Arms", CrimeType.TRAFFIC_ARMS, 40e3, 600e3, 2, 1, { TraffickArms: new Crime("Traffick Arms", "to traffic arms", CrimeType.TRAFFIC_ARMS, 40e3, 600e3, 2, 1, {
strength_exp: 20, strength_exp: 20,
defense_exp: 20, defense_exp: 20,
dexterity_exp: 20, dexterity_exp: 20,
@ -85,7 +85,7 @@ export const Crimes: IMap<Crime> = {
agility_success_weight: 1, agility_success_weight: 1,
}), }),
Homicide: new Crime("Homicide", CrimeType.HOMICIDE, 3e3, 45e3, 1, 3, { Homicide: new Crime("Homicide", "homicide", CrimeType.HOMICIDE, 3e3, 45e3, 1, 3, {
strength_exp: 2, strength_exp: 2,
defense_exp: 2, defense_exp: 2,
dexterity_exp: 2, dexterity_exp: 2,
@ -99,7 +99,7 @@ export const Crimes: IMap<Crime> = {
kills: 1, kills: 1,
}), }),
GrandTheftAuto: new Crime("Grand Theft Auto", CrimeType.GRAND_THEFT_AUTO, 80e3, 1.6e6, 8, 5, { GrandTheftAuto: new Crime("Grand Theft Auto", "grand theft auto", CrimeType.GRAND_THEFT_AUTO, 80e3, 1.6e6, 8, 5, {
strength_exp: 20, strength_exp: 20,
defense_exp: 20, defense_exp: 20,
dexterity_exp: 20, dexterity_exp: 20,
@ -115,7 +115,7 @@ export const Crimes: IMap<Crime> = {
intelligence_exp: 16 * CONSTANTS.IntelligenceCrimeBaseExpGain, intelligence_exp: 16 * CONSTANTS.IntelligenceCrimeBaseExpGain,
}), }),
Kidnap: new Crime("Kidnap", CrimeType.KIDNAP, 120e3, 3.6e6, 5, 6, { Kidnap: new Crime("Kidnap", "to kidnap", CrimeType.KIDNAP, 120e3, 3.6e6, 5, 6, {
strength_exp: 80, strength_exp: 80,
defense_exp: 80, defense_exp: 80,
dexterity_exp: 80, dexterity_exp: 80,
@ -130,7 +130,7 @@ export const Crimes: IMap<Crime> = {
intelligence_exp: 26 * CONSTANTS.IntelligenceCrimeBaseExpGain, intelligence_exp: 26 * CONSTANTS.IntelligenceCrimeBaseExpGain,
}), }),
Assassination: new Crime("Assassination", CrimeType.ASSASSINATION, 300e3, 12e6, 8, 10, { Assassination: new Crime("Assassination", "to assassinate", CrimeType.ASSASSINATION, 300e3, 12e6, 8, 10, {
strength_exp: 300, strength_exp: 300,
defense_exp: 300, defense_exp: 300,
dexterity_exp: 300, dexterity_exp: 300,
@ -145,7 +145,7 @@ export const Crimes: IMap<Crime> = {
kills: 1, kills: 1,
}), }),
Heist: new Crime("Heist", CrimeType.HEIST, 600e3, 120e6, 18, 15, { Heist: new Crime("Heist", "a heist", CrimeType.HEIST, 600e3, 120e6, 18, 15, {
hacking_exp: 450, hacking_exp: 450,
strength_exp: 450, strength_exp: 450,
defense_exp: 450, defense_exp: 450,

@ -124,7 +124,7 @@ function startNetscript1Script(workerScript: WorkerScript): Promise<void> {
const entry = ns[name]; const entry = ns[name];
if (typeof entry === "function") { if (typeof entry === "function") {
//Async functions need to be wrapped. See JS-Interpreter documentation //Async functions need to be wrapped. See JS-Interpreter documentation
const asyncFuncs = ["hack", "grow", "weaken", "sleep", "prompt", "manualHack", "scp", "write", "share", "wget"]; const asyncFuncs = ["hack", "grow", "weaken", "sleep", "prompt", "manualHack", "share", "wget"];
if (asyncFuncs.includes(name)) { if (asyncFuncs.includes(name)) {
const tempWrapper = function (...args: unknown[]): void { const tempWrapper = function (...args: unknown[]): void {

@ -1,14 +1,12 @@
export class RFAMessage { export class RFAMessage {
jsonrpc = "2.0"; // Transmits version of JSON-RPC. Compliance maybe allows some funky interaction with external tools? jsonrpc = "2.0"; // Transmits version of JSON-RPC. Compliance maybe allows some funky interaction with external tools?
public method?: string; // Is defined when it's a request/notification, otherwise undefined public method?: string; // Is defined when it's a request/notification, otherwise undefined
public result?: string | number; // Is defined when it's a response, otherwise undefined public result?: ResultType; // Is defined when it's a response, otherwise undefined
public params?: FileMetadata; // Optional parameters to method public params?: FileMetadata; // Optional parameters to method
public error?: string; // Only defined on error public error?: string; // Only defined on error
public id?: number; // ID to keep track of request -> response interaction, undefined with notifications, defined with request/response public id?: number; // ID to keep track of request -> response interaction, undefined with notifications, defined with request/response
constructor( constructor(obj: { method?: string; result?: ResultType; params?: FileMetadata; error?: string; id?: number } = {}) {
obj: { method?: string; result?: string | number; params?: FileMetadata; error?: string; id?: number } = {},
) {
this.method = obj.method; this.method = obj.method;
this.result = obj.result; this.result = obj.result;
this.params = obj.params; this.params = obj.params;
@ -17,6 +15,7 @@ export class RFAMessage {
} }
} }
type ResultType = string | number | Array<string> | Array<FileContent>;
type FileMetadata = FileData | FileContent | FileLocation | FileServer; type FileMetadata = FileData | FileContent | FileLocation | FileServer;
export interface FileData { export interface FileData {

@ -93,7 +93,7 @@ export const RFARequestHandler: Record<string, (message: RFAMessage) => void | R
...server.scripts.map((scr): string => scr.filename), ...server.scripts.map((scr): string => scr.filename),
]; ];
return new RFAMessage({ result: JSON.stringify(fileNameList), id: msg.id }); return new RFAMessage({ result: fileNameList, id: msg.id });
}, },
getAllFiles: function (msg: RFAMessage): RFAMessage { getAllFiles: function (msg: RFAMessage): RFAMessage {
@ -111,7 +111,7 @@ export const RFARequestHandler: Record<string, (message: RFAMessage) => void | R
}), }),
]; ];
return new RFAMessage({ result: JSON.stringify(fileList), id: msg.id }); return new RFAMessage({ result: fileList, id: msg.id });
}, },
calculateRam: function (msg: RFAMessage): RFAMessage { calculateRam: function (msg: RFAMessage): RFAMessage {

@ -221,6 +221,7 @@ export function WorkInProgressRoot(): React.ReactElement {
const crime = player.currentWork.getCrime(); const crime = player.currentWork.getCrime();
const completion = (player.currentWork.unitCompleted / crime.time) * 100; const completion = (player.currentWork.unitCompleted / crime.time) * 100;
const gains = player.currentWork.earnings(); const gains = player.currentWork.earnings();
const successChance = crime.successRate(player);
workInfo = { workInfo = {
buttons: { buttons: {
cancel: () => { cancel: () => {
@ -232,9 +233,10 @@ export function WorkInProgressRoot(): React.ReactElement {
player.stopFocusing(); player.stopFocusing();
}, },
}, },
title: `You are attempting to ${crime.type}`, title: `You are attempting ${crime.workName}`,
gains: [ gains: [
<Typography>Success chance: {numeralWrapper.formatPercentage(successChance)}</Typography>,
<Typography>Gains (on success)</Typography>, <Typography>Gains (on success)</Typography>,
<StatsRow name="Money:" color={Settings.theme.money}> <StatsRow name="Money:" color={Settings.theme.money}>
<Typography> <Typography>