2024-10-07 00:14:30 +02:00
8 changed files with 45 additions and 17 deletions

View File

@@ -0,0 +1,7 @@
/** @param {NS} ns */
export async function main(ns, divName) {
let cities = ["Sector-12", "Aevum", "Volhaven", "Chongqing", "New Tokyo", "Ishima"];
for (let city of cities) {
ns.corporation.expandCity(divName,city)
}
}

View File

@@ -1,5 +1,6 @@
/** @param {NS} ns */ /** @param {NS} ns */
export async function main(ns, newDivName) { export async function main(ns) {
let newDivName = ns.args[0]
ns.corporation.expandIndustry("Agriculture",newDivName); ns.corporation.expandIndustry("Agriculture",newDivName);
ns.run() ns.run("CorpExpandCity.js",1,newDivName)
} }

View File

@@ -1,4 +1,4 @@
import { getGrowThreads } from "Library.js"; import { getGrowThreads, getSetting } from "Library.js";
/** @param {NS} ns */ /** @param {NS} ns */
export async function main(ns) { export async function main(ns) {
@@ -20,6 +20,8 @@ export async function main(ns) {
const sWeakenScript = "RMweaken.js"; const sWeakenScript = "RMweaken.js";
const sGrowScript = "RMgrow.js"; const sGrowScript = "RMgrow.js";
const sHackScript = "RMhack.js"; const sHackScript = "RMhack.js";
const sLibraryScript = "Library.js"
const sSettingsFile = "settings.txt"
const nWeakenThreads = 1; //5 const nWeakenThreads = 1; //5
const nHackThreads = 1; //1 const nHackThreads = 1; //1
@@ -31,7 +33,8 @@ export async function main(ns) {
const nGrowScriptRAM = 1.7 * nGrowThreads; const nGrowScriptRAM = 1.7 * nGrowThreads;
//ns.tprint("nGrowScriptRAM = " + nGrowScriptRAM); //ns.tprint("nGrowScriptRAM = " + nGrowScriptRAM);
const nFrequency = 50; //const nFrequency = 50;
const nFrequency = getSetting(ns, "batchFrequency");
let nScriptsRAM; let nScriptsRAM;
let nMaxRam; let nMaxRam;
let nScripts; let nScripts;
@@ -65,6 +68,8 @@ export async function main(ns) {
ns.scp(sWeakenScript, entry.serverName, "home"); ns.scp(sWeakenScript, entry.serverName, "home");
ns.scp(sGrowScript, entry.serverName, "home"); ns.scp(sGrowScript, entry.serverName, "home");
ns.scp(sHackScript, entry.serverName, "home"); ns.scp(sHackScript, entry.serverName, "home");
ns.scp(sLibraryScript, entry.serverName, "home");
ns.scp(sSettingsFile, entry.serverName, "home");
ns.exec(sScript, entry.serverName, 1, sTarget, nFrequency, true, false); ns.exec(sScript, entry.serverName, 1, sTarget, nFrequency, true, false);
await ns.sleep(1); await ns.sleep(1);
} }
@@ -74,7 +79,6 @@ export async function main(ns) {
ns.scriptKill(sWeakenScript, entry.serverName); ns.scriptKill(sWeakenScript, entry.serverName);
ns.scriptKill(sGrowScript, entry.serverName); ns.scriptKill(sGrowScript, entry.serverName);
ns.scriptKill(sHackScript, entry.serverName); ns.scriptKill(sHackScript, entry.serverName);
ns.scp(sShareScript, entry.serverName); ns.scp(sShareScript, entry.serverName);
let nShare = Math.floor(((ns.getServerMaxRam(entry.serverName) - ns.getServerUsedRam(entry.serverName)) / ns.getScriptRam(sShareScript))); let nShare = Math.floor(((ns.getServerMaxRam(entry.serverName) - ns.getServerUsedRam(entry.serverName)) / ns.getScriptRam(sShareScript)));

View File

@@ -175,7 +175,7 @@ export async function purchaseAndUpgradeServers(ns) {
if (pServcount >= 9) { if (pServcount >= 9) {
sFrontZero = ""; sFrontZero = "";
} }
let hostname = ns.purchaseServer("pserv-" + sFrontZero + (aServers.length), targetRamInitial); let hostname = ns.purchaseServer("pserv-" + sFrontZero + pServcount, targetRamInitial);
ns.tprint("Purchased " + cCyan + hostname + cReset); ns.tprint("Purchased " + cCyan + hostname + cReset);
ns.toast("Purchased " + hostname, "info", 10000); ns.toast("Purchased " + hostname, "info", 10000);
pServcount = listPurchasedServers(ns).length; pServcount = listPurchasedServers(ns).length;

View File

@@ -0,0 +1,13 @@
import { getCracks, crackingAndRooting, findBestTarget } from "Library.js";
/** @param {NS} ns */
export async function main(ns) {
let cracks = {};
cracks = getCracks(ns);
let maxPorts = Object.keys(cracks).length;
findBestTarget(ns, 999, maxPorts, ns.getHackingLevel(),"");
let bestTarget = ns.read("bestTarget.txt")
ns.tprint("Best Target: " + bestTarget);
ns.tprint(Object.keys(JSON.parse(ns.read("serverList.txt"))).length);
crackingAndRooting(ns, cracks);
}

View File

@@ -1,5 +1,5 @@
import { purchaseServers, listPurchasedServers, getSetting } from "myLibrary.js"; import { purchaseAndUpgradeServers, listPurchasedServers, getSetting } from "Library.js";
/** @param {NS} ns */ /** @param {NS} ns */
@@ -23,7 +23,7 @@ export async function main(ns) {
//scripts //scripts
const sGangScript = "gang/auto-gang2.js"; const sGangScript = "gang/auto-gang2.js";
const sServerLister = "serverlister.js"; const sServerLister = "Serverlist.js";
const sServerListFile = "serverList.txt"; const sServerListFile = "serverList.txt";
const sBestServerFile = "bestTarget.txt"; const sBestServerFile = "bestTarget.txt";
const sBackdoorScript = "backdoor.js"; const sBackdoorScript = "backdoor.js";
@@ -31,7 +31,7 @@ export async function main(ns) {
//settings //settings
const nRefreshFrequency = 1000; //time in ms const nRefreshFrequency = 1000; //time in ms
ns.exec(sServerLister, sThisRunner, 1, false, true); //ns.exec(sServerLister, sThisRunner, 1, false, true);
await ns.sleep(100); await ns.sleep(100);
let oBestTarget = JSON.parse(ns.read("bestTarget.txt")); let oBestTarget = JSON.parse(ns.read("bestTarget.txt"));
@@ -52,11 +52,10 @@ export async function main(ns) {
//Gang //Gang
ns.print("Karma = " + cCyan + Math.round(ns.heart.break()).toLocaleString() + cReset); ns.print("Karma = " + cCyan + Math.round(ns.heart.break()).toLocaleString() + cReset);
if (ns.gang.inGang()) { if (ns.gang.inGang()) {
ns.print("Gang found... running " + sGangScript);
if (!ns.getRunningScript(sGangScript)) { if (!ns.getRunningScript(sGangScript)) {
ns.print("Gang found... running " + sGangScript);
ns.exec(sGangScript, sThisRunner, 1); ns.exec(sGangScript, sThisRunner, 1);
} }
} }
else { else {
ns.print("Gang: " + cRed + "none" + cReset); ns.print("Gang: " + cRed + "none" + cReset);
@@ -104,8 +103,9 @@ export async function main(ns) {
//Home Upgrades //Home Upgrades
if (nMoney > ns.singularity.getUpgradeHomeRamCost()) { if (nMoney > ns.singularity.getUpgradeHomeRamCost()) {
let nHomeRAMUpgradeCost = ns.singularity.getUpgradeHomeRamCost();
ns.singularity.upgradeHomeRam(); ns.singularity.upgradeHomeRam();
ns.tprint(cCyan + "Upgraded home RAM" + cReset); ns.tprint(cCyan + "Upgraded home RAM to " + (nHomeMaxRAM*2) + " for " + nHomeRAMUpgradeCost + cReset);
} }
else if (nCores < 8 && nMoney > ns.singularity.getUpgradeHomeCoresCost()) { else if (nCores < 8 && nMoney > ns.singularity.getUpgradeHomeCoresCost()) {
ns.singularity.upgradeHomeCores(); ns.singularity.upgradeHomeCores();
@@ -196,14 +196,15 @@ export async function main(ns) {
} }
else if (getSetting(ns, "autoPurchaseServers") && nPServs < 25 && nMoney >= 5e+6) { //Purchased Servers else if (getSetting(ns, "autoPurchaseServers") && nPServs < 25 && nMoney >= 5e+6) { //Purchased Servers
ns.tprint("purchasing servers "); ns.tprint("purchasing servers ");
await purchaseServers(ns); //await purchaseServers(ns);
await purchaseAndUpgradeServers(ns);
ns.exec(sServerLister, sThisRunner, 1, false, true); ns.exec(sServerLister, sThisRunner, 1, false, true);
} }
else if (getSetting(ns, "autoUpgrades") && nLowestRAM < (2 ** 20) && !ns.scriptRunning("upgrade.js", sThisRunner) && nPServs >= 25 && nMoney >= 1e+6) { /*else if (getSetting(ns, "autoUpgrades") && nLowestRAM < (2 ** 20) && !ns.scriptRunning("upgrade.js", sThisRunner) && nPServs >= 25 && nMoney >= 1e+6) {
ns.tprint("upgrading servers "); ns.tprint("upgrading servers ");
ns.exec("upgrade.js", sThisRunner, 1); ns.exec("upgrade.js", sThisRunner, 1);
} }*/
//ns.tprint("autoPurchaseServers = " + getSetting(ns, "autoPurchaseServers")); //ns.tprint("autoPurchaseServers = " + getSetting(ns, "autoPurchaseServers"));
//ns.tprint("autoUpgrades = " + getSetting(ns, "autoUpgrades")); //ns.tprint("autoUpgrades = " + getSetting(ns, "autoUpgrades"));

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,6 @@
{"setting":{ {"setting":{
"autoUpgrades":true, "autoUpgrades":true,
"autoPurchaseServers":true "autoPurchaseServers":true,
"batchHacks":100,
"batchFrequency":50
}} }}