This commit is contained in:
Olivier Gagnon 2021-08-19 01:45:26 -04:00
parent d6b349b6ff
commit 1a1a43c1ce
41 changed files with 216 additions and 193 deletions

File diff suppressed because one or more lines are too long

@ -1,2 +1,2 @@
!function(n){function t(t){for(var e,i,f=t[0],c=t[1],l=t[2],p=0,s=[];p<f.length;p++)i=f[p],u[i]&&s.push(u[i][0]),u[i]=0;for(e in c)Object.prototype.hasOwnProperty.call(c,e)&&(n[e]=c[e]);for(a&&a(t);s.length;)s.shift()();return r.push.apply(r,l||[]),o()}function o(){for(var n,t=0;t<r.length;t++){for(var o=r[t],e=!0,f=1;f<o.length;f++){var c=o[f];0!==u[c]&&(e=!1)}e&&(r.splice(t--,1),n=i(i.s=o[0]))}return n}var e={},u={1:0},r=[];function i(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=n,i.c=e,i.d=function(n,t,o){i.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:o})},i.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},i.t=function(n,t){if(1&t&&(n=i(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var e in n)i.d(o,e,function(t){return n[t]}.bind(null,e));return o},i.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(t,"a",t),t},i.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},i.p="";var f=window.webpackJsonp=window.webpackJsonp||[],c=f.push.bind(f);f.push=t,f=f.slice();for(var l=0;l<f.length;l++)t(f[l]);var a=c;r.push([858,0]),o()}({795:function(n,t,o){},797:function(n,t,o){},799:function(n,t,o){},801:function(n,t,o){},803:function(n,t,o){},805:function(n,t,o){},807:function(n,t,o){},809:function(n,t,o){},811:function(n,t,o){},813:function(n,t,o){},815:function(n,t,o){},817:function(n,t,o){},819:function(n,t,o){},821:function(n,t,o){},823:function(n,t,o){},825:function(n,t,o){},827:function(n,t,o){},829:function(n,t,o){},831:function(n,t,o){},833:function(n,t,o){},835:function(n,t,o){},837:function(n,t,o){},839:function(n,t,o){},841:function(n,t,o){},843:function(n,t,o){},845:function(n,t,o){},847:function(n,t,o){},849:function(n,t,o){},851:function(n,t,o){},853:function(n,t,o){},855:function(n,t,o){},858:function(n,t,o){"use strict";o.r(t);o(857),o(855),o(853),o(851),o(849),o(847),o(845),o(843),o(841),o(839),o(837),o(835),o(833),o(831),o(829),o(827),o(825),o(823),o(821),o(819),o(817),o(815),o(813),o(811),o(809),o(807),o(805),o(803),o(801),o(799),o(797),o(795)}});
!function(n){function t(t){for(var e,i,f=t[0],c=t[1],l=t[2],p=0,s=[];p<f.length;p++)i=f[p],u[i]&&s.push(u[i][0]),u[i]=0;for(e in c)Object.prototype.hasOwnProperty.call(c,e)&&(n[e]=c[e]);for(a&&a(t);s.length;)s.shift()();return r.push.apply(r,l||[]),o()}function o(){for(var n,t=0;t<r.length;t++){for(var o=r[t],e=!0,f=1;f<o.length;f++){var c=o[f];0!==u[c]&&(e=!1)}e&&(r.splice(t--,1),n=i(i.s=o[0]))}return n}var e={},u={1:0},r=[];function i(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=n,i.c=e,i.d=function(n,t,o){i.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:o})},i.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},i.t=function(n,t){if(1&t&&(n=i(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var e in n)i.d(o,e,function(t){return n[t]}.bind(null,e));return o},i.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(t,"a",t),t},i.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},i.p="";var f=window.webpackJsonp=window.webpackJsonp||[],c=f.push.bind(f);f.push=t,f=f.slice();for(var l=0;l<f.length;l++)t(f[l]);var a=c;r.push([856,0]),o()}({793:function(n,t,o){},795:function(n,t,o){},797:function(n,t,o){},799:function(n,t,o){},801:function(n,t,o){},803:function(n,t,o){},805:function(n,t,o){},807:function(n,t,o){},809:function(n,t,o){},811:function(n,t,o){},813:function(n,t,o){},815:function(n,t,o){},817:function(n,t,o){},819:function(n,t,o){},821:function(n,t,o){},823:function(n,t,o){},825:function(n,t,o){},827:function(n,t,o){},829:function(n,t,o){},831:function(n,t,o){},833:function(n,t,o){},835:function(n,t,o){},837:function(n,t,o){},839:function(n,t,o){},841:function(n,t,o){},843:function(n,t,o){},845:function(n,t,o){},847:function(n,t,o){},849:function(n,t,o){},851:function(n,t,o){},853:function(n,t,o){},856:function(n,t,o){"use strict";o.r(t);o(855),o(853),o(851),o(849),o(847),o(845),o(843),o(841),o(839),o(837),o(835),o(833),o(831),o(829),o(827),o(825),o(823),o(821),o(819),o(817),o(815),o(813),o(811),o(809),o(807),o(805),o(803),o(801),o(799),o(797),o(795),o(793)}});
//# sourceMappingURL=engineStyle.bundle.js.map

