Merge pull request #1 from danielyxie/dev

Update from main Repo
This commit is contained in:
pigalot 2021-12-29 14:49:53 +00:00 committed by GitHub
commit ac129f860a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 116 additions and 115 deletions

@ -28,5 +28,5 @@ Returns the amount of time in milliseconds it takes to execute the grow Netscrip
RAM cost: 0.05 GB RAM cost: 0.05 GB
Returns the amount of time in milliseconds it takes to execute the grow Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the grow time would be at different hacking levels. Returns the amount of time in milliseconds it takes to execute the grow Netscript function on the target server.

@ -28,5 +28,5 @@ Returns the amount of time in milliseconds it takes to execute the hack Netscrip
RAM cost: 0.05 GB RAM cost: 0.05 GB
Returns the amount of time in milliseconds it takes to execute the hack Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the hack time would be at different hacking levels. Returns the amount of time in milliseconds it takes to execute the hack Netscript function on the target server.

@ -28,5 +28,5 @@ Returns the amount of time in milliseconds it takes to execute the grow Netscrip
RAM cost: 0.05 GB RAM cost: 0.05 GB
Returns the amount of time in milliseconds it takes to execute the weaken() Netscript function on the target server. The function takes in an optional hackLvl parameter that can be specified to see what the weaken time would be at different hacking levels. Returns the amount of time in milliseconds it takes to execute the weaken() Netscript function on the target server.

@ -745,7 +745,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
BitNodeMultipliers.StaneksGiftPowerMultiplier = 0.5; BitNodeMultipliers.StaneksGiftPowerMultiplier = 0.5;
BitNodeMultipliers.StaneksGiftExtraSize = 2; BitNodeMultipliers.StaneksGiftExtraSize = 2;
BitNodeMultipliers.GangSoftcap = 0.8; BitNodeMultipliers.GangSoftcap = 0.8;
BitNodeMultipliers.CorporationSoftCap = 0.9; BitNodeMultipliers.CorporationSoftCap = 0.7;
BitNodeMultipliers.WorldDaemonDifficulty = 2; BitNodeMultipliers.WorldDaemonDifficulty = 2;
break; break;
case 10: // Digital Carbon case 10: // Digital Carbon

