zettelkasten/OneNoteExport/Schnelle_Notizen/Online Spiele/07_Dev.js.md
2023-08-17 19:32:37 +02:00

56 lines
754 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Dev.js
Dienstag, 15. Februar 2022
09:22
 
 
/\*\* \@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) {
ns.tprintf(\"INFO className: \\\"\" + box.className + \"\\\"\");
let props = getProps(box);
// get a 10% cash bonus
//props.player.money = props.player.money \* 1.1;
// open dev menu
//props.router.toDevMenu();
ns.tprintf(\"/\" + props);
}
}