mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
few bugdic
This commit is contained in:
parent
486e8a107f
commit
cf2efe7698
42
dist/vendor.bundle.js
vendored
42
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -10,7 +10,7 @@ getPlayer() Netscript Function
|
|||||||
Returns an object with the Player's stats. The object has the following properties::
|
Returns an object with the Player's stats. The object has the following properties::
|
||||||
|
|
||||||
{
|
{
|
||||||
hacking_skill: Current Hacking skill level
|
hacking: Current Hacking skill level
|
||||||
hp: Current health points
|
hp: Current health points
|
||||||
max_hp: Maximum health points
|
max_hp: Maximum health points
|
||||||
strength: Current Strength skill level
|
strength: Current Strength skill level
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
22
package-lock.json
generated
22
package-lock.json
generated
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "bitburner",
|
"name": "bitburner",
|
||||||
"version": "0.58.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "0.58.0",
|
"version": "1.0.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "SEE LICENSE IN license.txt",
|
"license": "SEE LICENSE IN license.txt",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -28,6 +28,7 @@
|
|||||||
"arg": "^5.0.0",
|
"arg": "^5.0.0",
|
||||||
"better-react-mathjax": "^1.0.3",
|
"better-react-mathjax": "^1.0.3",
|
||||||
"clsx": "^1.1.1",
|
"clsx": "^1.1.1",
|
||||||
|
"date-fns": "^2.25.0",
|
||||||
"decimal.js": "7.2.3",
|
"decimal.js": "7.2.3",
|
||||||
"escodegen": "^1.11.0",
|
"escodegen": "^1.11.0",
|
||||||
"file-saver": "^1.3.8",
|
"file-saver": "^1.3.8",
|
||||||
@ -6963,6 +6964,18 @@
|
|||||||
"whatwg-url": "^7.0.0"
|
"whatwg-url": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/date-fns": {
|
||||||
|
"version": "2.25.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.25.0.tgz",
|
||||||
|
"integrity": "sha512-ovYRFnTrbGPD4nqaEqescPEv1mNwvt+UTqI3Ay9SzNtey9NZnYu6E2qCcBBgJ6/2VF1zGGygpyTDITqpQQ5e+w==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.11"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/date-fns"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/date-now": {
|
"node_modules/date-now": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
||||||
@ -26992,6 +27005,11 @@
|
|||||||
"whatwg-url": "^7.0.0"
|
"whatwg-url": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"date-fns": {
|
||||||
|
"version": "2.25.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.25.0.tgz",
|
||||||
|
"integrity": "sha512-ovYRFnTrbGPD4nqaEqescPEv1mNwvt+UTqI3Ay9SzNtey9NZnYu6E2qCcBBgJ6/2VF1zGGygpyTDITqpQQ5e+w=="
|
||||||
|
},
|
||||||
"date-now": {
|
"date-now": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"arg": "^5.0.0",
|
"arg": "^5.0.0",
|
||||||
"better-react-mathjax": "^1.0.3",
|
"better-react-mathjax": "^1.0.3",
|
||||||
"clsx": "^1.1.1",
|
"clsx": "^1.1.1",
|
||||||
|
"date-fns": "^2.25.0",
|
||||||
"decimal.js": "7.2.3",
|
"decimal.js": "7.2.3",
|
||||||
"escodegen": "^1.11.0",
|
"escodegen": "^1.11.0",
|
||||||
"file-saver": "^1.3.8",
|
"file-saver": "^1.3.8",
|
||||||
|
@ -20,8 +20,6 @@ import { createRandomIp } from "../utils/IPAddress";
|
|||||||
|
|
||||||
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
|
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
interface IConstructorParams {
|
interface IConstructorParams {
|
||||||
adminRights?: boolean;
|
adminRights?: boolean;
|
||||||
hostname: string;
|
hostname: string;
|
||||||
@ -53,6 +51,9 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
|
|||||||
// Total number of hashes earned by this server
|
// Total number of hashes earned by this server
|
||||||
totalHashesGenerated = 0;
|
totalHashesGenerated = 0;
|
||||||
|
|
||||||
|
// Flag indicating wehther this is a purchased server
|
||||||
|
purchasedByPlayer = true;
|
||||||
|
|
||||||
constructor(params: IConstructorParams = { hostname: "", ip: createRandomIp() }) {
|
constructor(params: IConstructorParams = { hostname: "", ip: createRandomIp() }) {
|
||||||
super(params);
|
super(params);
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
|
|||||||
upgradeCore(levels: number, prodMult: number): void {
|
upgradeCore(levels: number, prodMult: number): void {
|
||||||
this.cores = Math.min(HacknetServerConstants.MaxCores, Math.round(this.cores + levels));
|
this.cores = Math.min(HacknetServerConstants.MaxCores, Math.round(this.cores + levels));
|
||||||
this.updateHashRate(prodMult);
|
this.updateHashRate(prodMult);
|
||||||
this.cpuCores=this.cores;
|
this.cpuCores = this.cores;
|
||||||
}
|
}
|
||||||
|
|
||||||
upgradeLevel(levels: number, prodMult: number): void {
|
upgradeLevel(levels: number, prodMult: number): void {
|
||||||
|
@ -354,8 +354,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
.find((l: any) => l.id === "javascript")
|
.find((l: any) => l.id === "javascript")
|
||||||
.loader();
|
.loader();
|
||||||
l.language.tokenizer.root.unshift(["ns", { token: "ns" }]);
|
l.language.tokenizer.root.unshift(["ns", { token: "ns" }]);
|
||||||
for (const symbol of symbols)
|
for (const symbol of symbols) l.language.tokenizer.root.unshift([symbol, { token: "netscriptfunction" }]);
|
||||||
l.language.tokenizer.root.unshift(["[^a-zA-Z0-9]" + symbol + "[^a-zA-Z0-9]", { token: "netscriptfunction" }]);
|
|
||||||
const otherKeywords = ["let", "const", "var", "function"];
|
const otherKeywords = ["let", "const", "var", "function"];
|
||||||
const otherKeyvars = ["true", "false", "null", "undefined"];
|
const otherKeyvars = ["true", "false", "null", "undefined"];
|
||||||
otherKeywords.forEach((k) => l.language.tokenizer.root.unshift([k, { token: "otherkeywords" }]));
|
otherKeywords.forEach((k) => l.language.tokenizer.root.unshift([k, { token: "otherkeywords" }]));
|
||||||
|
@ -94,6 +94,9 @@ export class BaseServer {
|
|||||||
// Text files on this server
|
// Text files on this server
|
||||||
textFiles: TextFile[] = [];
|
textFiles: TextFile[] = [];
|
||||||
|
|
||||||
|
// Flag indicating wehther this is a purchased server
|
||||||
|
purchasedByPlayer = false;
|
||||||
|
|
||||||
constructor(params: IConstructorParams = { hostname: "", ip: createRandomIp() }) {
|
constructor(params: IConstructorParams = { hostname: "", ip: createRandomIp() }) {
|
||||||
this.ip = params.ip ? params.ip : createRandomIp();
|
this.ip = params.ip ? params.ip : createRandomIp();
|
||||||
|
|
||||||
|
@ -48,9 +48,6 @@ export class Server extends BaseServer {
|
|||||||
// How many ports are currently opened on the server
|
// How many ports are currently opened on the server
|
||||||
openPortCount = 0;
|
openPortCount = 0;
|
||||||
|
|
||||||
// Flag indicating wehther this is a purchased server
|
|
||||||
purchasedByPlayer = false;
|
|
||||||
|
|
||||||
// Hacking level required to hack this server
|
// Hacking level required to hack this server
|
||||||
requiredHackingSkill = 1;
|
requiredHackingSkill = 1;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ export const defaultSettings: IDefaultSettings = {
|
|||||||
DisableHotkeys: false,
|
DisableHotkeys: false,
|
||||||
DisableTextEffects: false,
|
DisableTextEffects: false,
|
||||||
EnableBashHotkeys: false,
|
EnableBashHotkeys: false,
|
||||||
TimestampsFormat: "YYYY-MM-DD HH:MM:SS",
|
TimestampsFormat: "",
|
||||||
Locale: "en",
|
Locale: "en",
|
||||||
MaxLogCapacity: 50,
|
MaxLogCapacity: 50,
|
||||||
MaxPortCapacity: 50,
|
MaxPortCapacity: 50,
|
||||||
|
@ -27,7 +27,11 @@ export function download(
|
|||||||
const file = new Blob([server.scripts[i].code], {
|
const file = new Blob([server.scripts[i].code], {
|
||||||
type: "text/plain",
|
type: "text/plain",
|
||||||
});
|
});
|
||||||
zip.file(server.scripts[i].filename + ".js", file);
|
let name = server.scripts[i].filename;
|
||||||
|
if (name.startsWith("/")) {
|
||||||
|
name = name.slice(1);
|
||||||
|
}
|
||||||
|
zip.file(name + ".js", file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fn === "*" || fn === "*.txt") {
|
if (fn === "*" || fn === "*.txt") {
|
||||||
|
@ -19,6 +19,7 @@ import List from "@mui/material/List";
|
|||||||
import ListItem from "@mui/material/ListItem";
|
import ListItem from "@mui/material/ListItem";
|
||||||
import Link from "@mui/material/Link";
|
import Link from "@mui/material/Link";
|
||||||
import Tooltip from "@mui/material/Tooltip";
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
import TextField from "@mui/material/TextField";
|
||||||
|
|
||||||
import DownloadIcon from "@mui/icons-material/Download";
|
import DownloadIcon from "@mui/icons-material/Download";
|
||||||
import UploadIcon from "@mui/icons-material/Upload";
|
import UploadIcon from "@mui/icons-material/Upload";
|
||||||
@ -30,6 +31,7 @@ import { ThemeEditorModal } from "./ThemeEditorModal";
|
|||||||
|
|
||||||
import { Settings } from "../../Settings/Settings";
|
import { Settings } from "../../Settings/Settings";
|
||||||
import { save, deleteGame } from "../../db";
|
import { save, deleteGame } from "../../db";
|
||||||
|
import { formatTime } from "../../utils/helpers/formatTime";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles((theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@ -73,7 +75,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
|
|||||||
const [disableASCIIArt, setDisableASCIIArt] = useState(Settings.DisableASCIIArt);
|
const [disableASCIIArt, setDisableASCIIArt] = useState(Settings.DisableASCIIArt);
|
||||||
const [disableTextEffects, setDisableTextEffects] = useState(Settings.DisableTextEffects);
|
const [disableTextEffects, setDisableTextEffects] = useState(Settings.DisableTextEffects);
|
||||||
const [enableBashHotkeys, setEnableBashHotkeys] = useState(Settings.EnableBashHotkeys);
|
const [enableBashHotkeys, setEnableBashHotkeys] = useState(Settings.EnableBashHotkeys);
|
||||||
const [enableTimestamps, setEnableTimestamps] = useState(!!Settings.TimestampsFormat);
|
const [timestampFormat, setTimestampFormat] = useState(Settings.TimestampsFormat);
|
||||||
const [saveGameOnFileSave, setSaveGameOnFileSave] = useState(Settings.SaveGameOnFileSave);
|
const [saveGameOnFileSave, setSaveGameOnFileSave] = useState(Settings.SaveGameOnFileSave);
|
||||||
|
|
||||||
const [locale, setLocale] = useState(Settings.Locale);
|
const [locale, setLocale] = useState(Settings.Locale);
|
||||||
@ -154,9 +156,9 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
|
|||||||
setEnableBashHotkeys(event.target.checked);
|
setEnableBashHotkeys(event.target.checked);
|
||||||
Settings.EnableBashHotkeys = event.target.checked;
|
Settings.EnableBashHotkeys = event.target.checked;
|
||||||
}
|
}
|
||||||
function handleEnableTimestampsChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
function handleTimestampFormatChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
setEnableTimestamps(event.target.checked);
|
setTimestampFormat(event.target.value);
|
||||||
Settings.TimestampsFormat = event.target.checked ? "YYYY-MM-DD HH:MM:SS" : "";
|
Settings.TimestampsFormat = event.target.value;
|
||||||
}
|
}
|
||||||
function handleSaveGameOnFile(event: React.ChangeEvent<HTMLInputElement>): void {
|
function handleSaveGameOnFile(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
setSaveGameOnFileSave(event.target.checked);
|
setSaveGameOnFileSave(event.target.checked);
|
||||||
@ -466,21 +468,28 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
|
|||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<FormControlLabel
|
<Tooltip
|
||||||
control={<Switch checked={enableTimestamps} onChange={handleEnableTimestampsChange} />}
|
title={
|
||||||
label={
|
<Typography>
|
||||||
<Tooltip
|
Terminal commands and log entries will be timestamped. See
|
||||||
title={
|
https://date-fns.org/docs/Getting-Started/
|
||||||
<Typography>
|
</Typography>
|
||||||
Terminal commands and log entries will be timestamped. The timestamp will have the format: M/D
|
|
||||||
h:m
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Typography>Enable timestamps</Typography>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
}
|
||||||
/>
|
>
|
||||||
|
<span>
|
||||||
|
<TextField
|
||||||
|
InputProps={{
|
||||||
|
startAdornment: (
|
||||||
|
<Typography color={formatTime(timestampFormat) === "format error" ? "error" : "success"}>
|
||||||
|
Timestamp format:
|
||||||
|
</Typography>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
value={timestampFormat}
|
||||||
|
onChange={handleTimestampFormatChange}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<ListItem>
|
<ListItem>
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
export function formatTime(format: string): string {
|
import { format } from "date-fns";
|
||||||
return "";
|
|
||||||
|
export function formatTime(fmt: string): string {
|
||||||
|
try {
|
||||||
|
return format(new Date(), fmt);
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error(err);
|
||||||
|
return "format error";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user