Merge branch 'main' of https://gitea.goetje-ing.de/ArchitectsOfTheBitburner/The_Bitburner_Scripts
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
let aCitites = ["Sector-12", "Aevum", "Volhaven", "Chongqing", "New Tokyo", "Ishima"];
|
||||
let sCorpName = "RM Enterprises";
|
||||
let sDivisionName = "Agri-Ram";
|
||||
let reset = ns.args[0];
|
||||
if (reset === true || !ns.fileExists("CorpStatus.txt")) {
|
||||
@@ -14,6 +15,14 @@ export async function main(ns) {
|
||||
let oOfficeData = {};
|
||||
let oWarehouseData = {};
|
||||
let bUnlockStatus = false;
|
||||
nListenPID = ns.run("/corp/HasCorp.js");
|
||||
await ns.nextPortWrite(nListenPID);
|
||||
let bCorpExists = ns.readPort(nListenPID);
|
||||
if (!bCorpExists) {
|
||||
nListenPID = ns.run("/corp/CreateCorp.js", 1, sCorpName);
|
||||
await ns.nextPortWrite(nListenPID);
|
||||
}
|
||||
if (!ns.readPort(nListenPID)) { ns.tprint("Error! Couldn't start Corporation!"); return };
|
||||
ns.tprint(oCorpStatus);
|
||||
while (nStep < 199) {
|
||||
nStep = oCorpStatus.nStep;
|
||||
@@ -79,9 +88,24 @@ export async function main(ns) {
|
||||
nListenPID = ns.run("/corp/HireWorkers.js", 1, sDivisionName, sCity, JSON.stringify(oOfficeData));
|
||||
await ns.nextPortWrite(nListenPID);
|
||||
}
|
||||
oCorpStatus.nStep = 200;
|
||||
oCorpStatus.nStep = 50;
|
||||
break;
|
||||
case 50:
|
||||
let aCurrentGoods = [
|
||||
{"sMaterialName":"Food","yAmount":"MAX","yPrice":"MP"},
|
||||
{"sMaterialName":"Plants","yAmount":"MAX","yPrice":"MP"}
|
||||
]
|
||||
aCurrentGoods.forEach(async (entry) =>{
|
||||
for (let sCity of aCitites) {
|
||||
forEach
|
||||
nListenPID = ns.run("/corp/SetSalePrices.js", 1, sDivisionName, sCity, oCurrentGoods);
|
||||
await ns.nextPortWrite(nListenPID);
|
||||
oOfficeData = ns.readPort(nListenPID);
|
||||
ns.tprint(oOfficeData);
|
||||
nListenPID = ns.run("/corp/HireWorkers.js", 1, sDivisionName, sCity, JSON.stringify(oOfficeData));
|
||||
await ns.nextPortWrite(nListenPID);
|
||||
}})
|
||||
oCorpStatus.nStep = 200;
|
||||
break;
|
||||
case 60:
|
||||
break;
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function main(ns) {
|
||||
let nMaxRam;
|
||||
let nScripts;
|
||||
|
||||
serverList.forEach((entry) => {
|
||||
serverList.forEach(async (entry) => {
|
||||
//let rootAccess = ns.hasRootAccess(currentServer);
|
||||
|
||||
//ns.tprint(entry.serverName + " sTarget = " + sTarget);
|
||||
|
||||
7
Ramses/home/corp/CreateCorp.js
Normal file
7
Ramses/home/corp/CreateCorp.js
Normal file
@@ -0,0 +1,7 @@
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
let [sCorpName] = ns.args;
|
||||
ns.corporation.createCorporation(sCorpName,false)
|
||||
ns.writePort(ns.pid, true);
|
||||
}
|
||||
|
||||
5
Ramses/home/corp/HasCorp.js
Normal file
5
Ramses/home/corp/HasCorp.js
Normal file
@@ -0,0 +1,5 @@
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
ns.writePort(ns.pid,ns.corporation.hasCorporation());
|
||||
}
|
||||
|
||||
7
Ramses/home/corp/SetSalePrices.js
Normal file
7
Ramses/home/corp/SetSalePrices.js
Normal file
@@ -0,0 +1,7 @@
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
let [sDivName, sCity, oCurrentGoods] = ns.args;
|
||||
oCurrentGoods = JSON.parse(oCurrentGoods);
|
||||
ns.corporation.sellMaterial(sDivName,sCity,oCurrentGoods.sMaterialName,oCurrentGoods.yAmount,oCurrentGoods.yPrice);
|
||||
ns.writePort(ns.pid, true);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user