Philipp
2024-10-07 22:38:27 +02:00
14 changed files with 193 additions and 33 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
Mizzajl/home/bestTarget.txt
Mizzajl/home/ServerRouteList.txt
Mizzajl/home/serverList.txt

View File

@@ -49,7 +49,7 @@ export async function main(ns) {
//nScriptsRAM = ns.getScriptRam(sScript, "home") + Math.max(nWeakenScriptRAM, nGrowScriptRAM, nHackScriptRAM);
//ns.tprint("nScriptsRAM = " + nScriptsRAM);
if (entry.maxRam >= 64 && serverList[name].rootAccess === true) {
if (entry.maxRam >= 20 && serverList[name].rootAccess === true) {
if (sOverrideTarget !== undefined) {
sTarget = sOverrideTarget;
@@ -73,7 +73,7 @@ export async function main(ns) {
ns.exec(sScript, entry.serverName, 1, sTarget, nFrequency, true, false);
await ns.sleep(1);
}
else if (entry.maxRam < 64 && entry.maxRam > 0 && serverList[name].rootAccess === true) {
else if (entry.maxRam < 20 && entry.maxRam > 0 && serverList[name].rootAccess === true) {
ns.scriptKill(sScript, entry.serverName);
ns.scriptKill(sShareScript, entry.serverName);
ns.scriptKill(sWeakenScript, entry.serverName);

View File

@@ -1 +1 @@
{"home":{"n00dles":{"nectar-net":{"phantasy":{"netlink":{},"crush-fitness":{},"avmnite-02h":{"rothman-uni":{},"summit-uni":{},"syscore":{"lexo-corp":{"global-pharm":{"deltaone":{"defcomm":{"taiyang-digital":{"applied-energetics":{"stormtech":{".":{"nwo":{"ecorp":{},"The-Cave":{}}}}},"run4theh111z":{"fulcrumtech":{"omnitek":{"clarkinc":{}}},"vitalife":{"4sigma":{"b-and-a":{}}}}}},"icarus":{"nova-med":{"microdyne":{"helios":{"kuai-gong":{"blade":{"megacorp":{}},"powerhouse-fitness":{"fulcrumassets":{}}}}}}}}}},"rho-construction":{},"millenium-fitness":{"aerocorp":{"omnia":{"solaris":{}}},"snap-fitness":{"unitalife":{"univ-energy":{"infocomm":{}},"zeus-med":{"zb-def":{"titan-labs":{}}}}}}}}}}},"foodnstuff":{},"sigma-cosmetics":{"zer0":{"omega-net":{"the-hub":{},"johnson-ortho":{}}},"max-hardware":{}},"joesguns":{},"hong-fang-tea":{},"harakiri-sushi":{},"iron-gym":{"CSEC":{"neo-net":{"computek":{"zb-institute":{"alpha-ent":{},"aevum-police":{"galactic-cyber":{}}},"catalyst":{},"I.I.I.I":{}}},"silver-helix":{}}},"darkweb":{}}}
{"home":{"n00dles":{"CSEC":{}},"foodnstuff":{"zer0":{"phantasy":{"crush-fitness":{"rothman-uni":{"aevum-police":{"global-pharm":{"omnia":{"icarus":{"taiyang-digital":{}},"solaris":{"zb-def":{"titan-labs":{"stormtech":{"4sigma":{"blade":{"ecorp":{}},"nwo":{"fulcrumassets":{}}},".":{"powerhouse-fitness":{"The-Cave":{}}}},"vitalife":{"omnitek":{"b-and-a":{"megacorp":{}}}}},"applied-energetics":{},"run4theh111z":{"fulcrumtech":{"kuai-gong":{"clarkinc":{}}},"helios":{}}}}},"deltaone":{"defcomm":{},"univ-energy":{"infocomm":{"microdyne":{}},"nova-med":{}}}}}},"catalyst":{"millenium-fitness":{"galactic-cyber":{"unitalife":{"zeus-med":{}}},"aerocorp":{}}}}}},"nectar-net":{"neo-net":{"computek":{"syscore":{"rho-construction":{"snap-fitness":{}}}}},"silver-helix":{"johnson-ortho":{"summit-uni":{},"I.I.I.I":{"lexo-corp":{}}}},"omega-net":{"the-hub":{"zb-institute":{"alpha-ent":{}}},"netlink":{},"avmnite-02h":{}}}},"sigma-cosmetics":{},"joesguns":{"max-hardware":{}},"hong-fang-tea":{},"harakiri-sushi":{},"iron-gym":{}}}

13
Mizzajl/home/ShareHome.js Normal file
View File

@@ -0,0 +1,13 @@
/** @param {NS} ns */
export async function main(ns) {
const bKill = ns.args[0]; // if true kill all existing processess
const sShareScript = "factionboost.js";
if (bKill) { ns.killall("home"); }
else { ns.scriptKill(sShareScript, "home"); }
let nShare = Math.floor(((ns.getServerMaxRam("home") - ns.getServerUsedRam("home")) / ns.getScriptRam(sShareScript)));
if (nShare > 0) {
ns.exec(sShareScript, "home", nShare);
}
}

37
Mizzajl/home/Start.js Normal file
View File

@@ -0,0 +1,37 @@
/** @param {NS} ns */
export async function main(ns) {
ns.tail();
const sServerListScript = "Serverlist.js";
const sGangScript = "gang/auto-gang2.js";
const sPServScript = "purchaseServers.js";
const sBatchController = "EveryServerRun.js";
const sBackdoorScript = "backdoor.js";
const sUpdateTarget = "Updatebesttarget.js"
const sMonitorScript = "autoexec.js"
const sServerListFile = "serverList.txt";
const sBestServerFile = "bestTarget.txt";
if (!ns.isRunning(sServerListScript)){ns.run(sServerListScript);}
while(ns.isRunning(sServerListScript)){await ns.sleep(100);}
if (!ns.isRunning(sGangScript)){ns.run(sGangScript);}
if (!ns.isRunning(sPServScript)){ns.run(sPServScript);}
if (!ns.isRunning(sBackdoorScript)){ns.run(sBackdoorScript);}
while(ns.isRunning(sBackdoorScript)){await ns.sleep(100);}
if (!ns.isRunning(sUpdateTarget)){ns.run(sUpdateTarget);}
while(ns.isRunning(sUpdateTarget)){await ns.sleep(100);}
if (!ns.isRunning(sBatchController)){ns.run(sBatchController, 1, "n00dles");}
while(ns.isRunning(sBatchController)){await ns.sleep(100);}
if (!ns.isRunning(sMonitorScript)){ns.run(sMonitorScript);}
}

View File

@@ -5,7 +5,7 @@ export async function main(ns) {
let cracks = {};
cracks = getCracks(ns);
let maxPorts = Object.keys(cracks).length;
findBestTarget(ns, 999, maxPorts, ns.getHackingLevel(),"");
findBestTarget(ns, 999, maxPorts, ns.getHackingLevel(),"n00dles");
let bestTarget = ns.read("bestTarget.txt")
ns.tprint("Best Target: " + bestTarget);
ns.tprint(Object.keys(JSON.parse(ns.read("serverList.txt"))).length);

View File

@@ -5,13 +5,15 @@ export async function main(ns) {
goals
get money
upgrade home ram
/*
*/
let nPID = ns.run("serverlister.js");
while (ns.getRunningScript(nPID)){
/*
let nPID = ns.run("serverlister.js");
while (ns.getRunningScript(nPID)){
ns.tprint("waiting for script to finish");
await ns.sleep(100);
}
}
*/

View File

@@ -28,6 +28,7 @@ export async function main(ns) {
const nHackScriptRAM = 1.75;
const nGrowScriptRAM = 1.7;
const nWeakenScriptRAM = 1.75;
const nThisScriptRAM = 7.25;
//abort script if sTarget is undefined
@@ -97,6 +98,7 @@ export async function main(ns) {
nCurrentSecurity = ns.getServerSecurityLevel(sTarget);
nCurrentMoney = ns.getServerMoneyAvailable(sTarget);
/*
nBonusWeaken = 0;
if (nCurrentSecurity > nMinSecurity + 3) {
nBonusWeaken = 4;
@@ -105,7 +107,7 @@ export async function main(ns) {
if (nCurrentMoney <= nMaxMoney * 0.8) {
nBonusGrow = 11;
}
*/
nGrowThreads = Math.max(1 + nBonusGrow, getGrowThreads(ns, sTarget, nHackThreads));
nGrowThreadsINT = Math.ceil(nGrowThreads);
@@ -125,14 +127,14 @@ export async function main(ns) {
nUsedRAM = ns.getServerUsedRam(sRunner);
nFreeRam = nMaxRAM - nUsedRAM;
while (nFreeRam <= (nWeakenScriptRAM * nWeakenThreads) + nHomeServerReserve + 6) {
while (nFreeRam <= (nWeakenScriptRAM * nWeakenThreads) + nThisScriptRAM) {
await ns.sleep(100);
nMaxRAM = ns.getServerMaxRam(sRunner);
nUsedRAM = ns.getServerUsedRam(sRunner);
nFreeRam = nMaxRAM - nUsedRAM;
}
if (nFreeRam > (nWeakenScriptRAM * nWeakenThreads) + nHomeServerReserve + 6) {
if (nFreeRam > (nWeakenScriptRAM * nWeakenThreads) + nThisScriptRAM) {
//Calculate estimate time of completion
nOffset = ns.getWeakenTime(sTarget);
let nWeakTime = new Date(currentDate.getTime() + nOffset);
@@ -149,7 +151,7 @@ export async function main(ns) {
nUsedRAM = ns.getServerUsedRam(sRunner);
nFreeRam = nMaxRAM - nUsedRAM;
while (nFreeRam <= (nGrowScriptRAM * nGrowThreads) + nHomeServerReserve + 6) {
while (nFreeRam <= (nGrowScriptRAM * nGrowThreads) + nThisScriptRAM) {
await ns.sleep(100);
nMaxRAM = ns.getServerMaxRam(sRunner);
nUsedRAM = ns.getServerUsedRam(sRunner);
@@ -157,7 +159,7 @@ export async function main(ns) {
}
if (nCurrentSecurity <= (nMinSecurity + 1) && nFreeRam > (nGrowScriptRAM * nGrowThreads) + nHomeServerReserve + 6) {
if (nCurrentSecurity <= (nMinSecurity + 1) && nFreeRam > (nGrowScriptRAM * nGrowThreads) + nThisScriptRAM) {
//Calculate estimate time of completion
nOffset = ns.getGrowTime(sTarget);
@@ -175,7 +177,7 @@ export async function main(ns) {
nUsedRAM = ns.getServerUsedRam(sRunner);
nFreeRam = nMaxRAM - nUsedRAM;
while (nFreeRam <= (nHackScriptRAM * nHackThreads) + nHomeServerReserve + 6) {
while (nFreeRam <= (nHackScriptRAM * nHackThreads) + nThisScriptRAM) {
await ns.sleep(100);
nMaxRAM = ns.getServerMaxRam(sRunner);
nUsedRAM = ns.getServerUsedRam(sRunner);
@@ -183,7 +185,7 @@ export async function main(ns) {
}
if (nCurrentMoney >= nMaxMoney * 0.8 && nFreeRam > (nHackScriptRAM * nHackThreads) + nHomeServerReserve + 6) {
if (nCurrentMoney >= nMaxMoney * 0.8 && nFreeRam > (nHackScriptRAM * nHackThreads) + nThisScriptRAM) {
//Calculate estimate time of completion
nOffset = ns.getHackTime(sTarget);

View File

@@ -1 +1 @@
{"serverName":"the-hub","maxRam":64,"maxMoney":440206450.3125,"minSec":13,"minPorts":2,"minHackLvl":298,"rootAccess":true,"openPorts":0,"serverOrgs":"The Hub","serverCores":2,"serverFiles":[]}
{"serverName":"n00dles","maxRam":4,"maxMoney":70000,"minSec":1,"minPorts":0,"minHackLvl":1,"rootAccess":true,"openPorts":0,"serverOrgs":"Noodle Bar","serverCores":1,"serverFiles":["factionboost.js"]}

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -15,12 +15,12 @@ export async function main(ns) {
const nServ = ns.getPurchasedServers();
const sShareScript = "factionboost.js";
let nScripts = 0;
//let nScripts = 0;
//kill all scripts
for (let i = 0; i < nServ.length; i++) {
nScripts = Math.floor(ns.getServerMaxRam(nServ[i]) / ns.getScriptRam(sShareScript));
//nScripts = Math.floor(ns.getServerMaxRam(nServ[i]) / ns.getScriptRam(sShareScript));
if (bKill) { ns.killall(nServ[i]); }
else { ns.scriptKill(sShareScript, nServ[i]); }

78
Mizzajl/home/wip/hgw.js Normal file
View File

@@ -0,0 +1,78 @@
import { getGrowThreads, getSetting } from "Library.js";
/** @param {NS} ns */
export async function main(ns) {
ns.tail();
const sTarget = ns.args[0]; // target server
const sHackScript = "RMhack.js";
const sGrowScript = "RMgrow.js";
const sWeakenScript = "RMweaken.js";
const sServerListFile = "serverList.txt";
const nHackScriptRAM = 1.75;
const nGrowScriptRAM = 1.7;
const nWeakenScriptRAM = 1.75;
const nThisScriptRAM = 4.65;
while (true) {
//let nMaxRAM = ns.getServerMaxRam("home");
let oServerlist = JSON.parse(ns.read(sServerListFile));
//let nMaxRAM = [name, entry] of Object.entries(oServerlist);
let nMaxRAM = oServerlist["home"].maxRam;
//ns.print("nMaxRAM = " + nMaxRAM);
let nWeakenTime = ns.getWeakenTime(sTarget);
let nGrowTime = nWeakenTime * 0.8;
let nHackTime = nWeakenTime / 4;
let nGrowDelay = nWeakenTime - nGrowTime;
let nHackDelay = nWeakenTime - nHackTime;
let nUsedRAM = 0;
let nHackThreads;
let nGrowThreads;
let nGrowThreadsINT;
let nWeakenThreads;
let nWeakenThreadsINT;
for (let i = 0; nUsedRAM < nMaxRAM - nThisScriptRAM; i++) {
nHackThreads = i;
nGrowThreads = Math.max(2, getGrowThreads(ns, sTarget, nHackThreads));
nGrowThreadsINT = Math.ceil(nGrowThreads);
//25 hacks or 12.5 grows
nWeakenThreads = Math.max(2, (nHackThreads / 25) + (nGrowThreads / 12.5));
nWeakenThreadsINT = Math.ceil(nWeakenThreads);
nUsedRAM = nThisScriptRAM + (nHackThreads * nHackScriptRAM) + (nGrowThreadsINT * nGrowScriptRAM) + (nWeakenThreadsINT * nWeakenScriptRAM);
//ns.print("nMaxRAM = " + nMaxRAM + " nUsedRAM = " + nUsedRAM);
}
ns.print("nMaxRAM = " + nMaxRAM + " nUsedRAM = " + nUsedRAM);
let nHackPID = ns.run(sHackScript, nHackThreads, sTarget, false, nHackDelay - 100);
let nGrowPID = ns.run(sGrowScript, nGrowThreadsINT, sTarget, false, nGrowDelay - 50);
let nWeakenPID = ns.run(sWeakenScript, nWeakenThreadsINT, sTarget, false, 0);
//ns.tail(nHackPID, "home", nHackThreads, sTarget, false, nHackDelay - 100);
//ns.tail(nGrowPID, "home", nGrowThreadsINT, sTarget, false, nGrowDelay - 50);
//ns.tail(nWeakenPID, "home", nWeakenThreadsINT, sTarget, false, 0);
await Promise.all([
ns.nextPortWrite(nHackPID),
ns.nextPortWrite(nGrowPID),
ns.nextPortWrite(nWeakenPID)
])
await ns.sleep(1);
let nHackFinnish = ns.readPort(nHackPID);
let nGrowFinnish = ns.readPort(nGrowPID);
let nWeakenFinnish = ns.readPort(nWeakenPID);
ns.print("nHackFinnish = " + nHackFinnish);
ns.print("nGrowFinnish = " + nGrowFinnish);
ns.print("nWeakenFinnish = " + nWeakenFinnish);
}
}

View File

@@ -1,24 +1,49 @@
/** @param {NS} ns */
export async function main(ns) {
let aFactions = ns.getPlayer().factions;
const aOwnedAugmentations = ns.singularity.getOwnedAugmentations(true);
//ns.tprint("aOwnedAugmentations = " + aOwnedAugmentations);
const aFactions = ns.getPlayer().factions;
ns.tprint("aFactions = " + aFactions);
let aAugmentations;
let sStats;
let aStats;
for (let f = 0; f < aFactions.length; f++) {
//ns.tprint("f = " + f);
//sFaction = ns.singularity.faction
//loop throught the factions
ns.tprint("Faction = " + aFactions[f]);
aAugmentations = ns.singularity.getAugmentationsFromFaction(aFactions[f]);
ns.tprint("aAugmentations = " + aAugmentations);
ns.tprint("----------------------------------------------------------------------------------------------------------------------------------------------------------");
for (let a = 0; a < aFactions.length; a++) {
sStats = JSON.stringify(ns.singularity.getAugmentationStats(aAugmentations[a]));
ns.tprint(aAugmentations[f] + "sStats = " + sStats);
let aAvailableAugmentations = aAugmentations.filter(item => !aOwnedAugmentations.includes(item)); //ChatGPT
//ns.tprint("aAugmentations = " + aAugmentations);
ns.tprint("aAvailableAugmentations = " + aAvailableAugmentations);
ns.tprint("----------------------------------------------------------------------------------------------------------------------------------------------------------");
for (let a = 0; a < aAvailableAugmentations.length; a++) {
//loop throught their aumentations
//if (aOwnedAugmentations.includes(aAvailableAugmentations[a]) === false) {
//JSON.stringify(ns.singularity.getAugmentationStats(aAvailableAugmentations[a]));
let oStats = ns.singularity.getAugmentationStats(aAvailableAugmentations[a]);
ns.tprint(aAvailableAugmentations[a]);
let nAugmentationReputation = ns.singularity.getAugmentationRepReq(aAvailableAugmentations[a]);
let sAugmentationPrereq = ns.singularity.getAugmentationPrereq(aAvailableAugmentations[a]);
let nAugmentationPrice = ns.singularity.getAugmentationPrice(aAvailableAugmentations[a]);
ns.tprint("Reputation needed = " + nAugmentationReputation);
ns.tprint("Prereq = " + sAugmentationPrereq);
ns.tprint("Price = " + nAugmentationPrice);
// ChatGPT - Iterate through the object and display properties where the value is not 1
for (const key in oStats) {
if (oStats[key] !== 1) {
//console.log(`${key}: ${oStats[key]}`);
ns.tprint(`${key}: ${oStats[key]}`);
}
}
//ns.tprint(aAvailableAugmentations.filter(index !== 1) + " aStats = " + aStats);
//ns.tprint(aAvailableAugmentations[a] + " oStats = " + oStats);
ns.tprint("----------------------------------------------------------------------------------------------------------------------------------------------------------");
}
}
}