This commit is contained in:
Olivier Gagnon 2021-05-07 21:24:16 -04:00 committed by hydroflame
parent 9a9d2e1f81
commit 6dde89f3c4
23 changed files with 76 additions and 262 deletions

@ -47,7 +47,7 @@ List of all Source-Files
+------------------------------------+-------------------------------------------------------------------------------------+
| BitNode-9: Coming Soon | |
+------------------------------------+-------------------------------------------------------------------------------------+
| BitNode-10: Digital Carbon | * Each level of this grants a Duplicate Sleeve |
| BitNode-10: Digital Carbon | * Each level of this grants a Duplicate Sleeve. |
| | * Allows the player to access the :ref:`netscript_sleeveapi` in other BitNodes |
+------------------------------------+-------------------------------------------------------------------------------------+
| BitNode-11: The Big Crash | * Company favor increases both the player's salary and reputation gain at that |

@ -323,7 +323,7 @@ Source-File
:Max Level: 3
This Source-File unlocks Sleeve technology in other BitNodes.
Each level of this Source-File also grants you a Duplicate Sleeve
Each level of this Source-File also grants you a Duplicate Sleeve.
Difficulty
Hard

@ -1,9 +1,10 @@
getServer() Netscript Function
==========================================
.. js:function:: getServer()
.. js:function:: getServer([hostname])
:RAM cost: 4 GB
:param string hostname: Hostname of the server, defaults to host server.
If you are not in BitNode-5, then you must have Source-File 5-1 in order to run this function.

@ -3,6 +3,7 @@ getData() Netscript Function
.. js:function:: getData(filename[, hostname=current hostname])
:RAM cost: 5 GB
:param string filename: Filename of the contract
:param string hostname: Hostname of the server containing the contract.
Optional. Defaults to current server if not provided

@ -20,4 +20,4 @@ growPercent() Netscript Function
.. code-block:: javascript
tprint(growPercent(getServer(), 50, getPlayer()))
tprint(formulas.basic.growPercent(getServer(), 50, getPlayer()))

@ -21,4 +21,4 @@ growTime() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(growTime(server, getPlayer()));
tprint(formulas.basic.growTime(server, getPlayer()));

@ -21,4 +21,4 @@ hackChance() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(hackChance(server, getPlayer()));
tprint(formulas.basic.hackChance(server, getPlayer()));

@ -21,4 +21,4 @@ hackExp() Netscript Function
server = getServer();
server.hackDifficulty = 99.9;
tprint(hackExp(server, getPlayer()));
tprint(formulas.basic.hackExp(server, getPlayer()));

@ -22,4 +22,4 @@ hackPercent() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(hackPercent(server, getPlayer()));
tprint(formulas.basic.hackPercent(server, getPlayer()));

@ -21,4 +21,4 @@ hackTime() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(hackTime(server, getPlayer()));
tprint(formulas.basic.hackTime(server, getPlayer()));

@ -21,4 +21,4 @@ weakenTime() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(weakenTime(server, getPlayer()));
tprint(formulas.basic.weakenTime(server, getPlayer()));

@ -44,6 +44,18 @@ export function PlayerMultipliers(): React.ReactElement {
</table>
}
function BladeburnerMults(): React.ReactElement {
if(!Player.canAccessBladeburner()) return (<></>);
return (<>
{MultiplierTable([
['Bladeburner Success Chance', Player.bladeburner_max_stamina_mult, Player.bladeburner_max_stamina_mult*mults.bladeburner_max_stamina_mult],
['Bladeburner Max Stamina', Player.bladeburner_max_stamina_mult, Player.bladeburner_max_stamina_mult*mults.bladeburner_max_stamina_mult],
['Bladeburner Stamina Gain', Player.bladeburner_max_stamina_mult, Player.bladeburner_max_stamina_mult*mults.bladeburner_max_stamina_mult],
['Bladeburner Field Analysis', Player.bladeburner_max_stamina_mult, Player.bladeburner_max_stamina_mult*mults.bladeburner_max_stamina_mult],
])}<br />
</>);
}
return (
<>
<p><strong><u>Multipliers:</u></strong></p><br />
@ -103,6 +115,8 @@ export function PlayerMultipliers(): React.ReactElement {
['Crime success ', Player.crime_success_mult, Player.crime_success_mult*mults.crime_success_mult],
['Crime money ', Player.crime_money_mult, Player.crime_money_mult*mults.crime_money_mult],
])}<br />
<BladeburnerMults />
</>
)
}

