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 {
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 {
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: {

@ -120,7 +120,7 @@ export function getCostOfNextHacknetServer() {
const numOwned = Player.hacknetNodes.length;
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;
}

@ -406,7 +406,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
<div id="game-options-left-panel">
<!-- Netscript execution time -->
<fieldset>
<label for="settingsNSExecTimeRangeVal" class="tooltip">Netscript exec time:
<label for="settingsNSExecTimeRangeVal" class="tooltip">Netscript exec time:&nbsp;
<span class="tooltiptext">
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.
@ -414,13 +414,13 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
</span>
</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>
</fieldset>
<!-- Log capacity -->
<fieldset>
<label for="settingsNSLogRangeVal" class="tooltip">Netscript log size:
<label for="settingsNSLogRangeVal" class="tooltip">Netscript log size:&nbsp;&nbsp;
<span class="tooltiptext">
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.
@ -428,13 +428,13 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
</span>
</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>
</fieldset>
<!-- Port capacity -->
<fieldset>
<label for="settingsNSPortRangeVal" class="tooltip">Netscript port size:
<label for="settingsNSPortRangeVal" class="tooltip">Netscript port size:&nbsp;
<span class="tooltiptext">
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.
@ -442,19 +442,19 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
</span>
</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>
</fieldset>
<!-- Autosave Interval -->
<fieldset>
<label for="settingsAutosaveIntervalVal" class="tooltip">Autosave Interval
<label for="settingsAutosaveIntervalVal" class="tooltip">Autosave Interval:&nbsp;&nbsp;&nbsp;
<span class="tooltiptext">
The time (in seconds) between each autosave. Set to 0 to disable autosave.
</span>
</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>
</fieldset>
@ -467,7 +467,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
and can be viewed with the 'cat' Terminal command.
</span>
</label>
<input type="checkbox" name="settingsSuppressMessages" id="settingsSuppressMessages">
<input class="optionCheckbox" type="checkbox" name="settingsSuppressMessages" id="settingsSuppressMessages">
</fieldset>
<!-- 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.
</span>
</label>
<input type="checkbox" name="settingsSuppressFactionInvites" id="settingsSuppressFactionInvites">
<input class="optionCheckbox" type="checkbox" name="settingsSuppressFactionInvites" id="settingsSuppressFactionInvites">
</fieldset>
<!-- 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.
</span>
</label>
<input type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation">
<input class="optionCheckbox" type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation">
</fieldset>
@ -499,7 +499,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
If this is set, the confirmation message before buying augmentation will not show up.
</span>
</label>
<input type="checkbox" name="settingsSuppressBuyAugmentationConfirmation" id="settingsSuppressBuyAugmentationConfirmation">
<input class="optionCheckbox" type="checkbox" name="settingsSuppressBuyAugmentationConfirmation" id="settingsSuppressBuyAugmentationConfirmation">
</fieldset>
<!-- 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.
</span>
</label>
<input type="checkbox" name="settingsSuppressHospitalizationPopup" id="settingsSuppressHospitalizationPopup">
<input class="optionCheckbox" type="checkbox" name="settingsSuppressHospitalizationPopup" id="settingsSuppressHospitalizationPopup">
</fieldset>
<!-- 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.
</span>
</label>
<input type="checkbox" name="settingsDisableHotkeys" id="settingsDisableHotkeys">
<input class="optionCheckbox" type="checkbox" name="settingsDisableHotkeys" id="settingsDisableHotkeys">
</fieldset>
<!-- Locale for displaying numbers -->

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

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