Removed CharacterInfo maximum hacknet, styling in the options, comments in exploits

This commit is contained in:
Olivier Gagnon 2021-03-09 23:22:05 -05:00
parent 250841df66
commit af584e8c87
6 changed files with 90 additions and 36 deletions

@ -359,3 +359,38 @@ a:visited {
.smallfont { .smallfont {
font-size: $defaultFontSize * 0.8125; font-size: $defaultFontSize * 0.8125;
} }
.optionCheckbox {
filter: invert(100%) hue-rotate(0deg) brightness(1.7);
margin: 5px;
float: right;
}
.optionRange {
-webkit-appearance: none;
background: #777;
outline: none;
opacity: 0.7;
height: 10px;
-webkit-transition: .2s;
transition: opacity .2s;
margin: 3px;
}
.optionRange::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 10px;
height: 10px;
background: var(--my-font-color);
cursor: pointer;
}
.optionRange::-moz-range-thumb {
width: 10px;
height: 10px;
background: var(--my-font-color);
cursor: pointer;
}

@ -1,10 +1,22 @@
/* /*
The game cannot block every possible exploits. Specially since one of them is
that you can just edit your save file and that's impragmatic to prevent.
So instead we have source file minus 1. It is not obtained by destroying a
BitNode but instead it is awarded when the player finds innovative ways to break
the game, this serves 2 purpose, [one] the developpers don't have to spend time
trying to implement anti-cheat measures and [two] finding ways to break a
hacking game is very much in the spirit of the game.
Source-File minus 1 is extremely weak because it can be fully level up quickly.
*/ */
export enum Exploit { export enum Exploit {
UndocumentedFunctionCall = 'UndocumentedFunctionCall', UndocumentedFunctionCall = 'UndocumentedFunctionCall',
EditSaveFile = 'EditSaveFile', PrototypeTampering = 'PrototypeTampering',
PrototypeTampering = 'PrototypeTampering' // To the players reading this. Yes you're supposed to add EditSaveFile by
// editing your save file, yes you could add them all, no we don't care
// that's not the point
EditSaveFile = 'EditSaveFile'
} }
const names: { const names: {

@ -120,7 +120,7 @@ export function getCostOfNextHacknetServer() {
const numOwned = Player.hacknetNodes.length; const numOwned = Player.hacknetNodes.length;
const mult = HacknetServerPurchaseMult; const mult = HacknetServerPurchaseMult;
if (numOwned > MaxNumberHacknetServers) { return Infinity; } if (numOwned >= MaxNumberHacknetServers) { return Infinity; }
return BaseCostForHacknetServer * Math.pow(mult, numOwned) * Player.hacknet_node_purchase_cost_mult; return BaseCostForHacknetServer * Math.pow(mult, numOwned) * Player.hacknet_node_purchase_cost_mult;
} }

@ -406,7 +406,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
<div id="game-options-left-panel"> <div id="game-options-left-panel">
<!-- Netscript execution time --> <!-- Netscript execution time -->
<fieldset> <fieldset>
<label for="settingsNSExecTimeRangeVal" class="tooltip">Netscript exec time: <label for="settingsNSExecTimeRangeVal" class="tooltip">Netscript exec time:&nbsp;
<span class="tooltiptext"> <span class="tooltiptext">
The minimum number of milliseconds it takes to execute an operation in Netscript. The minimum number of milliseconds it takes to execute an operation in Netscript.
Setting this too low can result in poor performance if you have many scripts running. Setting this too low can result in poor performance if you have many scripts running.
@ -414,13 +414,13 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
</span> </span>
</label> </label>
<input type ="range" max="100" min="10" step="1" name="settingsNSExecTimeRangeVal" id="settingsNSExecTimeRangeVal" value="25" /> <input class="optionRange" type="range" max="100" min="10" step="1" name="settingsNSExecTimeRangeVal" id="settingsNSExecTimeRangeVal" value="25" />
<em id="settingsNSExecTimeRangeValLabel" style="font-style: normal;"></em> <em id="settingsNSExecTimeRangeValLabel" style="font-style: normal;"></em>
</fieldset> </fieldset>
<!-- Log capacity --> <!-- Log capacity -->
<fieldset> <fieldset>
<label for="settingsNSLogRangeVal" class="tooltip">Netscript log size: <label for="settingsNSLogRangeVal" class="tooltip">Netscript log size:&nbsp;&nbsp;
<span class="tooltiptext"> <span class="tooltiptext">
The maximum number of lines a script's logs can hold. Setting this too high The maximum number of lines a script's logs can hold. Setting this too high
can cause the game to use a lot of memory if you have many scripts running. can cause the game to use a lot of memory if you have many scripts running.
@ -428,13 +428,13 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
</span> </span>
</label> </label>
<input type="range" max="100" min="20" step="1" name="settingsNSLogRangeVal" id="settingsNSLogRangeVal" value="50" /> <input class="optionRange" type="range" max="100" min="20" step="1" name="settingsNSLogRangeVal" id="settingsNSLogRangeVal" value="50" />
<em id="settingsNSLogRangeValLabel" style="font-style: normal;"></em> <em id="settingsNSLogRangeValLabel" style="font-style: normal;"></em>
</fieldset> </fieldset>
<!-- Port capacity --> <!-- Port capacity -->
<fieldset> <fieldset>
<label for="settingsNSPortRangeVal" class="tooltip">Netscript port size: <label for="settingsNSPortRangeVal" class="tooltip">Netscript port size:&nbsp;
<span class="tooltiptext"> <span class="tooltiptext">
The maximum number of entries that can be written to a port using Netscript's The maximum number of entries that can be written to a port using Netscript's
write() function. Setting this too high can cause the game to use a lot of memory. write() function. Setting this too high can cause the game to use a lot of memory.
@ -442,19 +442,19 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
</span> </span>
</label> </label>
<input type="range" max="100" min="20" step="1" name="settingsNSPortRangeVal" id="settingsNSPortRangeVal" value="50" /> <input class="optionRange" type="range" max="100" min="20" step="1" name="settingsNSPortRangeVal" id="settingsNSPortRangeVal" value="50" />
<em id="settingsNSPortRangeValLabel" style="font-style: normal;"></em> <em id="settingsNSPortRangeValLabel" style="font-style: normal;"></em>
</fieldset> </fieldset>
<!-- Autosave Interval --> <!-- Autosave Interval -->
<fieldset> <fieldset>
<label for="settingsAutosaveIntervalVal" class="tooltip">Autosave Interval <label for="settingsAutosaveIntervalVal" class="tooltip">Autosave Interval:&nbsp;&nbsp;&nbsp;
<span class="tooltiptext"> <span class="tooltiptext">
The time (in seconds) between each autosave. Set to 0 to disable autosave. The time (in seconds) between each autosave. Set to 0 to disable autosave.
</span> </span>
</label> </label>
<input type="range" max="600" min="0" step="1" name="settingsAutosaveIntervalVal" id="settingsAutosaveIntervalVal" value="60" /> <input class="optionRange" type="range" max="600" min="0" step="1" name="settingsAutosaveIntervalVal" id="settingsAutosaveIntervalVal" value="60" />
<em id="settingsAutosaveIntervalValLabel" style="font-style: normal;"></em> <em id="settingsAutosaveIntervalValLabel" style="font-style: normal;"></em>
</fieldset> </fieldset>
@ -467,7 +467,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
and can be viewed with the 'cat' Terminal command. and can be viewed with the 'cat' Terminal command.
</span> </span>
</label> </label>
<input type="checkbox" name="settingsSuppressMessages" id="settingsSuppressMessages"> <input class="optionCheckbox" type="checkbox" name="settingsSuppressMessages" id="settingsSuppressMessages">
</fieldset> </fieldset>
<!-- Suppress faction invites --> <!-- Suppress faction invites -->
@ -478,7 +478,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
on the screen. Your outstanding faction invites can be viewed in the 'Factions' page. on the screen. Your outstanding faction invites can be viewed in the 'Factions' page.
</span> </span>
</label> </label>
<input type="checkbox" name="settingsSuppressFactionInvites" id="settingsSuppressFactionInvites"> <input class="optionCheckbox" type="checkbox" name="settingsSuppressFactionInvites" id="settingsSuppressFactionInvites">
</fieldset> </fieldset>
<!-- Suppress travel confirmation --> <!-- Suppress travel confirmation -->
@ -488,7 +488,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
If this is set, the confirmation message before traveling will not show up. You will automatically be deducted the travel cost as soon as you click. If this is set, the confirmation message before traveling will not show up. You will automatically be deducted the travel cost as soon as you click.
</span> </span>
</label> </label>
<input type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation"> <input class="optionCheckbox" type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation">
</fieldset> </fieldset>
@ -499,7 +499,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
If this is set, the confirmation message before buying augmentation will not show up. If this is set, the confirmation message before buying augmentation will not show up.
</span> </span>
</label> </label>
<input type="checkbox" name="settingsSuppressBuyAugmentationConfirmation" id="settingsSuppressBuyAugmentationConfirmation"> <input class="optionCheckbox" type="checkbox" name="settingsSuppressBuyAugmentationConfirmation" id="settingsSuppressBuyAugmentationConfirmation">
</fieldset> </fieldset>
<!-- Hospitalization Popup --> <!-- Hospitalization Popup -->
@ -509,7 +509,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
If this is set, a popup message will no longer be shown when you are hospitalized after taking too much damage. If this is set, a popup message will no longer be shown when you are hospitalized after taking too much damage.
</span> </span>
</label> </label>
<input type="checkbox" name="settingsSuppressHospitalizationPopup" id="settingsSuppressHospitalizationPopup"> <input class="optionCheckbox" type="checkbox" name="settingsSuppressHospitalizationPopup" id="settingsSuppressHospitalizationPopup">
</fieldset> </fieldset>
<!-- Disable Terminal and Navigation Shortcuts --> <!-- Disable Terminal and Navigation Shortcuts -->
@ -521,7 +521,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
and the "Save and Close (Ctrl + b)" hotkey in the Text Editor. and the "Save and Close (Ctrl + b)" hotkey in the Text Editor.
</span> </span>
</label> </label>
<input type="checkbox" name="settingsDisableHotkeys" id="settingsDisableHotkeys"> <input class="optionCheckbox" type="checkbox" name="settingsDisableHotkeys" id="settingsDisableHotkeys">
</fieldset> </fieldset>
<!-- Locale for displaying numbers --> <!-- Locale for displaying numbers -->

@ -11,7 +11,6 @@ import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
import { getPurchaseServerLimit } from "../Server/ServerPurchases"; import { getPurchaseServerLimit } from "../Server/ServerPurchases";
import { MaxNumberHacknetServers } from "../Hacknet/HacknetServer"; import { MaxNumberHacknetServers } from "../Hacknet/HacknetServer";
export function CharacterInfo(p: IPlayer): React.ReactElement { export function CharacterInfo(p: IPlayer): React.ReactElement {
function LastEmployer(): React.ReactElement { function LastEmployer(): React.ReactElement {
if (p.companyName) { if (p.companyName) {
@ -225,7 +224,7 @@ export function CharacterInfo(p: IPlayer): React.ReactElement {
<b>Misc.</b><br /><br /> <b>Misc.</b><br /><br />
<span>Servers owned: {p.purchasedServers.length} / {getPurchaseServerLimit()}</span><br /> <span>Servers owned: {p.purchasedServers.length} / {getPurchaseServerLimit()}</span><br />
<span>Hacknet Nodes owned: {p.hacknetNodes.length} / {MaxNumberHacknetServers}</span><br /> <span>Hacknet Nodes owned: {p.hacknetNodes.length}</span><br />
<span>Augmentations installed: {p.augmentations.length}</span><br /> <span>Augmentations installed: {p.augmentations.length}</span><br />
<span>Time played since last Augmentation: {convertTimeMsToTimeElapsedString(p.playtimeSinceLastAug)}</span><br /> <span>Time played since last Augmentation: {convertTimeMsToTimeElapsedString(p.playtimeSinceLastAug)}</span><br />
<BitNodeTimeText /> <BitNodeTimeText />

@ -5,17 +5,25 @@ import {numeralWrapper} from "./numeralFormat";
function setSettingsLabels() { function setSettingsLabels() {
var nsExecTime = document.getElementById("settingsNSExecTimeRangeValLabel"); function setAutosaveLabel(elem) {
var nsLogLimit = document.getElementById("settingsNSLogRangeValLabel"); if(Settings.AutosaveInterval === 0) {
var nsPortLimit = document.getElementById("settingsNSPortRangeValLabel"); elem.innerHTML = `disabled`;
var suppressMsgs = document.getElementById("settingsSuppressMessages"); } else {
var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites") elem.innerHTML = `every ${Settings.AutosaveInterval}s`;
var suppressTravelConfirmation = document.getElementById("settingsSuppressTravelConfirmation"); }
var suppressBuyAugmentationConfirmation = document.getElementById("settingsSuppressBuyAugmentationConfirmation"); }
var suppressHospitalizationPopup = document.getElementById("settingsSuppressHospitalizationPopup");
var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel"); const nsExecTime = document.getElementById("settingsNSExecTimeRangeValLabel");
var disableHotkeys = document.getElementById("settingsDisableHotkeys"); const nsLogLimit = document.getElementById("settingsNSLogRangeValLabel");
var locale = document.getElementById("settingsLocale"); const nsPortLimit = document.getElementById("settingsNSPortRangeValLabel");
const suppressMsgs = document.getElementById("settingsSuppressMessages");
const suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
const suppressTravelConfirmation = document.getElementById("settingsSuppressTravelConfirmation");
const suppressBuyAugmentationConfirmation = document.getElementById("settingsSuppressBuyAugmentationConfirmation");
const suppressHospitalizationPopup = document.getElementById("settingsSuppressHospitalizationPopup");
const autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel");
const disableHotkeys = document.getElementById("settingsDisableHotkeys");
const locale = document.getElementById("settingsLocale");
//Initialize values on labels //Initialize values on labels
nsExecTime.innerHTML = Settings.CodeInstructionRunTime + "ms"; nsExecTime.innerHTML = Settings.CodeInstructionRunTime + "ms";
@ -26,16 +34,16 @@ function setSettingsLabels() {
suppressTravelConfirmation.checked = Settings.SuppressTravelConfirmation; suppressTravelConfirmation.checked = Settings.SuppressTravelConfirmation;
suppressBuyAugmentationConfirmation.checked = Settings.SuppressBuyAugmentationConfirmation; suppressBuyAugmentationConfirmation.checked = Settings.SuppressBuyAugmentationConfirmation;
suppressHospitalizationPopup.checked = Settings.SuppressHospitalizationPopup; suppressHospitalizationPopup.checked = Settings.SuppressHospitalizationPopup;
autosaveInterval.innerHTML = Settings.AutosaveInterval; setAutosaveLabel(autosaveInterval);
disableHotkeys.checked = Settings.DisableHotkeys; disableHotkeys.checked = Settings.DisableHotkeys;
locale.value = Settings.Locale; locale.value = Settings.Locale;
numeralWrapper.updateLocale(Settings.Locale); //Initialize locale numeralWrapper.updateLocale(Settings.Locale); //Initialize locale
//Set handlers for when input changes for sliders //Set handlers for when input changes for sliders
var nsExecTimeInput = document.getElementById("settingsNSExecTimeRangeVal"); const nsExecTimeInput = document.getElementById("settingsNSExecTimeRangeVal");
var nsLogRangeInput = document.getElementById("settingsNSLogRangeVal"); const nsLogRangeInput = document.getElementById("settingsNSLogRangeVal");
var nsPortRangeInput = document.getElementById("settingsNSPortRangeVal"); const nsPortRangeInput = document.getElementById("settingsNSPortRangeVal");
var nsAutosaveIntervalInput = document.getElementById("settingsAutosaveIntervalVal"); const nsAutosaveIntervalInput = document.getElementById("settingsAutosaveIntervalVal");
nsExecTimeInput.value = Settings.CodeInstructionRunTime; nsExecTimeInput.value = Settings.CodeInstructionRunTime;
nsLogRangeInput.value = Settings.MaxLogCapacity; nsLogRangeInput.value = Settings.MaxLogCapacity;
nsPortRangeInput.value = Settings.MaxPortCapacity; nsPortRangeInput.value = Settings.MaxPortCapacity;
@ -57,8 +65,8 @@ function setSettingsLabels() {
}; };
nsAutosaveIntervalInput.oninput = function() { nsAutosaveIntervalInput.oninput = function() {
autosaveInterval.innerHTML = this.value;
Settings.AutosaveInterval = Number(this.value); Settings.AutosaveInterval = Number(this.value);
setAutosaveLabel(autosaveInterval)
if (Number(this.value) === 0) { if (Number(this.value) === 0) {
Engine.Counters.autoSaveCounter = Infinity; Engine.Counters.autoSaveCounter = Infinity;
} else { } else {