@ -221,7 +221,7 @@ BitNodes["BitNode11"] = new BitNode(11, "The Big Crash", "Okay. Sell it all.",
"The growth rate of servers is significantly reduced<br>" +
"Weakening a server is twice as effective<br>" +
"Company wages are decreased by 50%<br>" +
"Corporation valuations are 99% lower and are therefore significantly less profitable<br>" +
"Corporation valuations are 90% lower and are therefore significantly less profitable<br>" +
"Hacknet Node production is significantly decreased<br>" +
"Crime and Infiltration are more lucrative<br>" +
"Augmentations are twice as expensive<br><br>" +

@ -736,7 +736,7 @@ Bladeburner.prototype.completeAction = function() {
}
}
var logLossText = "";
if (loss > 0) {logLossText += "Lost " + formatNumber(loss, 3) + " rank.";}
if (loss > 0) {logLossText += "Lost " + formatNumber(loss, 3) + " rank. ";}
if (damage > 0) {logLossText += "Took " + formatNumber(damage, 0) + " damage.";}
if (isOperation && this.logging.ops) {
this.log(action.name + " failed! " + logLossText);

@ -62,9 +62,6 @@ export function joinFaction(faction) {
i--;
}
}
if (routing.isOn(Page.Factions)) {
Engine.loadFactionsContent();
}
}
export function startHackingMission(faction) {

@ -75,7 +75,7 @@ export class DonateOption extends React.Component<IProps, IState> {
}
handleChange(e: React.ChangeEvent<HTMLInputElement>): void {
const amt = numeralWrapper.parse(e.target.value);
const amt = numeralWrapper.parseMoney(e.target.value);
if (isNaN(amt)) {
this.setState({

@ -421,7 +421,9 @@ function processAllHacknetServerEarnings(numCycles) {
// Also, update the hash rate before processing
const hserver = AllServers[Player.hacknetNodes[i]];
hserver.updateHashRate(Player.hacknet_node_money_mult);
hashes += hserver.process(numCycles);
const h = hserver.process(numCycles);
hserver.totalHashesGenerated += h;
hashes += h;
}
Player.hashManager.storeHashes(hashes);

@ -3981,7 +3981,7 @@ function NetscriptFunctions(workerScript) {
setActionAutolevel: function(type="", name="", autoLevel=true) {
updateDynamicRam("setActionAutolevel", getRamCost("bladeburner", "setActionAutolevel"));
checkBladeburnerAccess("setActionAutolevel");
const action = getBladeburnerActionObject("getActionCurrentLevel", type, name);
const action = getBladeburnerActionObject("setActionAutolevel", type, name);
action.autoLevel = autoLevel;
},
setActionLevel: function(type="", name="", level=1) {
@ -3991,7 +3991,7 @@ function NetscriptFunctions(workerScript) {
if(level < 1 || level > action.maxLevel) {
throw makeRuntimeErrorMsg("bladeburner.setActionLevel", `Level must be between 1 and ${action.maxLevel}, is ${level}`)
}
actionObj.level = level;
action.level = level;
},
getRank: function() {
updateDynamicRam("getRank", getRamCost("bladeburner", "getRank"));

@ -178,7 +178,7 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
netscriptFns.push(name);
//Get functions from namespaces
const namespaces = ["bladeburner", "hacknet", "codingcontract", "gang", "sleeve"];
const namespaces = ["bladeburner", "hacknet", "codingcontract", "gang", "sleeve", "heart", "formulas"];
if (namespaces.includes(name)) {
let namespace = fnsObj[name];
if (typeof namespace !== "object") {continue;}
@ -189,6 +189,7 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
}
}
}
netscriptFns.sort().reverse();
CodeMirror.hint.netscript = function(editor) {
const origList = CodeMirror.hint.javascript(editor) || {from: editor.getCursor(), to: editor.getCursor(), list: []};

@ -1,5 +1,7 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
import CodeMirror from "codemirror/lib/codemirror.js";
import { NetscriptFunctions } from "../NetscriptFunctions";
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@ -26,7 +28,7 @@ CodeMirror.defineMode("netscript", function(config, parserConfig) {
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
return {
const ret = {
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
"return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C,
"debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"),
@ -40,234 +42,16 @@ CodeMirror.defineMode("netscript", function(config, parserConfig) {
// Netscript Basic Functions
"hack": atom,
"hackAnalyzeThreads": atom,
"hackAnalyzePercent": atom,
"hackChance": atom,
"sleep": atom,
"grow": atom,
"weaken": atom,
"growthAnalyze": atom,
"print": atom,
"tprint": atom,
"scan": atom,
"nuke": atom,
"brutessh": atom,
"ftpcrack": atom,
"clearLog": atom,
"disableLog": atom,
"enableLog": atom,
"isLogEnabled": atom,
"getScriptLogs": atom,
"tail": atom,
"relaysmtp": atom,
"httpworm": atom,
"sqlinject": atom,
"run": atom,
"exec": atom,
"spawn": atom,
"kill": atom,
"killall": atom,
"exit": atom,
"scp": atom,
"ls": atom,
"ps": atom,
"hasRootAccess": atom,
"getIp": atom,
"getHackingMultipliers": atom,
"getBitNodeMultipliers": atom,
"getStats": atom,
"isBusy": atom,
"getHacknetMultipliers": atom,
"getHostname": atom,
"getHackingLevel": atom,
"getServerMoneyAvailable": atom,
"getServerMaxMoney": atom,
"getServerGrowth": atom,
"getServerSecurityLevel": atom,
"getServerBaseSecurityLevel": atom,
"getServerMinSecurityLevel": atom,
"getServerRequiredHackingLevel": atom,
"getServerNumPortsRequired": atom,
"getServerRam": atom,
"serverExists": atom,
"fileExists": atom,
"isRunning": atom,
"deleteServer": atom,
"getPurchasedServers": atom,
"getPurchasedServerLimit": atom,
"getPurchasedServerMaxRam": atom,
"getPurchasedServerCost": atom,
"purchaseServer": atom,
"round": atom,
"write": atom,
"tryWrite": atom,
"read": atom,
"peek": atom,
"clear": atom,
"rm": atom,
"getPortHandle": atom,
"scriptRunning": atom,
"scriptKill": atom,
"getScriptName": atom,
"getScriptRam": atom,
"getHackTime": atom,
"getGrowTime": atom,
"getWeakenTime": atom,
"getScriptIncome": atom,
"getScriptExpGain": atom,
"getTimeSinceLastAug": atom,
"prompt": atom,
// Netscript Singularity Functions
"universityCourse": atom,
"getCharacterInformation": atom,
"gymWorkout": atom,
"travelToCity": atom,
"purchaseTor": atom,
"purchaseProgram": atom,
"upgradeHomeRam": atom,
"getUpgradeHomeRamCost": atom,
"workForCompany": atom,
"applyToCompany": atom,
"getCompanyRep": atom,
"getCompanyFavor": atom,
"stopAction": atom,
"getFactionFavor": atom,
"getFavorToDonate": atom,
"getFactionFavorGain": atom,
"getCompanyFavorGain": atom,
"checkFactionInvitations": atom,
"joinFaction": atom,
"workForFaction": atom,
"getFactionRep": atom,
"donateToFaction": atom,
"createProgram": atom,
"commitCrime": atom,
"getCrimeChance": atom,
"getOwnedAugmentations": atom,
"getOwnedSourceFiles": atom,
"getAugmentationsFromFaction": atom,
"getAugmentationPrereq": atom,
"getAugmentationCost": atom,
"purchaseAugmentation": atom,
"installAugmentations": atom,
// Netscript TIX API
"getStockPrice": atom,
"getStockAskPrice": atom,
"getStockBidPrice": atom,
"getStockPosition": atom,
"getStockSymbols": atom,
"getStockMaxShares": atom,
"getStockPurchaseCost": atom,
"getStockSaleGain": atom,
"buyStock": atom,
"sellStock": atom,
"shortStock": atom,
"sellShort": atom,
"placeOrder": atom,
"cancelOrder": atom,
"getOrders": atom,
"getStockVolatility": atom,
"getStockForecast": atom,
"purchase4SMarketData": atom,
"purchase4SMarketDataTixApi": atom,
// Netscript Hacknet Node API
"hacknet": atom,
"numNodes": atom,
"purchaseNode": atom,
"getPurchaseNodeCost": atom,
"getNodeStats": atom,
"upgradeLevel": atom,
"upgradeRam": atom,
"upgradeCore": atom,
"upgradeCache": atom,
"getLevelUpgradeCost": atom,
"getRamUpgradeCost": atom,
"getCoreUpgradeCost": atom,
"getCacheUpgradeCost": atom,
// Netscript Gang API
"gang": atom,
"getMemberNames": atom,
"getGangInformation": atom,
"getMemberInformation": atom,
"canRecruitMember": atom,
"recruitMember": atom,
"getTaskNames": atom,
"setMemberTask": atom,
"getEquipmentNames": atom,
"getEquipmentCost": atom,
"getEquipmentType": atom,
"purchaseEquipment": atom,
"ascendMember": atom,
"setTerritoryWarfare": atom,
"getChanceToWinClash": atom,
"getBonusTime": atom,
// Netscript Bladeburner API
"bladeburner": atom,
"getContractNames": atom,
"getOperationNames": atom,
"getBlackOpNames": atom,
"getGeneralActionNames": atom,
"getSkillNames": atom,
"startAction": atom,
"stopBladeburnerAction": atom,
"getCurrentAction": atom,
"getActionTime": atom,
"getActionEstimatedSuccessChance": atom,
"getActionCountRemaining": atom,
"getActionMaxLevel": atom,
"getActionCurrentLevel": atom,
"getActionAutolevel": atom,
"getActionRepGain": atom,
"setActionAutolevel": atom,
"setActionLevel": atom,
"getRank": atom,
"getBlackOpRank": atom,
"getSkillPoints": atom,
"getSkillLevel": atom,
"getSkillUpgradeCost": atom,
"upgradeSkill": atom,
"getTeamSize": atom,
"getCity": atom,
"setTeamSize": atom,
"getCityEstimatedPopulation": atom,
"getCityEstimatedCommunities": atom,
"getCityChaos": atom,
"switchCity": atom,
"getStamina": atom,
"joinBladeburnerFaction": atom,
// Repeat of above "getBonusTime": atom,
// Netscript Coding Contract API
"codingcontract": atom,
"attempt": atom,
"getContractType": atom,
"getData": atom,
"getDescription": atom,
"getNumTriesRemaining": atom,
// Sleeve API
"sleeve": atom,
"getNumSleeves": atom,
"setToShockRecovery": atom,
"setToSynchronize": atom,
"setToCommitCrime": atom,
"setToUniversityCourse": atom,
"travel": atom,
"setToCompanyWork": atom,
"setToFactionWork": atom,
"setToGymWorkout": atom,
"getSleeveStats": atom,
"getTask": atom,
"getInformation": atom,
"getSleeveAugmentations": atom,
"getSleevePurchasableAugs": atom,
"purchaseSleeveAug": atom,
};
function push(obj) {
for(const key of Object.keys(obj)) {
if(typeof obj[key] === 'function') ret[key] = atom;
if(typeof obj[key] === 'object') push(obj[key]);
}
}
push(NetscriptFunctions(null));
return ret;
}());
var isOperatorChar = /[+\-*&%=<>!?|~^@]/;

@ -108,6 +108,18 @@ export function CharacterInfo(p: IPlayer): React.ReactElement {
</>
}
function BladeburnerMults(): React.ReactElement {
if(!p.canAccessBladeburner()) return (<></>);
return (<>
<MultiplierTable rows={[
['Bladeburner Success Chance', p.bladeburner_max_stamina_mult],
['Bladeburner Max Stamina', p.bladeburner_stamina_gain_mult],
['Bladeburner Stamina Gain', p.bladeburner_analysis_mult],
['Bladeburner Field Analysis', p.bladeburner_success_chance_mult],
]} /><br />
</>);
}
function CurrentBitNode(): React.ReactElement {
if(p.sourceFiles.length > 0) {
@ -233,7 +245,9 @@ export function CharacterInfo(p: IPlayer): React.ReactElement {
<MultiplierTable rows={[
['Crime success', p.crime_success_mult],
['Crime money', p.crime_money_mult, p.crime_money_mult*BitNodeMultipliers.CrimeMoney],
]} /><br /><br />
]} /><br />
<BladeburnerMults /><br />
<b>Misc.</b><br /><br />
<span>{`Servers owned: ${p.purchasedServers.length} / ${getPurchaseServerLimit()}`}</span><br />

@ -139,7 +139,7 @@ class NumeralFormatter {
return this.format(n, "0,0");
}
parse(s: string): number {
parseMoney(s: string): number {
// numeral library does not handle formats like 1e10 well (returns 110),
// so if both return a valid number, return the biggest one
const numeralValue = numeral(s).value();

@ -1,6 +1,6 @@
import { dialogBoxCreate } from "./DialogBox";
import { clearEventListeners } from "./uiHelpers/clearEventListeners";
import { formatNumber } from "./StringHelperFunctions";
import { numeralWrapper } from "../src/ui/numeralFormat";
import { BitNodeMultipliers } from "../src/BitNode/BitNodeMultipliers";
import { CONSTANTS } from "../src/Constants";
@ -38,12 +38,12 @@ function infiltrationBoxCreate(inst) {
Player.gainIntelligenceExp(inst.calcGainedIntelligenceExp());
const expGainText = ["You gained:",
`${formatNumber(inst.calcGainedHackingExp(), 3)} hacking exp`,
`${formatNumber(inst.calcGainedStrengthExp(), 3)} str exp`,
`${formatNumber(inst.calcGainedDefenseExp(), 3)} def exp`,
`${formatNumber(inst.calcGainedDexterityExp(), 3)} dex exp`,
`${formatNumber(inst.calcGainedAgilityExp(), 3)} agi exp`,
`${formatNumber(inst.calcGainedCharismaExp(), 3)} cha exp`].join("\n");
`${numeralWrapper.formatExp(inst.calcGainedHackingExp(), 3)} hacking exp`,
`${numeralWrapper.formatExp(inst.calcGainedStrengthExp(), 3)} str exp`,
`${numeralWrapper.formatExp(inst.calcGainedDefenseExp(), 3)} def exp`,
`${numeralWrapper.formatExp(inst.calcGainedDexterityExp(), 3)} dex exp`,
`${numeralWrapper.formatExp(inst.calcGainedAgilityExp(), 3)} agi exp`,
`${numeralWrapper.formatExp(inst.calcGainedCharismaExp(), 3)} cha exp`].join("\n");
var totalValue = 0;
for (var i = 0; i < inst.secretsStolen.length; ++i) {
@ -58,9 +58,9 @@ function infiltrationBoxCreate(inst) {
CONSTANTS.InfiltrationRepValue * BitNodeMultipliers.InfiltrationRep;
var moneyValue = totalValue * CONSTANTS.InfiltrationMoneyValue * BitNodeMultipliers.InfiltrationMoney;
infiltrationSetText("You can sell the classified documents and secrets " +
"you stole from " + inst.companyName + " for <span class='money-gold'>$" +
formatNumber(moneyValue, 2) + "</span> on the black market or you can give it " +
"to a faction to gain <span class='light-yellow'>" + formatNumber(facValue, 3) + " reputation</span> with " +
"you stole from " + inst.companyName + " for <span class='money-gold'>" +
numeralWrapper.formatMoney(moneyValue) + "</span> on the black market or you can give it " +
"to a faction to gain <span class='light-yellow'>" + numeralWrapper.formatReputation(facValue) + " reputation</span> with " +
"that faction.");
var selector = document.getElementById("infiltration-faction-select");
selector.innerHTML = "";
@ -88,7 +88,7 @@ function infiltrationBoxCreate(inst) {
Player.gainMoney(moneyValue);
Player.recordMoneySource(moneyValue, "infiltration");
dialogBoxCreate("You sold the classified information you stole from " + inst.companyName +
" for <span class='money-gold'>$" + formatNumber(moneyValue, 2) + "</span> on the black market!<br><br>" +
" for <span class='money-gold'>" + numeralWrapper.formatMoney(moneyValue) + "</span> on the black market!<br><br>" +
expGainText);
infiltrationBoxClose();
return false;
@ -108,7 +108,7 @@ function infiltrationBoxCreate(inst) {
}
faction.playerReputation += facValue;
dialogBoxCreate("You gave the classified information you stole from " + inst.companyName +
" to " + facName + " and gained <span class='light-yellow'>" + formatNumber(facValue, 3) + " reputation</span> with the faction. <br><br>" +
" to " + facName + " and gained <span class='light-yellow'>" + numeralWrapper.formatReputation(facValue) + " reputation</span> with the faction. <br><br>" +
expGainText);
infiltrationBoxClose();
return false;