Bitburner – Tips how to open Developer Menu and edit player from code

Bitburner – Tips how to open Developer Menu and edit player from code 1 - steamlists.com
Bitburner – Tips how to open Developer Menu and edit player from code 1 - steamlists.com

Just a few lines on how to open the developer menu and edit player from code.
 
 

In a nutshell …

This should open the dev menu:
 
 

Object.entries(eval("document").getElementsByClassName("jss3 MuiBox-root")[0])
 .find(x => x[0].startsWith("__reactProps"))[1].children.props.router.toDevMenu();

 
 
The interesting objects here are player, router and maybe terminal.
 
 

var root = Object.entries(eval("document").getElementsByClassName("jss3 MuiBox-root")[0])
.find(x => x[0].startsWith("__reactProps"))[1].children.props;

var player = root.player;
var router = root.router;
var terminal = root.terminal;

// more money
player.money = 2 * player.money;

// open dev menu
router.toDevMenu();

 
 
Alternate solution using a less specific name:
 
 

/** @param {NS} ns **/

let getProps = (obj) => Object.entries(obj).find(entry => entry[0].startsWith("__reactProps"))[1].children.props;
let hasPlayer = (obj) => 
{
 try
 {
 return getProps(obj).player ? true : false;
 }
 catch(ex)
 {
 return false;
 }
}

export async function main(ns) {
 let boxes = Array.from(eval("document").querySelectorAll("[class*=MuiBox-root]"));
 let box = boxes.find(x => hasPlayer(x));

 if(box)
 {
 let props = getProps(box);

 // get a 10% cash bonus
 props.player.money = props.player.money * 1.1;

 // open dev menu
 props.router.toDevMenu();
 }
}

 
 
Use the debug console to dig deeper and find interesting properties:
 
 
Bitburner - Tips how to open Developer Menu and edit player from code - In a nutshell ... - 2A8FA98
 
 
Bitburner - Tips how to open Developer Menu and edit player from code - In a nutshell ... - 6236BA9
 
 
The DevMenu looks like this:
 
 
Bitburner - Tips how to open Developer Menu and edit player from code - In a nutshell ... - 307EE26
 
 
And remember “Only meant to be used for testing/debugging”
 
Have fun 😉
 
 

Written by makai

 
 
This is all about Bitburner – Tips how to open Developer Menu and edit player from code; I hope you enjoy reading the Guide! If you feel like we should add more information or we forget/mistake, please let us know via commenting below, and thanks! See you soon!
 
 


Be the first to comment

Leave a Reply

Your email address will not be published.


*