working on Mizzajl/home/wip/scanFactionAugments.js

This commit is contained in:
2024-10-07 12:01:02 +02:00
parent 38947d3d81
commit 6378dc3d7b
5 changed files with 42 additions and 14 deletions

View File

@@ -1,24 +1,49 @@
/** @param {NS} ns */
export async function main(ns) {
let aFactions = ns.getPlayer().factions;
const aOwnedAugmentations = ns.singularity.getOwnedAugmentations(true);
//ns.tprint("aOwnedAugmentations = " + aOwnedAugmentations);
const aFactions = ns.getPlayer().factions;
ns.tprint("aFactions = " + aFactions);
let aAugmentations;
let sStats;
let aStats;
for (let f = 0; f < aFactions.length; f++) {
//ns.tprint("f = " + f);
//sFaction = ns.singularity.faction
//loop throught the factions
ns.tprint("Faction = " + aFactions[f]);
aAugmentations = ns.singularity.getAugmentationsFromFaction(aFactions[f]);
ns.tprint("aAugmentations = " + aAugmentations);
let aAvailableAugmentations = aAugmentations.filter(item => !aOwnedAugmentations.includes(item)); //ChatGPT
//ns.tprint("aAugmentations = " + aAugmentations);
ns.tprint("aAvailableAugmentations = " + aAvailableAugmentations);
ns.tprint("----------------------------------------------------------------------------------------------------------------------------------------------------------");
for (let a = 0; a < aFactions.length; a++) {
sStats = JSON.stringify(ns.singularity.getAugmentationStats(aAugmentations[a]));
ns.tprint(aAugmentations[f] + "sStats = " + sStats);
for (let a = 0; a < aAvailableAugmentations.length; a++) {
//loop throught their aumentations
//if (aOwnedAugmentations.includes(aAvailableAugmentations[a]) === false) {
//JSON.stringify(ns.singularity.getAugmentationStats(aAvailableAugmentations[a]));
let oStats = ns.singularity.getAugmentationStats(aAvailableAugmentations[a]);
ns.tprint(aAvailableAugmentations[a]);
let nAugmentationReputation = ns.singularity.getAugmentationRepReq(aAvailableAugmentations[a]);
let sAugmentationPrereq = ns.singularity.getAugmentationPrereq(aAvailableAugmentations[a]);
let nAugmentationPrice = ns.singularity.getAugmentationPrice(aAvailableAugmentations[a]);
ns.tprint("Reputation needed = " + nAugmentationReputation);
ns.tprint("Prereq = " + sAugmentationPrereq);
ns.tprint("Price = " + nAugmentationPrice);
// ChatGPT - Iterate through the object and display properties where the value is not 1
for (const key in oStats) {
if (oStats[key] !== 1) {
//console.log(`${key}: ${oStats[key]}`);
ns.tprint(`${key}: ${oStats[key]}`);
}
}
//ns.tprint(aAvailableAugmentations.filter(index !== 1) + " aStats = " + aStats);
//ns.tprint(aAvailableAugmentations[a] + " oStats = " + oStats);
ns.tprint("----------------------------------------------------------------------------------------------------------------------------------------------------------");
}
}
}