@ -64,7 +64,7 @@ import { NetscriptSleeve } from "./NetscriptFunctions/Sleeve";
import { NetscriptExtra } from "./NetscriptFunctions/Extra"; import { NetscriptExtra } from "./NetscriptFunctions/Extra";
import { NetscriptHacknet } from "./NetscriptFunctions/Hacknet"; import { NetscriptHacknet } from "./NetscriptFunctions/Hacknet";
import { NetscriptStanek } from "./NetscriptFunctions/Stanek"; import { NetscriptStanek } from "./NetscriptFunctions/Stanek";
import { NetscriptUserInterface } from './NetscriptFunctions/UserInterface'; import { NetscriptUserInterface } from "./NetscriptFunctions/UserInterface";
import { NetscriptBladeburner } from "./NetscriptFunctions/Bladeburner"; import { NetscriptBladeburner } from "./NetscriptFunctions/Bladeburner";
import { NetscriptCodingContract } from "./NetscriptFunctions/CodingContract"; import { NetscriptCodingContract } from "./NetscriptFunctions/CodingContract";
import { NetscriptCorporation } from "./NetscriptFunctions/Corporation"; import { NetscriptCorporation } from "./NetscriptFunctions/Corporation";
@ -2317,10 +2317,12 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
...base, ...base,
...extra, ...extra,
}; };
function getFunctionNames(obj: NS, prefix: string): string[] { function getFunctionNames(obj: any, prefix: string): string[] {
const functionNames: string[] = []; const functionNames: string[] = [];
for (const [key, value] of Object.entries(obj)) { for (const [key, value] of Object.entries(obj)) {
if (typeof value == "function") { if (key === "args") {
continue;
} else if (typeof value == "function") {
functionNames.push(prefix + key); functionNames.push(prefix + key);
} else if (typeof value == "object") { } else if (typeof value == "object") {
functionNames.push(...getFunctionNames(value, key + ".")); functionNames.push(...getFunctionNames(value, key + "."));

@ -17,6 +17,17 @@ export function calculateSkillProgress(exp: number, mult = 1): ISkillProgress {
if (nextExperience < 0) nextExperience = 0; if (nextExperience < 0) nextExperience = 0;
const normalize = (value: number): number => ((value - baseExperience) * 100) / (nextExperience - baseExperience); const normalize = (value: number): number => ((value - baseExperience) * 100) / (nextExperience - baseExperience);
let progress = (nextExperience - baseExperience !== 0) ? normalize(exp) : 99.99;
// Clamp progress: When sleeves are working out, the player gets way too much progress
if (progress < 0) progress = 0
if (progress > 100) progress = 100;
// Clamp floating point imprecisions
let currentExperience = exp - baseExperience;
let remainingExperience = nextExperience - exp;
if (currentExperience < 0) currentExperience = 0;
if (remainingExperience < 0) remainingExperience = 0;
return { return {
currentSkill, currentSkill,
@ -24,7 +35,9 @@ export function calculateSkillProgress(exp: number, mult = 1): ISkillProgress {
baseExperience, baseExperience,
experience: exp, experience: exp,
nextExperience, nextExperience,
progress: (nextExperience - baseExperience !== 0) ? normalize(exp) : 99.99 currentExperience,
remainingExperience,
progress
} }
} }
@ -34,6 +47,8 @@ export interface ISkillProgress {
baseExperience: number; baseExperience: number;
experience: number; experience: number;
nextExperience: number; nextExperience: number;
currentExperience: number;
remainingExperience: number;
progress: number; progress: number;
} }
@ -41,6 +56,7 @@ export function getEmptySkillProgress(): ISkillProgress {
return { return {
currentSkill: 0, nextSkill: 0, currentSkill: 0, nextSkill: 0,
baseExperience: 0, experience: 0, nextExperience: 0, baseExperience: 0, experience: 0, nextExperience: 0,
currentExperience: 0, remainingExperience: 0,
progress: 0, progress: 0,
}; };
} }

@ -109,7 +109,6 @@ async function parseOnlyRamCalculate(
for (const s of otherScripts) { for (const s of otherScripts) {
if (areImportsEquals(s.filename, fn)) { if (areImportsEquals(s.filename, fn)) {
script = s; script = s;
console.log(`${s.filename} ${fn}`);
break; break;
} }
} }

@ -2890,7 +2890,7 @@ export interface Bladeburner {
} }
/** /**
* Coding Contact API * Coding Contract API
* @public * @public
*/ */
export interface CodingContract { export interface CodingContract {
@ -5487,8 +5487,6 @@ export interface NS extends Singularity {
* The required time is increased by the security level of the target server and decreased by the player's hacking level. * The required time is increased by the security level of the target server and decreased by the player's hacking level.
* *
* @param host - Host of target server. * @param host - Host of target server.
* @param hackLvl - Optional hacking level for the calculation. Defaults to players current hacking level.
* @param intLvl - Optional intelligence level for the calculation. Defaults to players current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).
* @returns Returns the amount of time in milliseconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server. * @returns Returns the amount of time in milliseconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server.
*/ */
getHackTime(host: string): number; getHackTime(host: string): number;
@ -5503,8 +5501,6 @@ export interface NS extends Singularity {
* The required time is increased by the security level of the target server and decreased by the player's hacking level. * The required time is increased by the security level of the target server and decreased by the player's hacking level.
* *
* @param host - Host of target server. * @param host - Host of target server.
* @param hackLvl - Optional hacking level for the calculation. Defaults to players current hacking level.
* @param intLvl - Optional intelligence level for the calculation. Defaults to players current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).
* @returns Returns the amount of time in milliseconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server. * @returns Returns the amount of time in milliseconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server.
*/ */
getGrowTime(host: string): number; getGrowTime(host: string): number;
@ -5519,8 +5515,6 @@ export interface NS extends Singularity {
* The required time is increased by the security level of the target server and decreased by the player's hacking level. * The required time is increased by the security level of the target server and decreased by the player's hacking level.
* *
* @param host - Host of target server. * @param host - Host of target server.
* @param hackLvl - Optional hacking level for the calculation. Defaults to players current hacking level.
* @param intLvl - Optional intelligence level for the calculation. Defaults to players current intelligence level. (Intelligence is unlocked after obtaining Source-File 5).
* @returns Returns the amount of time in milliseconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server. * @returns Returns the amount of time in milliseconds it takes to execute the grow Netscript function. Returns Infinity if called on a Hacknet Server.
*/ */
getWeakenTime(host: string): number; getWeakenTime(host: string): number;

@ -93,26 +93,21 @@ class OpenScript {
} }
} }
let openScripts: OpenScript[] = [];
let currentScript: OpenScript | null = null;
// Called every time script editor is opened // Called every time script editor is opened
export function Root(props: IProps): React.ReactElement { export function Root(props: IProps): React.ReactElement {
const setRerender = useState(false)[1];
function rerender(): void {
setRerender((o) => !o);
}
const editorRef = useRef<IStandaloneCodeEditor | null>(null); const editorRef = useRef<IStandaloneCodeEditor | null>(null);
const monacoRef = useRef<Monaco | null>(null); const monacoRef = useRef<Monaco | null>(null);
const vimStatusRef = useRef<HTMLElement>(null); const vimStatusRef = useRef<HTMLElement>(null);
const [vimEditor, setVimEditor] = useState<any>(null); const [vimEditor, setVimEditor] = useState<any>(null);
const [editor, setEditor] = useState<IStandaloneCodeEditor | null>(null); const [editor, setEditor] = useState<IStandaloneCodeEditor | null>(null);
const [openScripts, setOpenScripts] = useState<OpenScript[]>(
window.localStorage.getItem("scriptEditorOpenScripts") !== null
? JSON.parse(window.localStorage.getItem("scriptEditorOpenScripts")!)
: [],
);
const [currentScript, setCurrentScript] = useState<OpenScript | null>(
window.localStorage.getItem("scriptEditorCurrentScript") !== null
? JSON.parse(window.localStorage.getItem("scriptEditorCurrentScript")!)
: null,
);
const [ram, setRAM] = useState("RAM: ???"); const [ram, setRAM] = useState("RAM: ???");
const [updatingRam, setUpdatingRam] = useState(false); const [updatingRam, setUpdatingRam] = useState(false);
const [decorations, setDecorations] = useState<string[]>([]); const [decorations, setDecorations] = useState<string[]>([]);
@ -144,26 +139,6 @@ export function Root(props: IProps): React.ReactElement {
}; };
}, []); }, []);
useEffect(() => {
// Save currentScript
window.localStorage.setItem(
"scriptEditorCurrentScript",
JSON.stringify(currentScript, (key, value) => {
if (key == "model") return undefined;
return value;
}),
);
// Save openScripts
window.localStorage.setItem(
"scriptEditorOpenScripts",
JSON.stringify(openScripts, (key, value) => {
if (key == "model") return undefined;
return value;
}),
);
}, [currentScript, openScripts]);
useEffect(() => { useEffect(() => {
if (currentScript !== null) { if (currentScript !== null) {
updateRAM(currentScript.code); updateRAM(currentScript.code);
@ -171,23 +146,23 @@ export function Root(props: IProps): React.ReactElement {
}, []); }, []);
useEffect(() => { useEffect(() => {
function maybeSave(event: KeyboardEvent): void { function keydown(event: KeyboardEvent): void {
if (Settings.DisableHotkeys) return; if (Settings.DisableHotkeys) return;
//Ctrl + b //Ctrl + b
if (event.keyCode == 66 && (event.ctrlKey || event.metaKey)) { if (event.code == "KeyB" && (event.ctrlKey || event.metaKey)) {
event.preventDefault(); event.preventDefault();
save(); props.router.toTerminal();
} }
// CTRL/CMD + S // CTRL/CMD + S
if (event.code == `KeyS` && (event.ctrlKey || event.metaKey)) { if (event.code == "KeyS" && (event.ctrlKey || event.metaKey)) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
save(); save();
} }
} }
document.addEventListener("keydown", maybeSave); document.addEventListener("keydown", keydown);
return () => document.removeEventListener("keydown", maybeSave); return () => document.removeEventListener("keydown", keydown);
}); });
useEffect(() => { useEffect(() => {
@ -362,7 +337,7 @@ export function Root(props: IProps): React.ReactElement {
regenerateModel(openScript); regenerateModel(openScript);
} }
setCurrentScript(openScript); currentScript = openScript;
editorRef.current.setModel(openScript.model); editorRef.current.setModel(openScript.model);
editorRef.current.setPosition(openScript.lastPosition); editorRef.current.setPosition(openScript.lastPosition);
editorRef.current.revealLineInCenter(openScript.lastPosition.lineNumber); editorRef.current.revealLineInCenter(openScript.lastPosition.lineNumber);
@ -376,14 +351,12 @@ export function Root(props: IProps): React.ReactElement {
new monacoRef.current.Position(0, 0), new monacoRef.current.Position(0, 0),
monacoRef.current.editor.createModel(code, filename.endsWith(".txt") ? "plaintext" : "javascript"), monacoRef.current.editor.createModel(code, filename.endsWith(".txt") ? "plaintext" : "javascript"),
); );
setOpenScripts((oldArray) => [...oldArray, newScript]); openScripts.push(newScript);
setCurrentScript({ ...newScript }); currentScript = { ...newScript };
editorRef.current.setModel(newScript.model); editorRef.current.setModel(newScript.model);
updateRAM(newScript.code); updateRAM(newScript.code);
} }
} }
} else {
console.log("here we need to load something if we can");
} }
editorRef.current.focus(); editorRef.current.focus();
@ -422,25 +395,27 @@ export function Root(props: IProps): React.ReactElement {
function updateCode(newCode?: string): void { function updateCode(newCode?: string): void {
if (newCode === undefined) return; if (newCode === undefined) return;
updateRAM(newCode); updateRAM(newCode);
if (editorRef.current !== null) { if (editorRef.current === null) return;
const newPos = editorRef.current.getPosition(); const newPos = editorRef.current.getPosition();
if (newPos === null) return; if (newPos === null) return;
setCurrentScript((oldScript) => ({ ...oldScript!, code: newCode, lastPosition: newPos! }));
if (currentScript !== null) { if (currentScript !== null) {
currentScript = { ...currentScript, code: newCode, lastPosition: newPos };
const curIndex = openScripts.findIndex( const curIndex = openScripts.findIndex(
(script) => script.fileName === currentScript.fileName && script.hostname === currentScript.hostname, (script) =>
currentScript !== null &&
script.fileName === currentScript.fileName &&
script.hostname === currentScript.hostname,
); );
const newArr = [...openScripts]; const newArr = [...openScripts];
const tempScript = currentScript; const tempScript = currentScript;
tempScript.code = newCode; tempScript.code = newCode;
newArr[curIndex] = tempScript; newArr[curIndex] = tempScript;
setOpenScripts([...newArr]); openScripts = [...newArr];
} }
try { try {
infLoop(newCode); infLoop(newCode);
} catch (err) {} } catch (err) {}
} }
}
function saveScript(scriptToSave: OpenScript): void { function saveScript(scriptToSave: OpenScript): void {
const server = GetServer(scriptToSave.hostname); const server = GetServer(scriptToSave.hostname);
@ -487,7 +462,7 @@ export function Root(props: IProps): React.ReactElement {
function save(): void { function save(): void {
if (currentScript === null) { if (currentScript === null) {
console.log("currentScript is null when it shouldn't be. Unabel to save script"); console.error("currentScript is null when it shouldn't be. Unable to save script");
return; return;
} }
// this is duplicate code with saving later. // this is duplicate code with saving later.
@ -507,7 +482,6 @@ export function Root(props: IProps): React.ReactElement {
iTutorialNextStep(); iTutorialNextStep();
props.router.toTerminal();
return; return;
} }
@ -536,7 +510,6 @@ export function Root(props: IProps): React.ReactElement {
server.scripts, server.scripts,
); );
if (Settings.SaveGameOnFileSave) saveObject.saveGame(); if (Settings.SaveGameOnFileSave) saveObject.saveGame();
props.router.toTerminal();
return; return;
} }
} }
@ -550,7 +523,6 @@ export function Root(props: IProps): React.ReactElement {
if (server.textFiles[i].fn === currentScript.fileName) { if (server.textFiles[i].fn === currentScript.fileName) {
server.textFiles[i].write(currentScript.code); server.textFiles[i].write(currentScript.code);
if (Settings.SaveGameOnFileSave) saveObject.saveGame(); if (Settings.SaveGameOnFileSave) saveObject.saveGame();
props.router.toTerminal();
return; return;
} }
} }
@ -562,7 +534,6 @@ export function Root(props: IProps): React.ReactElement {
} }
if (Settings.SaveGameOnFileSave) saveObject.saveGame(); if (Settings.SaveGameOnFileSave) saveObject.saveGame();
props.router.toTerminal();
} }
function reorder(list: Array<OpenScript>, startIndex: number, endIndex: number): OpenScript[] { function reorder(list: Array<OpenScript>, startIndex: number, endIndex: number): OpenScript[] {
@ -582,19 +553,22 @@ export function Root(props: IProps): React.ReactElement {
const items = reorder(openScripts, result.source.index, result.destination.index); const items = reorder(openScripts, result.source.index, result.destination.index);
setOpenScripts(items); openScripts = items;
} }
function onTabClick(index: number): void { function onTabClick(index: number): void {
if (currentScript !== null) { if (currentScript !== null) {
// Save currentScript to openScripts // Save currentScript to openScripts
const curIndex = openScripts.findIndex( const curIndex = openScripts.findIndex(
(script) => script.fileName === currentScript.fileName && script.hostname === currentScript.hostname, (script) =>
currentScript !== null &&
script.fileName === currentScript.fileName &&
script.hostname === currentScript.hostname,
); );
openScripts[curIndex] = currentScript; openScripts[curIndex] = currentScript;
} }
setCurrentScript({ ...openScripts[index] }); currentScript = { ...openScripts[index] };
if (editorRef.current !== null && openScripts[index] !== null) { if (editorRef.current !== null && openScripts[index] !== null) {
if (openScripts[index].model === undefined || openScripts[index].model.isDisposed()) { if (openScripts[index].model === undefined || openScripts[index].model.isDisposed()) {
@ -609,25 +583,21 @@ export function Root(props: IProps): React.ReactElement {
} }
} }
async function onTabClose(index: number): Promise<void> { function onTabClose(index: number): void {
// See if the script on the server is up to date // See if the script on the server is up to date
const closingScript = openScripts[index]; const closingScript = openScripts[index];
const savedOpenScripts: Array<OpenScript> = JSON.parse(window.localStorage.getItem("scriptEditorOpenScripts")!); const savedScriptIndex = openScripts.findIndex(
const savedScriptIndex = savedOpenScripts.findIndex(
(script) => script.fileName === closingScript.fileName && script.hostname === closingScript.hostname, (script) => script.fileName === closingScript.fileName && script.hostname === closingScript.hostname,
); );
let savedScriptCode = ""; let savedScriptCode = "";
if (savedScriptIndex !== -1) { if (savedScriptIndex !== -1) {
savedScriptCode = savedOpenScripts[savedScriptIndex].code; savedScriptCode = openScripts[savedScriptIndex].code;
} }
const server = GetServer(closingScript.hostname);
if (server === null) throw new Error(`Server '${closingScript.hostname}' should not be null, but it is.`);
const serverScriptIndex = GetServer(closingScript.hostname)?.scripts.findIndex( const serverScriptIndex = server.scripts.findIndex((script) => script.filename === closingScript.fileName);
(script) => script.filename === closingScript.fileName, if (serverScriptIndex === -1 || savedScriptCode !== server.scripts[serverScriptIndex as number].code) {
);
if (
serverScriptIndex === -1 ||
savedScriptCode !== GetServer(closingScript.hostname)?.scripts[serverScriptIndex as number].code
) {
PromptEvent.emit({ PromptEvent.emit({
txt: "Do you want to save changes to " + closingScript.fileName + "?", txt: "Do you want to save changes to " + closingScript.fileName + "?",
resolve: (result: boolean) => { resolve: (result: boolean) => {
@ -641,15 +611,18 @@ export function Root(props: IProps): React.ReactElement {
} }
if (openScripts.length > 1) { if (openScripts.length > 1) {
setOpenScripts((oldScripts) => oldScripts.filter((value, i) => i !== index)); openScripts = openScripts.filter((value, i) => i !== index);
let indexOffset = -1; let indexOffset = -1;
if (openScripts[index + indexOffset] === undefined) { if (openScripts[index + indexOffset] === undefined) {
indexOffset = 1; indexOffset = 1;
if (openScripts[index + indexOffset] === undefined) {
indexOffset = 0;
}
} }
// Change current script if we closed it // Change current script if we closed it
setCurrentScript(openScripts[index + indexOffset]); currentScript = openScripts[index + indexOffset];
if (editorRef.current !== null) { if (editorRef.current !== null) {
if ( if (
openScripts[index + indexOffset].model === undefined || openScripts[index + indexOffset].model === undefined ||
@ -664,14 +637,26 @@ export function Root(props: IProps): React.ReactElement {
editorRef.current.revealLineInCenter(openScripts[index + indexOffset].lastPosition.lineNumber); editorRef.current.revealLineInCenter(openScripts[index + indexOffset].lastPosition.lineNumber);
editorRef.current.focus(); editorRef.current.focus();
} }
rerender();
} else { } else {
// No more scripts are open // No more scripts are open
setOpenScripts([]); openScripts = [];
setCurrentScript(null); currentScript = null;
props.router.toTerminal(); props.router.toTerminal();
} }
} }
function dirty(index: number): string {
const openScript = openScripts[index];
const server = GetServer(openScript.hostname);
if (server === null) throw new Error(`Server '${openScript.hostname}' should not be null, but it is.`);
const serverScript = server.scripts.find((s) => s.filename === openScript.fileName);
if (serverScript === undefined) return " *";
return serverScript.code !== openScript.code ? " *" : "";
}
// Toolbars are roughly 112px: // Toolbars are roughly 112px:
// 8px body margin top // 8px body margin top
// 38.5px filename tabs // 38.5px filename tabs
@ -718,7 +703,6 @@ export function Root(props: IProps): React.ReactElement {
}} }}
> >
<Button <Button
id={"tabButton" + fileName + hostname}
onClick={() => onTabClick(index)} onClick={() => onTabClick(index)}
style={{ style={{
background: background:
@ -727,10 +711,9 @@ export function Root(props: IProps): React.ReactElement {
: "", : "",
}} }}
> >
{hostname}:~/{fileName} {hostname}:~/{fileName} {dirty(index)}
</Button> </Button>
<Button <Button
id={"tabCloseButton" + fileName + hostname}
onClick={() => onTabClose(index)} onClick={() => onTabClose(index)}
style={{ style={{
maxWidth: "20px", maxWidth: "20px",
@ -779,7 +762,8 @@ export function Root(props: IProps): React.ReactElement {
<Typography color={updatingRam ? "secondary" : "primary"} sx={{ mx: 1 }}> <Typography color={updatingRam ? "secondary" : "primary"} sx={{ mx: 1 }}>
{ram} {ram}
</Typography> </Typography>
<Button onClick={save}>Save & Close (Ctrl/Cmd + s)</Button> <Button onClick={save}>Save All (Ctrl/Cmd + s)</Button>
<Button onClick={props.router.toTerminal}>Close (Ctrl/Cmd + b)</Button>
<Typography sx={{ mx: 1 }}> <Typography sx={{ mx: 1 }}>
{" "} {" "}
Documentation:{" "} Documentation:{" "}
@ -825,10 +809,14 @@ export function Root(props: IProps): React.ReactElement {
alignItems: "center", alignItems: "center",
}} }}
> >
<p style={{ color: Settings.theme.primary, fontSize: "20px", textAlign: "center" }}> <span style={{ color: Settings.theme.primary, fontSize: "20px", textAlign: "center" }}>
<h1>No open files</h1> <Typography variant="h4">No open files</Typography>
<h5>Use "nano [File Name]" in the terminal to open files</h5> <Typography variant="h5">
</p> Use `nano FILENAME` in
<br />
the terminal to open files
</Typography>
</span>
</div> </div>
</> </>
); );

@ -779,7 +779,7 @@ export const InitStockMetadata: IConstructorParams[] = [
max: 350, max: 350,
min: 200, min: 200,
}, },
name: "Joes Guns", name: LocationName.Sector12JoesGuns,
otlkMag: 1, otlkMag: 1,
spreadPerc: { spreadPerc: {
divisor: 10, divisor: 10,
@ -790,7 +790,7 @@ export const InitStockMetadata: IConstructorParams[] = [
max: 52e3, max: 52e3,
min: 15e3, min: 15e3,
}, },
symbol: StockSymbols["Joes Guns"], symbol: StockSymbols[LocationName.Sector12JoesGuns],
}, },
{ {

@ -53,7 +53,7 @@ export function mv(
// Also, you can't convert between different file types // Also, you can't convert between different file types
if (isScriptFilename(source)) { if (isScriptFilename(source)) {
const script = srcFile as Script; const script = srcFile as Script;
if (!isScriptFilename(dest)) { if (!isScriptFilename(destPath)) {
terminal.error(`Source and destination files must have the same type`); terminal.error(`Source and destination files must have the same type`);
return; return;
} }
@ -66,7 +66,7 @@ export function mv(
if (destFile != null) { if (destFile != null) {
// Already exists, will be overwritten, so we'll delete it // Already exists, will be overwritten, so we'll delete it
const status = server.removeFile(dest); const status = server.removeFile(destPath);
if (!status.res) { if (!status.res) {
terminal.error(`Something went wrong...please contact game dev (probably a bug)`); terminal.error(`Something went wrong...please contact game dev (probably a bug)`);
return; return;

@ -9,6 +9,7 @@ interface IProgressProps {
min: number; min: number;
max: number; max: number;
current: number; current: number;
remaining: number;
progress: number; progress: number;
color?: React.CSSProperties["color"]; color?: React.CSSProperties["color"];
} }
@ -18,14 +19,14 @@ interface IStatsOverviewCellProps {
color?: React.CSSProperties["color"]; color?: React.CSSProperties["color"];
} }
export function StatsProgressBar({ min, max, current, progress, color }: IProgressProps): React.ReactElement { export function StatsProgressBar({ min, max, current, remaining, progress, color }: IProgressProps): React.ReactElement {
const tooltip = ( const tooltip = (
<Typography sx={{ textAlign: 'right' }}> <Typography sx={{ textAlign: 'right' }}>
<strong>Progress:</strong>&nbsp; <strong>Progress:</strong>&nbsp;
{numeralWrapper.formatExp(current - min)} / {numeralWrapper.formatExp(max - min)} {numeralWrapper.formatExp(current)} / {numeralWrapper.formatExp(max - min)}
<br /> <br />
<strong>Remaining:</strong>&nbsp; <strong>Remaining:</strong>&nbsp;
{numeralWrapper.formatExp(max - current)} ({progress.toFixed(2)}%) {numeralWrapper.formatExp(remaining)} ({progress.toFixed(2)}%)
</Typography> </Typography>
); );
@ -58,7 +59,8 @@ export function StatsProgressOverviewCell({ progress: skill, color }: IStatsOver
<StatsProgressBar <StatsProgressBar
min={skill.baseExperience} min={skill.baseExperience}
max={skill.nextExperience} max={skill.nextExperience}
current={skill.experience} current={skill.currentExperience}
remaining={skill.remainingExperience}
progress={skill.progress} progress={skill.progress}
color={color} color={color}
/> />