Merge pull request #941 from danielyxie/dev

hotfix for some stuff
This commit is contained in:
hydroflame 2021-05-05 21:07:09 -04:00 committed by GitHub
commit ce0c3d71f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 43 additions and 38 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,11 +1,12 @@
hashGainRate() Netscript Function
==========================================
.. js:function:: hashGainRate(level, ram, core[, mult])
.. js:function:: hashGainRate(level, ramUsed, maxRam, core[, mult])
:RAM cost: 0 GB
:param number level: level of the server.
:param number ram: ram of the server.
:param number ramUsed: ram used on the server.
:param number maxRam: max ram of the server.
:param number core: cores of the server.
:returns: Money per second that a server with those stats would gain per second.
@ -18,7 +19,7 @@ hashGainRate() Netscript Function
.. code-block:: javascript
server = hacknet.getNodeStats(1);
currentRate = formulas.hacknetNodes.hashGainRate(server.level, server.ram, server.cores);
levelRate = formulas.hacknetNodes.hashGainRate(server.level+1, server.ram, server.cores);
ramRate = formulas.hacknetNodes.hashGainRate(server.level, server.ram*2, server.cores);
coresRate = formulas.hacknetNodes.hashGainRate(server.level, server.ram, server.cores+1);
currentRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram, server.cores);
levelRate = formulas.hacknetNodes.hashGainRate(server.level+1, 0, server.ram, server.cores);
ramRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram*2, server.cores);
coresRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram, server.cores+1);

@ -4,4 +4,4 @@ maxNumNodes() Netscript Function
.. js:function:: maxNumNodes()
:RAM cost: 0 GB
:returns: Maximum number of Hacknet Nodes you can own.
:returns: Maximum number of Hacknet Nodes you can own, unless you have not unlocked HackNet servers. Then, it returns Infinity.

@ -587,14 +587,14 @@
Copy Save data to Clipboard
</button>
<button id="debug-delete-scripts-link" class="a-link-button tooltip">
(DEBUG) Delete Active Scripts
Delete all active scripts
<span class="tooltiptextleft">
Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
Forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
using this, save the game and then reload the page.
</span>
</button>
<button id="debug-soft-reset" class="a-link-button tooltip">
(DEBUG) Soft Reset
Soft Reset
<span class="tooltiptextleft">
Perform a soft reset. Resets everything as if you had just purchased an Augmentation.
</span>

