mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-03 11:57:34 +01:00
basic autocomplete working
This commit is contained in:
parent
0b3c48827b
commit
4497143785
@ -1,144 +1,150 @@
|
|||||||
export declare function scan(ip: string, hostnames: boolean): string[];
|
export const libSource = `interface NS {
|
||||||
export declare function hack(ip: string, threads: number, stock: boolean): Promise<string>;
|
args: string[];
|
||||||
export declare function hackAnalyzeThreads(ip: string, hackAmount: number): number;
|
/**
|
||||||
export declare function hackAnalyzePercent(ip: string): number;
|
* Example documentation for scan.
|
||||||
export declare function hackChance(ip: string): number;
|
*/
|
||||||
export declare function sleep(time: number): Promise<void>;
|
scan(ip: string, hostnames: boolean): string[];
|
||||||
export declare function grow(ip: string, threads: number, stock: boolean): Promise<string>;
|
hack(ip: string, threads: number, stock: boolean): Promise<string>;
|
||||||
export declare function growthAnalyze(ip: string, growth: number): number;
|
hackAnalyzeThreads(ip: string, hackAmount: number): number;
|
||||||
export declare function weaken(ip: string, threads: boolean): Promise<string>;
|
hackAnalyzePercent(ip: string): number;
|
||||||
export declare function print(): void;
|
hackChance(ip: string): number;
|
||||||
export declare function tprint(): void;
|
sleep(time: number): Promise<void>;
|
||||||
export declare function clearLog(): void;
|
grow(ip: string, threads: number, stock: boolean): Promise<string>;
|
||||||
export declare function disableLog(fn: string): void;
|
growthAnalyze(ip: string, growth: number): number;
|
||||||
export declare function enableLog(fn: string): void;
|
weaken(ip: string, threads: boolean): Promise<string>;
|
||||||
export declare function isLogEnabled(fn: string): boolean;
|
print(...args: any[]): void;
|
||||||
export declare function getScriptLogs(fn: string, ip: string, ...scriptArgs: any[]): string[];
|
tprint(...args: any[]): void;
|
||||||
export declare function tail(fn: string, ip: string, ...scriptArgs: any[]): void;
|
clearLog(): void;
|
||||||
export declare function nuke(ip: string): boolean;
|
disableLog(fn: string): void;
|
||||||
export declare function brutessh(ip: string): boolean;
|
enableLog(fn: string): void;
|
||||||
export declare function ftpcrack(ip: string): boolean;
|
isLogEnabled(fn: string): boolean;
|
||||||
export declare function relaysmtp(ip: string): boolean;
|
getScriptLogs(fn: string, ip: string, ...scriptArgs: any[]): string[];
|
||||||
export declare function httpworm(ip: string): boolean;
|
tail(fn: string, ip: string, ...scriptArgs: any[]): void;
|
||||||
export declare function sqlinject(ip: string): boolean;
|
nuke(ip: string): boolean;
|
||||||
export declare function run(scriptname: string, threads: number): number;
|
brutessh(ip: string): boolean;
|
||||||
export declare function exec(scriptname: string, ip: string, threads: number): number;
|
ftpcrack(ip: string): boolean;
|
||||||
export declare function spawn(scriptname: string, threads: number): void;
|
relaysmtp(ip: string): boolean;
|
||||||
export declare function kill(filename: string, ip: string, ...scriptArgs: any[]): boolean;
|
httpworm(ip: string): boolean;
|
||||||
export declare function killall(ip: string): boolean;
|
sqlinject(ip: string): boolean;
|
||||||
export declare function exit(): void;
|
run(scriptname: string, threads: number): number;
|
||||||
export declare function scp(scriptname: string, ip1: string, ip2: string): boolean;
|
exec(scriptname: string, ip: string, threads: number): number;
|
||||||
export declare function ls(ip: string, grep: string): string[];
|
spawn(scriptname: string, threads: number): void;
|
||||||
export declare function ps(ip: string): {filename: string, threads: number, args: string[], pid: number}[];
|
kill(filename: string, ip: string, ...scriptArgs: any[]): boolean;
|
||||||
export declare function hasRootAccess(ip: string): boolean;
|
killall(ip: string): boolean;
|
||||||
export declare function getIp(): string;
|
exit(): void;
|
||||||
export declare function getHostname(): string;
|
scp(scriptname: string, ip1: string, ip2: string): boolean;
|
||||||
export declare function getHackingLevel(): number;
|
ls(ip: string, grep: string): string[];
|
||||||
export declare function getHackingMultipliers(): number;
|
ps(ip: string): {filename: string, threads: number, args: string[], pid: number}[];
|
||||||
export declare function getHacknetMultipliers(): number;
|
hasRootAccess(ip: string): boolean;
|
||||||
export declare function getBitNodeMultipliers(): number;
|
getIp(): string;
|
||||||
export declare function getServer(ip: string): any;
|
getHostname(): string;
|
||||||
export declare function getServerMoneyAvailable(ip: string): number;
|
getHackingLevel(): number;
|
||||||
export declare function getServerSecurityLevel(ip: string): number;
|
getHackingMultipliers(): number;
|
||||||
export declare function getServerBaseSecurityLevel(ip: string): number;
|
getHacknetMultipliers(): number;
|
||||||
export declare function getServerMinSecurityLevel(ip: string): number;
|
getBitNodeMultipliers(): number;
|
||||||
export declare function getServerRequiredHackingLevel(ip: string): number;
|
getServer(ip: string): any;
|
||||||
export declare function getServerMaxMoney(ip: string): number;
|
getServerMoneyAvailable(ip: string): number;
|
||||||
export declare function getServerGrowth(ip: string): number;
|
getServerSecurityLevel(ip: string): number;
|
||||||
export declare function getServerNumPortsRequired(ip: string): number;
|
getServerBaseSecurityLevel(ip: string): number;
|
||||||
export declare function getServerRam(ip: string): number[];
|
getServerMinSecurityLevel(ip: string): number;
|
||||||
export declare function getServerMaxRam(ip: string): number;
|
getServerRequiredHackingLevel(ip: string): number;
|
||||||
export declare function getServerUsedRam(ip: string): number;
|
getServerMaxMoney(ip: string): number;
|
||||||
export declare function serverExists(ip: string): boolean;
|
getServerGrowth(ip: string): number;
|
||||||
export declare function fileExists(filename: string, ip: string): boolean;
|
getServerNumPortsRequired(ip: string): number;
|
||||||
export declare function isRunning(fn: string, ip: string, ...scriptArgs: any[]): boolean;
|
getServerRam(ip: string): number[];
|
||||||
export declare function getStockSymbols(): string[];
|
getServerMaxRam(ip: string): number;
|
||||||
export declare function getStockPrice(symbol: string): number;
|
getServerUsedRam(ip: string): number;
|
||||||
export declare function getStockAskPrice(symbol: string): number;
|
serverExists(ip: string): boolean;
|
||||||
export declare function getStockBidPrice(symbol: string): number;
|
fileExists(filename: string, ip: string): boolean;
|
||||||
export declare function getStockPosition(symbol: string): number;
|
isRunning(fn: string, ip: string, ...scriptArgs: any[]): boolean;
|
||||||
export declare function getStockMaxShares(symbol: string): number;
|
getStockSymbols(): string[];
|
||||||
export declare function getStockPurchaseCost(symbol: string, shares: number, posType: string): number;
|
getStockPrice(symbol: string): number;
|
||||||
export declare function getStockSaleGain(symbol: string, shares: number, posType: string): number;
|
getStockAskPrice(symbol: string): number;
|
||||||
export declare function buyStock(symbol: string, shares: number): number;
|
getStockBidPrice(symbol: string): number;
|
||||||
export declare function sellStock(symbol: string, shares: number): number;
|
getStockPosition(symbol: string): number;
|
||||||
export declare function shortStock(symbol: string, shares: number): number;
|
getStockMaxShares(symbol: string): number;
|
||||||
export declare function sellShort(symbol: string, shares: number): number;
|
getStockPurchaseCost(symbol: string, shares: number, posType: string): number;
|
||||||
export declare function placeOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;
|
getStockSaleGain(symbol: string, shares: number, posType: string): number;
|
||||||
export declare function cancelOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;
|
buyStock(symbol: string, shares: number): number;
|
||||||
export declare function getOrders(): any;
|
sellStock(symbol: string, shares: number): number;
|
||||||
export declare function getStockVolatility(symbol: string): number;
|
shortStock(symbol: string, shares: number): number;
|
||||||
export declare function getStockForecast(symbol: string): number;
|
sellShort(symbol: string, shares: number): number;
|
||||||
export declare function getPurchasedServerLimit(): number;
|
placeOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;
|
||||||
export declare function getPurchasedServerMaxRam(): number;
|
cancelOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;
|
||||||
export declare function getPurchasedServerCost(ram: number): number;
|
getOrders(): any;
|
||||||
export declare function purchaseServer(hostname: string, ram: number): string;
|
getStockVolatility(symbol: string): number;
|
||||||
export declare function deleteServer(hostname: string): boolean;
|
getStockForecast(symbol: string): number;
|
||||||
export declare function getPurchasedServers(hostname: string): string[];
|
getPurchasedServerLimit(): number;
|
||||||
export declare function write(port: number, data: string, mode: string): boolean;
|
getPurchasedServerMaxRam(): number;
|
||||||
export declare function tryWrite(port: number, data: string): boolean;
|
getPurchasedServerCost(ram: number): number;
|
||||||
export declare function read(port: number): any;
|
purchaseServer(hostname: string, ram: number): string;
|
||||||
export declare function peek(port: number): any;
|
deleteServer(hostname: string): boolean;
|
||||||
export declare function clear(port: number): number;
|
getPurchasedServers(hostname: string): string[];
|
||||||
export declare function getPortHandle(port: number): any; // netscript port
|
write(port: number, data: string, mode: string): boolean;
|
||||||
export declare function rm(fn: string, ip: string): boolean;
|
tryWrite(port: number, data: string): boolean;
|
||||||
export declare function scriptRunning(scriptname: string, ip: string): boolean;
|
read(port: number): any;
|
||||||
export declare function scriptKill(scriptname: string, ip: string): boolean;
|
peek(port: number): any;
|
||||||
export declare function getScriptName(): string;
|
clear(port: number): number;
|
||||||
export declare function getScriptRam(scriptname: string, ip: string): number;
|
getPortHandle(port: number): any; // netscript port
|
||||||
export declare function getRunningScript(fn: string, ip: string): any; // running script
|
rm(fn: string, ip: string): boolean;
|
||||||
export declare function getHackTime(ip: string): number;
|
scriptRunning(scriptname: string, ip: string): boolean;
|
||||||
export declare function getGrowTime(ip: string): number;
|
scriptKill(scriptname: string, ip: string): boolean;
|
||||||
export declare function getWeakenTime(ip: string): number;
|
getScriptName(): string;
|
||||||
export declare function getScriptIncome(scriptname: string, ip: string): number;
|
getScriptRam(scriptname: string, ip: string): number;
|
||||||
export declare function getScriptExpGain(scriptname: string, ip: string): number;
|
getRunningScript(fn: string, ip: string): any; // running script
|
||||||
export declare function nFormat(n: number, format: string): string;
|
getHackTime(ip: string): number;
|
||||||
export declare function tFormat(milliseconds: number, milliPrecision: boolean): string;
|
getGrowTime(ip: string): number;
|
||||||
export declare function getTimeSinceLastAug(): number;
|
getWeakenTime(ip: string): number;
|
||||||
export declare function prompt(txt: string): Promise<boolean>;
|
getScriptIncome(scriptname: string, ip: string): number;
|
||||||
export declare function getFavorToDonate(): number;
|
getScriptExpGain(scriptname: string, ip: string): number;
|
||||||
export declare function universityCourse(universityName: string, className: string): boolean;
|
nFormat(n: number, format: string): string;
|
||||||
export declare function gymWorkout(gymName: string, stat: string): boolean;
|
tFormat(milliseconds: number, milliPrecision: boolean): string;
|
||||||
export declare function travelToCity(cityname: string): boolean;
|
getTimeSinceLastAug(): number;
|
||||||
export declare function purchaseTor(): boolean;
|
prompt(txt: string): Promise<boolean>;
|
||||||
export declare function purchaseProgram(programName: string): boolean;
|
getFavorToDonate(): number;
|
||||||
export declare function getCurrentServer(): any; // server object
|
universityCourse(universityName: string, className: string): boolean;
|
||||||
export declare function connect(hostname: string): boolean;
|
gymWorkout(gymName: string, stat: string): boolean;
|
||||||
export declare function manualHack(): Promise<string>;
|
travelToCity(cityname: string): boolean;
|
||||||
export declare function installBackdoor(): Promise<void>;
|
purchaseTor(): boolean;
|
||||||
export declare function getStats(): any; // complex type
|
purchaseProgram(programName: string): boolean;
|
||||||
export declare function getCharacterInformation(): any; // complex type
|
getCurrentServer(): any; // server object
|
||||||
export declare function getPlayer(): any; // complex type
|
connect(hostname: string): boolean;
|
||||||
export declare function hospitalize(): number;
|
manualHack(): Promise<string>;
|
||||||
export declare function isBusy(): boolean;
|
installBackdoor(): Promise<void>;
|
||||||
export declare function stopAction(): boolean;
|
getStats(): any; // complex type
|
||||||
export declare function upgradeHomeRam(): number;
|
getCharacterInformation(): any; // complex type
|
||||||
export declare function getUpgradeHomeRamCost(): number;
|
getPlayer(): any; // complex type
|
||||||
export declare function workForCompany(companyName: string): boolean;
|
hospitalize(): number;
|
||||||
export declare function applyToCompany(companyName: string, field: string): boolean;
|
isBusy(): boolean;
|
||||||
export declare function getCompanyRep(companyName: string): number;
|
stopAction(): boolean;
|
||||||
export declare function getCompanyFavor(companyName: string): number;
|
upgradeHomeRam(): number;
|
||||||
export declare function getCompanyFavorGain(companyName: string): number;
|
getUpgradeHomeRamCost(): number;
|
||||||
export declare function checkFactionInvitations(): string[];
|
workForCompany(companyName: string): boolean;
|
||||||
export declare function joinFaction(name: string): boolean;
|
applyToCompany(companyName: string, field: string): boolean;
|
||||||
export declare function workForFaction(name: string, type: string): boolean;
|
getCompanyRep(companyName: string): number;
|
||||||
export declare function getFactionRep(name: string): number;
|
getCompanyFavor(companyName: string): number;
|
||||||
export declare function getFactionFavor(name: string): number;
|
getCompanyFavorGain(companyName: string): number;
|
||||||
export declare function getFactionFavorGain(name: string): number;
|
checkFactionInvitations(): string[];
|
||||||
export declare function donateToFaction(name: string, amt: number): boolean;
|
joinFaction(name: string): boolean;
|
||||||
export declare function createProgram(name: string): boolean;
|
workForFaction(name: string, type: string): boolean;
|
||||||
export declare function commitCrime(crimeRoughName: string): number;
|
getFactionRep(name: string): number;
|
||||||
export declare function getCrimeChance(crimeRoughName: string): boolean;
|
getFactionFavor(name: string): number;
|
||||||
export declare function getCrimeStats(crimeRoughName: string): any; // complex type
|
getFactionFavorGain(name: string): number;
|
||||||
export declare function getOwnedAugmentations(purchased: boolean): string[];
|
donateToFaction(name: string, amt: number): boolean;
|
||||||
export declare function getOwnedSourceFiles(): any; // complex type
|
createProgram(name: string): boolean;
|
||||||
export declare function getAugmentationsFromFaction(facname: string): string[];
|
commitCrime(crimeRoughName: string): number;
|
||||||
export declare function getAugmentationPrereq(name: string): string[];
|
getCrimeChance(crimeRoughName: string): boolean;
|
||||||
export declare function getAugmentationCost(name: string): number;
|
getCrimeStats(crimeRoughName: string): any; // complex type
|
||||||
export declare function getAugmentationStats(name: string): any; // complex type
|
getOwnedAugmentations(purchased: boolean): string[];
|
||||||
export declare function purchaseAugmentation(faction: string, name: string): boolean;
|
getOwnedSourceFiles(): any; // complex type
|
||||||
export declare function softReset(cbScript: string): void;
|
getAugmentationsFromFaction(facname: string): string[];
|
||||||
export declare function installAugmentations(cbScript: string): void;
|
getAugmentationPrereq(name: string): string[];
|
||||||
export declare function exploit(): void;
|
getAugmentationCost(name: string): number;
|
||||||
export declare function bypass(doc: any): void;
|
getAugmentationStats(name: string): any; // complex type
|
||||||
export declare function flags(data: any): any;
|
purchaseAugmentation(faction: string, name: string): boolean;
|
||||||
|
softReset(cbScript: string): void;
|
||||||
|
installAugmentations(cbScript: string): void;
|
||||||
|
exploit(): void;
|
||||||
|
bypass(doc: any): void;
|
||||||
|
flags(data: any): any;
|
||||||
|
}`
|
@ -19,7 +19,7 @@ import { calculateRamUsage } from "../../Script/RamCalculations";
|
|||||||
import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes";
|
import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes";
|
||||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
import { CursorPositions } from "../../ScriptEditor/CursorPositions";
|
import { CursorPositions } from "../../ScriptEditor/CursorPositions";
|
||||||
import * as NetscriptDefinitions from "../NetscriptDefinitions";
|
import { libSource } from "../NetscriptDefinitions";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
filename: string;
|
filename: string;
|
||||||
@ -202,24 +202,8 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function beforeMount(monaco: any): void {
|
function beforeMount(monaco: any): void {
|
||||||
|
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, 'netscript.d.ts');
|
||||||
// extra libraries
|
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, 'netscript.d.ts');
|
||||||
const libSource = `
|
|
||||||
export declare function upgradeHomeRam(): number;
|
|
||||||
export declare function getUpgradeHomeRamCost(): number;
|
|
||||||
export declare function workForCompany(companyName: string): boolean;
|
|
||||||
export declare function applyToCompany(companyName: string, field: string): boolean;
|
|
||||||
export declare function getCompanyRep(companyName: string): number;
|
|
||||||
export declare function getCompanyFavor(companyName: string): number;
|
|
||||||
export declare function getCompanyFavorGain(companyName: string): number;
|
|
||||||
export declare function checkFactionInvitations(): string[];
|
|
||||||
export declare function joinFaction(name: string): boolean;
|
|
||||||
export declare function workForFaction(name: string, type: string): boolean;
|
|
||||||
export declare function getFactionRep(name: string): number;
|
|
||||||
export declare function getFactionFavor(name: string): number;`;
|
|
||||||
|
|
||||||
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource);
|
|
||||||
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (<div id="script-editor-wrapper">
|
return (<div id="script-editor-wrapper">
|
||||||
@ -233,7 +217,7 @@ export declare function getFactionFavor(name: string): number;`;
|
|||||||
onMount={onMount}
|
onMount={onMount}
|
||||||
loading={<p>Loading script editor!</p>}
|
loading={<p>Loading script editor!</p>}
|
||||||
height="80%"
|
height="80%"
|
||||||
defaultLanguage="javascript"
|
defaultLanguage="typescript"
|
||||||
defaultValue={code}
|
defaultValue={code}
|
||||||
value={code}
|
value={code}
|
||||||
onChange={updateCode}
|
onChange={updateCode}
|
||||||
|
Loading…
Reference in New Issue
Block a user