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::
|
||||
|
||||
{
|
||||
hacking_skill: Current Hacking skill level
|
||||
hacking: Current Hacking skill level
|
||||
hp: Current health points
|
||||
max_hp: Maximum health points
|
||||
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",
|
||||
"version": "0.58.0",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "0.58.0",
|
||||
"version": "1.0.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "SEE LICENSE IN license.txt",
|
||||
"dependencies": {
|
||||
@ -28,6 +28,7 @@
|
||||
"arg": "^5.0.0",
|
||||
"better-react-mathjax": "^1.0.3",
|
||||
"clsx": "^1.1.1",
|
||||
"date-fns": "^2.25.0",
|
||||
"decimal.js": "7.2.3",
|
||||
"escodegen": "^1.11.0",
|
||||
"file-saver": "^1.3.8",
|
||||
@ -6963,6 +6964,18 @@
|
||||
"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": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
||||
@ -26992,6 +27005,11 @@
|
||||
"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": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
||||
|
@ -29,6 +29,7 @@
|
||||
"arg": "^5.0.0",
|
||||
"better-react-mathjax": "^1.0.3",
|
||||
"clsx": "^1.1.1",
|
||||
"date-fns": "^2.25.0",
|
||||
"decimal.js": "7.2.3",
|
||||
"escodegen": "^1.11.0",
|
||||
"file-saver": "^1.3.8",
|
||||
|
@ -20,8 +20,6 @@ import { createRandomIp } from "../utils/IPAddress";
|
||||
|
||||
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
|
||||
|
||||
|
||||
|
||||
interface IConstructorParams {
|
||||
adminRights?: boolean;
|
||||
hostname: string;
|
||||
@ -53,6 +51,9 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
|
||||
// Total number of hashes earned by this server
|
||||
totalHashesGenerated = 0;
|
||||
|
||||
// Flag indicating wehther this is a purchased server
|
||||
purchasedByPlayer = true;
|
||||
|
||||
constructor(params: IConstructorParams = { hostname: "", ip: createRandomIp() }) {
|
||||
super(params);
|
||||
|
||||
@ -95,7 +96,7 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
|
||||
upgradeCore(levels: number, prodMult: number): void {
|
||||
this.cores = Math.min(HacknetServerConstants.MaxCores, Math.round(this.cores + levels));
|
||||
this.updateHashRate(prodMult);
|
||||
this.cpuCores=this.cores;
|
||||
this.cpuCores = this.cores;
|
||||
}
|
||||
|
||||
upgradeLevel(levels: number, prodMult: number): void {
|
||||
|
@ -354,8 +354,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
.find((l: any) => l.id === "javascript")
|
||||
.loader();
|
||||
l.language.tokenizer.root.unshift(["ns", { token: "ns" }]);
|
||||
for (const symbol of symbols)
|
||||
l.language.tokenizer.root.unshift(["[^a-zA-Z0-9]" + symbol + "[^a-zA-Z0-9]", { token: "netscriptfunction" }]);
|
||||
for (const symbol of symbols) l.language.tokenizer.root.unshift([symbol, { token: "netscriptfunction" }]);
|
||||
const otherKeywords = ["let", "const", "var", "function"];
|
||||
const otherKeyvars = ["true", "false", "null", "undefined"];
|
||||
otherKeywords.forEach((k) => l.language.tokenizer.root.unshift([k, { token: "otherkeywords" }]));
|
||||
|
@ -94,6 +94,9 @@ export class BaseServer {
|
||||
// Text files on this server
|
||||
textFiles: TextFile[] = [];
|
||||
|
||||
// Flag indicating wehther this is a purchased server
|
||||
purchasedByPlayer = false;
|
||||
|
||||
constructor(params: IConstructorParams = { hostname: "", 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
|
||||
openPortCount = 0;
|
||||
|
||||
// Flag indicating wehther this is a purchased server
|
||||
purchasedByPlayer = false;
|
||||
|
||||
// Hacking level required to hack this server
|
||||
requiredHackingSkill = 1;
|
||||
|
||||
|
@ -166,7 +166,7 @@ export const defaultSettings: IDefaultSettings = {
|
||||
DisableHotkeys: false,
|
||||
DisableTextEffects: false,
|
||||
EnableBashHotkeys: false,
|
||||
TimestampsFormat: "YYYY-MM-DD HH:MM:SS",
|
||||
TimestampsFormat: "",
|
||||
Locale: "en",
|
||||
MaxLogCapacity: 50,
|
||||
MaxPortCapacity: 50,
|
||||
|
@ -27,7 +27,11 @@ export function download(
|
||||
const file = new Blob([server.scripts[i].code], {
|
||||
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") {
|
||||
|
@ -19,6 +19,7 @@ import List from "@mui/material/List";
|
||||
import ListItem from "@mui/material/ListItem";
|
||||
import Link from "@mui/material/Link";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import TextField from "@mui/material/TextField";
|
||||
|
||||
import DownloadIcon from "@mui/icons-material/Download";
|
||||
import UploadIcon from "@mui/icons-material/Upload";
|
||||
@ -30,6 +31,7 @@ import { ThemeEditorModal } from "./ThemeEditorModal";
|
||||
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { save, deleteGame } from "../../db";
|
||||
import { formatTime } from "../../utils/helpers/formatTime";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
@ -73,7 +75,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
|
||||
const [disableASCIIArt, setDisableASCIIArt] = useState(Settings.DisableASCIIArt);
|
||||
const [disableTextEffects, setDisableTextEffects] = useState(Settings.DisableTextEffects);
|
||||
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 [locale, setLocale] = useState(Settings.Locale);
|
||||
@ -154,9 +156,9 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
|
||||
setEnableBashHotkeys(event.target.checked);
|
||||
Settings.EnableBashHotkeys = event.target.checked;
|
||||
}
|
||||
function handleEnableTimestampsChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||
setEnableTimestamps(event.target.checked);
|
||||
Settings.TimestampsFormat = event.target.checked ? "YYYY-MM-DD HH:MM:SS" : "";
|
||||
function handleTimestampFormatChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||
setTimestampFormat(event.target.value);
|
||||
Settings.TimestampsFormat = event.target.value;
|
||||
}
|
||||
function handleSaveGameOnFile(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||
setSaveGameOnFileSave(event.target.checked);
|
||||
@ -466,21 +468,28 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<FormControlLabel
|
||||
control={<Switch checked={enableTimestamps} onChange={handleEnableTimestampsChange} />}
|
||||
label={
|
||||
<Tooltip
|
||||
title={
|
||||
<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>
|
||||
<Tooltip
|
||||
title={
|
||||
<Typography>
|
||||
Terminal commands and log entries will be timestamped. See
|
||||
https://date-fns.org/docs/Getting-Started/
|
||||
</Typography>
|
||||
}
|
||||
/>
|
||||
>
|
||||
<span>
|
||||
<TextField
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<Typography color={formatTime(timestampFormat) === "format error" ? "error" : "success"}>
|
||||
Timestamp format:
|
||||
</Typography>
|
||||
),
|
||||
}}
|
||||
value={timestampFormat}
|
||||
onChange={handleTimestampFormatChange}
|
||||
/>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</ListItem>
|
||||
|
||||
<ListItem>
|
||||
|
@ -1,3 +1,10 @@
|
||||
export function formatTime(format: string): string {
|
||||
return "";
|
||||
import { format } from "date-fns";
|
||||
|
||||
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