cleaning up my stuff a bit
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;
|
||||
@@ -75,13 +84,26 @@ export async function main(ns) {
|
||||
nListenPID = ns.run("/corp/GetOfficeData.js", 1, sDivisionName, sCity);
|
||||
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;
|
||||
oCorpStatus.nStep = 50;
|
||||
break;
|
||||
case 50:
|
||||
let aCurrentGoods = [
|
||||
{ "sMaterialName": "Food", "yAmount": "MAX", "yPrice": "MP-5" },
|
||||
{ "sMaterialName": "Plants", "yAmount": "MAX", "yPrice": "MP-5" }
|
||||
]
|
||||
for (let sCity of aCitites) {
|
||||
aCurrentGoods.forEach(async (entry) => {
|
||||
|
||||
nListenPID = ns.run("/corp/SetSalePrices.js", 1, sDivisionName, sCity, JSON.stringify(entry));
|
||||
nListenPID = ns.run("/corp/SetMaterialLimit.js", 1, sDivisionName, sCity, JSON.stringify(entry));
|
||||
|
||||
ns.tprint(sCity, entry)
|
||||
})
|
||||
}
|
||||
oCorpStatus.nStep = 200;
|
||||
break;
|
||||
case 60:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user