CrimeMonitor!
This commit is contained in:
37
Mizzajl/home/GenerateCrimeList.js
Normal file
37
Mizzajl/home/GenerateCrimeList.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
ns.tail();
|
||||
const sCrimeStatsFile = "CrimeStats.txt";
|
||||
|
||||
let aCrimes = [
|
||||
"Shoplift",
|
||||
"Rob Store",
|
||||
"Mug",
|
||||
"Larceny",
|
||||
"Deal Drugs",
|
||||
"Bond Forgery",
|
||||
"Traffick Arms",
|
||||
"Homicide",
|
||||
"Grand Theft Auto",
|
||||
"Kidnap",
|
||||
"Assassination",
|
||||
"Heist"
|
||||
];
|
||||
|
||||
let aCrimeStatsList = [];
|
||||
|
||||
for (let i = 0; i < aCrimes.length; i++) {
|
||||
let oCrimeStats = ns.singularity.getCrimeStats(aCrimes[i]);
|
||||
|
||||
// Create a new object starting with the name of the crime
|
||||
let oCrimeWithStats = {
|
||||
name: aCrimes[i], // Name of the crime as the first item
|
||||
...oCrimeStats // Spread the rest of the stats into the object
|
||||
};
|
||||
|
||||
aCrimeStatsList.push(oCrimeWithStats);
|
||||
}
|
||||
|
||||
// Write the list of crime stats to the file as a JSON string
|
||||
ns.write(sCrimeStatsFile, JSON.stringify(aCrimeStatsList, null, 2), "w");
|
||||
}
|
||||
Reference in New Issue
Block a user