34
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -3,6 +3,28 @@
Changelog
=========
v0.52.4 - 2021-07-19 Bladeburner in React (hydroflame)
-------------------------------------------
** Bladeburner **
* The entire UI was rebuild in React. It should be more responsive
** Hacknet **
* Displays how many time each hash upgrade was bought.
* Displays cummulative effect of the upgrade.
* Removed "Close" button from hash upgrade menu.
** Misc. **
* More popup/modals have dark background, can be dismissed by clicking
outside, or by pressing escape.
* Small reword in the guide.
* Fix several typos in the bladeburner documentation.
* Linting (no one cares except the dev)
* nerf noodle bar
v0.52.3 - 2021-07-15 Gangs were OP (hydroflame)
-------------------------------------------
@ -24,6 +46,7 @@ v0.52.3 - 2021-07-15 Gangs were OP (hydroflame)
* Fixed an issue where you could join the same faction twice via script and
UI simultaneously.
* Factions list screen converted to React.
* nerf noodle bar
v0.52.2 - 2021-07-15 Oh yeah, BN11 is a thing (drunk hydroflame tbh)
-------------------------------------------
@ -39,6 +62,10 @@ v0.52.2 - 2021-07-15 Oh yeah, BN11 is a thing (drunk hydroflame tbh)
programs.
* Augmentation descriptions are now more concise and consistent.
** Misc. **
* nerf noodle bar
v0.52.1 - 2021-07-10 bugfixing (hydroflame & community)
-------------------------------------------
@ -58,6 +85,7 @@ v0.52.1 - 2021-07-10 bugfixing (hydroflame & community)
* Plenty of typo/description fixed (@MageKing17)
* Cleanup description of singularity function on readthedocs (@PurePandemonium)
* Fix bug when autolinking a server while backdooring (@schroederIT)
* nerf noodle bar
v0.52.0 - 2021-06-13 Infiltration 2.0 (hydroflame & community)
--------------------------------------------------------------
@ -107,6 +135,7 @@ v0.52.0 - 2021-06-13 Infiltration 2.0 (hydroflame & community)
* Fixed an issue where reputation could be transfered to new jobs when unfocused.
* Empty stack traces should no longer appear.
* Purchasing anything with Infinity money doesn't result in NaN.
* nerf noodle bar
v0.51.10 - 2021-05-31 Focus Mark, Focus! (hydroflame)
-----------------------------------------------------
@ -150,6 +179,7 @@ v0.51.10 - 2021-05-31 Focus Mark, Focus! (hydroflame)
* Very large number will no longer appear as "$NaNt"
* Hash capacity now displays in the "big number" format.
* nerf noodle bar
v0.51.9 - 2021-05-17 offline progress and exports! (hydroflame & community)
---------------------------------------------------------------
@ -203,6 +233,7 @@ v0.51.9 - 2021-05-17 offline progress and exports! (hydroflame & community)
* Updated several dependencies (big who cares, I know)
* ls no longer prints lingering newline.
* Money earned/spent by sleeves is now tracked under Character>Money
* nerf noodle bar
v0.51.8 - 2021-05-07 It was there all along (hydroflame & community)
@ -260,6 +291,7 @@ v0.51.8 - 2021-05-07 It was there all along (hydroflame & community)
* Fix infiltration number formatting.
* script income transfers to parent on death. This helps keep track of
income for scripts that spawn short lived scripts.
* nerf noodle bar
v0.51.7 - 2021-04-28 n00dles (hydroflame & community)
-----------------------------------------
@ -317,6 +349,7 @@ v0.51.7 - 2021-04-28 n00dles (hydroflame & community)
* Money amount under 1000 dont display 3 decimal anymore.
* Fix nextSourceFile flag miscalculation on the bitverse (for Bn12)
* Faction invite text says "Decide later"/"Join!" instead of "No"/"Yes"
* nerf noodle bar
v0.51.6 - 2021-04-28 Backdoor! (hydroflame & community)
@ -367,6 +400,7 @@ v0.51.6 - 2021-04-28 Backdoor! (hydroflame & community)
* so many documentation and typos fixes (@Pimgd)
* A corruption visual effect has been added to location with servers that
have backdoor installed. (@dewint)
* nerf noodle bar
v0.51.5 - 2021-04-20 Flags! (hydroflame)
@ -391,6 +425,7 @@ v0.51.5 - 2021-04-20 Flags! (hydroflame)
* Souce-File typo fix
* Fix 'while you were away' screen.
* Bladeburner team size can no longer be set to negative amounts.
* nerf noodle bar
v0.51.4 - 2021-04-19 Manual hacking is fun (hydroflame)
-------------------------------------------------------
@ -426,6 +461,7 @@ v0.51.4 - 2021-04-19 Manual hacking is fun (hydroflame)
* The text editor now remembers the location of your cursor and restores it.
* skills are recalculated instantly.
* Fix typo in Operation Zero description.
* nerf noodle bar
v0.51.3 - 2021-04-16 Y'all broke it on the first day (hydroflame)
-----------------------------------------------------------------
@ -467,6 +503,7 @@ v0.51.3 - 2021-04-16 Y'all broke it on the first day (hydroflame)
* Hacknet node names is easier to handle for screen readers.
* Money spent on classes is now tracked independently of work money.
* running coding contract from the terminal will display its name.
* nerf noodle bar
v0.51.2 - 2021-04-09 Vegas, Baby! (hydroflame)
----------------------------------------------
@ -481,6 +518,7 @@ v0.51.2 - 2021-04-09 Vegas, Baby! (hydroflame)
* Link to discord added under options
* 'getMemberInformation' doc updated, oops
* tech vendor now handle max ram and cores.
* nerf noodle bar
v0.51.1 - 2021-04-06 Bugfixes because the author of the last patch sucks (it's hydroflame)
------------------------------------------------------------------------------------------
@ -512,6 +550,7 @@ v0.51.1 - 2021-04-06 Bugfixes because the author of the last patch sucks (it's h
* 'fl1ght.exe' will no longer suggest the combat path. Related faction
requirements unchanged.
* nerf noodle bar
v0.51.0 - 2021-03-31 Formulas (hydroflame)
------------------------------------------
@ -538,6 +577,10 @@ v0.51.0 - 2021-03-31 Formulas (hydroflame)
* Certain UI elements are now 'click-to-copy'
** Misc. **
* nerf noodle bar
v0.50.2 - 2021-03-25 Everyone asked for this one. (hydroflame)
--------------------------------------------------------------
@ -555,6 +598,7 @@ v0.50.2 - 2021-03-25 Everyone asked for this one. (hydroflame)
* New shortcut, Alt + b, brings you to bladeburner
* New shortcut, Alt + g, brings you to gang
* nerf noodle bar
v0.50.1 - 2021-03-22 (hydroflame)
---------------------------------
@ -577,6 +621,7 @@ v0.50.1 - 2021-03-22 (hydroflame)
**Misc.**
* Minor spacing in stats tables.
* nerf noodle bar
v0.50.0 - 2021-03-20 Intelligence (hydroflame)
----------------------------------------------
@ -597,6 +642,7 @@ v0.50.0 - 2021-03-20 Intelligence (hydroflame)
* number formatting
* remove wiki button in Hacking Missions.
* Fix NaN displayed when very very large numbers are reached.
* nerf noodle bar
v0.49.2 - 2021-03-13 (hydroflame)
---------------------------------
@ -634,6 +680,7 @@ v0.49.2 - 2021-03-13 (hydroflame)
**Misc.**
* Fix issue where the effective stats under Character>Stats were being calculated.
* nerf noodle bar
v0.49.0 - 2021-03-11 Source-File -1 (hydroflame)
------------------------------------------------
@ -661,6 +708,7 @@ v0.49.0 - 2021-03-11 Source-File -1 (hydroflame)
* Minor formatting under Hacking>Active Scripts
* option menu colors now match the rest of the game, kinda.
* nerf noodle bar
v0.48.0 - ASCII - 2021-03-07 (hydroflame)
@ -708,6 +756,7 @@ v0.48.0 - ASCII - 2021-03-07 (hydroflame)
has bought but not installed
* Character>Factions has a badge indicating how many factions have pending
invites.
* nerf noodle bar
v0.47.2 - 7/15/2019
-------------------

@ -66,7 +66,7 @@ documentation_title = '{0} Documentation'.format(project)
# The short X.Y version.
version = '0.52'
# The full version, including alpha/beta/rc tags.
release = '0.52.3'
release = '0.52.4'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

@ -636,7 +636,7 @@ This tells me that I can reach :code:`CSEC` by going through :code:`iron-gym`::
from CSEC once you hit 50 hacking, you cannot actually pass their test
until your hacking is high enough to install a backdoor on their server.
After you are connected to the :code:`CSEC` server, you can hack it. Note that this
After you are connected to the :code:`CSEC` server, you can backdoor it. Note that this
server requires one open port in order to gain root access. We can open the SSH port
using the :code:`BruteSSH.exe` program we created earlier. In |Terminal|::

@ -12,7 +12,7 @@ getActionCountRemaining() Netscript Function
This function will return 'Infinity' for actions such as 'Training' and
'Field Analysis'.
This function will return 1 for BlackOps not yet completed regardless of
wether the player has the required rank to attempt the mission or not.
whether the player has the required rank to attempt the mission or not.
Example:

@ -12,4 +12,4 @@ getActionCurrentLevel() Netscript Function
.. code-block:: javascript
bladeburner.getActionCountRemaining("Contracts", "Tracking"); // returns: 7
bladeburner.getActionCurrentLevel("Contracts", "Tracking"); // returns: 9

@ -230,8 +230,10 @@
<div id="augmentations-container" class="generic-menupage-container"></div>
<!-- Milestones content -->
<div id="milestones-container" class="generic-menupage-container">
</div>
<div id="milestones-container" class="generic-menupage-container"></div>
<!-- Bladeburner -->
<div id="bladeburner-container" class="generic-menupage-container"></div>
<!-- Tutorial content -->
<div id="tutorial-container" class="generic-menupage-container">

@ -126,5 +126,5 @@
"watch": "webpack --watch --mode production",
"watch:dev": "webpack --watch --mode development"
},
"version": "0.52.3"
"version": "0.52.4"
}

