From 9f43a7208cbca685730c9d1b3c6547e30e23ac3f Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 25 Jul 2018 00:11:35 -0400 Subject: [PATCH 1/3] gave distinct fl1ght message when conditions are fulfilled --- src/Terminal.js | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/Terminal.js b/src/Terminal.js index 9054dfae6..9cfe051d5 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -1922,17 +1922,29 @@ let Terminal = { post("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10."); break; case Programs.Flight.name: - post("Augmentations: " + Player.augmentations.length + " / 30"); + const fulfilled = Player.augmentations.length >= 30 && + Player.money.gt(1e11) && + ((Player.hacking_skill >= 2500)|| + (Player.strength >= 1500 && + Player.defense >= 1500 && + Player.dexterity >= 1500 && + Player.agility >= 1500)); + if(!fulfilled) { + post("Augmentations: " + Player.augmentations.length + " / 30"); - post("Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + " / " + numeral(1e11).format('($0.000a)')); - post("One path below must be fulfilled..."); - post("----------HACKING PATH----------"); - post("Hacking skill: " + Player.hacking_skill + " / 2500"); - post("----------COMBAT PATH----------"); - post("Strength: " + Player.strength + " / 1500"); - post("Defense: " + Player.defense + " / 1500"); - post("Dexterity: " + Player.dexterity + " / 1500"); - post("Agility: " + Player.agility + " / 1500"); + post("Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + " / " + numeral(1e11).format('($0.000a)')); + post("One path below must be fulfilled..."); + post("----------HACKING PATH----------"); + post("Hacking skill: " + Player.hacking_skill + " / 2500"); + post("----------COMBAT PATH----------"); + post("Strength: " + Player.strength + " / 1500"); + post("Defense: " + Player.defense + " / 1500"); + post("Dexterity: " + Player.dexterity + " / 1500"); + post("Agility: " + Player.agility + " / 1500"); + } else { + post("We will contact you."); + post("-- Daedalus --"); + } break; case Programs.BitFlume.name: var yesBtn = yesNoBoxGetYesButton(), From a4f2c3c7a8191dcc0ba4f4f8fea2a94b50162c8b Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 25 Jul 2018 00:31:17 -0400 Subject: [PATCH 2/3] added getOwnedAugmentation function --- doc/source/netscriptsingularityfunctions.rst | 11 +++++++++++ netscript.js | 4 ++-- src/NetscriptFunctions.js | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/doc/source/netscriptsingularityfunctions.rst b/doc/source/netscriptsingularityfunctions.rst index 9d687b230..f69426158 100644 --- a/doc/source/netscriptsingularityfunctions.rst +++ b/doc/source/netscriptsingularityfunctions.rst @@ -481,6 +481,17 @@ getOwnedAugmentations This function returns an array containing the names (as strings) of all Augmentations you have. +getOwnedSourceFiles +------------------- + +..js:function:: getOwnedSourceFiles() + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + Returns an array of source files + [{n: 1, lvl: 3}, {n: 4, lvl: 3}] + + getAugmentationsFromFaction --------------------------- diff --git a/netscript.js b/netscript.js index 6b2a336c0..b0c991af0 100644 --- a/netscript.js +++ b/netscript.js @@ -82,9 +82,9 @@ let NetscriptFunctions = "getCompanyFavor|stopAction|getFactionFavor|" + "checkFactionInvitations|joinFaction|workForFaction|getFactionRep|" + "createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" + - "getAugmentationsFromFaction|" + + "getOwnedSourceFiles|getAugmentationsFromFaction|" + "getAugmentationCost|purchaseAugmentation|" + - "installAugmentations|" + + "installAugmentations|" + "getStockPrice|getStockPosition|buyStock|sellStock|shortStock|sellShort|" + "placeOrder|cancelOrder|" + //Hacknet Node API diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 4e23fdba2..873bd9812 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -3094,6 +3094,25 @@ function NetscriptFunctions(workerScript) { } return res; }, + getOwnedSourceFiles : function() { + let ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 8;} + if (workerScript.checkingRam) { + return updateStaticRam("getOwnedSourceFiles", ramCost); + } + updateDynamicRam("getOwnedSourceFiles", ramCost); + if (Player.bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 3)) { + throw makeRuntimeRejectMsg(workerScript, "Cannot run getOwnedSourceFiles(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); + return []; + } + } + let res = []; + for (let i = 0; i < Player.sourceFiles.length; ++i) { + res.push({n: Player.sourceFiles[i].n, lvl: Player.sourceFiles[i].lvl}); + } + return res; + }, getAugmentationsFromFaction : function(facname) { var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; if (Player.bitNodeN !== 4) {ramCost *= 8;} From a465db4e74bbeebe62089da9ce5015434f77b753 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 25 Jul 2018 00:56:52 -0400 Subject: [PATCH 3/3] save game now glows red if you dont have autosave enabled --- src/engine.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/engine.js b/src/engine.js index 69b01555e..0fcd56241 100644 --- a/src/engine.js +++ b/src/engine.js @@ -570,6 +570,16 @@ let Engine = { overviewText += "
Int: " + (Player.intelligence).toLocaleString(); } document.getElementById("character-overview-text").innerHTML = overviewText.replace( / /g, " "); + + + + const save = document.getElementById("character-overview-save-button"); + const flashClass = "flashing-button"; + if(!Settings.AutosaveInterval) { + save.classList.add(flashClass); + } else { + save.classList.remove(flashClass); + } }, /* Display character info */