mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-23 16:13:49 +01:00
52a80ad236
* Make command `cd` without arguments an alias for `cd /` (#853) In most shells `cd` without arguments takes you to the home directory of the current user. I keep trying to do this due to muscle memory from working in terminals, so I figured I'd make it do something useful. There is no home directory in the game, but going to / is the closest thing we have, since that is the starting point for the user in the game. * Add new `backdoor` terminal command (#852) * Add the backdoor command to the terminal This command will perform a manual hack without rewarding money. It will be used for the story, mainly for faction hacking tests * Add tab completion for backdoor command * Add help text for backdoor command * Change condition syntax to be more consistent with others * Extract reused code block so it is always called after actions * Update documentation for new backdoor command Modified references to manual hack as it isn't for factions anymore * Remove extra parenthesis * Rename manuallyHacked to backdoorInstalled * Fix typo * Change faction test messages to use backdoor instad of hack * Rename more instances of manuallyHacked * fixed typo in helptext of darkweb buy (#858) * Fix typos and unify descriptions of augmentations (#859) Made an attempt to... - give all "+rep% company/faction" the same text - make all augmentations with a single effect use a single line to describe the effect - make all effects end with a period * Made Cashroot starter kit display its tooltip with the money formatted properly and in gold * fix typo in docs (#860) * Initial code for Casino Card Deck implementation * Casino Blackjack Implementation * Update some tools (eslint, typescript) * Blackjack code cleanup * Update README_contribution * Update ScriptHelpers.js (#861) expand error message * More augmentation typo fixes (#862) * Add Netscript function getCurrentScript (#856) Add netscript function that returns the current script. * Added milestones menu to guide new players. (#865) Milestone menu * fix typos in milestones (#866) Co-authored-by: sschmidTU <s.schmid@phonicscore.com> * Corrupt location title when backdoor is installed (#864) * Add corruptableText component * Corrupt location title if backdoor is installed * Formatting * Add helper to check value of backdoorInstalled Helper could be oneline but it would make it less readable * Fix some formatting * Add settings option to disable text effects * Import useState * getRunningScript (#867) * Replaced getCurrentScript with getRunningScript * Bunch of smaller fixes (#904) Fix #884 Fix #879 Fix #878 Fix #876 Fix #874 Fix #873 Fix #887 Fix #891 Fix #895 * rework the early servers to be more noob friendly (#903) * v0.51.6 Co-authored-by: Andreas Eriksson <2691182+AndreasTPC@users.noreply.github.com> Co-authored-by: Jack <jackdewinter1@gmail.com> Co-authored-by: Teun Pronk <5228255+Crownie88@users.noreply.github.com> Co-authored-by: Pimvgd <Pimvgd@gmail.com> Co-authored-by: Daniel Xie <daniel.xie@flockfreight.com> Co-authored-by: Simon <33069673+sschmidTU@users.noreply.github.com> Co-authored-by: sschmidTU <s.schmid@phonicscore.com>
129 lines
5.1 KiB
JavaScript
129 lines
5.1 KiB
JavaScript
import {Engine} from "../engine";
|
|
import {Settings} from "../Settings/Settings";
|
|
|
|
import {numeralWrapper} from "./numeralFormat";
|
|
|
|
|
|
function setSettingsLabels() {
|
|
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 disableASCIIArt = document.getElementById("settingsDisableASCIIArt");
|
|
const disableTextEffects = document.getElementById("settingsDisableTextEffects");
|
|
const locale = document.getElementById("settingsLocale");
|
|
|
|
//Initialize values on labels
|
|
nsExecTime.innerHTML = Settings.CodeInstructionRunTime + "ms";
|
|
nsLogLimit.innerHTML = Settings.MaxLogCapacity;
|
|
nsPortLimit.innerHTML = Settings.MaxPortCapacity;
|
|
suppressMsgs.checked = Settings.SuppressMessages;
|
|
suppressFactionInv.checked = Settings.SuppressFactionInvites;
|
|
suppressTravelConfirmation.checked = Settings.SuppressTravelConfirmation;
|
|
suppressBuyAugmentationConfirmation.checked = Settings.SuppressBuyAugmentationConfirmation;
|
|
suppressHospitalizationPopup.checked = Settings.SuppressHospitalizationPopup;
|
|
setAutosaveLabel(autosaveInterval);
|
|
disableHotkeys.checked = Settings.DisableHotkeys;
|
|
disableASCIIArt.checked = Settings.CityListView;
|
|
disableTextEffects.checked = Settings.DisableTextEffects;
|
|
locale.value = Settings.Locale;
|
|
numeralWrapper.updateLocale(Settings.Locale); //Initialize locale
|
|
|
|
//Set handlers for when input changes for sliders
|
|
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;
|
|
nsAutosaveIntervalInput.value = Settings.AutosaveInterval;
|
|
|
|
nsExecTimeInput.oninput = function() {
|
|
nsExecTime.innerHTML = this.value + 'ms';
|
|
Settings.CodeInstructionRunTime = this.value;
|
|
};
|
|
|
|
nsLogRangeInput.oninput = function() {
|
|
nsLogLimit.innerHTML = this.value;
|
|
Settings.MaxLogCapacity = this.value;
|
|
};
|
|
|
|
nsPortRangeInput.oninput = function() {
|
|
nsPortLimit.innerHTML = this.value;
|
|
Settings.MaxPortCapacity = this.value;
|
|
};
|
|
|
|
nsAutosaveIntervalInput.oninput = function() {
|
|
Settings.AutosaveInterval = Number(this.value);
|
|
setAutosaveLabel(autosaveInterval)
|
|
if (Number(this.value) === 0) {
|
|
Engine.Counters.autoSaveCounter = Infinity;
|
|
} else {
|
|
Engine.Counters.autoSaveCounter = Number(this.value) * 5;
|
|
}
|
|
};
|
|
|
|
//Set handlers for when settings change on checkboxes
|
|
suppressMsgs.onclick = function() {
|
|
Settings.SuppressMessages = this.checked;
|
|
};
|
|
|
|
suppressFactionInv.onclick = function() {
|
|
Settings.SuppressFactionInvites = this.checked;
|
|
};
|
|
|
|
suppressTravelConfirmation.onclick = function() {
|
|
Settings.SuppressTravelConfirmation = this.checked;
|
|
};
|
|
|
|
suppressBuyAugmentationConfirmation.onclick = function() {
|
|
Settings.SuppressBuyAugmentationConfirmation = this.checked;
|
|
};
|
|
|
|
suppressHospitalizationPopup.onclick = function() {
|
|
Settings.SuppressHospitalizationPopup = this.checked;
|
|
}
|
|
|
|
disableHotkeys.onclick = function() {
|
|
Settings.DisableHotkeys = this.checked;
|
|
}
|
|
|
|
disableASCIIArt.onclick = function() {
|
|
Settings.DisableASCIIArt = this.checked;
|
|
}
|
|
|
|
disableTextEffects.onclick = function() {
|
|
Settings.DisableTextEffects = this.checked;
|
|
}
|
|
|
|
//Locale selector
|
|
locale.onchange = function() {
|
|
if (!numeralWrapper.updateLocale(locale.value)) {
|
|
console.warn(`Invalid locale for numeral: ${locale.value}`);
|
|
|
|
let defaultValue = 'en';
|
|
Settings.Locale = defaultValue;
|
|
locale.value = defaultValue;
|
|
return;
|
|
}
|
|
Settings.Locale = locale.value;
|
|
}
|
|
}
|
|
|
|
export { setSettingsLabels };
|