@ -55,7 +55,7 @@ interface IConstructorParams {
}
function generateStatsDescription(mults: IMap<number>, programs?: string[], startingMoney?: number): JSX.Element {
const f = (x: number, decimals = 0) => {
const f = (x: number, decimals = 0): string => {
// look, I don't know how to make a "smart decimals"
// todo, make it smarter
if(x === 1.0777-1) return "7.77%";

@ -18,8 +18,6 @@ import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
import { dialogBoxCreate } from "../../utils/DialogBox";
import { clearObject } from "../../utils/helpers/clearObject";
import { Money } from "../ui/React/Money";
import { CorruptableText } from "../ui/React/CorruptableText";
import { WHRNG } from "../Casino/RNG";

@ -7,8 +7,8 @@ interface IParams {
}
export class ActionIdentifier implements IActionIdentifier {
name: string = "";
type: number = -1;
name = "";
type = -1;
constructor(params: IParams = {}) {
if (params.name) this.name = params.name;

@ -38,25 +38,25 @@ import { joinFaction } from "../Faction/FactionHelpers";
import { WorkerScript } from "../Netscript/WorkerScript";
export class Bladeburner implements IBladeburner {
numHosp: number = 0;
moneyLost: number = 0;
rank: number = 0;
maxRank: number = 0;
numHosp = 0;
moneyLost = 0;
rank = 0;
maxRank = 0;
skillPoints: number = 0;
totalSkillPoints: number = 0;
skillPoints = 0;
totalSkillPoints = 0;
teamSize: number = 0;
teamLost: number = 0;
hpLost: number = 0;
teamSize = 0;
teamLost = 0;
hpLost = 0;
storedCycles: number = 0;
storedCycles = 0;
randomEventCounter: number = getRandomInt(240, 600);
actionTimeToComplete: number = 0;
actionTimeCurrent: number = 0;
actionTimeOverflow: number = 0;
actionTimeToComplete = 0;
actionTimeCurrent = 0;
actionTimeOverflow = 0;
action: IActionIdentifier = new ActionIdentifier({type: ActionTypes["Idle"]});
@ -64,9 +64,9 @@ export class Bladeburner implements IBladeburner {
city: string = BladeburnerConstants.CityNames[2];
skills: any = {};
skillMultipliers: any = {};
staminaBonus: number = 0;
maxStamina: number = 0;
stamina: number = 0;
staminaBonus = 0;
maxStamina = 0;
stamina = 0;
contracts: any = {};
operations: any = {};
blackops: any = {};
@ -77,11 +77,11 @@ export class Bladeburner implements IBladeburner {
blackops:true,
events:true,
};
automateEnabled: boolean = false;
automateEnabled = false;
automateActionHigh: IActionIdentifier = new ActionIdentifier({type: ActionTypes["Idle"]});
automateThreshHigh: number = 0;
automateThreshHigh = 0;
automateActionLow: IActionIdentifier = new ActionIdentifier({type: ActionTypes["Idle"]});
automateThreshLow: number = 0;
automateThreshLow = 0;
consoleHistory: string[] = [];
consoleLogs: string[] = [
"Bladeburner Console",
@ -89,7 +89,7 @@ export class Bladeburner implements IBladeburner {
];
constructor(player?: IPlayer) {
for (var i = 0; i < BladeburnerConstants.CityNames.length; ++i) {
for (let i = 0; i < BladeburnerConstants.CityNames.length; ++i) {
this.cities[BladeburnerConstants.CityNames[i]] = new City(BladeburnerConstants.CityNames[i]);
}
@ -219,7 +219,7 @@ export class Bladeburner implements IBladeburner {
}
}
postToConsole(input: string, saveToLogs: boolean = true): void {
postToConsole(input: string, saveToLogs = true): void {
const MaxConsoleEntries = 100;
if (saveToLogs) {
this.consoleLogs.push(input);
@ -250,13 +250,13 @@ export class Bladeburner implements IBladeburner {
}
}
storeCycles(numCycles: number = 0): void {
storeCycles(numCycles = 0): void {
this.storedCycles += numCycles;
}
// working on
getActionIdFromTypeAndName(type: string = "", name: string = ""): IActionIdentifier | null {
getActionIdFromTypeAndName(type = "", name = ""): IActionIdentifier | null {
if (type === "" || name === "") {return null;}
const action = new ActionIdentifier();
const convertedType = type.toLowerCase().trim();
@ -402,18 +402,19 @@ export class Bladeburner implements IBladeburner {
executeSkillConsoleCommand(args: string[]): void {
switch (args.length) {
case 1:
case 1: {
// Display Skill Help Command
this.postToConsole("Invalid usage of 'skill' console command: skill [action] [name]");
this.postToConsole("Use 'help skill' for more info");
break;
case 2:
}
case 2: {
if (args[1].toLowerCase() === "list") {
// List all skills and their level
this.postToConsole("Skills: ");
const skillNames = Object.keys(Skills);
for(let i = 0; i < skillNames.length; ++i) {
let skill = Skills[skillNames[i]];
const skill = Skills[skillNames[i]];
let level = 0;
if (this.skills[skill.name] != null) {level = this.skills[skill.name];}
this.postToConsole(skill.name + ": Level " + formatNumber(level, 0));
@ -482,7 +483,8 @@ export class Bladeburner implements IBladeburner {
this.postToConsole("Use 'help skill' for more info");
}
break;
case 3:
}
case 3: {
const skillName = args[2];
const skill = Skills[skillName];
if (skill == null || !(skill instanceof Skill)) {
@ -513,12 +515,14 @@ export class Bladeburner implements IBladeburner {
this.postToConsole("Use 'help skill' for more info");
}
break;
default:
}
default: {
this.postToConsole("Invalid usage of 'skill' console command: skill [action] [name]");
this.postToConsole("Use 'help skill' for more info");
break;
}
}
}
executeLogConsoleCommand(args: string[]): void {
if (args.length < 3) {
@ -748,7 +752,7 @@ export class Bladeburner implements IBladeburner {
return args;
}
executeConsoleCommand(player: IPlayer, command: string) {
executeConsoleCommand(player: IPlayer, command: string): void {
command = command.trim();
command = command.replace(/\s\s+/g, ' '); // Replace all whitespace w/ a single space
@ -1117,7 +1121,7 @@ export class Bladeburner implements IBladeburner {
if (this.action.type !== ActionTypes.Contract) {
throw new Error("completeContract() called even though current action is not a Contract");
}
var city = this.getCurrentCity();
const city = this.getCurrentCity();
if (success) {
switch (this.action.name) {
case "Tracking":
@ -1364,7 +1368,7 @@ export class Bladeburner implements IBladeburner {
break;
}
case ActionTypes["Diplomacy"]: {
let eff = this.getDiplomacyEffectiveness(player);
const eff = this.getDiplomacyEffectiveness(player);
this.getCurrentCity().chaos *= eff;
if (this.getCurrentCity().chaos < 0) { this.getCurrentCity().chaos = 0; }
if (this.logging.general) {
@ -1444,9 +1448,9 @@ export class Bladeburner implements IBladeburner {
return gain * (this.skillMultipliers.stamina * player.bladeburner_stamina_gain_mult);
}
calculateMaxStamina(player: IPlayer) {
calculateMaxStamina(player: IPlayer): void {
const effAgility = player.agility * this.skillMultipliers.effAgi;
let maxStamina = (Math.pow(effAgility, 0.8) + this.staminaBonus) *
const maxStamina = (Math.pow(effAgility, 0.8) + this.staminaBonus) *
this.skillMultipliers.stamina *
player.bladeburner_max_stamina_mult;
if (this.maxStamina !== maxStamina) {
@ -1654,7 +1658,7 @@ export class Bladeburner implements IBladeburner {
}
}
getTypeAndNameFromActionId(actionId: IActionIdentifier): {type: string, name: string} {
getTypeAndNameFromActionId(actionId: IActionIdentifier): {type: string; name: string} {
const res = {type: '', name: ''};
const types = Object.keys(ActionTypes);
for (let i = 0; i < types.length; ++i) {
@ -1668,22 +1672,28 @@ export class Bladeburner implements IBladeburner {
res.name = actionId.name != null ? actionId.name : "Idle";
return res;
}
getContractNamesNetscriptFn(): string[] {
return Object.keys(this.contracts);
}
getOperationNamesNetscriptFn(): string[] {
return Object.keys(this.operations);
}
getBlackOpNamesNetscriptFn(): string[] {
return Object.keys(BlackOperations);
}
getGeneralActionNamesNetscriptFn(): string[] {
return Object.keys(GeneralActions);
}
getSkillNamesNetscriptFn(): string[] {
return Object.keys(Skills);
}
startActionNetscriptFn(player: IPlayer, type: string, name: string, workerScript: WorkerScript) {
startActionNetscriptFn(player: IPlayer, type: string, name: string, workerScript: WorkerScript): boolean {
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
const actionId = this.getActionIdFromTypeAndName(type, name);
if (actionId == null) {
@ -1695,9 +1705,9 @@ export class Bladeburner implements IBladeburner {
if (actionId.type === ActionTypes["BlackOp"]) {
// Can't start a BlackOp if you don't have the required rank
const action = this.getActionObject(actionId);
if(action == null) throw new Error('Action not found ${actionId.type}, ${actionId.name}');
if(action == null) throw new Error(`Action not found ${actionId.type}, ${actionId.name}`);
if(!(action instanceof BlackOperation)) throw new Error(`Action should be BlackOperation but isn't`);
const blackOp = (action as BlackOperation);
//const blackOp = (action as BlackOperation);
if (action.reqdRank > this.rank) {
workerScript.log("bladeburner.startAction", `Insufficient rank to start Black Op '${actionId.name}'.`);
return false;
@ -1710,7 +1720,7 @@ export class Bladeburner implements IBladeburner {
}
// Can't start a BlackOp if you haven't done the one before it
var blackops = [];
const blackops = [];
for (const nm in BlackOperations) {
if (BlackOperations.hasOwnProperty(nm)) {
blackops.push(nm);
@ -1720,7 +1730,7 @@ export class Bladeburner implements IBladeburner {
return (BlackOperations[a].reqdRank - BlackOperations[b].reqdRank); // Sort black ops in intended order
});
let i = blackops.indexOf(actionId.name);
const i = blackops.indexOf(actionId.name);
if (i === -1) {
workerScript.log("bladeburner.startAction", `Invalid Black Op: '${name}'`);
return false;
@ -1742,6 +1752,7 @@ export class Bladeburner implements IBladeburner {
return false;
}
}
getActionTimeNetscriptFn(player: IPlayer, type: string, name: string, workerScript: WorkerScript): number {
const errorLogText = `Invalid action: type='${type}' name='${name}'`
const actionId = this.getActionIdFromTypeAndName(type, name);
@ -1776,6 +1787,7 @@ export class Bladeburner implements IBladeburner {
return -1;
}
}
getActionEstimatedSuccessChanceNetscriptFn(player: IPlayer, type: string, name: string, workerScript: WorkerScript): number {
const errorLogText = `Invalid action: type='${type}' name='${name}'`
const actionId = this.getActionIdFromTypeAndName(type, name);
@ -1807,7 +1819,8 @@ export class Bladeburner implements IBladeburner {
return -1;
}
}
getActionCountRemainingNetscriptFn(type: string, name: string, workerScript: WorkerScript) {
getActionCountRemainingNetscriptFn(type: string, name: string, workerScript: WorkerScript): number {
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
const actionId = this.getActionIdFromTypeAndName(type, name);
if (actionId == null) {
@ -1841,7 +1854,8 @@ export class Bladeburner implements IBladeburner {
return -1;
}
}
getSkillLevelNetscriptFn(skillName: string, workerScript: WorkerScript) {
getSkillLevelNetscriptFn(skillName: string, workerScript: WorkerScript): number {
if (skillName === "" || !Skills.hasOwnProperty(skillName)) {
workerScript.log("bladeburner.getSkillLevel", `Invalid skill: '${skillName}'`);
return -1;
@ -1853,7 +1867,8 @@ export class Bladeburner implements IBladeburner {
return this.skills[skillName];
}
}
getSkillUpgradeCostNetscriptFn(skillName: string, workerScript: WorkerScript) {
getSkillUpgradeCostNetscriptFn(skillName: string, workerScript: WorkerScript): number {
if (skillName === "" || !Skills.hasOwnProperty(skillName)) {
workerScript.log("bladeburner.getSkillUpgradeCost", `Invalid skill: '${skillName}'`);
return -1;
@ -1866,7 +1881,8 @@ export class Bladeburner implements IBladeburner {
return skill.calculateCost(this.skills[skillName]);
}
}
upgradeSkillNetscriptFn(skillName: string, workerScript: WorkerScript) {
upgradeSkillNetscriptFn(skillName: string, workerScript: WorkerScript): boolean {
const errorLogText = `Invalid skill: '${skillName}'`;
if (!Skills.hasOwnProperty(skillName)) {
workerScript.log("bladeburner.upgradeSkill", errorLogText);
@ -1895,6 +1911,7 @@ export class Bladeburner implements IBladeburner {
workerScript.log("bladeburner.upgradeSkill", `'${skillName}' upgraded to level ${this.skills[skillName]}`);
return true;
}
getTeamSizeNetscriptFn(type: string, name: string, workerScript: WorkerScript): number {
if (type === "" && name === "") {
return this.teamSize;
@ -1921,6 +1938,7 @@ export class Bladeburner implements IBladeburner {
return 0;
}
}
setTeamSizeNetscriptFn(type: string, name: string, size: number, workerScript: WorkerScript): number {
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
const actionId = this.getActionIdFromTypeAndName(type, name);
@ -1952,8 +1970,9 @@ export class Bladeburner implements IBladeburner {
workerScript.log("bladeburner.setTeamSize", `Team size for '${name}' set to ${sanitizedSize}.`);
return sanitizedSize;
}
joinBladeburnerFactionNetscriptFn(workerScript: WorkerScript): boolean {
var bladeburnerFac = Factions["Bladeburners"];
const bladeburnerFac = Factions["Bladeburners"];
if (bladeburnerFac.isMember) {
return true;
} else if (this.rank >= BladeburnerConstants.RankNeededForFaction) {

@ -59,7 +59,7 @@ export interface IBladeburner {
prestige(): void;
storeCycles(numCycles?: number): void;
getTypeAndNameFromActionId(actionId: IActionIdentifier): {type: string, name: string};
getTypeAndNameFromActionId(actionId: IActionIdentifier): {type: string; name: string};
getContractNamesNetscriptFn(): string[];
getOperationNamesNetscriptFn(): string[];
getBlackOpNamesNetscriptFn(): string[];

@ -31,14 +31,14 @@ export function BlackOpElem(props: IProps): React.ReactElement {
const hasReqdRank = props.bladeburner.rank >= props.action.reqdRank;
const computedActionTimeCurrent = Math.min(props.bladeburner.actionTimeCurrent+props.bladeburner.actionTimeOverflow, props.bladeburner.actionTimeToComplete);
function onStart() {
function onStart(): void {
props.bladeburner.action.type = ActionTypes.BlackOperation;
props.bladeburner.action.name = props.action.name;
props.bladeburner.startAction(props.player, props.bladeburner.action);
setRerender(old => !old);
}
function onTeam() {
function onTeam(): void {
const popupId = "bladeburner-operation-set-team-size-popup";
createPopup(popupId, TeamSizePopup, {
bladeburner: props.bladeburner,

@ -1,11 +1,4 @@
import * as React from "react";
import {
formatNumber,
convertTimeMsToTimeElapsedString,
} from "../../../utils/StringHelperFunctions";
import { ActionTypes } from "../data/ActionTypes";
import { createProgressBarText } from "../../../utils/helpers/createProgressBarText";
import { stealthIcon, killIcon } from "../data/Icons";
import React from "react";
import { BlackOperations } from "../BlackOperations";
import { BlackOperation } from "../BlackOperation";
import { BlackOpElem } from "./BlackOpElem";

@ -25,12 +25,12 @@ export function Console(props: IProps): React.ReactElement {
const [consoleHistoryIndex, setConsoleHistoryIndex] = useState(props.bladeburner.consoleHistory.length);
// TODO: Figure out how to actually make the scrolling work correctly.
function scrollToBottom() {
function scrollToBottom(): void {
if(lastRef.current)
lastRef.current.scrollTop = lastRef.current.scrollHeight;
}
function rerender() {
function rerender(): void {
setRerender(old => !old);
}

@ -25,26 +25,26 @@ export function ContractElem(props: IProps): React.ReactElement {
const actionTime = props.action.getActionTime(props.bladeburner);
const autolevelCheckboxId = `bladeburner-${props.action.name}-autolevel-checkbox`;
function onStart() {
function onStart(): void {
props.bladeburner.action.type = ActionTypes.Contract;
props.bladeburner.action.name = props.action.name;
props.bladeburner.startAction(props.player, props.bladeburner.action);
setRerender(old => !old);
}
function increaseLevel() {
function increaseLevel(): void {
++props.action.level;
if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);
setRerender(old => !old);
}
function decreaseLevel() {
function decreaseLevel(): void {
--props.action.level;
if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);
setRerender(old => !old);
}
function onAutolevel(event: React.ChangeEvent<HTMLInputElement>) {
function onAutolevel(event: React.ChangeEvent<HTMLInputElement>): void {
props.action.autoLevel = event.target.checked;
setRerender(old => !old);
}

@ -1,10 +1,5 @@
import React, { useState, useEffect } from "react";
import {
formatNumber,
convertTimeMsToTimeElapsedString,
} from "../../../utils/StringHelperFunctions";
import React from "react";
import { ContractElem } from "./ContractElem";
import { Contract } from "../Contract";
import { IBladeburner } from "../IBladeburner";
import { IPlayer } from "../../PersonObjects/IPlayer";

@ -1,12 +1,7 @@
import React, { useState } from "react";
import { ActionTypes } from "../data/ActionTypes";
import { createProgressBarText } from "../../../utils/helpers/createProgressBarText";
import {
formatNumber,
convertTimeMsToTimeElapsedString,
} from "../../../utils/StringHelperFunctions";
import { stealthIcon, killIcon } from "../data/Icons";
import { BladeburnerConstants } from "../data/Constants";
import { formatNumber } from "../../../utils/StringHelperFunctions";
import { IBladeburner } from "../IBladeburner";
import { IPlayer } from "../../PersonObjects/IPlayer";
@ -21,7 +16,7 @@ export function GeneralActionElem(props: IProps): React.ReactElement {
const isActive = props.action.name === props.bladeburner.action.name;
const computedActionTimeCurrent = Math.min(props.bladeburner.actionTimeCurrent+props.bladeburner.actionTimeOverflow, props.bladeburner.actionTimeToComplete);
function onStart() {
function onStart(): void {
props.bladeburner.action.type = ActionTypes[(props.action.name as string)];
props.bladeburner.action.name = props.action.name;
props.bladeburner.startAction(props.player, props.bladeburner.action);

@ -1,8 +1,4 @@
import React, { useState, useEffect } from "react";
import {
formatNumber,
convertTimeMsToTimeElapsedString,
} from "../../../utils/StringHelperFunctions";
import React from "react";
import { GeneralActionElem } from "./GeneralActionElem";
import { Action } from "../Action";
import { GeneralActions } from "../GeneralActions";

@ -27,14 +27,14 @@ export function OperationElem(props: IProps): React.ReactElement {
const actionTime = props.action.getActionTime(props.bladeburner);
const autolevelCheckboxId = `bladeburner-${props.action.name}-autolevel-checkbox`;
function onStart() {
function onStart(): void {
props.bladeburner.action.type = ActionTypes.Operation;
props.bladeburner.action.name = props.action.name;
props.bladeburner.startAction(props.player, props.bladeburner.action);
setRerender(old => !old);
}
function onTeam() {
function onTeam(): void {
const popupId = "bladeburner-operation-set-team-size-popup";
createPopup(popupId, TeamSizePopup, {
bladeburner: props.bladeburner,
@ -43,19 +43,19 @@ export function OperationElem(props: IProps): React.ReactElement {
});
}
function increaseLevel() {
function increaseLevel(): void {
++props.action.level;
if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);
setRerender(old => !old);
}
function decreaseLevel() {
function decreaseLevel(): void {
--props.action.level;
if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);
setRerender(old => !old);
}
function onAutolevel(event: React.ChangeEvent<HTMLInputElement>) {
function onAutolevel(event: React.ChangeEvent<HTMLInputElement>): void {
props.action.autoLevel = event.target.checked;
setRerender(old => !old);
}

@ -1,10 +1,5 @@
import React, { useState, useEffect } from "react";
import {
formatNumber,
convertTimeMsToTimeElapsedString,
} from "../../../utils/StringHelperFunctions";
import React from "react";
import { OperationElem } from "./OperationElem";
import { Operation } from "../Operation";
import { IBladeburner } from "../IBladeburner";
import { IPlayer } from "../../PersonObjects/IPlayer";

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import { CopyableText } from "../../ui/React/CopyableText";
import { formatNumber } from "../../../utils/StringHelperFunctions";
import { IBladeburner } from "../IBladeburner";
@ -20,7 +20,7 @@ export function SkillElem(props: IProps): React.ReactElement {
const canLevel = props.bladeburner.skillPoints >= pointCost;
const maxLvl = props.skill.maxLvl ? currentLevel >= props.skill.maxLvl : false;
function onClick() {
function onClick(): void {
if (props.bladeburner.skillPoints < pointCost) return;
props.bladeburner.skillPoints -= pointCost;
props.bladeburner.upgradeSkill(props.skill);

@ -13,7 +13,7 @@ export function SkillPage(props: IProps): React.ReactElement {
const setRerender = useState(false)[1];
const mults = props.bladeburner.skillMultipliers;
function valid(mult: any) {
function valid(mult: any): boolean {
return mult && mult !== 1
}

@ -63,7 +63,7 @@ export function Stats(props: IProps): React.ReactElement {
"be logged in the Bladeburner Console.");
}
function openTravel() {
function openTravel(): void {
const popupId = "bladeburner-travel-popup";
createPopup(popupId, TravelPopup, {
bladeburner: props.bladeburner,
@ -71,7 +71,7 @@ export function Stats(props: IProps): React.ReactElement {
});
}
function openFaction() {
function openFaction(): void {
const faction = Factions["Bladeburners"];
if (faction.isMember) {
props.engine.loadFactionContent();

@ -1,6 +1,5 @@
import React, { useState } from "react";
import { removePopup } from "../../ui/React/createPopup";
import { BladeburnerConstants } from "../data/Constants";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { Action } from "../Action";
import { IBladeburner } from "../IBladeburner";

@ -9,7 +9,7 @@ interface IProps {
}
export function TravelPopup(props: IProps): React.ReactElement {
function travel(city: string) {
function travel(city: string): void {
props.bladeburner.city = city;
removePopup(props.popupId);
}
@ -21,12 +21,12 @@ export function TravelPopup(props: IProps): React.ReactElement {
in for your Bladeburner duties does not affect
your location in the game otherwise.
</p>
{BladeburnerConstants.CityNames.map(city =>
{BladeburnerConstants.CityNames.map(city => {
// Reusing this css class...it adds a border and makes it
// so that background color changes when you hover
<div key={city} className="cmpy-mgmt-find-employee-option"
return <div key={city} className="cmpy-mgmt-find-employee-option"
onClick={() => travel(city)}>
{city}
</div>)}
</div>})}
</>);
}

@ -6,7 +6,7 @@
import { IMap } from "./types";
export const CONSTANTS: IMap<any> = {
Version: "0.52.3",
Version: "0.52.4",
// Speed (in ms) at which the main loop is updated
_idleSpeed: 200,
@ -228,26 +228,26 @@ export const CONSTANTS: IMap<any> = {
TotalNumBitNodes: 24,
LatestUpdate: `
v0.52.3 - 2021-07-15 Gangs were OP (hydroflame)
v0.52.4 - 2021-07-19 Bladeburner in React (hydroflame)
-------------------------------------------
** Gang **
** Bladeburner **
* Significant rework. Ascension is now based on exp gained.
* All upgrades give exp bonuses.
* Maximum gang members reduced to 12.
* Respect required to recruit sharply increased.
* Rewritten in React, the UI should be smoother and less laggy now.
* The entire UI was rebuild in React. It should be more responsive
** Infiltration **
** Hacknet **
* Now isTrusted protected.
* Displays how many time each hash upgrade was bought.
* Displays cummulative effect of the upgrade.
* Removed "Close" button from hash upgrade menu.
** Misc. **
* Many UI element are now "noselect" protected.
* Fixed an issue where you could join the same faction twice via script and
UI simultaneously.
* Factions list screen converted to React.
* More popup/modals have dark background, can be dismissed by clicking
outside, or by pressing escape.
* Small reword in the guide.
* Fix several typos in the bladeburner documentation.
* Linting (no one cares except the dev)
* nerf noodle bar
`,
}

@ -8,8 +8,6 @@
import { Faction } from "../Faction/Faction";
import { Factions } from "../Faction/Factions";
import { numeralWrapper } from "../ui/numeralFormat";
import { dialogBoxCreate } from "../../utils/DialogBox";
import {
Reviver,

@ -4,7 +4,6 @@ import { GangMemberUpgrade } from "./GangMemberUpgrade";
import { GangMemberUpgrades } from "./GangMemberUpgrades";
import { IAscensionResult } from "./IAscensionResult";
import { IPlayer } from "../PersonObjects/IPlayer";
import { GangConstants } from "./data/Constants";
import { AllGangs } from "./AllGangs";
import { IGang } from "./IGang";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviver";

@ -542,7 +542,7 @@ export function purchaseHashUpgrade(upgName, upgTarget) {
case "Exchange for Bladeburner Rank": {
// This will throw if player isnt in Bladeburner
try {
Player.bladeburner.changeRank(upg.value);
Player.bladeburner.changeRank(Player, upg.value);
} catch(e) {
Player.hashManager.refundUpgrade(upgName);
return false;

@ -8,6 +8,7 @@ export interface IConstructorParams {
hasTargetServer?: boolean;
name: string;
value: number;
effectText?: (level: number) => JSX.Element | null;
}
export class HashUpgrade {
@ -43,8 +44,11 @@ export class HashUpgrade {
// The meaning varies between different upgrades
value = 0;
effectText: (level: number) => JSX.Element | null = () => null;
constructor(p: IConstructorParams) {
if (p.cost != null) { this.cost = p.cost; }
if (p.effectText != null) { this.effectText = p.effectText; }
this.costPerLevel = p.costPerLevel;
this.desc = p.desc;

@ -1,5 +1,8 @@
// Metadata used to construct all Hash Upgrades
import React from "react";
import { IConstructorParams } from "../HashUpgrade";
import { numeralWrapper } from "../../ui/numeralFormat";
import { Money } from "../../ui/React/Money";
export const HashUpgradesMetadata: IConstructorParams[] = [
{
@ -7,12 +10,14 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
costPerLevel: 4,
desc: "Sell hashes for $1m",
name: "Sell for Money",
effectText: (level: number): JSX.Element | null => (<>Sold for {Money(1e6*level)}</>),
value: 1e6,
},
{
costPerLevel: 100,
desc: "Sell hashes for $1b in Corporation funds",
name: "Sell for Corporation Funds",
effectText: (level: number): JSX.Element | null => (<>Sold for {Money(1e9*level)} Corporation funds.</>),
value: 1e9,
},
{
@ -38,6 +43,7 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
desc: "Use hashes to improve the experience earned when studying at a university by 20%. " +
"This effect persists until you install Augmentations",
name: "Improve Studying",
//effectText: (level: number) => JSX.Element | null = <>Improves studying by ${level*20}%</>,
value: 20, // Improves studying by value%
},
{
@ -45,30 +51,35 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
desc: "Use hashes to improve the experience earned when training at the gym by 20%. This effect " +
"persists until you install Augmentations",
name: "Improve Gym Training",
effectText: (level: number): JSX.Element | null => (<>Improves training by ${level*20}%</>),
value: 20, // Improves training by value%
},
{
costPerLevel: 200,
desc: "Exchange hashes for 1k Scientific Research in all of your Corporation's Industries",
name: "Exchange for Corporation Research",
effectText: (level: number): JSX.Element | null => (<>Acquired a total of {level}k Scientific Research in your industries.</>),
value: 1000,
},
{
costPerLevel: 250,
desc: "Exchange hashes for 100 Bladeburner Rank",
name: "Exchange for Bladeburner Rank",
effectText: (level: number): JSX.Element | null => (<>Acquired a total of {numeralWrapper.format(100*level, '0a')} Bladeburner rank</>),
value: 100,
},
{
costPerLevel: 250,
desc: "Exchanges hashes for 10 Bladeburner Skill Points",
name: "Exchange for Bladeburner SP",
effectText: (level: number): JSX.Element | null => (<>Acquired a total of {numeralWrapper.format(10*level, '0a')} Bladeburner Skill Points</>),
value: 10,
},
{
costPerLevel: 200,
desc: "Generate a random Coding Contract somewhere on the network",
name: "Generate Coding Contract",
effectText: (level: number): JSX.Element | null => (<>Generated {level} contracts.</>),
value: 1,
},
]

@ -54,6 +54,8 @@ class HashUpgrade extends React.Component {
const hashManager = this.props.hashManager;
const upg = this.props.upg;
const cost = hashManager.getUpgradeCost(upg.name);
const level = hashManager.upgrades[upg.name];
const effect = upg.effectText(level);
// Purchase button
const canPurchase = hashManager.hashes >= cost;
@ -63,11 +65,13 @@ class HashUpgrade extends React.Component {
return (
<div className={"bladeburner-action"}>
<CopyableText value={upg.name} />
<p>Cost: {Hashes(cost)}</p>
<p>Cost: {Hashes(cost)}, Bought: {level} times</p>
<p>{upg.desc}</p>
<button className={btnClass} onClick={this.purchase}>
Purchase
</button>
{level > 0 && effect && <p>{effect}</p>}
{
upg.hasTargetServer &&
<ServerDropdown
@ -119,7 +123,6 @@ export class HashUpgradePopup extends React.Component {
return (
<div>
<PopupCloseButton popup={this.props.popupId} text={"Close"} />
<p>Spend your hashes on a variety of different upgrades</p>
<p>Hashes: {numeralWrapper.formatHashes(this.state.totalHashes)}</p>
{upgradeElems}

@ -14,13 +14,6 @@ interface IProps {
cancel: () => void;
}
function diffStr(d: number): string {
if(d<=0.5) return "trivial";
if(d<=1.5) return "normal";
if(d<=2.5) return "hard";
return "impossible";
}
function arrowPart(color: string, length: number): JSX.Element {
let arrow = "";
if(length <= 0) length = 0;

@ -30,7 +30,7 @@ import { dialogBoxCreate } from "../../utils/DialogBox";
import { compareArrays } from "../../utils/helpers/compareArrays";
import { createElement } from "../../utils/uiHelpers/createElement";
var scriptEditorRamCheck = null, scriptEditorRamText = null;
var scriptEditorRamText = null;
export function scriptEditorInit() {
// Wrapper container that holds all the buttons below the script editor
const wrapper = document.getElementById("script-editor-buttons-wrapper");
@ -58,22 +58,6 @@ export function scriptEditorInit() {
display:"inline-block", margin:"10px", id:"script-editor-status-text",
});
// Label for checkbox (defined below)
const checkboxLabel = createElement("label", {
for:"script-editor-ram-check", margin:"4px", marginTop: "8px",
innerText:"Dynamic RAM Usage Checker", color:"white",
tooltip:"Enable/Disable the dynamic RAM Usage display. You may " +
"want to disable it for very long scripts because there may be " +
"performance issues",
});
// Checkbox for enabling/disabling dynamic RAM calculation
scriptEditorRamCheck = createElement("input", {
type:"checkbox", name:"script-editor-ram-check", id:"script-editor-ram-check",
margin:"4px", marginTop: "8px",
});
scriptEditorRamCheck.checked = true;
// Link to Netscript documentation
const documentationButton = createElement("a", {
class: "std-button",
@ -98,8 +82,6 @@ export function scriptEditorInit() {
wrapper.appendChild(beautifyButton);
wrapper.appendChild(closeButton);
wrapper.appendChild(scriptEditorRamText);
wrapper.appendChild(scriptEditorRamCheck);
wrapper.appendChild(checkboxLabel);
wrapper.appendChild(documentationButton);
// Initialize editors
@ -170,8 +152,8 @@ export function getCurrentEditor() {
//Updates RAM usage in script
export async function updateScriptEditorContent() {
var filename = document.getElementById("script-editor-filename").value;
if (scriptEditorRamCheck == null || !scriptEditorRamCheck.checked || !isScriptFilename(filename)) {
scriptEditorRamText.innerText = "N/A";
if (!isScriptFilename(filename)) {
scriptEditorRamText.innerText = "RAM: N/A";
return;
}

@ -18,7 +18,6 @@ import {
initBitNodeMultipliers,
} from "./BitNode/BitNode";
import { Bladeburner } from "./Bladeburner/Bladeburner";
import { process as ProcessBladeburner } from "./Bladeburner/Bladeburner";
import { CharacterOverviewComponent } from "./ui/React/CharacterOverview";
import { cinematicTextFlag } from "./CinematicText";
import { generateRandomContract } from "./CodingContractGenerator";
@ -28,8 +27,6 @@ import { CONSTANTS } from "./Constants";
import { createDevMenu, closeDevMenu } from "./DevMenu";
import { Factions, initFactions } from "./Faction/Factions";
import {
displayFactionContent,
joinFaction,
processPassiveFactionRepGain,
inviteToFaction,
} from "./Faction/FactionHelpers";
@ -111,8 +108,6 @@ import { initializeMainMenuLinks, MainMenuLinks } from "./ui/MainMenu/Links";
import { dialogBoxCreate } from "../utils/DialogBox";
import { gameOptionsBoxClose, gameOptionsBoxOpen } from "../utils/GameOptions";
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
import { createElement } from "../utils/uiHelpers/createElement";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { removeLoadingScreen } from "../utils/uiHelpers/removeLoadingScreen";
import { KEY } from "../utils/helpers/keyCodes";

@ -32,7 +32,7 @@ let gameContainer: HTMLElement;
// This variable is used to avoid setting the semi-transparent background
// several times on top of one another. Sometimes there's several popup at once.
let deepestPopupId: string = "";
let deepestPopupId = "";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export function createPopup<T>(id: string, rootComponent: (props: T) => React.ReactElement, props: T): HTMLElement | null {

@ -1,10 +1,7 @@
import { KEY } from "./helpers/keyCodes";
import { DialogBox } from "./ui/DialogBox";
import { createPopup } from "../src/ui/React/createPopup";
import { getRandomInt } from "./helpers/getRandomInt";
import React from "react";
import ReactDOM from "react-dom";
interface IProps {
content: JSX.Element;
@ -14,23 +11,23 @@ export function MessagePopup(props: IProps): React.ReactElement {
return (<>{props.content}</>);
}
function dialogBoxCreate(txt: string | JSX.Element, preformatted: boolean = false): void {
function dialogBoxCreate(txt: string | JSX.Element, preformatted = false): void {
const popupId = `popup-`+(Array.from(Array(16))).map(() => `${getRandomInt(0, 9)}`).join('');
if (typeof txt === 'string') {
if (preformatted) {
// For text files as they are often computed data that
// shouldn't be wrapped and should retain tabstops.
createPopup(popupId, MessagePopup, {
content: (<pre dangerouslySetInnerHTML={{ __html: txt }} />)
content: (<pre dangerouslySetInnerHTML={{ __html: txt }} />),
});
} else {
createPopup(popupId, MessagePopup, {
content: (<p dangerouslySetInnerHTML={{ __html: txt.replace(/(?:\r\n|\r|\n)/g, '<br />') }} />)
content: (<p dangerouslySetInnerHTML={{ __html: txt.replace(/(?:\r\n|\r|\n)/g, '<br />') }} />),
});
}
} else {
createPopup(popupId, MessagePopup, {
content: txt
content: txt,
});
}
}