@ -4447,9 +4447,9 @@ function NetscriptFunctions(workerScript) {
},
},
hacknetServers: {
hashGainRate: function(level, ram, cores, mult=1) {
hashGainRate: function(level, ramUsed, maxRam, cores, mult=1) {
checkFormulasAccess("hacknetServers.hashGainRate", 9);
return HScalculateHashGainRate(level, ram, cores, mult);
return HScalculateHashGainRate(level, ramUsed, maxRam, cores, mult=1);
},
levelUpgradeCost: function(startingLevel, extraLevels=1, costMult=1) {
checkFormulasAccess("hacknetServers.levelUpgradeCost", 9);

@ -586,7 +586,8 @@ let Terminal = {
const org = currServ.organizationName
post("Organization name: " + (!isHacknet ? org : "Player"));
const admin = currServ.hasAdminRights;
post("Root Access: " + (!isHacknet ? "YES" : "NO"));
let hasAdminRights = !isHacknet && currServ.hasAdminRights || isHacknet;
post("Root Access: " + (hasAdminRights ? "YES" : "NO"));
const hackingSkill = currServ.requiredHackingSkill
post("Required hacking skill: " + (!isHacknet ? hackingSkill : "N/A"));
const security = currServ.hackDifficulty;
@ -965,7 +966,8 @@ let Terminal = {
}
const server = Player.getCurrentServer();
if(!server.scripts.some(script => script.filename.startsWith(evaledDir))) {
if(!server.scripts.some(script => script.filename.startsWith(evaledDir)) &&
!server.textFiles.some(file => file.fn.startsWith(evaledDir))) {
postError("Invalid path. Failed to change directories");
return;
}

@ -107,10 +107,10 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
{
desc: (n: number): string => {
return ["It is possible write four as a sum in exactly four different ways:\n\n",
" 3 + 1\n",
" 2 + 2\n",
" 2 + 1 + 1\n",
" 1 + 1 + 1 + 1\n\n",
"&nbsp;&nbsp;&nbsp;&nbsp;3 + 1\n",
"&nbsp;&nbsp;&nbsp;&nbsp;2 + 2\n",
"&nbsp;&nbsp;&nbsp;&nbsp;2 + 1 + 1\n",
"&nbsp;&nbsp;&nbsp;&nbsp;1 + 1 + 1 + 1\n\n",
`How many different ways can the number ${n} be written as a sum of at least`,
"two positive integers?"].join(" ");
},
@ -142,17 +142,17 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
}
d += ["\nHere is an example of what spiral order should be:",
"\nExample:",
" [\n",
" [1, 2, 3],\n",
" [4, 5, 6],\n",
" [7, 8, 9]\n",
" ] should result in [1, 2, 3, 6, 9, 8 ,7, 4, 5]\n\n",
"&nbsp;&nbsp;&nbsp;&nbsp;[\n",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[1, 2, 3],\n",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[4, 5, 6],\n",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[7, 8, 9]\n",
"&nbsp;&nbsp;&nbsp;&nbsp;] should result in [1, 2, 3, 6, 9, 8 ,7, 4, 5]\n\n",
"Note that the matrix will not always be square:\n",
" [\n",
" [1, 2, 3, 4]\n",
" [5, 6, 7, 8]\n",
" [9, 10, 11, 12]\n",
" ] should result in [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7"].join(" ");
"&nbsp;&nbsp;&nbsp;&nbsp;[\n",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[1, 2, 3, 4]\n",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[5, 6, 7, 8]\n",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[9, 10, 11, 12]\n",
"&nbsp;&nbsp;&nbsp;&nbsp;] should result in [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7"].join(" ");
return d;
},

@ -63,7 +63,7 @@ import {
scriptEditorInit,
updateScriptEditorContent,
} from "./Script/ScriptHelpers";
import { initForeignServers } from "./Server/AllServers";
import { initForeignServers, AllServers } from "./Server/AllServers";
import { Settings } from "./Settings/Settings";
import { updateSourceFileFlags } from "./SourceFile/SourceFileFlags";
import { initSpecialServerIps } from "./Server/SpecialServerIps";
@ -1542,8 +1542,10 @@ const Engine = {
// DEBUG Delete active Scripts on home
document.getElementById("debug-delete-scripts-link").addEventListener("click", function() {
Player.getHomeComputer().runningScripts = [];
dialogBoxCreate("Forcefully deleted all running scripts on home computer. Please save and refresh page");
for(const hostname of Object.keys(AllServers)) {
AllServers[hostname].runningScripts = [];
}
dialogBoxCreate("Forcefully deleted all running scripts. Please save and refresh page.");
gameOptionsBoxClose();
return false;
});

@ -600,14 +600,14 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
Copy Save data to Clipboard
</button>
<button id="debug-delete-scripts-link" class="a-link-button tooltip">
(DEBUG) Delete Active Scripts
Delete all active scripts
<span class="tooltiptextleft">
Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
Forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
using this, save the game and then reload the page.
</span>
</button>
<button id="debug-soft-reset" class="a-link-button tooltip">
(DEBUG) Soft Reset
Soft Reset
<span class="tooltiptextleft">
Perform a soft reset. Resets everything as if you had just purchased an Augmentation.
</span>

@ -42,7 +42,7 @@ export class CodingContractPopup extends React.Component<IProps, IState>{
const contractType: CodingContractType = CodingContractTypes[this.props.c.type];
let description = [];
for (const [i, value] of contractType.desc(this.props.c.data).split('\n').entries())
description.push(<span key={i}>{value}<br/></span>);
description.push(<span key={i} dangerouslySetInnerHTML={{__html: value+'<br />'}}></span>);
return (
<div>
<CopyableText value={this.props.c.type} tag={ClickableTag.Tag_h1} />