Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** @param {NS} ns **/
- export function theGang(ns) {
- let theGang = {
- // All weapons, armor and vehicles
- buyCombatList: ["Baseball Bat", "Katana", "Glock 18C", "P90C",
- "Steyr AUG", "AK-47", "M15A10 Assault Rifle",
- "AWM Sniper Rifle", "Bulletproof Vest", "Full Body Armor",
- "Liquid Body Armor", "Graphene Plating Armor", "Ford Flex V20",
- "ATX1070 Superbike", "Mercedes-Benz S9001", "White Ferrari"],
- // Implement this list later
- buyOtherList: ["NUKE Rootkit", "Soulstealer Rootkit",
- "Demon Rootkit","Hmap Node", "Jack the Ripper", "Bionic Arms",
- "Bionic Legs", "Bionic Spine", "BrachiBlades", "Nanofiber Weave",
- "Synthetic Heart", "Synfibril Muscle", "BitWire",
- "Neuralstimulator", "DataJack", "Graphene Bone Lacings"],
- // Buy list when money is low
- buyEarlyCombatList: ["Baseball Bat", "Katana", "Glock 18C"],
- // List of current agents
- agents: function () {
- return ns.gang.getMemberNames();
- },
- // Equip all agents
- equipAgents: function () {
- let xList;
- // Determine which list to use for purchases
- if (ns.getServerMoneyAvailable("home") < 10000000000) {
- xList = this.buyEarlyCombatList;
- } else {
- xList = this.buyCombatList;
- }
- // Purchase chosen gear for each agent
- for (let agent of this.agents()) {
- for (let gear of xList) {
- ns.gang.purchaseEquipment(agent, gear);
- }
- }
- },
- // List of all agents excluding the agent with highest respect
- ascendList: function () {
- let xSort = {};
- // Get respect of each agent
- for (let agent of this.agents()) {
- xSort[agent] = ns.gang.getMemberInformation(agent).earnedRespect;
- }
- // Turn object to array pairs, sort pairs and get agent
- // with the highest respect
- let entries = Object.entries(xSort);
- let sorted = entries.sort((a, b) => b[1] - a[1]);
- let highRespectAgent = sorted[0][0];
- // Remove agent with highest respect from list
- return this.agents().filter(agent => agent !== highRespectAgent);
- },
- // Ascend all agents excluding the agent with highest respect
- ascend: function () {
- for (let agent of this.ascendList()) {
- ns.gang.ascendMember(agent);
- }
- }
- }
- return theGang;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement