Advertisement
Guest User

Untitled

a guest
Feb 9th, 2022
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /** @param {NS} ns **/
  2. export function theGang(ns) {
  3.  
  4.     let theGang = {
  5.         // All weapons, armor and vehicles
  6.         buyCombatList: ["Baseball Bat", "Katana", "Glock 18C", "P90C",
  7.          "Steyr AUG", "AK-47", "M15A10 Assault Rifle",
  8.          "AWM Sniper Rifle", "Bulletproof Vest", "Full Body Armor",
  9.          "Liquid Body Armor", "Graphene Plating Armor", "Ford Flex V20",
  10.          "ATX1070 Superbike", "Mercedes-Benz S9001", "White Ferrari"],
  11.         // Implement this list later
  12.         buyOtherList: ["NUKE Rootkit", "Soulstealer Rootkit",
  13.         "Demon Rootkit","Hmap Node", "Jack the Ripper", "Bionic Arms",
  14.         "Bionic Legs", "Bionic Spine", "BrachiBlades", "Nanofiber Weave",
  15.         "Synthetic Heart", "Synfibril Muscle", "BitWire",
  16.         "Neuralstimulator", "DataJack", "Graphene Bone Lacings"],
  17.         // Buy list when money is low
  18.         buyEarlyCombatList: ["Baseball Bat", "Katana", "Glock 18C"],
  19.         // List of current agents
  20.         agents: function () {
  21.             return ns.gang.getMemberNames();
  22.         },
  23.         // Equip all agents
  24.         equipAgents: function () {
  25.             let xList;
  26.             // Determine which list to use for purchases
  27.             if (ns.getServerMoneyAvailable("home") < 10000000000) {
  28.                 xList = this.buyEarlyCombatList;
  29.             } else {
  30.                 xList = this.buyCombatList;
  31.             }
  32.             // Purchase chosen gear for each agent
  33.             for (let agent of this.agents()) {
  34.  
  35.                 for (let gear of xList) {
  36.                     ns.gang.purchaseEquipment(agent, gear);
  37.                 }
  38.             }
  39.         },
  40.         // List of all agents excluding the agent with highest respect
  41.         ascendList: function () {
  42.             let xSort = {};
  43.             // Get respect of each agent
  44.             for (let agent of this.agents()) {
  45.                 xSort[agent] = ns.gang.getMemberInformation(agent).earnedRespect;
  46.             }
  47.             // Turn object to array pairs, sort pairs and get agent
  48.             // with the highest respect
  49.             let entries = Object.entries(xSort);
  50.             let sorted = entries.sort((a, b) => b[1] - a[1]);
  51.             let highRespectAgent = sorted[0][0];
  52.             // Remove agent with highest respect from list
  53.             return this.agents().filter(agent => agent !== highRespectAgent);
  54.         },
  55.         // Ascend all agents excluding the agent with highest respect
  56.         ascend: function () {
  57.             for (let agent of this.ascendList()) {
  58.                 ns.gang.ascendMember(agent);
  59.             }
  60.         }
  61.     }
  62.  
  63.     return theGang;
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement