diff --git a/css/styles.css b/css/styles.css index 7928f8446..c4aa2c395 100644 --- a/css/styles.css +++ b/css/styles.css @@ -138,6 +138,11 @@ a:link, a:visited { padding: 5px; margin: 5px; border: 1px solid #333333; + + -moz-user-select: none; + -ms-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; } .a-link-button:hover { diff --git a/index.html b/index.html index 440ac9049..aa1617126 100644 --- a/index.html +++ b/index.html @@ -821,6 +821,16 @@ + +
" + mat.name + ": " + formatNumber(mat.qty, 3) + "(" + formatNumber(totalGain, 3) + "/s)" + diff --git a/src/Constants.js b/src/Constants.js index 3e9055f13..b968247fc 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -43,6 +43,7 @@ let CONSTANTS = { /* Netscript Constants */ //RAM Costs for different commands ScriptBaseRamCost: 1.4, + ScriptCheatRamCost: 1e21, // if someone tries to cheat by using window or document we just spike the ram cost. ScriptWhileRamCost: 0.2, ScriptForRamCost: 0.2, ScriptIfRamCost: 0.15, diff --git a/src/Location.js b/src/Location.js index 56a39114e..1d7fa0702 100644 --- a/src/Location.js +++ b/src/Location.js @@ -11,6 +11,7 @@ import {Player} from "./Player.js"; import {Server, AllServers, AddToAllServers} from "./Server.js"; import {purchaseServer, purchaseRamForHomeComputer} from "./ServerPurchases.js"; +import {Settings} from "./Settings.js"; import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps.js"; import {dialogBoxCreate} from "../utils/DialogBox.js"; @@ -326,9 +327,9 @@ function displayLocationContent() { repGain = repGain[0]; jobReputation.innerHTML = "Company reputation: " + formatNumber(company.playerReputation, 4) + "You will earn " + - formatNumber(repGain, 4) + + formatNumber(repGain, 0) + " faction favor upon resetting after installing an Augmentation"; - companyFavor.innerHTML = "Company Favor: " + formatNumber(company.favor, 4) + + companyFavor.innerHTML = "Company Favor: " + formatNumber(company.favor, 0) + "Company favor increases the rate at which " + "you earn reputation for this company by 1% per favor. Company favor " + "is gained whenever you reset after installing an Augmentation. The amount of " + @@ -2002,11 +2003,13 @@ function purchaseTorRouter() { AddToAllServers(darkweb); SpecialServerIps.addIp("Darkweb Server", darkweb.ip); - document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive"); + const purchaseTor = document.getElementById("location-purchase-tor"); + purchaseTor.setAttribute("class", "a-link-button-bought"); + purchaseTor.innerHTML = "TOR Router - purchased"; Player.getHomeComputer().serversOnNetwork.push(darkweb.ip); darkweb.serversOnNetwork.push(Player.getHomeComputer().ip); - dialogBoxCreate("You have purchased a Tor router!You now have access to the dark web from your home computerUse the scan/netstat commands to search for the dark web connection."); + dialogBoxCreate("You have purchased a Tor router!You now have access to the dark web from your home computerUse the scan/scan-analyze commands to search for the dark web connection."); } function displayUniversityLocationContent(costMult) { @@ -2144,6 +2147,10 @@ function setJobRequirementTooltip(loc, entryPosType, btn) { } function travelBoxCreate(destCityName, cost) { + if(Settings.SuppressTravelConfirmation) { + travelToCity(destCityName, cost); + return; + } var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton(); yesBtn.innerHTML = "Yes"; noBtn.innerHTML = "No"; diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index ff49584c2..81e58cb0b 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -833,7 +833,9 @@ function runScriptFromScript(server, scriptname, args, workerScript, threads=1) return Promise.resolve(false); } else { //Able to run script - workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + printArray(args) + ". May take a few seconds to start up..."); + if(workerScript.disableLogs.ALL == null && workerScript.disableLogs.exec == null && workerScript.disableLogs.run == null && workerScript.disableLogs.spawn == null) { + workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + printArray(args) + ". May take a few seconds to start up..."); + } var runningScriptObj = new RunningScript(script, args); runningScriptObj.threads = threads; server.runningScripts.push(runningScriptObj); //Push onto runningScripts diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 23faf4ee1..f2bfb3b0d 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -14,6 +14,7 @@ import {CONSTANTS} from "./Constants.js"; import {Programs} from "./CreateProgram.js"; import {parseDarkwebItemPrice, DarkWebItems} from "./DarkWeb.js"; import {Engine} from "./engine.js"; +import {AllGangs} from "./Gang.js"; import {Factions, Faction, joinFaction, factionExists, purchaseAugmentation} from "./Faction.js"; import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode.js"; @@ -308,8 +309,10 @@ function NetscriptFunctions(workerScript) { } return netscriptDelay(growTime, workerScript).then(function() { if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} + const moneyBefore = server.moneyAvailable; server.moneyAvailable += (1 * threads); //It can be grown even if it has no money var growthPercentage = processSingleServerGrowth(server, 450 * threads); + const moneyAfter = server.moneyAvailable; workerScript.scriptRef.recordGrow(server.ip, threads); var expGain = scriptCalculateExpGain(server) * threads; if (growthPercentage == 1) { @@ -317,7 +320,7 @@ function NetscriptFunctions(workerScript) { } if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) { workerScript.scriptRef.log("Available money on " + server.hostname + " grown by " + - formatNumber(growthPercentage*100 - 100, 6) + "%. Gained " + + formatNumber((moneyAfter/moneyBefore)*100 - 100, 6) + "%. Gained " + formatNumber(expGain, 4) + " hacking exp (t=" + threads +")"); } workerScript.scriptRef.onlineExpGained += expGain; @@ -948,6 +951,23 @@ function NetscriptFunctions(workerScript) { allFiles.sort(); return allFiles; }, + ps : function(ip=workerScript.serverIp) { + if (workerScript.checkingRam) { + return updateStaticRam("ps", CONSTANTS.ScriptScanRamCost); + } + updateDynamicRam("ps", CONSTANTS.ScriptScanRamCost); + var server = getServer(ip); + if (server == null){ + workerScript.scriptRef.log("ps() failed. Invalid IP or hostname passed in: " + ip); + throw makeRuntimeRejectMsg(workerScript, "ps() failed. Invalid IP or hostname passed in: " + ip); + } + const processes = []; + for(const i in server.runningScripts) { + const script = server.runningScripts[i]; + processes.push({filename:script.filename, threads: script.threads, args: script.args.slice()}) + } + return processes; + }, hasRootAccess : function(ip) { if (workerScript.checkingRam) { return updateStaticRam("hasRootAccess", CONSTANTS.ScriptHasRootAccessRamCost); @@ -2777,6 +2797,12 @@ function NetscriptFunctions(workerScript) { } } + // if the player is in a gang and the target faction is any of the gang faction, fail + if(Player.gang != null && AllGangs[name] !== undefined) { + workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not offer work at the moment."); + return; + } + if (inMission) { workerScript.scriptRef.log("ERROR: workForFaction() failed because you are in the middle of a mission."); return; diff --git a/src/Script.js b/src/Script.js index 8b7b1ee7f..53d03e3c4 100644 --- a/src/Script.js +++ b/src/Script.js @@ -448,6 +448,7 @@ function parseOnlyRamCalculate(server, code, workerScript) { if (ref == specialReferenceFOR) ram += CONSTANTS.ScriptForRamCost; if (ref == specialReferenceWHILE) ram += CONSTANTS.ScriptWhileRamCost; if (ref == "hacknetnodes") ram += CONSTANTS.ScriptHacknetNodesRamCost; + if (ref == "document" || ref == "window") ram += CONSTANTS.ScriptCheatRamCost; // Check if this ident is a function in the workerscript env. If it is, then we need to // get its RAM cost. We do this by calling it, which works because the running script diff --git a/src/Settings.js b/src/Settings.js index e3755e242..e8a8c4b08 100644 --- a/src/Settings.js +++ b/src/Settings.js @@ -7,6 +7,7 @@ let Settings = { MaxPortCapacity: 50, SuppressMessages: false, SuppressFactionInvites: false, + SuppressTravelConfirmation: false, AutosaveInterval: 60, DisableHotkeys: false, ThemeHighlightColor: "#ffffff", @@ -26,6 +27,7 @@ function initSettings() { Settings.MaxPortCapacity = 50; Settings.SuppressMessages = false; Settings.SuppressFactionInvites = false; + Settings.SuppressTravelConfirmation = false, Settings.AutosaveInterval = 60; Settings.DisableHotkeys = false; } @@ -36,6 +38,7 @@ function setSettingsLabels() { var nsPortLimit = document.getElementById("settingsNSPortRangeValLabel"); var suppressMsgs = document.getElementById("settingsSuppressMessages"); var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites") + var suppressTravelConfirmation = document.getElementById("settingsSuppressTravelConfirmation"); var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel"); var disableHotkeys = document.getElementById("settingsDisableHotkeys"); @@ -45,6 +48,7 @@ function setSettingsLabels() { nsPortLimit.innerHTML = Settings.MaxPortCapacity; suppressMsgs.checked = Settings.SuppressMessages; suppressFactionInv.checked = Settings.SuppressFactionInvites; + suppressTravelConfirmation.checked = Settings.suppressTravelConfirmation; autosaveInterval.innerHTML = Settings.AutosaveInterval; disableHotkeys.checked = Settings.DisableHotkeys; @@ -91,6 +95,10 @@ function setSettingsLabels() { Settings.SuppressFactionInvites = this.checked; }; + suppressTravelConfirmation.onclick = function() { + Settings.SuppressTravelConfirmation = this.checked; + }; + disableHotkeys.onclick = function() { Settings.DisableHotkeys = this.checked; }