Library fix
This commit is contained in:
5
Ramses/home/CorpStart.js
Normal file
5
Ramses/home/CorpStart.js
Normal file
@@ -0,0 +1,5 @@
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns, newDivName) {
|
||||
ns.corporation.expandIndustry("Agriculture",newDivName);
|
||||
ns.run()
|
||||
}
|
||||
@@ -163,22 +163,22 @@ export async function purchaseAndUpgradeServers(ns) {
|
||||
ns.disableLog("getServerMaxRam");
|
||||
let maxPurchasedServers = ns.getPurchasedServerLimit();
|
||||
let purchasedServers = [];
|
||||
let count = listPurchasedServers(ns).length;
|
||||
let pServcount = listPurchasedServers(ns).length;
|
||||
let currentMoney = 0;
|
||||
let serverList = {};
|
||||
while (count < maxPurchasedServers) {
|
||||
while (pServcount < maxPurchasedServers) {
|
||||
purchasedServers = listPurchasedServers(ns);
|
||||
currentMoney = ns.getServerMoneyAvailable("home");
|
||||
let targetRamInitial = 16;
|
||||
if (ns.getPurchasedServerCost(targetRamInitial) < currentMoney) {
|
||||
let sFrontZero = "0";
|
||||
if (nServers >= 9) {
|
||||
if (pServcount >= 9) {
|
||||
sFrontZero = "";
|
||||
}
|
||||
let hostname = ns.purchaseServer("pserv-" + sFrontZero + (aServers.length), targetRamInitial);
|
||||
ns.tprint("Purchased " + cCyan + hostname + cReset);
|
||||
ns.toast("Purchased " + hostname, "info", 10000);
|
||||
count = listPurchasedServers(ns).length;
|
||||
pServcount = listPurchasedServers(ns).length;
|
||||
serverList = JSON.parse(ns.read("serverList.txt"));
|
||||
serverList[hostname] = {
|
||||
serverName: hostname,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCracks, scanServerList, findBestTarget, crackingAndRooting, copyAndRunScript, purchaseAndUpgradeServers } from "/RamsesUtils.js";
|
||||
import { getCracks, scanServerList, findBestTarget, crackingAndRooting, copyAndRunScript, purchaseAndUpgradeServers } from "/Library.js";
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
await purchaseAndUpgradeServers(ns);
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user