Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as helpers from "/apis/helpers.js";
- let earlyList = ["Netburners", "Tian Di Hui", "CyberSec"];
- let cityList = ["Aevum", "Chongqing", "Ishima", "New Tokyo", "Sector-12", "Volhaven"];
- let criminalList = ["Speakers for the Dead", "The Dark Army", "The Syndicate", "Silhouette", "Tetrads", "Slum Snakes"];
- let hackingList = ["BitRunners", "The Black Hand", "NiteSec"];
- let corporationList = ["ECorp", "MegaCorp", "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated", "OmniTek Incorporated", "Four Sigma", "KuaiGong International", "Fulcrum Secret Technologies"];
- let endgameList = ["Illuminati", "Daedalus", "The Covenant"];
- let specialList = ["Bladeburners", "Church of the Machine God"];
- /** @param {NS} ns */
- export async function main(ns) {
- let owned = ns.singularity.getOwnedAugmentations(true);
- let fullList = [];
- fullList.push(...earlyList, ...cityList, ...criminalList, ...hackingList, ...corporationList, ...endgameList, ...specialList);
- let argList = [];
- argList.push("Active", "Early", "City", "Criminal", "Hacking", "Corporation", "EndGame", "Special", "All", ...fullList)
- if (!argList.includes(ns.args[0])) {
- ns.tprint("Valid options are - ", argList);
- return;
- }
- let data = [[ "Augmentation", "Faction(s)","Money", "Rep"]];
- switch (ns.args[0]) {
- case "Early":
- for (let faction of earlyList) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- case "City":
- for (let faction of cityList) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- case "Criminal":
- for (let faction of criminalList) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- case "Hacking":
- for (let faction of hackingList) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- case "Corporation":
- for (let faction of corporationList) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- case "EndGame":
- for (let faction of endgameList) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- case "Special":
- for (let faction of specialList) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- case "All":
- for (let faction of fullList) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- case "Active":
- for (let faction of ns.getPlayer().factions) {
- data.push(...getAugData(ns, faction, owned));
- }
- break;
- default:
- data.push(...getAugData(ns, ns.args[0], owned));
- break;
- }
- data = cleanDuplicates(ns, data);
- let sortArray = [[3,1],[2,1]];
- data = await helpers.sortArray(data, sortArray);
- //ns.tprint(data);
- helpers.columnize(ns, data, 2,[["none"], ["none"],["num","(0.00 a)"], ["num","(0.00 a)"]], true);
- }
- function cleanDuplicates(ns, array){
- let data = [];
- let augs = [];
- for (let i in array){
- let augName = array[i][0];
- //check if its already in the list
- if (!augs.includes(augName)) {
- //if its not in the list, add it in.
- data.push(array[i]);
- augs.push(augName);
- } else {
- //if its already in the list, add the faction to the current entry.
- data[augs.indexOf(augName)][1] += ", " + array[i][1];
- }
- }
- return data;
- }
- /** @param {NS} ns */
- function getAugData(ns, faction, owned) {
- let factionAugs = ns.singularity.getAugmentationsFromFaction(faction);
- let list = [];
- for (let aug of factionAugs) {
- if (!owned.includes(aug)) {
- list.push([aug, faction, ns.singularity.getAugmentationPrice(aug), ns.singularity.getAugmentationRepReq(aug)]);
- }
- }
- return list;
- }
- export function autocomplete(data, args) {
- let factions = [
- "Early",
- "City",
- "Criminal",
- "Hacking",
- "Corporation",
- "Special",
- "All",
- "Active",
- "Illuminati",
- "Daedalus",
- "The Covenant",
- "ECorp",
- "MegaCorp",
- "Bachman & Associates",
- "Blade Industries",
- "NWO",
- "Clarke Incorporated",
- "OmniTek Incorporated",
- "Four Sigma",
- "KuaiGong International",
- "Fulcrum Secret Technologies",
- "BitRunners",
- "The Black Hand",
- "NiteSec",
- "Aevum",
- "Chongqing",
- "Ishima",
- "New Tokyo",
- "Sector-12",
- "Volhaven",
- "Speakers for the Dead",
- "The Dark Army",
- "The Syndicate",
- "Silhouette",
- "Tetrads",
- "Slum Snakes",
- "Netburners",
- "Tian Di Hui",
- "CyberSec",
- "Bladeburners",
- "Church of the Machine God"]
- return [...factions];
- }
Advertisement
Add Comment
Please, Sign In to add comment