allbuild commit e6d14eff

This commit is contained in:
Olivier Gagnon 2022-07-26 15:30:12 -04:00
parent e6d14eff68
commit 3e4f26ac0a
17 changed files with 230 additions and 44 deletions

4
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

42
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

@ -3,6 +3,82 @@
Changelog Changelog
========= =========
v2.0.0 - 2022-07-19 Work rework
-------------------------------
API break rewards
* Everyone is awarded 10 NFG.
* All work in progress program is auto completed.
* All work in progress crafting is auto completed without adding entropy.
Work (Create program / Work for faction / Studying / etc ...)
* Working has been rebuilt from the grounds up. The motivation for that change is that all
different types of work all required different cached variables on the main Player object.
This caused a lot of bugs and crashes. It's been reworked in such a way as to prevent bugs
and make it nearly trivial to add new kinds of work. However, since this caused a few API break
I've decided to mark this version following semver protocols and call it 2.0.0
* Crime can be unfocused and auto loops, no more spam clicking.
* All work type give their reward immediately. No need to stop work to bank rewards like reputation.
* Faction and Company work no longer have a time limit.
* Company work no longer reduces rep gain by half for quitting early.
* Company faction require 400k rep to join (from 200k)
* Backdooring company server reduces faction requirement to 300k.
* All work generally no longer keep track of cumulative gains like exp and reputation since it's applied instantly.
* getPlayer returns way less fields but does return the new 'currentWork' field.
API breaks
* workForCompany argument 'companyName' is now not-optional
* commitCrime now has 'focus' optional parameter
* using getScriptIncome to get total income has been separated to getTotalScriptIncome.
* using getScriptExpGain to get total income has been separated to getTotalScriptExpGain.
* scp has it's 2 last argument reversed, the signature is now (files, destination, optional_source)
* ns.connect and other singularity function are no longer available at the top level.
They were already hidden from documentation but now they're gone.
* stock.buy and stock.sell were renamed to stock.buyStock and stock.sellStock because 'buy' and 'sell'
are very common tokens.
* corporation.bribe no longer allows to give shares as bribe.
Netscript
* Add singularity.getCurrentWork
* Add singularity.getAugmentationBasePrice
* Add sleeve.getSleeveAugmentationPrice
* Add sleeve.getSleeveAugmentationRepReq
* Fix infiltration.getInfiltrationLocations
* Singularity.goToLocation support for non-city-specific locations (@Ansopedian)
* All corporation functions are synchronous. Job assignment only works on the following cycle. (@stalefishies)
* Add batch functionality to NS spendHashes API (@undeemiss)
* Fix #3661 Add missing memory property to Sleeve API (@borisflagell)
* FIX#3732 Cannot assign two sleeve on "Take on contracts" regardless of contract type. (@borisflagell)
Corporation
* Dividend fixes and exposing dividends info via scripts (@stalefishies)
* Add big number format support in some Corporation's modal (@borisflagell)
* Fix #3261 Industry overview number formatting (@nickofolas)
Multipliers
* The main player object was also plagues with a million fields all called '*_mult'. Representing the different multipliers
* These have been refactored in a field called 'mults'.
Misc.
* #3596 Enhanced terminal command parsing (@RevanProdigalKnight)
* Fix #3366 Sleeve UI would sometimes displays the wrong stat while working out. (@borisflagell)
* Two new encryption themed contracts - caesar and vigenere (@Markus-D-M)
* Fixes #3132 several Sleeve can no longer works concurrently in the same company (@borisflagell)
* FIX #3514 Clear recently killed tab on BN end event (@Daniel-Barbera)
* HammingCodes description and implementation fixes (@s2ks)
* FIX #3794 Sleeve were getting less shocked when hospitalized (was positive, should have detrimental) (@borisflagell)
* Fix #3803 Servers can no longer have duplicate IPs (@crimsonhawk47)
* Fix #3854 ctrl+c does not clear terminal input (@evil-tim)
* Nerf noodle bar, obviously.
v1.6.3 - 2022-04-01 Few stanek fixes v1.6.3 - 2022-04-01 Few stanek fixes
------------------------------------ ------------------------------------

