Sync
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
/** @param {NS} ns */
|
/** @param {NS} ns */
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
let aCitites = ["Sector-12", "Aevum", "Volhaven", "Chongqing", "New Tokyo", "Ishima"];
|
let aCitites = ["Sector-12", "Aevum", "Volhaven", "Chongqing", "New Tokyo", "Ishima"];
|
||||||
|
let sCorpName = "RM Enterprises";
|
||||||
let sDivisionName = "Agri-Ram";
|
let sDivisionName = "Agri-Ram";
|
||||||
let reset = ns.args[0];
|
let reset = ns.args[0];
|
||||||
if (reset === true || !ns.fileExists("CorpStatus.txt")) {
|
if (reset === true || !ns.fileExists("CorpStatus.txt")) {
|
||||||
@@ -14,6 +15,14 @@ export async function main(ns) {
|
|||||||
let oOfficeData = {};
|
let oOfficeData = {};
|
||||||
let oWarehouseData = {};
|
let oWarehouseData = {};
|
||||||
let bUnlockStatus = false;
|
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);
|
ns.tprint(oCorpStatus);
|
||||||
while (nStep < 199) {
|
while (nStep < 199) {
|
||||||
nStep = oCorpStatus.nStep;
|
nStep = oCorpStatus.nStep;
|
||||||
@@ -79,9 +88,24 @@ export async function main(ns) {
|
|||||||
nListenPID = ns.run("/corp/HireWorkers.js", 1, sDivisionName, sCity, JSON.stringify(oOfficeData));
|
nListenPID = ns.run("/corp/HireWorkers.js", 1, sDivisionName, sCity, JSON.stringify(oOfficeData));
|
||||||
await ns.nextPortWrite(nListenPID);
|
await ns.nextPortWrite(nListenPID);
|
||||||
}
|
}
|
||||||
oCorpStatus.nStep = 200;
|
oCorpStatus.nStep = 50;
|
||||||
break;
|
break;
|
||||||
case 50:
|
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;
|
break;
|
||||||
case 60:
|
case 60:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export async function main(ns) {
|
|||||||
let nMaxRam;
|
let nMaxRam;
|
||||||
let nScripts;
|
let nScripts;
|
||||||
|
|
||||||
serverList.forEach((entry) => {
|
serverList.forEach(async (entry) => {
|
||||||
//let rootAccess = ns.hasRootAccess(currentServer);
|
//let rootAccess = ns.hasRootAccess(currentServer);
|
||||||
|
|
||||||
//ns.tprint(entry.serverName + " sTarget = " + sTarget);
|
//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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user