@ -57,8 +57,7 @@ getPlayer
The reason for that is that these fields are all, in one way or another, included in the new work field 'currentWork'. The reason for that is that these fields are all, in one way or another, included in the new work field 'currentWork'.
Some of these values are also irrelevant. Some of these values are also irrelevant.
'currentWork' will be one of many different kind of value. For example when creating a program it will have a programName field. Take a look at the new singularity.getCurrentWork function.
One field that all kinds of work have in common is 'type' which denotes the current kind of work.
All fields ending in _mult have been moved to the 'mults' struct. All fields ending in _mult have been moved to the 'mults' struct.
For example: getPlayer().hacking_skill_mult is now getPlayer().mults.hacking_skill For example: getPlayer().hacking_skill_mult is now getPlayer().mults.hacking_skill

@ -272,10 +272,11 @@ v2.0.0 - 2022-07-19 Work rework
Netscript Netscript
* Add getAugmentationBasePrice * Add singularity.getCurrentWork
* Add getSleeveAugmentationPrice * Add singularity.getAugmentationBasePrice
* Add getSleeveAugmentationRepReq * Add sleeve.getSleeveAugmentationPrice
* Fix getInfiltrationLocations * Add sleeve.getSleeveAugmentationRepReq
* Fix infiltration.getInfiltrationLocations
* Singularity.goToLocation support for non-city-specific locations (@Ansopedian) * Singularity.goToLocation support for non-city-specific locations (@Ansopedian)
* All corporation functions are synchronous. Job assignment only works on the following cycle. (@stalefishies) * All corporation functions are synchronous. Job assignment only works on the following cycle. (@stalefishies)
* Add batch functionality to NS spendHashes API (@undeemiss) * Add batch functionality to NS spendHashes API (@undeemiss)

@ -203,6 +203,7 @@ const singularity = {
setFocus: SF4Cost(0.1), setFocus: SF4Cost(0.1),
b1tflum3: SF4Cost(16), b1tflum3: SF4Cost(16),
destroyW0r1dD43m0n: SF4Cost(32), destroyW0r1dD43m0n: SF4Cost(32),
getCurrentWork: SF4Cost(0.5),
}; };
// Gang API // Gang API

@ -1278,5 +1278,9 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
runAfterReset(callbackScript); runAfterReset(callbackScript);
}, 0); }, 0);
}, },
getCurrentWork: () => (): any | null => {
if (!player.currentWork) return null;
return player.currentWork.APICopy();
},
}; };
} }

@ -2344,6 +2344,15 @@ export interface Singularity {
* @param callbackScript - Name of the script to launch in the next BN. * @param callbackScript - Name of the script to launch in the next BN.
*/ */
destroyW0r1dD43m0n(nextBN: number, callbackScript?: string): void; destroyW0r1dD43m0n(nextBN: number, callbackScript?: string): void;
/**
* Get the current work the player is doing.
* @remarks
* RAM cost: 0.5 GB * 16/4/1
*
* @returns - An object representing the current work. Fields depend on the kind of work.
*/
getCurrentWork(): any | null;
} }
/** /**

@ -12,18 +12,18 @@ import { Work, WorkType } from "./Work";
import { applyWorkStats, newWorkStats, sumWorkStats, WorkStats } from "./WorkStats"; import { applyWorkStats, newWorkStats, sumWorkStats, WorkStats } from "./WorkStats";
export enum ClassType { export enum ClassType {
StudyComputerScience = "StudyComputerScience", StudyComputerScience = "STUDYCOMPUTERSCIENCE",
DataStructures = "DataStructures", DataStructures = "DATASTRUCTURES",
Networks = "Networks", Networks = "NETWORKS",
Algorithms = "Algorithms", Algorithms = "ALGORITHMS",
Management = "Management", Management = "MANAGEMENT",
Leadership = "Leadership", Leadership = "LEADERSHIP",
GymStrength = "GymStrength", GymStrength = "GYMSTRENGTH",
GymDefense = "GymDefense", GymDefense = "GYMDEFENSE",
GymDexterity = "GymDexterity", GymDexterity = "GYMDEXTERITY",
GymAgility = "GymAgility", GymAgility = "GYMAGILITY",
} }
export interface Class { export interface Class {
@ -179,6 +179,15 @@ export class ClassWork extends Work {
} }
} }
APICopy(): Record<string, unknown> {
return {
type: this.type,
cyclesWorked: this.cyclesWorked,
classType: this.classType,
location: this.location,
};
}
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */

@ -54,6 +54,14 @@ export class CompanyWork extends Work {
); );
} }
APICopy(): Record<string, unknown> {
return {
type: this.type,
cyclesWorked: this.cyclesWorked,
companyName: this.companyName,
};
}
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */

@ -101,6 +101,14 @@ export class CreateProgramWork extends Work {
} }
} }
APICopy(): Record<string, unknown> {
return {
type: this.type,
cyclesWorked: this.cyclesWorked,
programName: this.programName,
};
}
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */

@ -9,6 +9,51 @@ import { CrimeType } from "../utils/WorkType";
import { Work, WorkType } from "./Work"; import { Work, WorkType } from "./Work";
import { newWorkStats, scaleWorkStats, WorkStats } from "./WorkStats"; import { newWorkStats, scaleWorkStats, WorkStats } from "./WorkStats";
enum newCrimeType {
SHOPLIFT = "SHOPLIFT",
ROBSTORE = "ROBSTORE",
MUG = "MUG",
LARCENY = "LARCENY",
DRUGS = "DRUGS",
BONDFORGERY = "BONDFORGERY",
TRAFFICKARMS = "TRAFFICKARMS",
HOMICIDE = "HOMICIDE",
GRANDTHEFTAUTO = "GRANDTHEFTAUTO",
KIDNAP = "KIDNAP",
ASSASSINATION = "ASSASSINATION",
HEIST = "HEIST",
}
const convertCrimeType = (crimeType: CrimeType): newCrimeType => {
switch (crimeType) {
case CrimeType.Shoplift:
return newCrimeType.SHOPLIFT;
case CrimeType.RobStore:
return newCrimeType.ROBSTORE;
case CrimeType.Mug:
return newCrimeType.MUG;
case CrimeType.Larceny:
return newCrimeType.LARCENY;
case CrimeType.Drugs:
return newCrimeType.DRUGS;
case CrimeType.BondForgery:
return newCrimeType.BONDFORGERY;
case CrimeType.TraffickArms:
return newCrimeType.TRAFFICKARMS;
case CrimeType.Homicide:
return newCrimeType.HOMICIDE;
case CrimeType.GrandTheftAuto:
return newCrimeType.GRANDTHEFTAUTO;
case CrimeType.Kidnap:
return newCrimeType.KIDNAP;
case CrimeType.Assassination:
return newCrimeType.ASSASSINATION;
case CrimeType.Heist:
return newCrimeType.HEIST;
}
return newCrimeType.SHOPLIFT;
};
interface CrimeWorkParams { interface CrimeWorkParams {
crimeType: CrimeType; crimeType: CrimeType;
singularity: boolean; singularity: boolean;
@ -72,7 +117,7 @@ export class CrimeWork extends Work {
let karma = crime.karma; let karma = crime.karma;
const success = determineCrimeSuccess(player, crime.type); const success = determineCrimeSuccess(player, crime.type);
if (success) { if (success) {
player.gainMoney(gains.money, "crime"); player.gainMoney(gains.money * player.mults.crime_money, "crime");
player.numPeopleKilled += crime.kills; player.numPeopleKilled += crime.kills;
player.gainIntelligenceExp(gains.intExp); player.gainIntelligenceExp(gains.intExp);
} else { } else {
@ -88,8 +133,16 @@ export class CrimeWork extends Work {
player.karma -= karma * focusPenalty; player.karma -= karma * focusPenalty;
} }
finish(player: IPlayer, cancelled: boolean): void { finish(): void {
if (cancelled) return; /** nothing to do */
}
APICopy(): Record<string, unknown> {
return {
type: this.type,
cyclesWorked: this.cyclesWorked,
crimeType: convertCrimeType(this.crimeType),
};
} }
/** /**

@ -83,6 +83,15 @@ export class FactionWork extends Work {
} }
} }
APICopy(): Record<string, unknown> {
return {
type: this.type,
cyclesWorked: this.cyclesWorked,
factionWorkType: this.factionWorkType,
factionName: this.factionName,
};
}
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */

@ -84,6 +84,14 @@ export class GraftingWork extends Work {
} }
} }
APICopy(): Record<string, unknown> {
return {
type: this.type,
cyclesWorked: this.cyclesWorked,
augmentation: this.augmentation,
};
}
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */

@ -14,6 +14,7 @@ export abstract class Work {
abstract process(player: IPlayer, cycles: number): boolean; abstract process(player: IPlayer, cycles: number): boolean;
abstract finish(player: IPlayer, cancelled: boolean): void; abstract finish(player: IPlayer, cancelled: boolean): void;
abstract APICopy(): Record<string, unknown>;
abstract toJSON(): IReviverValue; abstract toJSON(): IReviverValue;
} }